BetaTrader
A HFT Eco-System
Loading...
Searching...
No Matches
common Namespace Reference

Classes

class  Order
 Represents a single trading order in the system. More...
 
class  Trade
 Represents a single trade execution in the system. More...
 

Typedefs

using ClientID = std::string
 A type alias for client identifiers.
 
using OrderID = uint64_t
 A type alias for unique order identifiers.
 
using Price = double
 A type alias for price values.
 
using Quantity = uint64_t
 A type alias for quantity values.
 
using SessionID = uint64_t
 A type alias for session identifiers.
 
using Symbol = Instrument
 A type alias for financial instrument symbols.
 
using Timestamp = std::chrono::system_clock::time_point
 A type alias for std::chrono::system_clock::time_point.
 
using TradeID = uint64_t
 A type alias for unique trade identifiers.
 

Enumerations

enum class  Instrument : uint8_t {
  EURUSD ,
  USDJPY ,
  GBPUSD ,
  USDCAD ,
  USDINR ,
  EURINR ,
  GBPINR ,
  AUDUSD ,
  USDMXN ,
  COUNT
}
 Represents the financial instruments available for trading. More...
 
enum class  OrderSide : uint8_t {
  Buy ,
  Sell
}
 Represents the side of an order (Buy or Sell). More...
 
enum class  OrderStatus : uint8_t {
  New ,
  PartiallyFilled ,
  Filled ,
  Cancelled ,
  Rejected
}
 Represents the lifecycle of an order. More...
 
enum class  OrderType : uint8_t {
  Limit ,
  Market ,
  Stop ,
  StopLimit
}
 Represents the execution logic of an order. More...
 
enum class  TimeInForce : uint8_t {
  DAY ,
  GTC ,
  IOC ,
  FOK ,
  MOO ,
  MOC
}
 Guides How long the order is in the system. More...
 

Functions

Instrument from_string (std::string_view name)
 Converts a string to its corresponding Instrument enum.
 
OrderSide from_string_OrderSide (std::string_view name)
 
OrderStatus from_string_OrderStatus (std::string_view name)
 
OrderType from_string_OrderType (std::string_view name)
 
TimeInForce from_string_TimeInForce (std::string_view name)
 
std::string to_string (Instrument symbol)
 Converts an Instrument enum to its string representation.
 
std::string to_string (OrderSide side)
 
std::string to_string (OrderStatus status)
 
std::string to_string (OrderType type)
 
std::string to_string (TimeInForce tif)
 

Variables

constexpr std::array< std::string_view, 2 > order_side_names = {"Buy", "Sell"}
 
constexpr std::array< std::string_view, 5 > order_status_names = {"New", "PartiallyFilled", "Filled", "Cancelled", "Rejected"}
 
constexpr std::array< std::string_view, 2 > order_type_names = {"Limit", "Market"}
 
constexpr std::array< std::string_view, static_cast< size_t >(Instrument::COUNT)> symbol_names
 An array of string representations for the Instrument enum.
 
constexpr std::array< std::string_view, 6 > time_in_force_names = {"DAY", "GTC", "IOC", "FOK", "MOO", "MOC"}
 

Typedef Documentation

◆ ClientID

using common::ClientID = typedef std::string

A type alias for client identifiers.

◆ OrderID

using common::OrderID = typedef uint64_t

A type alias for unique order identifiers.

◆ Price

using common::Price = typedef double

A type alias for price values.

◆ Quantity

using common::Quantity = typedef uint64_t

A type alias for quantity values.

◆ SessionID

using common::SessionID = typedef uint64_t

A type alias for session identifiers.

◆ Symbol

using common::Symbol = typedef Instrument

A type alias for financial instrument symbols.

◆ Timestamp

using common::Timestamp = typedef std::chrono::system_clock::time_point

A type alias for std::chrono::system_clock::time_point.

This is used throughout the system to represent timestamps for orders, trades, and other time-sensitive events.

◆ TradeID

using common::TradeID = typedef uint64_t

A type alias for unique trade identifiers.

Enumeration Type Documentation

◆ Instrument

enum class common::Instrument : uint8_t
strong

Represents the financial instruments available for trading.

Enumerator
EURUSD 

Euro / US Dollar.

USDJPY 

US Dollar / Japanese Yen.

