class IO2GMarketDataSnapshotResponseReader

Parents
IAddRef

Brief

The class reads a stream of historical prices.

Details

If you need historical prices information, you must request it. The process of requesting historical prices consists of several steps that are described in the How to get historical prices section.

As an answer to the historical prices request, the trading server sends a response object of the MarketDataSnapshot type. This object is the response parameter in your implementation of the IO2GResponseListener.onRequestCompleted method. To process the response contents, you must use an instance of the IO2GMarketDataSnapshotResponseReader class.

To create an instance of the IO2GMarketDataSnapshotResponseReader class, pass the response object as an argument to the IO2GResponseReaderFactory.createMarketDataSnapshotReader method. For example,

O2GMarketDataSnapshotResponseReader marketDataReader = factory.createMarketDataSnapshotReader(response);

Example

Get historical ask prices [hide]

 void ResponseListener::onRequestCompleted(const char *requestId, IO2GResponse  *response)
 {
     //...
     if (response->getType() == MarketDataSnapshot)
     {
         O2G2Ptr<IO2GResponseReaderFactory> factory = mSession->getResponseReaderFactory();
         if (factory)
         {
             O2G2Ptr<IO2GMarketDataSnapshotResponseReader> reader = factory->createMarketDataSnapshotReader(response);
             //...
         }
     }
 }

Public Methods

getAsk

Gets the ask price of a tick.

getAskClose

Gets the close price of an ask bar.

getAskHigh

Gets the highest price of an ask bar.

getAskLow

Gets the lowest price of an ask bar.

getAskOpen

Gets the open price of an ask bar.

getBid

Gets the bid price of a tick.

getBidClose

Gets the close price of a bid bar.

getBidHigh

Gets the highest price of a bid bar.

getBidLow

Gets the lowest price of a bid bar.

getBidOpen

Gets the open price of a bid bar.

getDate

Gets an instance of the calendar representing a tick's date/time or the beginning of a bar's date/time.

getLastBarTime

Gets a calendar instance representing the date and time of the last tick of the last bar.

getLastBarVolume

Gets the last bar tick volume.

getVolume

Gets the tick volume of a bar.

isBar

Checks whether the historical prices in the response are represented as bars or ticks.

size

Gets the number of bars or ticks in the reader.

back