☰
Login
Signup
Home
›
General
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Register
Categories
Recent Discussions
Activity
Categories
14.8K
All Categories
0
Incidents
173
Node JS client
49
Go client
828
.Net API client
394
Kite Publisher
553
.Net / VBA / Excel (3rd party)
487
Algorithms and Strategies
1.1K
Java client
1.2K
API clients
408
PHP client
4.3K
Python client
357
Mobile and Desktop apps
1.5K
Market data (WebSockets)
3.5K
General
In this Discussion
3:08AM
salim_chisty
GetHistoricalData for Sensex options throws invalid from date error
kmuralidaran
1:55AM
in
General
DateTime tradingDay = DateTime.Today;
while (tradingDay.DayOfWeek == DayOfWeek.Saturday || tradingDay.DayOfWeek == DayOfWeek.Sunday)
{
tradingDay = tradingDay.AddDays(-1);
}
// Step 5: Set market open/close
var marketOpen = new DateTime(tradingDay.Year, tradingDay.Month, tradingDay.Day, 9, 15, 0, DateTimeKind.Utc);
var marketClose = new DateTime(tradingDay.Year, tradingDay.Month, tradingDay.Day, 15, 30, 0, DateTimeKind.Utc);
var toTime = DateTime.Now > marketClose ? marketClose : DateTime.Now;
var quote = kite.GetQuote(["408065"]);
// Step 6: Fetch historical data
var historicalData = kite.GetHistoricalData(
optionInstrument.InstrumentToken.ToString(),
marketOpen,
marketClose,
Constants.INTERVAL_MINUTE, // interval
false, // continuous for options/futures
false // extended hours
);
KiteConnect.InputException: invalid from date
at KiteConnect.Kite.Request(String Route, String Method, Object Params, Dictionary`2 QueryParams, Boolean json)
at KiteConnect.Kite.Get(String Route, Dictionary`2 Params, Dictionary`2 QueryParams)
at KiteConnect.Kite.GetHistoricalData(String InstrumentToken, DateTime FromDate, DateTime ToDate, String Interval, Boolean Continuous, Boolean OI)
at SensexOptionFetcher.GetNearestSensexOptionData(Decimal strike, String type) in H:\ZerodhaAutomation\SensexOptionsFetcher.cs:line 60
at ZerodhaAutomation.MainForm.btnDownloadHistory_Click(Object sender, EventArgs e) in H:\ZerodhaAutomation\MainForm.cs:line 457
Tagged:
getHistoricalData
salim_chisty
3:08AM
You may refer to the similar discussion
here
.
Sign In
or
Register
to comment.