API Support Forum
OEC API > API Support > Data request from OEC
Author Topic: Data request from OEC
(7 messages, Page 1 of 1)
Moderators: VPfau
SSprikut637
Posts: 12
Joined: Apr 04, 2011


Posted: Jul 22, 2012 @ 07:44 AM             Msg. 1 of 7
Hello! I'm posting this question on behalf of my developer. We need to request 30 bars of data to calculate custom trend function. Data could be time bars, tick bars, Range bars or momentum bars. My developer is saying he can only request certain amount of time and not quantity of bars. Please, help us out to resolve this. Please, be specific in your response. Thank you very much

Attached is the info from developer:

"We are using OEC API Version 3.5.0.0 for C# Application
We are subscribing to bars by following OEC methods:

oec.SubscribeBars(oec.Contracts[Contract], datetime, barType, interval); for barType (SubscriptionType)=Bar,Tick
and
oec.SubscribeBars(oec.Contracts[Contract], datetime , barType, interval); for barType (SubscriptionType)= RangeBar and MomentumBar

where Contract="ESU2"
Datetime= Past date of about 120 hours back
barType=Bar,Tick,RangeBar and MomentumBar
interval=1,2,3,4.....

My Question is: How can I get a list of exactly 30 bars.? Because giving Starting date 120 hours back gives me unnecessary very old historic data which I don't need anyway for my calculations. I want only desired number of bars from my subscription of each type."

Sergey Sprikut
RuslanK
Posts: 69
Joined: Jun 02, 2010


Posted: Jul 23, 2012 @ 08:04 AM             Msg. 2 of 7
Hello

This version of SubscribeBars method allows to load exact amount of bars:

public Subscription SubscribeBars(
Contract contract,
Int32 Amount, //Here is the parameter your developer looking for
SubscriptionType Type,
Int32 Interval,
Boolean IgnoreSessionBoundaries
);

This and all other methods always can be found in our online API documentation available at http://www.openecry.com/api/api/index.html

Ruslan Kartokhin
Software Developer
SSprikut637
Posts: 12
Joined: Apr 04, 2011


Posted: Jul 23, 2012 @ 12:55 PM             Msg. 3 of 7
Hi, Ruslan!
Thank you very much for your prompt response.

Couple of questions:
-What’s the latest version of API?
-URL to download the latest API?

According to my developer:
“as per their documentation they are showing 4 overload of same method but in my API I have only 3 overloads”

Can you please let me know where the problem might be?

Again, big SPACIBO.

Sorry for any confusion on this.

Regards,
-Sergey Sprikut

Sergey Sprikut
SSprikut637
Posts: 12
Joined: Apr 04, 2011


Posted: Jul 23, 2012 @ 12:55 PM             Msg. 4 of 7
Hi, Ruslan!
Thank you very much for your prompt response.

Couple of questions:
-What’s the latest version of API?
-URL to download the latest API?

According to my developer:
“as per their documentation they are showing 4 overload of same method but in my API I have only 3 overloads”

Can you please let me know where the problem might be?

Again, big SPACIBO.

Sorry for any confusion on this.

Regards,
-Sergey Sprikut

Sergey Sprikut
SSprikut637
Posts: 12
Joined: Apr 04, 2011


Posted: Jul 23, 2012 @ 01:01 PM             Msg. 5 of 7
Ruslan, this is exact verbage from the developer:

I have downloaded sample application from this link:
http://www.openecry.com/trading/api/documentation.cfm

This sample app is using the same API version 3.5.0.0(which I am using in my application) and this version does not contains the method:

public Subscription SubscribeBars(
Contract contract,
Int32 Amount, //Here is the parameter your developer looking for
SubscriptionType Type,
Int32 Interval,
Boolean IgnoreSessionBoundaries
);

Can you please provide me the link where I can get the latest API containing the above mentioned method..?

THANK YOU VERY MUCH

Sergey Sprikut
RuslanK
Posts: 69
Joined: Jun 02, 2010


Posted: Jul 23, 2012 @ 02:04 PM             Msg. 6 of 7
Seems like method was not marked to be visible in editor and object browser.

Please re-download API from the same location - this should be fixed now.

Ruslan Kartokhin
Software Developer
SSprikut637
Posts: 12
Joined: Apr 04, 2011


Posted: Aug 01, 2012 @ 12:42 PM             Msg. 7 of 7
Hello, Ruslan! You've kindly addressed my previous question. My developer asked me to post another clarification pertaining to Momentum Bar calculations. Here is his question:
========
am subscribing to momentum Bar via method :
Subscription s = oec.SubscribeBars(oec.Contracts[Contract], 30, barType, interval, false);
where,
Contract="ESM2"
barType="MomentumBar"
interval=4


I get 30 Bars in count with last Bar for e.g like.:


like Open =1331, high=1331,low=1330,close=1330 for 4 ticks (after 30 bars, I start getting bars each fraction of second)
then the next Bar should be
1. Open=1329.75 as Last close was with Low Price
2. Difference between High and Low should be 4 ticks
for e.g. High=1332 and low=1331
3. And Close= either 1332 or 1331
Then I wait for the next Bar.Let the last close was 1332 i.e at High Price
Then I wait for the Bar whose:
1. Open Price should be 1332.25
2. Diff B/w High and low shoukd be 4 ticks
3. And Close Price should be either equal to High Price or Low Price
But what happens here:
Since I was waiting for the Bar whose Open should be 1332.25 , It does not go with my expectation and new Bar start coming like this:
Open=1332 High=1332.25 Low=1331.25 close=1331.25
then next Bar
Open=1331.75 High=1331.75 low=1330.75 Close=1330.75
then Next Bar
Open=1330.75 High=1331.50 low=1330.50 Close=1330.50
and so On
Remember we were expecting for the new Bar with open Price =1332.25
but its reversse happened, instead of getting Bars with Open Price moving upward like 1332.25 I start getting Bars with Open Price moving downward like 1332,1331.75,1330.75
And This is the point where we Stop getting the expected Bar while momentum Bar is building on the platform (Tradestation) chart successfully while we are stuck in the application waiting for the expected Valid Bar.
Can you please help me on how to handle such data for Momentum Bar in my application or Is there any other way of getting the Valid Bars likewise we are getting in the Tradestation..???
===========

Sergey Sprikut