The clock a loop waits on over a mock market: waiting moves the market.
More...
#include <algotradelib/src/brokers/mock/clock.hpp>
|
| | MarketClock (Market &market) |
| | Builds a clock over a market.
|
| std::chrono::system_clock::time_point | now () const noexcept |
| | Returns the market's time.
|
| std::chrono::steady_clock::time_point | monotonic_now () const noexcept |
| | Returns a reading that moves with the market's time and never backwards.
|
| void | wait_for (std::chrono::nanoseconds duration) |
| | Advances the market by a duration instead of sleeping.
|
The clock a loop waits on over a mock market: waiting moves the market.
Give it to runner::PollingLoop, and through a runner::ClockReference to live::bind_journaled, so the loop, its journal and the market read one time.
Definition at line 16 of file clock.hpp.
◆ MarketClock()
| algotradelib::mock::MarketClock::MarketClock |
( |
Market & | market | ) |
|
|
inlineexplicit |
Builds a clock over a market.
- Parameters
-
| market | The market; borrowed, and must outlive the clock. |
Definition at line 22 of file clock.hpp.
◆ monotonic_now()
| std::chrono::steady_clock::time_point algotradelib::mock::MarketClock::monotonic_now |
( |
| ) |
const |
|
inlinenoexcept |
Returns a reading that moves with the market's time and never backwards.
- Returns
- The market's time as a steady reading.
Definition at line 36 of file clock.hpp.
◆ now()
| std::chrono::system_clock::time_point algotradelib::mock::MarketClock::now |
( |
| ) |
const |
|
inlinenoexcept |
◆ wait_for()
| void algotradelib::mock::MarketClock::wait_for |
( |
std::chrono::nanoseconds | duration | ) |
|
|
inline |
Advances the market by a duration instead of sleeping.
- Parameters
-
| duration | How long; nothing moves if it is not positive. |
Definition at line 46 of file clock.hpp.
The documentation for this class was generated from the following file: