![]() |
algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
|
An instrument's order book: resting bids and offers. More...
#include <algotradelib/src/core/market_data.hpp>
Public Member Functions | |
| std::optional< DepthLevel > | best_bid () const |
| Returns the best bid. | |
| std::optional< DepthLevel > | best_ask () const |
| Returns the best offer. | |
| std::optional< Decimal64 > | spread () const |
| Returns the spread, best offer minus best bid, exactly. | |
| std::optional< Decimal64 > | mid () const |
| Returns the midpoint of the best bid and offer, exactly (one more decimal place if needed). | |
Public Attributes | |
| InstrumentId | instrument_ |
| The instrument. | |
| std::vector< DepthLevel > | bids_ |
| The bids, descending by price. | |
| std::vector< DepthLevel > | asks_ |
| The offers, ascending by price. | |
| Currency | currency_ |
| The currency of the prices. | |
| std::optional< std::chrono::system_clock::time_point > | exchange_time_ |
| When the exchange says the book was true, if the broker gave a time. | |
| std::chrono::system_clock::time_point | received_at_ |
| When the book was received, on this machine's clock. | |
An instrument's order book: resting bids and offers.
Index zero is the best level on each side (bids descending, asks ascending); adapters sort the levels themselves. A side may be empty.
Definition at line 206 of file market_data.hpp.
|
inline |
Returns the best offer.
Definition at line 232 of file market_data.hpp.
|
inline |
Returns the best bid.
Definition at line 224 of file market_data.hpp.
|
inline |
Returns the midpoint of the best bid and offer, exactly (one more decimal place if needed).
Not rounded to the tick grid; round it yourself before using it as an order price.
Definition at line 256 of file market_data.hpp.
|
inline |
Returns the spread, best offer minus best bid, exactly.
Definition at line 240 of file market_data.hpp.
| std::vector<DepthLevel> algotradelib::DepthSnapshot::asks_ |
The offers, ascending by price.
Definition at line 212 of file market_data.hpp.
Referenced by best_ask(), and algotradelib::order_depth().
| std::vector<DepthLevel> algotradelib::DepthSnapshot::bids_ |
The bids, descending by price.
Definition at line 210 of file market_data.hpp.
Referenced by best_bid(), and algotradelib::order_depth().
| Currency algotradelib::DepthSnapshot::currency_ |
The currency of the prices.
Definition at line 214 of file market_data.hpp.
| std::optional<std::chrono::system_clock::time_point> algotradelib::DepthSnapshot::exchange_time_ |
When the exchange says the book was true, if the broker gave a time.
Definition at line 216 of file market_data.hpp.
| InstrumentId algotradelib::DepthSnapshot::instrument_ |
The instrument.
Definition at line 208 of file market_data.hpp.
| std::chrono::system_clock::time_point algotradelib::DepthSnapshot::received_at_ |
When the book was received, on this machine's clock.
Definition at line 218 of file market_data.hpp.