FastMM documentation
FastMM C++ API 0.6.0
Public headers, tier 1 and tier 2
Loading...
Searching...
No Matches
fastmm::QuoteManager Class Reference

#include <fastmm/core/quote_manager.hpp>

Public Member Functions

 QuoteManager (const QuoteParams &p={}) noexcept
 
const QuoteParams & params () const noexcept
 
void set_params (const QuoteParams &p) noexcept
 
const QuoteStats & stats () const noexcept
 
void set_replace (InstrumentId id, bool on) noexcept
 Whether the instrument's venue amends in place (default true; supports_replace still applies).
 
bool replaces (InstrumentId id) const noexcept
 
template<class Placer >
std::uint32_t reconcile (const Instrument &inst, const DesiredQuotes &desired, const Oms &oms, Timestamp now, Placer &&place) noexcept
 Reconciles desired vs resting for one instrument. Returns the number of actions placed.
 
template<class Placer >
std::uint32_t pull_quotes (const Instrument &inst, const Oms &oms, Placer &&place, bool keep_desired=false) noexcept
 Cancels every working quote on the instrument and suppresses re-quoting until the next reconcile().
 
template<class Placer >
std::uint32_t resume (const Instrument &inst, const Oms &oms, Timestamp now, Placer &&place) noexcept
 Re-applies the desired quotes kept by pull_quotes(keep_desired). Returns the actions placed.
 
bool resumable (InstrumentId id) const noexcept
 
bool starved () const noexcept
 Instruments whose quotes were held back for want of an order token, oldest first.
 
std::size_t starved_count () const noexcept
 
InstrumentId pop_starved () noexcept
 Takes the oldest starved instrument off the queue (the caller checks starved() first).
 
template<class Placer >
std::uint32_t retry (const Instrument &inst, const Oms &oms, Timestamp now, Placer &&place) noexcept
 Re-applies the last desired quotes of an instrument popped from the starved queue; one that was pulled meanwhile stays pulled.
 
template<class Placer >
void on_order_update (const OmsUpdate &u, const Instrument &inst, const Oms &oms, Timestamp now, Placer &&place) noexcept
 Feed every OmsUpdate here.
 
Handle< Order > slot_handle (InstrumentId id, Side s, std::uint32_t level) const noexcept
 
bool pulled (InstrumentId id) const noexcept
 
const DesiredQuotes & desired (InstrumentId id) const noexcept
 The last ladder reconcile() applied to the instrument (empty after a pull).
 
bool starved (InstrumentId id) const noexcept
 The instrument waits for an order token (a New or Replace was rate-limited).
 
bool backing_off (InstrumentId id, Side s, Timestamp now) const noexcept
 The side is in its venue-reject backoff at now.
 

Static Public Member Functions

static constexpr std::uint32_t make_tag (Side s, std::uint32_t level) noexcept
 user_tag encoding so a terminal OmsUpdate can be mapped back to its slot.
 
static constexpr bool is_quote_tag (std::uint32_t tag) noexcept
 

Constructor & Destructor Documentation

◆ QuoteManager()

fastmm::QuoteManager::QuoteManager ( const QuoteParams &  p = {})
inlineexplicitnoexcept

Member Function Documentation

◆ params()

const QuoteParams & fastmm::QuoteManager::params ( ) const
inlinenoexcept

◆ set_params()

void fastmm::QuoteManager::set_params ( const QuoteParams &  p)
inlinenoexcept

◆ stats()

const QuoteStats & fastmm::QuoteManager::stats ( ) const
inlinenoexcept

◆ set_replace()

void fastmm::QuoteManager::set_replace ( InstrumentId  id,
bool  on 
)
inlinenoexcept

Whether the instrument's venue amends in place (default true; supports_replace still applies).

◆ replaces()

bool fastmm::QuoteManager::replaces ( InstrumentId  id) const
inlinenoexcept

◆ make_tag()

static constexpr std::uint32_t fastmm::QuoteManager::make_tag ( Side  s,
std::uint32_t  level 
)
inlinestaticconstexprnoexcept

