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 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); }
/// <summary> /// Update / create a bar watch using the information in the form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void SubscribeBars(string symbol, HistoryIntervalType intervalType, int intervalValue, int numberOfDaysBack = 1, string beginFilterTime = "", string endFilterTime = "", DateTime?beginDateTime = null) { string sBeginDateTime = "19700101000000"; // 1/1/1970 00:00:00 if (beginDateTime != null) { sBeginDateTime = beginDateTime.Value.ToIQString(); } // the command we need to send to turn on news is wSYMBOL\r\n string sCommand; sCommand = String.Format("BW,{0},{1},{2},{3},{4},{5},{6},{7},{8},,{9}\r\n", symbol, intervalValue, sBeginDateTime, numberOfDaysBack, this.MaxDatapointsToReceive, beginFilterTime, endFilterTime, this.RequestID, GetIntervalType(intervalType), this.UpdateIntervalInSeconds); SendRequestToIQFeed(sCommand); }
// 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); }
public static string GetIntervalType(HistoryIntervalType intervalType) { string result = "s"; if (intervalType == HistoryIntervalType.Tick) { result = "t"; } else if (intervalType == HistoryIntervalType.Volume) { result = "v"; } return(result); }
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); } }
// 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, 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 static string ToIntervalTypeString(this HistoryIntervalType itype) { return(GetIntervalType(itype)); }