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
5namespace slick::sim::utils {
6
7template<Side s>
8inline 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
16template<Side s>
18 if constexpr (s == Side::BUY) {
19 return a >= b;
20 } else {
21 return a <= b;
22 }
23}
24
25inline 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
33inline 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}
Conversions between wire decimals with a constant exponent of -9 (CME PRICE9, ICE Decimal9) and the s...
Definition decimal.hpp:9
bool isPriceBetter(price_t a, price_t b)
Definition price.hpp:8
bool isPriceBetterOrEqual(price_t a, price_t b)
Definition price.hpp:17
int_fast64_t price_t
Definition types.hpp:21