Skip to main content

Crate v_exchanges

Crate v_exchanges 

Source

Modules§

adapters
binance
bitmex
bybit
core
error
orders
prelude
yahoo

Macros§

bail
Return early with an error.
debug
Constructs an event at the debug level.
define_provider_timeframe
error
Constructs an event at the error level.
eyre
Construct an ad-hoc error from a string.
info
Constructs an event at the info level.
json
Construct a serde_json::Value from a JSON literal.
trace
Constructs an event at the trace level.
warn
Constructs an event at the warn level.

Structs§

ApiKeyInfo
Arc
A thread-safe reference-counting pointer. ‘Arc’ stands for ‘Atomically Reference Counted’.
Asset
AssetBalance
BTreeMap
An ordered map based on a B-Tree.
BTreeSet
An ordered set based on a B-Tree.
Balances
BatchTrades
Batched trade stream event. All trades share prec.
Binance
Bitmex
BookShape
(price, qty) levels for both sides of an orderbook, keyed by raw price. Both BTreeMaps are ascending; consumers reverse bids for best-bid.
Bybit
Close
Unlike Kline, timestamp signifies the end of the period, not the start. As another difference - Vec<Close> can have uneven spacing between measured points.
Empty
An empty field.
ExchangeInfo
ExchangeOrder
An order bound to a specific exchange and ticker, ready to be placed.
HashMap
A hash map implemented with quadratic probing and SIMD lookup.
HashSet
A hash set implemented as a HashMap where the value is ().
InvalidPairError
Kline
Standard candlestick data unit. Can only ever be full, - if an exchange returns partial data for an ongoing candle, or if trading/exchange is down leading to the associated data being cut, the Kline object is NOT created.
Klines
Does not have any gaps in the data, (as klines are meant to be indexed naively when used). TODO: enforce this.
LimitOrder
Exchange-agnostic limit order.
Lsr
Lsrs
MarketOrder
Exchange-agnostic market order.
Mutex
A mutual exclusion primitive useful for protecting shared data
Ohlc
OpenInterest
most exchanges default to returning OI value in asset quantity, not quote. Exception would be Inverse on Bybit. Which actually makes sense, as same endpoints accept things like “BTCETH”, where quote value would be irrelevant.
OrderId
OrderPlaced
Unified response from placing any order.
OutOfRangeError
Pair
PairInfo
PersonalInfo
Pin
A pointer which pins its pointee in place.
PrecisionPriceQty
Per-batch precision shared across all levels / trades in a BookShape / BatchTrades.
Price
Fixed-point price. Signed to support spreads and options. raw = value × 10^precision
Qty
Fixed-point quantity. Non-negative. raw = value × 10^precision
Report
The core error reporting type of the library, a wrapper around a dynamic error reporting type.
RetryConfig
Configuration for retry behavior.
RwLock
A reader-writer lock
Span
A handle representing a span, with the capability to enter the span if it exists.
StopLimitOrder
Stop-limit order: a limit order that activates when the trigger price is hit.
StopMarketOrder
Stop-market order: a market order that activates when the trigger price is hit.
Symbol
Ticker
Timeframe
Implemented over the number of milliseconds
TimeframeDesignatorIter
An iterator over the variants of TimeframeDesignator
TrailingStopOrder
Trailing stop-market order.
Trigger
Trigger configuration for conditional orders (stop-limit, stop-market, take-profit, etc.)
UnsupportedTimeframeError
Usd
A struct representing USD (in future, inflation-adjusted) value. That’s it. Just a newtype. But extremely powerful.
VecDeque
A double-ended queue implemented with a growable ring buffer.
YahooTimeframe

Enums§

BookUpdate
Distinguishes full snapshots from incremental deltas. For deltas: qty=0 means remove that price level.
Contingency
Contingency linkage between orders.
Error
ExchangeError
ExchangeName
Instrument
KeyPermission
MethodError
OrderStatus
RequestRange
RequestRangeError
SelfTradePreventionMode
Binance: EXPIRE_MAKER/EXPIRE_TAKER/EXPIRE_BOTH; OKX: cancel_maker/cancel_taker/cancel_both
Side
TimeInForce
TimeframeDesignator
TrailingCallback
Trailing stop callback specification.
TriggerPriceType
What price feed triggers the conditional order.
Value
Represents any valid JSON value.

Traits§

BookPersistor
Pluggable sink that captures book updates as they fly through the WS connection. The connection invokes on_snapshot/on_delta synchronously on every event, before returning from next(). Implementations are expected to be cheap; heavy I/O should be batched internally.
Deserialize
A data structure that can be deserialized from any data format supported by Serde.
DeserializeOwned
A data structure that can be deserialized without borrowing any data from the deserializer.
Deserializer
A data format that can deserialize any data structure supported by Serde.
Exchange
Main trait for all standardized exchange interactions.
ExchangeStream
Concerns itself with exact types.
Sequence
Per-exchange book-event ordering token. Used internally by the WS connection to detect gaps in the per-pair delta chain. Not persisted; the result (gapped: bool) is.
Serialize
A data structure that can be serialized into any data format supported by Serde.
Serializer
A data format that can serialize any data structure supported by Serde.
SubscribeOrder
Timestamped
Three timestamps describing a piece of data’s lifecycle across a communication chain.
_
A trait for writing or formatting into Unicode-accepting buffers or streams.

Functions§

guess_timestamp_unsafe
Doesn’t support negative timestamps
join_all
Creates a future which represents a collection of the outputs of the futures given.
mock_p_to_ohlc
take a price-series, and imagine that entries are constantly spaced
p_to_ohlc
vix
vix_change

Type Aliases§

ExchangeResult
Result
type alias for Result<T, Report>

Attribute Macros§

instrument
Instruments a function to create and enter a tracing span every time the function is called.

Derive Macros§

Deserialize
Error
Serialize