static void GetDayRange() { double high, low; DateTime Today = DateTime.Now; List <KC.Historical> historical = Kite.GetHistoricalData( InstrumentToken: "5633", FromDate: new DateTime(Today.Year, Today.Month, Today.Day, 9, 0, 0), ToDate: new DateTime(Today.Year, Today.Month, Today.Day, 13, 30, 0), Interval: KC.Constants.INTERVAL_30MINUTE, Continuous: false ); }
public IEnumerable <Candle> GetData(Symbol symbol, string period, DateTime fromDate, DateTime toDate, bool isContinous = false, bool isDevelopment = false) { int isRetryCount = 5; while (isRetryCount > 0) { try { List <Historical> historical = _kite.GetHistoricalData( InstrumentToken: symbol.InstrumentToken, FromDate: fromDate, ToDate: toDate, Interval: period, Continuous: isContinous ); if (historical != null && historical.Count > 0) { var candles = new List <Candle>(); for (int i = 0; i < historical.Count; i++) { candles.Add(new Candle(Convert.ToDateTime(historical[i].TimeStamp), historical[i].Open, historical[i].High, historical[i].Low, historical[i].Close, historical[i].Volume)); } return(candles); } isRetryCount -= 1; } catch (Exception ex) { isRetryCount -= 1; Thread.Sleep(100); //if(!isDevelopment) // ApplicationLogger.LogException("Exception Occured in GetData() for Sybmol : " + JsonConvert.SerializeObject(symbol) + Environment.NewLine + // "FromDate : " + fromDate.ToString() + Environment.NewLine + // "ToDate : " + toDate.ToString() + Environment.NewLine + // "Exception : " + JsonConvert.SerializeObject(ex)); } } return(null); }