public method O2GRequestFactory.createMarketDataSnapshotRequestInstrument

Brief

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

Declaration
Java
O2GRequest  createMarketDataSnapshotRequestInstrument (String instrument, O2GTimeframe timeframe, int maxBars)

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 O2GOfferRow class.

timeframe

The time frame. The time frame must be one of the time frames returned by the getTimeFrameCollection method for the same session for which the request is created.

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.

Details

createMarketDataSnapshotRequestInstrument [hide]

O2GRequestFactory requestFactory = mSession.getRequestFactory();
if (requestFactory == null) {
    return;
}
O2GTimeframeCollection timeFrames = requestFactory.getTimeFrameCollection();
O2GTimeframe timeFrame = timeFrames.get("m1");
if (timeFrame != null) {
    request = requestFactory.createMarketDataSnapshotRequestInstrument("EUR/USD", timeFrame, 300);
    //...
}

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 MARKET_DATA_SNAPSHOT type and must be parsed using the O2GMarketDataSnapshotResponseReader class.

Declared in O2GRequestFactory

back