Author |
Topic: RequestBars not working (7 messages, Page 1 of 1) |
||||
---|---|---|---|---|---|
Moderators: VPfau | |||||
DClark1295 Posts: 15 Joined: Jan 16, 2014 |
I used the code from the URL at [1] and other places on OpenECry but I can not get historical market data to show up. The event for oecapi_OnBarsReceived is called but the bars object is empty.
I've tried the code below with DateTime.UtcNow for both values , and it still doesnt work. oecapi.RequestBars(contract, OEC.API.Duration.Date( DateTime.Now.AddDays(-6), DateTime.Now), OEC.API.BarDescription.HoursMinutes(5)); [1] http://www.openecry.com/api/api/html/4e2865e8-7ac9-457e-8d5a-6d930f3408a8.htm Daniel Clark |
||||
VictorV Posts: 746 Joined: May 08, 2007 |
What username and contract did you use?
Victor Vins Lead Software Developer |
||||
DClark1295 Posts: 15 Joined: Jan 16, 2014 |
Victor,
I can get historical bars if I change the interval to 15 instead of 5. Any idea why this doesnt work for 5 min bars ? static void oecapi_OnLoginComplete() { OEC.API.Contract someES = oecapi.BaseContracts["ES"].Contracts.First; if (someES != null) DisplayContract(someES); OEC.API.Contract ESU2 = oecapi.Contracts["ESH4"]; if (ESU2 != null) DisplayContract(ESU2); EsSymbolLookupRequest = oecapi.SymbolLookup("ESH4"); } Daniel Clark |
||||
VictorV Posts: 746 Joined: May 08, 2007 |
Can you reproduce it in OEC Sample or OEC Trader?
Victor Vins Lead Software Developer |
||||
DClark1295 Posts: 15 Joined: Jan 16, 2014 |
I will try the OEC Sample. I dont have OEC Trader.
I use the username in my posts Daniel Clark |
||||
CWeber984 Posts: 226 Joined: Apr 24, 2012 |
I noticed that this user is using:
(DateTime.Now.AddDays(-6), DateTime.Now) Should that not be DateTime.UtcNow.AddDays(-6), DateTime.UtcNow)? Source is the same as user indicated. CHW |
||||
DClark1295 Posts: 15 Joined: Jan 16, 2014 |
I actually used DateTime.UtcNow.AddDays(-6), DateTime.UtcNow) when I was testing and it only worked sometimes. I've been using that for the last 2 weeks and I only get bars if I switch the interval and restart the program to request new bars.
I'm not sure why its this buggy. I really love the API but I dont think its my code when its working sometimes but not others. Daniel Clark |
||||