TT CORE SDK

Fetching a Single Instrument

Fetching a Single Instrument

The GetInstrument() function provides overloaded forms that let you identify instruments using different sets of criteria. These are listed below along with code snippets showing their use.

Fetch by instrument id



ttsdk::Instrument::ResponseCode respCode;
uint64_t id = 3899904826036563588;
ttsdk::InstrumentPtr instrument = ttsdk::GetInstrument(id, respCode);
if (!instrument)
{
        std::cout << "Unable to find instrument with id = “ << id << std::endl;
}

  

Fetch by market ID, product name, product type and instrument alias


ttsdk::Instrument::ResponseCode respCode;
ttsdk::MarketId market = ttsdk::MarketId::CME;
std::string product = “GE”;
ttsdk::ProductType productType = ttsdk::ProductType::Future;
std::string alias = "GE Sep28";
ttsdk::InstrumentPtr instrument = ttsdk::GetInstrument(market, product.c_str(),
        productType, alias.c_str(), respCode);
if (!instrument)
{
        std::cout << "Unable to find instrument with alias = “ << alias << std::endl;
}

Note: The instrument alias parameter must match the string displayed in TT and TT Desktop, where it is called the “contract alias”. The instrument alias parameter for Autospreader and Aggregator instruments must match the name with which it was created.