Slick Trader 0.11.0
Multi-broker algorithmic trading engine with plugin strategies and a live web dashboard
Loading...
Searching...
No Matches
instrument_definition_event.hpp
Go to the documentation of this file.
1#pragma once
2
5#include <algorithm>
6#include <cstring>
7#include <string_view>
8#include <type_traits>
9
10namespace slick::trader {
11
12constexpr size_t MAX_CURRENCY_LENGTH = 8;
13
14// InstrumentDefinitionEvent - the static description of one tradable instrument,
15// published by a broker's market data connector (for CME, from MDP 3.0's instrument
16// definitions). StrategyManager applies the contract multiplier to position and risk
17// accounting and forwards the event to every strategy.
18#pragma pack(push, 1)
20 price_t tick_size; // Minimum price increment, in the same price units as orders and market data
21 double contract_multiplier; // Currency value of a one-unit price move on one unit of quantity (ES: 50, BTC-USD: 1)
22 qty_t min_quantity; // Smallest order quantity (0 = no limit)
23 qty_t max_quantity; // Largest order quantity (0 = no limit)
24 qty_t quantity_increment; // Order quantity step (0 = any)
25 char currency[MAX_CURRENCY_LENGTH]; // Settlement currency, e.g. "USD"
26
36
37 void set_currency(std::string_view ccy) {
38 size_t len = std::min(ccy.size(), MAX_CURRENCY_LENGTH - 1);
39 std::memcpy(currency, ccy.data(), len);
40 currency[len] = '\0';
41 }
42};
43#pragma pack(pop)
44
45static_assert(std::is_trivially_copyable_v<InstrumentDefinitionEvent>, "InstrumentDefinitionEvent must be trivially copyable");
46
47} // namespace slick::trader
int64_t qty_t
Definition types.hpp:17
int64_t price_t
Definition types.hpp:16
constexpr size_t MAX_CURRENCY_LENGTH
Event(EventType t=EventType::TRADE)
Definition event.hpp:63