Skip to main content

Crate algo_sdk

Crate algo_sdk 

Source
Expand description

§Sequence Algo SDK — Ultra Low Latency Trading

Write HFT algorithms in Rust, compile to WASM, deploy to Sequence.

§Execution Models

  • Single-venue (Algo) — one exchange, one book, tick-by-tick with OnlineFeatures
  • V5 Strategy/Executor (Strategy / Executor) — sharded multi-venue with execution plan intents. The recommended path for cross-venue strategies.

§Modules

ModuleContents
bookLevel, L2Book — order book depth
stateAlgoState, OpenOrder, SymbolMeta, RiskSnapshot
eventsFill, Reject, FillExt
actionsActions buffer, Action, order types
venueVenue IDs, NbboSnapshot, VenueBooks
poolPoolBooks, PoolMeta, PoolAmm, PoolStateTable
featuresOnlineFeatures, ChainFeeTable
[builders]Fluent builders for V5 execution plans
unitsType-safe Px/Qty newtypes
configConfigRegion for runtime parameter tuning
testingTest harness for native strategy development
amm_mathPure AMM/CLMM pricing math

Re-exports§

pub use book::Level;
pub use book::L2Book;
pub use state::AlgoState;
pub use state::OpenOrder;
pub use state::PnlSnapshot;
pub use state::RiskSnapshot;
pub use state::SymbolMeta;
pub use state::Status;
pub use state::MAX_ORDERS;
pub use events::Fill;
pub use events::FillExt;
pub use events::Reject;
pub use events::RejectCode;
pub use actions::Action;
pub use actions::Actions;
pub use actions::WasmActions;
pub use actions::OrderType;
pub use actions::MAX_ACTIONS;
pub use actions::ACTION_NEW;
pub use actions::ACTION_CANCEL;
pub use actions::ACTION_AMEND;
pub use venue::NbboSnapshot;
pub use venue::VenueBooks;
pub use venue::MAX_VENUES;
pub use venue::VENUE_BOOKS_WASM_OFFSET;
pub use venue::VENUE_KRAKEN;
pub use venue::VENUE_COINBASE;
pub use venue::VENUE_BINANCE;
pub use venue::VENUE_BITGET;
pub use venue::VENUE_CRYPTOCOM;
pub use venue::VENUE_BITMART;
pub use venue::VENUE_DEX;
pub use venue::VENUE_OKX;
pub use venue::VENUE_BYBIT;
pub use venue::VENUE_UNKNOWN;
pub use venue::VENUE_DEX_ETH;
pub use venue::VENUE_DEX_ARB;
pub use venue::VENUE_DEX_BASE;
pub use venue::VENUE_DEX_OP;
pub use venue::VENUE_DEX_POLY;
pub use venue::VENUE_DEX_SOL;
pub use venue::VENUE_HYPERLIQUID;
pub use venue::is_dex;
pub use venue::is_cex;
pub use venue::venue_name;
pub use pool::PoolMeta;
pub use pool::PoolBooks;
pub use pool::PoolAmm;
pub use pool::PoolStateTable;
pub use pool::pool_type;
pub use pool::MAX_POOLS;
pub use pool::MAX_POOL_STATES;
pub use pool::POOL_BOOKS_WASM_OFFSET;
pub use pool::POOL_STATE_TABLE_WASM_OFFSET;
pub use features::OnlineFeatures;
pub use features::ChainFee;
pub use features::ChainFeeTable;
pub use features::chain_id;
pub use features::venue_chain_id;
pub use features::ONLINE_FEATURES_WASM_OFFSET;
pub use features::CHAIN_FEE_TABLE_WASM_OFFSET;
pub use features::MAX_CHAINS;
pub use traits::Algo;
pub use messaging::send;
pub use messaging::MAX_MESSAGE_SIZE;
pub use actions::ACTION_INTENT;
pub use actions::IntentPolicy;
pub use log::LogLevel;
pub use config::ConfigRegion;
pub use config::CONFIG_REGION_WASM_OFFSET;
pub use config::MAX_CONFIG_PARAMS;

Modules§

actions
Order actions buffer — place, cancel, amend orders.
amm_math
Pure AMM/CLMM pricing math for algo strategies.
book
Order book types — L2 depth, price levels.
config
Runtime parameter configuration via shared WASM memory. Runtime parameter configuration — live-tunable strategy parameters.
events
Execution events — fills, rejects, extended metadata.
features
Online microstructure features and chain fee data.
log
HFT-safe async logging — non-blocking, ~100ns per call.
messaging
Mesh algo messaging — send/receive between algo instances by label.
pool
DEX pool books, AMM state, and pool metadata.
state
Position state, orders, risk limits, symbol metadata.
testing
Test harness for native strategy development (non-WASM only). Testing harness for native strategy development.
time
Simple timing helpers for client-controlled latency measurement.
traits
Trading algorithm traits.
units
Type-safe fixed-point price and quantity newtypes. Type-safe fixed-point units — prevents mixing prices and quantities.
venue
Venue identification, NBBO snapshots, and per-venue order books.

Macros§

export_algo
Stub macro for native builds (no-op).
log_debug
Log debug with formatting.
log_error
Log error with formatting.
log_info
Log info message with formatting.
log_warn
Log warning with formatting.
sequence_algo_entry
Set up WASM entry boilerplate: panic handler + bump allocator.