![]() |
algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
|
A price known to be on its instrument's tick grid. More...
#include <algotradelib/src/strategy/intent.hpp>
Public Member Functions | |
| const Decimal64 & | value () const noexcept |
| Returns the price as a decimal. | |
| std::string | str () const |
| Returns the price as text, for logs. | |
Static Public Member Functions | |
| static std::optional< Price > | checked (Decimal64 value, const PriceRule &rule) |
| Makes a price from a value that is already on the grid. | |
| static std::optional< Price > | rounded (const Decimal64 &value, const PriceRule &rule, OrderSide side) |
| Makes a price by rounding a value onto the grid, in the order's favour. | |
Friends | |
| bool | operator== (const Price &lhs, const Price &rhs) |
| Compares two prices by exact value (scale included; see Decimal64). | |
| bool | operator!= (const Price &lhs, const Price &rhs) |
| Compares two prices for inequality. | |
A price known to be on its instrument's tick grid.
Make one with checked (for a price you have) or rounded (to move a price onto the grid). For a price computed as a Scalar, use analytics::round_scalar_to_tick first.
Definition at line 29 of file intent.hpp.
|
inlinestatic |
Makes a price from a value that is already on the grid.
| value | The price. |
| rule | The instrument's tick rule (from its Instrument reference data). |
Definition at line 39 of file intent.hpp.
|
inlinestatic |
Makes a price by rounding a value onto the grid, in the order's favour.
A buy rounds down and a sell rounds up, so the price never becomes worse for the order.
| value | The price to round. |
| rule | The instrument's tick rule. |
| side | The side of the order the price is for. |
Definition at line 57 of file intent.hpp.
|
inline |
Returns the price as text, for logs.
Definition at line 79 of file intent.hpp.
|
inlinenoexcept |
Returns the price as a decimal.
Definition at line 73 of file intent.hpp.
|
friend |
Compares two prices for inequality.
| lhs | The first price. |
| rhs | The second price. |
Definition at line 97 of file intent.hpp.
|
friend |
Compares two prices by exact value (scale included; see Decimal64).
| lhs | The first price. |
| rhs | The second price. |
Definition at line 87 of file intent.hpp.