algotradelib
0.0.0.9000
C++ header-only library for algorithmic trading
Toggle main menu visibility
Loading...
Searching...
No Matches
us.hpp
1
#pragma once
2
3
#include "../../core/instrument.hpp"
4
5
namespace
algotradelib
{
6
namespace
us
{
7
18
inline
PriceRule
equity_price_rule
() {
19
PriceRule
rule;
20
rule.
kind_
=
PriceRule::Kind::STATED
;
21
rule.
source_
=
22
"US Regulation NMS Rule 612 minimum increments, $0.01 from $1 and $0.0001 below (library-maintained; the 2024 "
23
"half-penny tier not checked)"
;
24
rule.
bands_
= {
25
TickBand
{
Decimal64::parse
(
"0"
),
Decimal64::parse
(
"0.0001"
)},
26
TickBand
{
Decimal64::parse
(
"1"
),
Decimal64::parse
(
"0.01"
)},
27
};
28
return
rule;
29
}
30
31
}
// namespace us
32
}
// namespace algotradelib
algotradelib::Decimal64::parse
static Decimal64 parse(std::string_view input)
Parses a decimal string exactly (no binary floating point).
Definition
types.hpp:468
algotradelib::us
The US equity price grid that the Alpaca adapter attaches to instruments, in brokers/common/us....
Definition
us.hpp:6
algotradelib::us::equity_price_rule
PriceRule equity_price_rule()
Returns the US equity price grid: $0.01 at or above $1, $0.0001 below (Regulation NMS Rule 612).
Definition
us.hpp:18
algotradelib
The library: broker-neutral types (core), and the modules below.
Definition
conversion.hpp:13
algotradelib::PriceRule
The price grid (tick sizes) an instrument's order prices must sit on.
Definition
instrument.hpp:150
algotradelib::PriceRule::source_
std::string source_
Where the table came from and its revision, or why there is none.
Definition
instrument.hpp:168
algotradelib::PriceRule::bands_
std::vector< TickBand > bands_
The bands, ascending by from_; empty unless kind_ is STATED.
Definition
instrument.hpp:166
algotradelib::PriceRule::Kind::STATED
@ STATED
bands_ describe the market's grid.
Definition
instrument.hpp:154
algotradelib::PriceRule::kind_
Kind kind_
The kind of rule; UNKNOWN by default, so an unset rule refuses to round.
Definition
instrument.hpp:164
algotradelib::TickBand
One band of a price grid: the tick size from a price upward, until the next band.
Definition
instrument.hpp:135
algotradelib
src
brokers
common
us.hpp
Generated by
1.18.0