5 Second Real Time Bars

Real time and historical data functionality is combined through the LYNXApi.EClient.reqRealTimeBars request. reqRealTimeBars will create an active subscription that will return a single bar in real time every five seconds that has the OHLC values over that period. reqRealTimeBars can only be used with a bar size of 5 seconds.

[!WARNING] Real time bars subscriptions combine the limitations of both, top and historical market data. Make sure you observe Market Data Lines and Pacing Violations for Small Bars (30 secs or less). For example, no more than 60 new requests for real time bars can be made in 10 minutes, and the total number of active active subscriptions of all types cannot exceed the maximum allowed market data lines for the user.


** Python **

self.reqRealTimeBars(3001, ContractSamples.EurGbpFx(), 5, "MIDPOINT", True, [])

** Java **

client.reqRealTimeBars(3001, ContractSamples.EurGbpFx(), 5, "MIDPOINT", true, null);
  • To receive volume, VWAP, or trade count data, it is necessary to specify whatToShow as TRADES.
  • It may be necessary to remake real time bars subscriptions after the LYNX server reset or between trading sessions.


Once invoked, historical data bars of five seconds will start being delivered through the LYNXApi.EWrapper.realtimeBar callback:

** Python **

class TestWrapper(wrapper.EWrapper):

def realtimeBar(self, reqId: TickerId, time:int, open_: float, high: float, low: float, close: float, volume: int, wap: float, count: int):
    super().realtimeBar(reqId, time, open_, high, low, close, volume,         wap, count)
    print("RealTimeBar. TickerId:", reqId, RealTimeBar(time, -1,         open_, high, low, close, volume, wap, count))

** Java **

public class EWrapperImpl implements EWrapper {

public void realtimeBar(int reqId, long time, double open, double high,
        double low, double close, long volume, double wap, int count) {
    System.out.println("RealTimeBars. " + reqId + " - Time: " + time + ", Open: " + open + ", High: " + high + ", Low: " + low + ", Close: " + close + ", Volume: " + volume + ", Count: " + count + ", WAP: " + wap);

-Volume for US stocks has a multiplier of 100


To cancel an active request simply invoke LYNXApi.EClient.cancelRealTimeBars

** Python **


** Java **