#include <market_events_db.h>
|
| | MarketEventsDb (const std::string &dbPath) |
| | ~MarketEventsDb () |
| bool | init () noexcept(true) |
| | Initialized the database by setting up performance configurations, running migrations, and starting up an async thread for batch writes.
|
| bool | logEvent (const common::Event &event) |
| | log a single event to the events table. Smartly routes events based on their type to either be logged synchronous or async This method does not throw.
|
| bool | logEvents (const std::vector< common::Event > &events) |
| | log a batch of events to the events table.
|
| std::optional< Events > | getEventsSince (int64_t timestamp) noexcept(true) |
| | Return a vector containing the Events since the given timestamp. This method does not throw, but returns std::nullopt if something goes wrong.
|
| std::optional< Events > | getEventsBySymbol (const std::string &symbol, int64_t startTs, const std::optional< int64_t > &endTs=std::nullopt) noexcept(true) |
| | Return a vector containing the Events for a given symbol between the given startTs and endTs. If the optional endTs isn't given, assume endTs = present. This method does not throw, but returns std::nullopt if something goes wrong.
|
| bool | logSnapshot (const common::SymbolPositions &snapshot) noexcept(true) |
| | Write a single snapshot synchronously.
|
| bool | logSnapshots (const std::vector< common::SymbolPositions > &snapshots) noexcept(true) |
| | Write a group of snapshots synchronously in a batch.
|
| std::optional< common::SymbolPositions > | getLatestSnapshot (const std::string &symbol) noexcept(true) |
| | get latest snapshot for a given symbol
|
| std::optional< SymbolPositionsVec > | getLatestSnapshots () noexcept(true) |
| | get latest snapshot for all symbols
|
◆ Events
◆ MarketEventsDbPtr
◆ SymbolPositionsVec
◆ MarketEventsDb()
| crypto_trader::databases::MarketEventsDb::MarketEventsDb |
( |
const std::string & | dbPath | ) |
|
|
explicit |
◆ ~MarketEventsDb()
| crypto_trader::databases::MarketEventsDb::~MarketEventsDb |
( |
| ) |
|
◆ getEventsBySymbol()
| std::optional< MarketEventsDb::Events > crypto_trader::databases::MarketEventsDb::getEventsBySymbol |
( |
const std::string & | symbol, |
|
|
int64_t | startTs, |
|
|
const std::optional< int64_t > & | endTs = std::nullopt ) |
|
noexcept |
Return a vector containing the Events for a given symbol between the given startTs and endTs. If the optional endTs isn't given, assume endTs = present. This method does not throw, but returns std::nullopt if something goes wrong.
- Returns
- std::optional<std::vector<Event>>
◆ getEventsSince()
| std::optional< MarketEventsDb::Events > crypto_trader::databases::MarketEventsDb::getEventsSince |
( |
int64_t | timestamp | ) |
|
|
noexcept |
Return a vector containing the Events since the given timestamp. This method does not throw, but returns std::nullopt if something goes wrong.
- Returns
- std::optional<std::vector<Event>>
◆ getLatestSnapshot()
| std::optional< common::SymbolPositions > crypto_trader::databases::MarketEventsDb::getLatestSnapshot |
( |
const std::string & | symbol | ) |
|
|
noexcept |
◆ getLatestSnapshots()
◆ init()
| bool crypto_trader::databases::MarketEventsDb::init |
( |
| ) |
|
|
noexcept |
Initialized the database by setting up performance configurations, running migrations, and starting up an async thread for batch writes.
- Returns
- bool if all succeeded
◆ logEvent()
| bool crypto_trader::databases::MarketEventsDb::logEvent |
( |
const common::Event & | event | ) |
|
log a single event to the events table. Smartly routes events based on their type to either be logged synchronous or async This method does not throw.
- Returns
- bool if successful
◆ logEvents()
| bool crypto_trader::databases::MarketEventsDb::logEvents |
( |
const std::vector< common::Event > & | events | ) |
|
log a batch of events to the events table.
- Returns
- bool if successful
◆ logSnapshot()
Write a single snapshot synchronously.
- Parameters
-
- Returns
- bool on success
◆ logSnapshots()
| bool crypto_trader::databases::MarketEventsDb::logSnapshots |
( |
const std::vector< common::SymbolPositions > & | snapshots | ) |
|
|
noexcept |
Write a group of snapshots synchronously in a batch.
- Parameters
-
- Returns
- bool on success
The documentation for this class was generated from the following files: