algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
Loading...
Searching...
No Matches
algotradelib::MarketSegment Struct Reference

The market segment an instrument is listed on, such as KOSPI or NASDAQ. More...

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

Collaboration diagram for algotradelib::MarketSegment:

Public Types

enum class  Known {
  UNKNOWN , KOSPI , KOSDAQ , NYSE ,
  NASDAQ , AMEX
}
 The segments the library recognizes. More...

Public Member Functions

std::string str () const
 Returns the segment's name for display.

Public Attributes

Known known_ {Known::UNKNOWN}
 The segment, or UNKNOWN if the broker's code was not recognized.
Code< 12 > other_
 The broker's code, when known_ is UNKNOWN and the code fits Code<12>.

Friends

bool operator== (const MarketSegment &lhs, const MarketSegment &rhs)
 Compares the normalized segment and the preserved code.
bool operator!= (const MarketSegment &lhs, const MarketSegment &rhs)
 Compares two segments for inequality.

Detailed Description

The market segment an instrument is listed on, such as KOSPI or NASDAQ.

A code the library does not recognize is kept in other_ when Code<12> can hold it.

Definition at line 18 of file instrument.hpp.

Member Enumeration Documentation

◆ Known

The segments the library recognizes.

Definition at line 20 of file instrument.hpp.

Member Function Documentation

◆ str()

std::string algotradelib::MarketSegment::str ( ) const
inline

Returns the segment's name for display.

Returns
The normalized name, the preserved code, or "UNKNOWN".

Definition at line 43 of file instrument.hpp.

◆ operator!=

bool operator!= ( const MarketSegment & lhs,
const MarketSegment & rhs )
friend

Compares two segments for inequality.

Parameters
lhsThe first segment.
rhsThe second segment.
Returns
true if they differ.

Definition at line 77 of file instrument.hpp.

◆ operator==

bool operator== ( const MarketSegment & lhs,
const MarketSegment & rhs )
friend

Compares the normalized segment and the preserved code.

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

Definition at line 67 of file instrument.hpp.

Member Data Documentation

◆ known_

Known algotradelib::MarketSegment::known_ {Known::UNKNOWN}

The segment, or UNKNOWN if the broker's code was not recognized.

Definition at line 30 of file instrument.hpp.

Referenced by algotradelib::market_segment(), operator==, and str().

◆ other_

Code<12> algotradelib::MarketSegment::other_

The broker's code, when known_ is UNKNOWN and the code fits Code<12>.

Empty beside UNKNOWN means the broker named no segment, or named one too long or with characters Code cannot hold.

Definition at line 37 of file instrument.hpp.

Referenced by algotradelib::market_segment(), operator==, and str().


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