public method IO2GRequestFactory.createMarketDataSnapshotRequestInstrument

Brief

Creates a market data snapshot (get price history) request.

Declaration
C++
virtual IO2GRequest createMarketDataSnapshotRequestInstrument (const char * instrument, IO2GTimeframe * timeframe, int maxBars) = 0

Parameters
instrument

The instrument to get the snapshot for. The instrument specified must be exactly the same as the instrument name returned by the getInstrument method of the IO2GOfferRow interface.

timeframe

The time frame. The time frame must be one of the time frames from IO2GTimeframeCollection returned by the getTimeFrameCollection method for the same session for which the request is created. After calling the method you can release the instance of the time frame object, the request keeps the further refers to the time frame itself.

maxBars

The maximum number of bars. Please note that the maximum number of the bars must not exceed the maximum number of bars specified in the server properties (300 on most servers). Even if a bigger number is specified in the request, the server will return the maximum number of bars specified in its configuration. This value can be obtained by getQueryDepth method of timeframe.

Details

The market data snapshot request returns historical price data for the specified instrument.

createMarketDataSnapshotRequestInstrument [hide]

 IO2GRequestFactory *factory = session->getRequestFactory();
 IO2GTimeframeCollection *timeframe_collection = factory->getTimeFrameCollection();
 IO2GTimeframe *timeframe = timeframe_collection->get("m1");
 timeframe_collection->release();
 IO2GRequest *request = factory->createMarketDataSnapshotRequestInstrument(instrument.c_str(), timeframe, timeframe->getQueryDepth());
 //...
 timeframe->release();
 factory->release();

To specify the date/time range, please use the fillMarketDataSnapshotRequestTime method after createMarketDataSnapshotRequestInstrument. If the date/time range is not specified, the request will return most recent data.

The response to this request will have the MarketDataSnapshot type and must be parsed using the IO2GMarketDataSnapshotResponseReader class.

The returned object must be released using the release method when it is not used anymore.

Declared in IO2GRequestFactory

back