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.
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;
}
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.