user_tag encoding so a terminal OmsUpdate can be mapped back to its slot.

◆ is_quote_tag()

static constexpr bool fastmm::QuoteManager::is_quote_tag ( std::uint32_t  tag)
inlinestaticconstexprnoexcept

◆ reconcile()

template<class Placer >
std::uint32_t fastmm::QuoteManager::reconcile ( const Instrument &  inst,
const DesiredQuotes &  desired,
const Oms &  oms,
Timestamp  now,
Placer &&  place 
)
inlinenoexcept

Reconciles desired vs resting for one instrument. Returns the number of actions placed.

◆ pull_quotes()

template<class Placer >
std::uint32_t fastmm::QuoteManager::pull_quotes ( const Instrument &  inst,
const Oms &  oms,
Placer &&  place,
bool  keep_desired = false 
)
inlinenoexcept

Cancels every working quote on the instrument and suppresses re-quoting until the next reconcile().

With keep_desired (a pause, not a decision to stop quoting) the last desired quotes are kept for resume(), unless the instrument was already pulled.

< pending: cannot touch; a later pull will catch it

◆ resume()

template<class Placer >
std::uint32_t fastmm::QuoteManager::resume ( const Instrument &  inst,
const Oms &  oms,
Timestamp  now,
Placer &&  place 
)
inlinenoexcept

Re-applies the desired quotes kept by pull_quotes(keep_desired). Returns the actions placed.

◆ resumable()

bool fastmm::QuoteManager::resumable ( InstrumentId  id) const
inlinenoexcept

◆ starved() [1/2]

bool fastmm::QuoteManager::starved ( ) const
inlinenoexcept

Instruments whose quotes were held back for want of an order token, oldest first.

◆ starved_count()

std::size_t fastmm::QuoteManager::starved_count ( ) const
inlinenoexcept

◆ pop_starved()

InstrumentId fastmm::QuoteManager::pop_starved ( )
inlinenoexcept

Takes the oldest starved instrument off the queue (the caller checks starved() first).

◆ retry()

template<class Placer >
std::uint32_t fastmm::QuoteManager::retry ( const Instrument &  inst,
const Oms &  oms,
Timestamp  now,
Placer &&  place 
)
inlinenoexcept

Re-applies the last desired quotes of an instrument popped from the starved queue; one that was pulled meanwhile stays pulled.

An action held back again queues it at the back.

◆ on_order_update()

template<class Placer >
void fastmm::QuoteManager::on_order_update ( const OmsUpdate &  u,
const Instrument &  inst,
const Oms &  oms,
Timestamp  now,
Placer &&  place 
)
inlinenoexcept

Feed every OmsUpdate here.

A terminal update frees the slot it belonged to and, if a target was recorded for it (cancel-then-new, or a requote that met the order pending), places the New now. The ack of an order that was pending at a requote applies the recorded target. While the instrument is pulled, an order that has just become working is cancelled instead.

< the venue takes this side

The terminal order was this slot's unless the slot already holds a newer live order. Ids are not compared: a replace changes the order's id, and a stale id used to drop the update and leave the slot waiting for a terminal state forever.

◆ slot_handle()

Handle< Order > fastmm::QuoteManager::slot_handle ( InstrumentId  id,
Side  s,
std::uint32_t  level 
) const
inlinenoexcept

◆ pulled()

bool fastmm::QuoteManager::pulled ( InstrumentId  id) const
inlinenoexcept

◆ desired()

const DesiredQuotes & fastmm::QuoteManager::desired ( InstrumentId  id) const
inlinenoexcept

The last ladder reconcile() applied to the instrument (empty after a pull).

◆ starved() [2/2]

bool fastmm::QuoteManager::starved ( InstrumentId  id) const
inlinenoexcept

The instrument waits for an order token (a New or Replace was rate-limited).

◆ backing_off()

bool fastmm::QuoteManager::backing_off ( InstrumentId  id,
Side  s,
Timestamp  now 
) const
inlinenoexcept

The side is in its venue-reject backoff at now.