// Request string for HistoryType.TickDatapoints public string GetRequestTickDatapoints(string symbol, HistoryDataDirection direction = HistoryDataDirection.Forward, string datapointsPerSend = "", string maxDatapoints = "") { string sDirection = string.Format("{0}", (int)direction); // request in the format: // HTX,SYMBOL,NUMDATAPOINTS,DIRECTION,REQUESTID,DATAPOINTSPERSEND<CR><LF> return String.Format("HTX,{0},{1},{2},{3},{4}\r\n", symbol, maxDatapoints, sDirection, REQUEST_ID, datapointsPerSend); }
// Request string for HistoryType.IntervalTimeframe public string GetRequestIntervalTimeframe(string symbol, HistoryIntervalType itype, string interval, string beginDateTime, string endDateTime, HistoryDataDirection direction = HistoryDataDirection.Forward, string datapointsPerSend = "", string maxDatapoints = "", string beginFilterTime = "", string endFilterTime = "") { string sIntervalType = itype.ToIntervalTypeString(); // interval type: "s" for Time, "v" for Volume, "t" for Tick string sDirection = string.Format("{0}", (int)direction); // request in the format: // HIT,SYMBOL,INTERVAL,BEGINDATE BEGINTIME,ENDDATE ENDTIME,MAXDATAPOINTS,BEGINFILTERTIME,ENDFILTERTIME,DIRECTION,REQUESTID,DATAPOINTSPERSEND,INTERVALTYPE<CR><LF> return String.Format("HIT,{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10}\r\n", symbol, interval, beginDateTime, endDateTime, maxDatapoints, beginFilterTime, endFilterTime, sDirection, REQUEST_ID, datapointsPerSend, sIntervalType); }
// Request string for HistoryType.IntervalTimeframe public string GetRequestIntervalTimeframe(string symbol, HistoryIntervalType itype, HistoryInterval interval, string beginDateTime, string endDateTime, HistoryDataDirection direction = HistoryDataDirection.Forward, string datapointsPerSend = "", string maxDatapoints = "", string beginFilterTime = "", string endFilterTime = "") { return GetRequestIntervalTimeframe(symbol, itype, ((int)interval).ToString(), beginDateTime, endDateTime, direction, datapointsPerSend, maxDatapoints, beginFilterTime, endFilterTime); }
public void HistoryIntervalTimeframe(string symbol, HistoryIntervalType itype, string interval, string beginDateTime = null, string endDateTime = null, HistoryDataDirection direction = HistoryDataDirection.Forward, string datapointsPerSend = "", string maxDatapoints = "", string beginFilterTime = "", string endFilterTime = "") { beginDateTime = beginDateTime ?? EARLIEST_DATE; endDateTime = endDateTime ?? DateTime.Now.ToString("yyyyMMdd"); string sRequest = GetRequestIntervalTimeframe(symbol, itype, interval, beginDateTime, endDateTime, direction, datapointsPerSend, maxDatapoints, beginFilterTime, endFilterTime); GetData(sRequest); }
public void HistoryIntervalTimeframe(string symbol, HistoryIntervalType itype, HistoryInterval interval, string beginDateTime = null, string endDateTime = null, HistoryDataDirection direction = HistoryDataDirection.Forward, string datapointsPerSend = "", string maxDatapoints = "", string beginFilterTime = "", string endFilterTime = "") { string sInterval = ((int)interval).ToString(); HistoryIntervalTimeframe(symbol, itype, sInterval, beginDateTime, endDateTime, direction, datapointsPerSend, maxDatapoints, beginFilterTime, endFilterTime); }
public void HistoryTickDatapoints(string symbol, HistoryDataDirection direction = HistoryDataDirection.Forward, string datapointsPerSend = "", string maxDatapoints = "") { string sRequest = GetRequestTickDatapoints(symbol, direction, datapointsPerSend, maxDatapoints); GetData(sRequest); }
public void HistoryFuturesIntervalTimeframe(string rootSymbol, HistoryIntervalType itype, HistoryInterval interval, string beginDateTime = null, string endDateTime = null, HistoryDataDirection direction = HistoryDataDirection.Forward, string datapointsPerSend = "", string maxDatapoints = "", string beginFilterTime = "", string endFilterTime = "") { m_filename = Folders.df_path(GFile.GetDfFuturesFilename(rootSymbol, (int)interval)); m_outfile = null; int addMonthsToEnd = 6; beginDateTime = beginDateTime ?? EARLIEST_DATE; endDateTime = endDateTime ?? DateTime.Now.AddMonths(addMonthsToEnd).ToString("yyyyMMdd"); var mcList = GetMonthCodeList(beginDateTime, endDateTime); string sInterval = ((int)interval).ToString(); foreach (var mYY in mcList) { m_symbol = rootSymbol + mYY; // use mYY and the mYY from 6 months prior to calculate a begin and end date for contract historical data string mYYplus1 = AddMonths(mYY, 1); string mYYminus6 = AddMonths(mYY, -6); string dt1 = GetDateTimeMYY(mYYminus6).ToYYYYMMDD(); string dt2 = GetDateTimeMYY(mYYplus1).ToYYYYMMDD(); HistoryIntervalTimeframe(m_symbol, itype, sInterval, dt1, dt2, direction, datapointsPerSend, maxDatapoints, beginFilterTime, endFilterTime); } if (m_outfile != null) { m_outfile.Close(); Console.WriteLine("\nOutput to file: {0}\n", m_filename); } }
public void HistoryContractIntervalTimeframe(string symbol, HistoryIntervalType itype, HistoryInterval interval, string beginDateTime = null, string endDateTime = null, HistoryDataDirection direction = HistoryDataDirection.Forward, string datapointsPerSend = "", string maxDatapoints = "", string beginFilterTime = "", string endFilterTime = "") { m_filename = Folders.df_path(GFile.GetDfContractFilename(symbol, (int)interval)); m_outfile = null; beginDateTime = beginDateTime ?? EARLIEST_DATE; endDateTime = endDateTime ?? DateTime.Now.AddMonths(1).ToString("yyyyMMdd"); string sInterval = ((int)interval).ToString(); m_symbol = symbol; HistoryIntervalTimeframe(m_symbol, itype, sInterval, beginDateTime, endDateTime, direction, datapointsPerSend, maxDatapoints, beginFilterTime, endFilterTime); if (m_outfile != null) { m_outfile.Close(); Console.WriteLine("\nOutput to file: {0}\n", m_filename); } }