Skip to content

Tutorials

Patterns that build on the Aspens SDK and gRPC API. Each is sketched here; turn them into working code by combining the Developer Guide and the API Reference.

Crosschain liquidity scanner

Stream Orderbook for several markets in parallel, score each by spread + depth, and surface the best venue per pair. Any number of markets can share a single gRPC connection; entries arrive on stream::Stream<OrderbookEntry>.

Yield router

Watch on-chain yields via your own data source. When the gap exceeds a threshold, submit SendOrderRequests (instant, no gas to place) to move stablecoin balances between chains via Aspens markets. Use balance::balance_from_config_with_wallets to size the moves correctly.

Crosschain DEX aggregator

For each user request, query the relevant Aspens markets alongside on-chain DEX pools and route to whichever offers the better effective price. Aspens orders settle natively on each chain, so no bridge step is needed in the route.

Market-maker bot

Stream Trades and Orderbook for a single market, derive a fair mid from external feeds, and continuously cancel + repost limit orders inside your spread. Placing and cancelling orders is gas-free, so re-quoting as often as you like costs nothing on-chain.

Portfolio dashboard

Aggregate balance::balance_from_config_with_wallets across every chain you have a wallet for. Cross-reference Trades history per trader to compute realized PnL.

Live reference

The SDK ships examples/quickstart.rs — the simplest end-to-end script: connect, deposit, place an order, withdraw. Run it with cargo run --example quickstart against any configured AMS.

Why Aspens?

  • Native settlement — every leg confirmed on its own chain; no bridge intermediary.
  • Single API, many chains — one gRPC client covers EVM and Solana today; new architectures plug in without changing the matching engine.
  • Custody stays with the user — funds sit in per-chain trading contracts; a cancel always releases them.
  • Open source — both stack and SDK are public; build, fork, or self-host.