? ? public void subscribe(int tickerId, Contract contract, String period,
? ? ? ? ? ? ? ? ? ? ? ? ? boolean reqRealTimeBars, boolean reqTickByTickData, boolean reqMarketDepth, boolean reqHistoricalData) {
? ? ? ? if (reqRealTimeBars) socket.reqRealTimeBars(tickerId, contract, 5, "MIDPOINT", false, null);
? ? ? ? if (reqTickByTickData) {
? ? ? ? ? ? socket.reqTickByTickData(tickerId, contract, "AllLast", 0, false);
? ? ? ? ? ? socket.reqTickByTickData(tickerId + 1, contract, "BidAsk", 0, false);
? ? ? ? }
? ? ? ? if (reqMarketDepth) {
? ? ? ? ? ? socket.reqMktDepth(tickerId, contract, 8, true, null);
? ? ? ? }
? ? ? ? if (reqHistoricalData) {
? ? ? ? ? ? //socket.reqHistoricalData(tickerId, contract, "", period, "1 day", "TRADES", 0, 1, false, null);
? ? ? ? ? ? //int tickerId, Contract contract, String endDateTime, String durationStr, String barSizeSetting, String whatToShow, int useRTH, int formatDate, boolean keepUpToDate, List<TagValue> chartOptions
? ? ? ? ? ? socket.reqHistoricalData(tickerId, contract, "", period, "5 secs", "BID_ASK", 0, 1, false, null);
? ? ? ? }
? ? ? ? socket.reqMktData(tickerId, contract, "233", false, false, null); //RTVolume
? ? ? ? socket.reqPositions();
? ? ? ? socket.reqIds(-1);
? ? }
subscribe(Configuration.MES_CONTRACT_ID, getMicroESFuturesContract(), LOOKBACK_UNITS_PERIOD + " S",