Slick Sim 0.10.1
Exchange simulator that shadows real venues for risk-free strategy testing
Loading...
Searching...
No Matches
match_common.hpp File Reference
#include "matching_engine.hpp"
#include <slick/logger.hpp>
#include <common/order.hpp>
#include <utils/order.hpp>
#include <utils/price.hpp>
#include <algorithm>
#include <cassert>
#include <optional>
#include <vector>
Include dependency graph for match_common.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  slick::sim::engine::detail::MatchContext
 State one match() call carries through its fills. More...

Namespaces

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

Enumerations

enum class  slick::sim::engine::detail::Reach : uint8_t { slick::sim::engine::detail::Queue , slick::sim::engine::detail::Level }
 How far into a price level an aggressor reaches. More...

Functions

bool slick::sim::engine::detail::isSelfMatch (const Order *incoming_order, const Order *book_order)
bool slick::sim::engine::detail::handleSelfMatch (MatchingEngine &engine, const Order *incoming_order, Order *book_order, OrderBook &book, slick::sim::time_t request_time, uint64_t event_time, uint64_t seq_num, SelfMatchPreventionMode smp_mode)
template<Side SIDE, Reach REACH>
bool slick::sim::engine::detail::wouldSelfMatch (const Order *order, price_t order_price, qty_t order_qty, OrderBook &book)
template<Side SIDE>
bool slick::sim::engine::detail::canFillCompletely (const Order *order, price_t order_price, qty_t order_qty, OrderBook &book, SelfMatchPreventionMode smp_mode)
template<Side SIDE, Reach REACH>
std::optional< OrdRejectReason > slick::sim::engine::detail::prepareOrder (MatchingEngine &engine, Order *order, price_t order_price, qty_t order_qty, OrderBook &book, slick::sim::time_t request_time, SelfMatchPreventionMode smp_mode)
 Everything a client order goes through before it matches: the CANCEL_NEWEST pre-check, the ack, the FOK pre-check, and applying a pending replace.
template<Side SIDE>
void slick::sim::engine::detail::recordTrade (MatchContext &ctx, uint64_t aggressor_id, uint64_t book_order_id, price_t price, qty_t trade_qty, qty_t phantom_qty)
 Adds one fill to the trade summaries, which are aggregated per price level: a new summary when the price changes, otherwise one more leg on the current one.
template<Side SIDE>
bool slick::sim::engine::detail::fillResting (MatchContext &ctx, Order *order, uint64_t book_order_id, Order *full_book_order, price_t price, qty_t trade_qty, qty_t remaining)
 One fill of a client order against a resting order.
template<Side SIDE>
bool slick::sim::engine::detail::fillRestingFromFeed (MatchContext &ctx, uint64_t aggressor_id, uint64_t book_order_id, price_t price, qty_t trade_qty, qty_t &qty)
 One fill of market-data liquidity against a resting order.
void slick::sim::engine::detail::cancelUnrestableRemainder (MatchingEngine &engine, const Order *order, qty_t remaining, slick::sim::time_t request_time)
 What cannot rest is cancelled: an IOC's remainder, and a market order's, which would otherwise rest at NULL_PRICE.