I finally got reqMktData() to work! Unfortunately, it just gave me the price $5.54 for the stock SHLD. That is the close of Thursday. and right now it's Saturday... I would think it should give me the closing price of Friday... and even the most recent after hours closing price.
So it seems that it's a day off? I wonder if this is because of the weekend?
I'm not sure. Here is my code snippet for the tickPrice() function (basically just printing things out):
void PosixTestClient::tickPrice( TickerId tickerId, TickType field, double price, int canAutoExecute) {
printf( "Tick Price. Ticker Id: %ld, Field: %d, Price: %g, CanAutoEx: %ld \n",
tickerId, (int)field, price, canAutoExecute);
}
And here is my code for the reqMktData() function:
void PosixTestClient::getHData(){
Contract contract;
contract.symbol = "SHLD";
contract.secType = "STK";
contract.exchange = "SMART";
contract.currency = "USD";
TagValueListSPtr mktDataOptions( new TagValueList);
m_pClient->reqMktData(1,contract,"",false, mktDataOptions);
}