GBPUSD 

British Pound / US Dollar.

USDCAD 

US Dollar / Canadian Dollar.

USDINR 

US Dollar / Indian Rupee.

EURINR 

Euro / Indian Rupee.

GBPINR 

British Pound / Indian Rupee.

AUDUSD 

Australian Dollar / US Dollar.

USDMXN 

US Dollar / Mexican Peso.

COUNT 

Helper to get the number of instruments.

◆ OrderSide

enum class common::OrderSide : uint8_t
strong

Represents the side of an order (Buy or Sell).

Enumerator
Buy 

A buy order.

Sell 

a sell order.

◆ OrderStatus

enum class common::OrderStatus : uint8_t
strong

Represents the lifecycle of an order.

Enumerator
New 

The order has been created but not yet matched.

PartiallyFilled 

The order has been partially matched.

Filled 

The order has been fully matched.

Cancelled 

The order has been cancelled before being fully matched.

Rejected 

The order was rejected by the system and never entered the matching engine.

◆ OrderType

enum class common::OrderType : uint8_t
strong

Represents the execution logic of an order.

Enumerator
Limit 

A limit order, which is executed at a specified price or better.

Market 

A market order, which is executed immediately at the best available price.

Stop 

Triggers a market order once a set price is reached (Not implemented)

StopLimit 

Triggers a limit order once a set price is reached (Not implemented)

◆ TimeInForce

enum class common::TimeInForce : uint8_t
strong

Guides How long the order is in the system.

Enumerator
DAY 

Keep the order in the system for a day.

GTC 

Good till cancellation.

IOC 

Immediate or cancel.

FOK 

Fill or kill.

MOO 

Market on Open.

MOC 

Market on Close.

Function Documentation

◆ from_string()

Instrument common::from_string ( std::string_view  name)
inline

Converts a string to its corresponding Instrument enum.

Parameters
nameThe string representation of the Instrument.
Returns
The Instrument enum.
Exceptions
std::invalid_argumentif the string is not a valid instrument.
Here is the caller graph for this function:

◆ from_string_OrderSide()

OrderSide common::from_string_OrderSide ( std::string_view  name)
inline
Here is the caller graph for this function:

◆ from_string_OrderStatus()

OrderStatus common::from_string_OrderStatus ( std::string_view  name)
inline
Here is the caller graph for this function:

◆ from_string_OrderType()

OrderType common::from_string_OrderType ( std::string_view  name)
inline
Here is the caller graph for this function:

◆ from_string_TimeInForce()

TimeInForce common::from_string_TimeInForce ( std::string_view  name)
inline
Here is the caller graph for this function:

◆ to_string() [1/5]

std::string common::to_string ( Instrument  symbol)
inline

Converts an Instrument enum to its string representation.

Parameters
symbolThe Instrument to convert.
Returns
The string representation of the Instrument.
Here is the caller graph for this function:

◆ to_string() [2/5]

std::string common::to_string ( OrderSide  side)
inline

◆ to_string() [3/5]

std::string common::to_string ( OrderStatus  status)
inline

◆ to_string() [4/5]

std::string common::to_string ( OrderType  type)
inline

◆ to_string() [5/5]

std::string common::to_string ( TimeInForce  tif)
inline

Variable Documentation

◆ order_side_names

constexpr std::array<std::string_view, 2> common::order_side_names = {"Buy", "Sell"}
constexpr

◆ order_status_names

constexpr std::array<std::string_view, 5> common::order_status_names = {"New", "PartiallyFilled", "Filled", "Cancelled", "Rejected"}
constexpr

◆ order_type_names

constexpr std::array<std::string_view, 2> common::order_type_names = {"Limit", "Market"}
constexpr

◆ symbol_names

constexpr std::array<std::string_view, static_cast<size_t>(Instrument::COUNT)> common::symbol_names
constexpr
Initial value:
= {"EURUSD", "USDJPY", "GBPUSD", "USDCAD", "USDINR",
"EURINR", "GBPINR", "AUDUSD", "USDMXN"}

An array of string representations for the Instrument enum.

◆ time_in_force_names

constexpr std::array<std::string_view, 6> common::time_in_force_names = {"DAY", "GTC", "IOC", "FOK", "MOO", "MOC"}
constexpr