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

Reference data for one instrument. More...

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

Collaboration diagram for algotradelib::Instrument:

Public Member Functions

DateExclusion dates_exclude (Date day) const
 Tests whether the listing and delisting dates rule a day out.

Public Attributes

InstrumentId id_
 The instrument.
std::string name_
 The local-language name, as the broker spells it.
std::string english_name_
 The English name, or empty.
std::string isin_
 The ISIN, or empty.
MarketSegment segment_
 The market segment.
SecurityType type_ {SecurityType::UNKNOWN}
 The kind of security.
InstrumentStatus status_ {InstrumentStatus::UNKNOWN}
 Listed, awaiting listing, or delisted.
Currency currency_
 The currency it trades in.
bool common_share_ {true}
 Whether this is the common share, not a preferred or derived line.
StatedDate listed_on_
 The listing date.
StatedDate delisted_on_
 The delisting date; always NOT_STATED from Kiwoom, which publishes none.
std::optional< Decimal64 > shares_outstanding_
 Shares outstanding, if published; KIS's blank or zero is empty, never zero shares.
std::optional< Decimal64 > lot_size_
 The order quantity increment, if the broker publishes one.
PriceRule price_rule_
 The price grid, set by the adapter or the caller; kind UNKNOWN where it has no table.

Detailed Description

Reference data for one instrument.

Fields a broker may omit are optional or empty. price_rule_ is set by the adapter that read the instrument, or by the caller who builds the reference data, and is UNKNOWN where it has no table.

Definition at line 420 of file instrument.hpp.

Member Function Documentation

◆ dates_exclude()

DateExclusion algotradelib::Instrument::dates_exclude ( Date day) const
inline

Tests whether the listing and delisting dates rule a day out.

Parameters
dayThe day.
Returns
EXCLUDED if a readable date rules day out (listed after it, or delisted on or before it); otherwise UNREADABLE if either date is unreadable; otherwise NOT_EXCLUDED.
Note
NOT_EXCLUDED does not mean the instrument trades on day; check status_ too.

Definition at line 462 of file instrument.hpp.

Member Data Documentation

◆ common_share_

bool algotradelib::Instrument::common_share_ {true}

Whether this is the common share, not a preferred or derived line.

Definition at line 438 of file instrument.hpp.

◆ currency_

Currency algotradelib::Instrument::currency_

The currency it trades in.

Definition at line 436 of file instrument.hpp.

Referenced by algotradelib::alpaca::AlpacaBlockingClient::instrument(), and algotradelib::strategy::weight_target().

◆ delisted_on_

StatedDate algotradelib::Instrument::delisted_on_

The delisting date; always NOT_STATED from Kiwoom, which publishes none.

Definition at line 446 of file instrument.hpp.

Referenced by dates_exclude().

◆ english_name_

std::string algotradelib::Instrument::english_name_

The English name, or empty.

Definition at line 426 of file instrument.hpp.

Referenced by algotradelib::alpaca::AlpacaBlockingClient::instrument().

◆ id_

◆ isin_

std::string algotradelib::Instrument::isin_

The ISIN, or empty.

Definition at line 428 of file instrument.hpp.

◆ listed_on_

StatedDate algotradelib::Instrument::listed_on_

The listing date.

Toss sends null for none; KIS sends "" (and probably "00000000"); Kiwoom sends "".

Definition at line 444 of file instrument.hpp.

Referenced by dates_exclude().

◆ lot_size_

std::optional<Decimal64> algotradelib::Instrument::lot_size_

The order quantity increment, if the broker publishes one.

Definition at line 450 of file instrument.hpp.

Referenced by algotradelib::alpaca::AlpacaBlockingClient::instrument().

◆ name_

std::string algotradelib::Instrument::name_

The local-language name, as the broker spells it.

Definition at line 424 of file instrument.hpp.

Referenced by algotradelib::alpaca::AlpacaBlockingClient::instrument().

◆ price_rule_

PriceRule algotradelib::Instrument::price_rule_

The price grid, set by the adapter or the caller; kind UNKNOWN where it has no table.

Definition at line 452 of file instrument.hpp.

Referenced by algotradelib::alpaca::AlpacaBlockingClient::instrument(), algotradelib::strategy::reconcile(), and algotradelib::strategy::reconcile().

◆ segment_

MarketSegment algotradelib::Instrument::segment_

The market segment.

Definition at line 430 of file instrument.hpp.

Referenced by algotradelib::alpaca::AlpacaBlockingClient::instrument().

◆ shares_outstanding_

std::optional<Decimal64> algotradelib::Instrument::shares_outstanding_

Shares outstanding, if published; KIS's blank or zero is empty, never zero shares.

Definition at line 448 of file instrument.hpp.

◆ status_

InstrumentStatus algotradelib::Instrument::status_ {InstrumentStatus::UNKNOWN}

Listed, awaiting listing, or delisted.

Definition at line 434 of file instrument.hpp.

Referenced by algotradelib::alpaca::AlpacaBlockingClient::instrument().

◆ type_

SecurityType algotradelib::Instrument::type_ {SecurityType::UNKNOWN}

The kind of security.

Definition at line 432 of file instrument.hpp.


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