Slick Sim
0.10.1
Exchange simulator that shadows real venues for risk-free strategy testing
Loading...
Searching...
No Matches
price.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
common/order.hpp
>
4
5
namespace
slick::sim::utils
{
6
7
template
<S
id
e s>
8
inline
bool
isPriceBetter
(
price_t
a,
price_t
b) {
9
if
constexpr
(s ==
Side::BUY
) {
10
return
a > b;
11
}
else
{
12
return
a < b;
13
}
14
}
15
16
template
<S
id
e s>
17
inline
bool
isPriceBetterOrEqual
(
price_t
a,
price_t
b) {
18
if
constexpr
(s ==
Side::BUY
) {
19
return
a >= b;
20
}
else
{
21
return
a <= b;
22
}
23
}
24
25
inline
bool
isPriceBetter
(
Side
side,
price_t
a,
price_t
b) {
26
if
(side ==
Side::BUY
) {
27
return
a > b;
28
}
else
{
29
return
a < b;
30
}
31
}
32
33
inline
bool
isPriceBetterOrEqual
(
Side
side,
price_t
a,
price_t
b) {
34
if
(side ==
Side::BUY
) {
35
return
a >= b;
36
}
else
{
37
return
a <= b;
38
}
39
}
40
41
}
order.hpp
slick::sim::utils
Conversions between wire decimals with a constant exponent of -9 (CME PRICE9, ICE Decimal9) and the s...
Definition
decimal.hpp:9
slick::sim::utils::isPriceBetter
bool isPriceBetter(price_t a, price_t b)
Definition
price.hpp:8
slick::sim::utils::isPriceBetterOrEqual
bool isPriceBetterOrEqual(price_t a, price_t b)
Definition
price.hpp:17
slick::sim::Side
Side
Definition
order.hpp:20
slick::sim::BUY
@ BUY
Definition
order.hpp:21
slick::sim::price_t
int_fast64_t price_t
Definition
types.hpp:21
utils
price.hpp
Generated by
1.15.0