algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
Loading...
Searching...
No Matches
algotradelib::OrderRef< Broker > Struct Template Reference

A broker's reference to one order, used to amend or cancel it. More...

#include <algotradelib/src/core/types.hpp>

Inheritance diagram for algotradelib::OrderRef< Broker >:

Public Member Functions

std::string str () const
 Formats the reference for logs, as broker:primary[:secondary].

Static Public Member Functions

static constexpr std::string_view broker () noexcept
 Returns the issuing broker's name.

Public Attributes

std::string primary_
 The order number or id.
std::string secondary_
 A second part some brokers need, such as KIS's branch code; empty otherwise.

Friends

bool operator== (const OrderRef &lhs, const OrderRef &rhs)
 Compares two references.
bool operator!= (const OrderRef &lhs, const OrderRef &rhs)
 Compares two references for inequality.

Detailed Description

template<typename Broker>
struct algotradelib::OrderRef< Broker >

A broker's reference to one order, used to amend or cancel it.

The broker is a type parameter, so a reference from one broker cannot be passed to another's session (it does not compile); a broker's asynchronous and blocking clients share one tag. Treat the parts as opaque: store, compare and hash them, but do not parse them.

Template Parameters
BrokerThe broker's tag type, with static constexpr std::string_view name.

Definition at line 2111 of file types.hpp.

Member Function Documentation

◆ broker()

template<typename Broker>
constexpr std::string_view algotradelib::OrderRef< Broker >::broker ( )
inlinestaticconstexprnoexcept

Returns the issuing broker's name.

Returns
Broker::name.

Definition at line 2121 of file types.hpp.

◆ str()

template<typename Broker>
std::string algotradelib::OrderRef< Broker >::str ( ) const
inline

Formats the reference for logs, as broker:primary[:secondary].

Returns
The text.

Definition at line 2127 of file types.hpp.

◆ operator!=

template<typename Broker>
bool operator!= ( const OrderRef< Broker > & lhs,
const OrderRef< Broker > & rhs )
friend

Compares two references for inequality.

Parameters
lhsThe first reference.
rhsThe second reference.
Returns
true if either part differs.

Definition at line 2154 of file types.hpp.

◆ operator==

template<typename Broker>
bool operator== ( const OrderRef< Broker > & lhs,
const OrderRef< Broker > & rhs )
friend

Compares two references.

Parameters
lhsThe first reference.
rhsThe second reference.
Returns
true if both parts are equal.

Definition at line 2144 of file types.hpp.

Member Data Documentation

◆ primary_

◆ secondary_

template<typename Broker>
std::string algotradelib::OrderRef< Broker >::secondary_

A second part some brokers need, such as KIS's branch code; empty otherwise.

Definition at line 2115 of file types.hpp.

Referenced by algotradelib::OrderRef< kis::Broker >::operator==.


The documentation for this struct was generated from the following file: