Expand description
§Barter-Execution
Stream private account data from financial venues, and execute (live or mock) orders. Also provides a feature rich MockExchange and MockExecutionClient to assist with backtesting and paper-trading.
It is:
- Easy: ExecutionClient trait provides a unified and simple language for interacting with exchanges.
- Normalised: Allow your strategy to communicate with every real or MockExchange using the same interface.
- Extensible: Barter-Execution is highly extensible, making it easy to contribute by adding new exchange integrations!
See README.md for more information and examples.
Re-exports§
pub use borrow_capacity::BorrowCapacity;pub use cash_flow::CashFlow;pub use cash_flow::CashFlowId;pub use cash_flow::CashFlowKind;pub use cash_flow::CashFlowPeriod;pub use cash_flow::CashFlowsRead;pub use cash_flow::InterestTiming;pub use fee::FeeAssetConfig;pub use fee::FeeAssetConfigError;pub use fee::FeeModel;pub use fee::FeeModelConfig;pub use fee::Liquidity;pub use fee::PerContractFeeModel;pub use fee::PercentageFeeModel;pub use fee::SpotFeeAsset;pub use fee::ZeroFeeModel;pub use fill::BidAskFillModel;pub use fill::FillContext;pub use fill::FillModel;pub use fill::LastPriceFillModel;pub use fill::MarketOrderTiming;pub use fill::MidpointFillModel;pub use fill::NextBarPrice;pub use fill::SimFillConfig;pub use fill_recovery::FillRecoveryFailure;pub use fill_recovery::FillRecoveryGap;pub use fill_recovery::FillRecoveryScope;pub use holding_cost::AccrualDays;pub use holding_cost::BorrowFeeModel;pub use holding_cost::DailyAccrual;pub use holding_cost::DayCount;pub use holding_cost::FinancingModel;pub use holding_cost::FinancingRates;pub use holding_cost::FundingModel;pub use holding_cost::HeldPosition;pub use holding_cost::HoldingCharge;pub use holding_cost::HoldingCostModel;pub use holding_cost::HolidayCalendar;pub use holding_cost::RateSeries;pub use holding_cost::RateSeriesUnsorted;pub use holding_cost::SettlementCalendar;pub use holding_cost::WeekendsOnly;pub use margin::InterestCharge;pub use margin::InterestDue;pub use margin::InterestSchedule;pub use margin::MarginEffect;pub use margin::MarginInterestModel;pub use margin::PeriodicMarginInterest;pub use margin::SpotMarginConfig;pub use margin::SpotMarginConfigError;pub use margin::SpotMarginLiquidation;pub use margin_debt::MarginDebtKind;pub use margin_debt::MarginDebtUpdate;pub use market::MarketBar;pub use market::MarketDepth;pub use market::MarketObservation;pub use market::MarketSnapshot;pub use notice::AccountNotice;pub use notice::NoticeKind;pub use rules::OrderRules;pub use rules::PreSendRules;pub use rules::ValueRule;pub use shortability::Shortability;pub use shortability::ShortabilityProvider;pub use shortability::ShortabilityTable;pub use slippage::SlippageConfig;pub use slippage::SlippageConfigError;
Modules§
- balance
- borrow_
capacity - How much more this account can borrow now: what a venue says about the account’s own capacity
to borrow, as opposed to
Shortability, which says what the venue has to lend. - cash_
flow - Cash that moves into or out of an account other than by a trade: perpetual funding, margin interest, stock borrow fees and rebates.
- client
- Execution client implementations for various exchanges.
- error
- Error types for
ExecutionClientoperations. - exchange
- fee
- fill
- fill_
recovery - What an account stream reports when its fill recovery gives up on a span of fills.
- holding_
cost - What a simulated position costs to hold over time: perpetual funding, borrow fees and overnight financing.
- indexer
- map
- margin
- Margin borrowing: the borrow and repay policy a margin account applies to its orders, the simulated venue’s spot margin configuration, and the interest it charges on its loans.
- margin_
debt - A change in what a margin account owes in one asset, as the venue streams it: a borrow, a repay or an interest charge.
- market
- notice
- Notices a venue sends about an account’s state that are not trades, orders or balances: margin calls, liquidation warnings, a liquidation under way, and the all-clear after them.
- order
- position
- reduce_
only - Which of an instrument’s orders were sent reduce-only, kept so a fill can be matched to the
ReduceOnlyof its order. - rules
- An instrument’s order rules (tick, lot step, minimums and maximums) and the check of an order against them before it is sent.
- shortability
- Whether an instrument can be sold short, and on what terms: what a venue says about lending it.
- slippage
- Adverse slippage on the simulated venue’s taker fills.
- trade
Structs§
- Account
Event - Account
Snapshot - Instrument
Account Snapshot - One instrument’s slice of an
AccountSnapshot: its orders, and its position or isolated balances where the venue has them. - Instrument
Balance Snapshot - One asset’s full balance in a pair’s isolated sub-account, debt included (the
AccountEventKind::InstrumentBalanceSnapshotpayload). - Instrument
Balance Update - Live per-instrument isolated-margin balance update payload (the
AccountEventKind::InstrumentBalanceUpdatecounterpart ofIsolatedInstrumentState). - Isolated
Instrument State - Per-pair isolated-margin state attached to an
InstrumentAccountSnapshot. - Isolated
Margin Risk - Per-pair isolated-margin risk metrics, surfaced on
IsolatedInstrumentState.
Enums§
Type Aliases§
- Unindexed
Account Event - Convenient type alias for an
AccountEventkeyed withExchangeId,AssetNameExchange, andInstrumentNameExchange. - Unindexed
Account Snapshot - Convenient type alias for an
AccountSnapshotkeyed withExchangeId,AssetNameExchange, andInstrumentNameExchange.