Slick Sim 0.10.1
Exchange simulator that shadows real venues for risk-free strategy testing
Loading...
Searching...
No Matches
types.hpp File Reference
#include <limits>
#include <cstdint>
#include <string>
#include <string_view>
#include <boost/multiprecision/cpp_int.hpp>
Include dependency graph for types.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  slick
namespace  slick::sim
namespace  slick::sim::detail

Macros

#define SLICK_SIM_ZERO_SIZE_ARRAY_BEGIN
#define SLICK_SIM_ZERO_SIZE_ARRAY_END
#define SLICK_SIM_VENUE_LIST(X)
 One line per venue: the enumerator, then the canonical name to_string returns and to_venue accepts.
#define SLICK_SIM_VENUE_ENUMERATOR(name, text)
#define SLICK_SIM_VENUE_CASE(name, text)
#define SLICK_SIM_VENUE_MATCH(name, text)

Typedefs

using slick::sim::price_t = int_fast64_t
using slick::sim::qty_t = int_fast64_t
using slick::sim::time_t = uint_fast64_t
using slick::sim::symid_t = uint16_t
using slick::sim::cum_value_t = boost::multiprecision::uint128_t

Enumerations

enum  slick::sim::Venue : uint8_t {
  slick::sim::UNKNOWN_VENUE , slick::sim::CME , slick::sim::ICE , slick::sim::COINBASE ,
  slick::sim::HYPERLIQUID , slick::sim::STOCK , slick::sim::__COUNT__
}

Functions

constexpr price_t slick::sim::to_price_t (double price)
 Scales a decimal into the fixed-point representation, rounding to the nearest tick rather than truncating.
constexpr double slick::sim::to_price_double (price_t price)
constexpr qty_t slick::sim::to_qty_t (double qty)
constexpr double slick::sim::to_qty_double (qty_t qty)
std::string slick::sim::to_fixed_string (int_fast64_t value, unsigned min_frac_digits=0)
 Renders a fixed-point value as an exact decimal string.
std::string slick::sim::to_price_string (price_t price)
std::string slick::sim::to_qty_string (qty_t qty)
bool slick::sim::detail::iequals (std::string_view a, std::string_view b) noexcept
 ASCII case-insensitive compare, used for every venue-name lookup.
const char * slick::sim::to_string (Venue venue)
Venue slick::sim::to_venue (std::string_view exch)
 Matches venue names case-insensitively, including mixed-case names such as "Coinbase".

Variables

constexpr symid_t slick::sim::INVALID_SYMBOL_ID = std::numeric_limits<symid_t>::max()
constexpr price_t slick::sim::NULL_PRICE = std::numeric_limits<price_t>::max()
constexpr int32_t slick::sim::DOUBLE_MULTIPLIER = static_cast<int32_t>(1e8)
constexpr double slick::sim::EPSILON = 1e-8

Macro Definition Documentation

◆ SLICK_SIM_VENUE_CASE

#define SLICK_SIM_VENUE_CASE ( name,
text )
Value:
case Venue::name: return text;

Referenced by slick::sim::to_string().

◆ SLICK_SIM_VENUE_ENUMERATOR

#define SLICK_SIM_VENUE_ENUMERATOR ( name,
text )
Value:
name,

Definition at line 157 of file types.hpp.

◆ SLICK_SIM_VENUE_LIST

#define SLICK_SIM_VENUE_LIST ( X)
Value:
X(CME, "CME") \
X(ICE, "ICE") \
X(COINBASE, "COINBASE") \
X(HYPERLIQUID, "HYPERLIQUID") \
X(STOCK, "STOCK")

One line per venue: the enumerator, then the canonical name to_string returns and to_venue accepts.

Adding a venue is this line and nothing else - the enum, to_string and to_venue are all generated from it.

APPEND ONLY. Venue is written into every MarketDataUpdate frame and into the shared-memory md queue, so inserting in the middle renumbers the existing venues under any process already reading a queue or a capture file.

This list is deliberately NOT conditional on the per-venue build options. A Venue is an identity written on the wire, not a claim that an adapter was compiled in: to_venue("coinbase") still yields COINBASE in a build with the Coinbase adapter switched off, which is what lets a capture recorded elsewhere still be read here.

Definition at line 148 of file types.hpp.

Referenced by slick::sim::to_string(), and slick::sim::to_venue().

◆ SLICK_SIM_VENUE_MATCH

#define SLICK_SIM_VENUE_MATCH ( name,
text )
Value:
if (detail::iequals(exch, text)) { return Venue::name; }

Referenced by slick::sim::to_venue().

◆ SLICK_SIM_ZERO_SIZE_ARRAY_BEGIN

#define SLICK_SIM_ZERO_SIZE_ARRAY_BEGIN

Definition at line 15 of file types.hpp.

◆ SLICK_SIM_ZERO_SIZE_ARRAY_END

#define SLICK_SIM_ZERO_SIZE_ARRAY_END

Definition at line 16 of file types.hpp.