Author |
Topic: RequestBars sometimes works, sometimes does'nt (12 messages, Page 1 of 1) |
||||
---|---|---|---|---|---|
Moderators: VPfau | |||||
CZendejas116 Posts: 51 Joined: Apr 13, 2011 |
Hi,
I'm trying to obtain the Settlement price for some contracts, this contracts belongs to the same base symbol (CC-M, the futures). In order to do this I'm requesting the bars, just because this request fills the CurrentPrice field in Contract object (well, first I subscribe the contracts), and into this field (which its type is Price) I can get the settlement price. The problem is I don't always get all the bars, I mean, not all the executions of my program run OnBarsReceived method, sometimes yes, sometimes not. When I don't get all the executions of OnBarsReceived, varies which contracts have their bars, not always fail same contracts. What am I missing? Is there another way to obtain the CurrentPrice? Thanks in advance Claudia Zendejas |
||||
VictorV Posts: 746 Joined: May 08, 2007 |
Hello,
you don't need to request bars to obtain CurrentPrice. All what you need for it is just to subscribe for quotes http://www.openecry.com/api/api/html/M_OEC_API_OECClient_Subscribe.htm Missed OnBarsReceived can be related to a error message that you mentioned in previous topic ("Your loading limit of 16 has been reached") - the bar request is ignored after reaching the limit Victor Vins Lead Software Developer |
||||
CZendejas116 Posts: 51 Joined: Apr 13, 2011 |
Hi,
I manage that limit of 16 requests, just like RuslanK suggested, so I don't have that message any more, and sometimes I get all the bars, and there's no problem. Actually CC-M future contracts are only 12, so I never reach that limit of 16. But I dont get bars for all that contracts all the time. Previously I was just subscribing and waiting for OnPriceTick event, but, some contracts doesn't fire that event, just because they have no ticks in that particular moment when I execute my program, so, CurrentPrice never get updated and remains as null. I have observed, that the CurrentPrice is not null anymore until the first OnPriceTicks event is fired. That's why I change my logic and I use OnBarsReceived, but, sometimes I get bars for all that 12 contracts, but sometime I don't. Claudia Zendejas |
||||
VictorV Posts: 746 Joined: May 08, 2007 |
OEC Trader populates Quotes window on OnPriceChanged event: this event is raised by initial setting of CurrentPrice. You can try to use this event too.
Please send me username and exact time of the issue when you requested bars and didn't receive a response. Victor Vins Lead Software Developer |
||||
CZendejas116 Posts: 51 Joined: Apr 13, 2011 |
Hi,
OnPriceChanged works, I can read CurrentPrice field, but, if market is closed, this info from CurrentPrice is updated anyway? I mean, does it have the last settlement price? or the last price? On the other hand, all RequestBars for all contracts don't fire all OnBarsReceived, for example in this execution: I make RequestBars for all CC-M futures: CC-MK3 And just some of them fired OnBarsReceived. OEC log is: 15:39:54.018 Dbg System #11 Logger level: Core (Data feed: every 1 per 00:01:00) I ran this with: username: AAlonso Thanks in advance. Claudia Zendejas |
||||
VictorV Posts: 746 Joined: May 08, 2007 |
OECAPI logs a message for bar packages that have length more than 10 bars to prevent flood of messages. Missed log messages were related to contracts that have no bars at all or less than 10. Sorry for confusion.
Victor Vins Lead Software Developer Edited by VictorV on Apr 5, 2013 at 11:50:17 |
||||
CZendejas116 Posts: 51 Joined: Apr 13, 2011 |
Ok, I just think this was a good idea to show how not all OnBarsReceived events are fired. Anyway, I can see that not all the events are fired because I show lastPrice and other things just inside OnBarsReceived event, and not all of them are shown. There are only 12 contracts, I'm sure that not everyone fired the event.
The weird thing is, that sometimes all events are fired, so I have info from all 12 contracts, but sometimes doesn't, and I have info from some contracts (which and how varied) On the other hand I have a question: OnPriceChanged works, I can read CurrentPrice field, but, if market is closed, this info from CurrentPrice is updated anyway? I mean, does it have the last settlement price? or the last price? Thanks in advance Claudia Zendejas |
||||
VictorV Posts: 746 Joined: May 08, 2007 |
Are you sure your OnBarsReceived is not fired with less than 10 bars? The log snapshot from OECAPI is just a log issue, not an issue with events.
OnPriceChanged will be raised even market is closed. CurrentPrice will contain the latest known state, including the last and settlement price. Victor Vins Lead Software Developer |
||||
CZendejas116 Posts: 51 Joined: Apr 13, 2011 |
I'm sure OnBarsReceived is not fired with any bars, as I said before, I just thought that showing OECAPI log was a good idea, but not, I'm sorry.
I have my own logs and also, I use OnBarsReceived event to show info into a windows form, and sometimes shows info from all contracts, and sometimes don't, and only are 12. And of course I update info in windows form asynchronously. Now, that I know, thanks to you, OnPriceChanged works for my purposes, that's what I will use, but anyway, why RequestBars/OnBarsReceived doesn't work as expected? Regards Claudia Zendejas |
||||
VictorV Posts: 746 Joined: May 08, 2007 |
Our sample application loads daily bars of all CC-M contracts as expected. Could you please build a sample application to reproduce the issue?
Victor Vins Lead Software Developer |
||||
CZendejas116 Posts: 51 Joined: Apr 13, 2011 |
will be to send it to you?
Claudia Zendejas |
||||
VictorV Posts: 746 Joined: May 08, 2007 |
Yes, this is ok
Victor Vins Lead Software Developer |
||||