softwarespartan / IB4m

Interactive Brokers API for Matlab
GNU General Public License v2.0
62 stars 21 forks source link

9.72 or 9.73 #22

Closed ciaoitaly closed 5 years ago

ciaoitaly commented 6 years ago

Hi I am about to install IB4M with API. SHould I install 9.72 or 9.73?

Thanks

softwarespartan commented 6 years ago

you’ll want 9.72

-abel

On Mar 15, 2018, at 1:47 PM, ciaoitaly notifications@github.com wrote:

Hi I am about to install IB4M with API. SHould I install 9.72 or 9.73?

Thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/softwarespartan/IB4m/issues/22, or mute the thread https://github.com/notifications/unsubscribe-auth/AEWq1OhhJrEeQZPLL0diYpUq61Ca2Afwks5teqk_gaJpZM4SsmoK.

ciaoitaly commented 6 years ago

Abel,

The problem is that I need to use reqHistoricalData function with newer field "keepUpToDate" that is only available since API 9.73.

If I use 9.73, your code wont work?

Thanks so much for your help

softwarespartan commented 6 years ago

The 9.72 API comes with IB4m

Will work with any version of TWS.

There are a few good reasons to stay on 9.72 for matlab.

Sent from my iPhone

On Mar 15, 2018, at 2:12 PM, ciaoitaly notifications@github.com wrote:

Abel,

The problem is that I need to use reqHistoricalData function with newer field "keepUpToDate" that is only available since API 9.73.

If I use 9.73, your code wont work?

Thanks so much for your help

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

ciaoitaly commented 6 years ago

Thanks Abel, I am currently using latest TWS, IB API 9.73 and IB4m. I am running this code from your example and try to query reqHistoricalData by adding a field before [] for "keepUpToDate". I get this error: Undefined function or variable 'True'.

Error in testt (line 22) session.eClientSocket.reqHistoricalData(1000001,contract,datestr(now(),'yyyymmdd HH:MM:SS'),'1000 S','1 min','TRADES',0,1,True,[]);

Any idea why this is not working ??

Thanks so much

% initialize session with TWS session = TWS.Session.getInstance();

% create local buffer for historical data events [buf,lh] = TWS.initBufferForEvent(TWS.Events.HISTORICALDATA);

% connect to TWS session.eClientSocket.eConnect('127.0.0.1',7496,0);

% create an empty stock contract contract = com.ib.client.Contract(); contract.m_secType = 'FUT' ; contract.m_exchange = 'NYMEX'; contract.m_currency = 'USD' ; contract.m_localSymbol='CLK8';

% request historical data for our contract for a year w/ 1-day bars session.eClientSocket.reqHistoricalData(1000001,contract,datestr(now(),'yyyymmdd HH:MM:SS'),'1000 S','1 min','TRADES',0,1,True,[]);

ciaoitaly commented 6 years ago

I guess I didnt realize that I didnt need to download IB API as it comes with IB4m. And as you are based on 9.72, this would explain why the above request doesn't work.

ciaoitaly commented 6 years ago

Do you have any plan to be able to support the newly functions of 9.73 API any time soon? Thanks

softwarespartan commented 6 years ago

What does keepUptodate do?

Likely easy to replicate in 9.72 ...

Sent from my iPhone

On Mar 15, 2018, at 3:58 PM, ciaoitaly notifications@github.com wrote:

Do you have any plan to be able to support the newly functions of 9.73 API any time soon? Thanks

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

ciaoitaly commented 6 years ago

keepUpToDate, Whether a subscription is made to return updates of unfinished real time bars as they are available (True), or all data is returned on a one-time basis (False). Available starting with API v973.03+ and TWS v965+. If True, and endDateTime cannot be specified.

ciaoitaly commented 6 years ago

so when you request historical bars, the latest bar will not be done based on the latest data 5 sec ago, but on the latest data in real time

softwarespartan commented 6 years ago

What is the update frequency?

You can get 5 sec bars continuous with 9.72 api using

reqRealTimeBars

Or just make market data subscriptions for real-time bars (IB real-time is like 100 - 200 millisecond)

Does any of that work for you?

Sent from my iPhone

On Mar 15, 2018, at 4:39 PM, ciaoitaly notifications@github.com wrote:

keepUpToDate, Whether a subscription is made to return updates of unfinished real time bars as they are available (True), or all data is returned on a one-time basis (False). Available starting with API v973.03+ and TWS v965+. If True, and endDateTime cannot be specified.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

ciaoitaly commented 6 years ago

yes 5 seconds, I just don't know how to query that function.

Currently if i query historical data 10 minutes bar, I get the complete 950am and the newly formed 10am bar at 10:00:05. There is a 5 sec delay for the new bar to print and old bar to complete. To improve this, I would query reqrealtimebar at 10am, so that i could have by 10:00:01 the complete 950am bar.

On Thu, Mar 15, 2018 at 4:43 PM, Abel Brown notifications@github.com wrote:

What is the update frequency?

You can get 5 sec bars continuous with 9.72 api using

reqRealTimeBars

Or just make market data subscriptions for real-time bars (IB real-time is like 100 - 200 millisecond)

Does any of that work for you?

Sent from my iPhone

On Mar 15, 2018, at 4:39 PM, ciaoitaly notifications@github.com wrote:

keepUpToDate, Whether a subscription is made to return updates of unfinished real time bars as they are available (True), or all data is returned on a one-time basis (False). Available starting with API v973.03+ and TWS v965+. If True, and endDateTime cannot be specified.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/softwarespartan/IB4m/issues/22#issuecomment-373516613, or mute the thread https://github.com/notifications/unsubscribe-auth/Ajrjvfre6ONJK-zXNaUdzr15eO7ELeQCks5tetJ9gaJpZM4SsmoK .

ciaoitaly commented 6 years ago

when I do that request session.eClientSocket.reqRealTimeBars(reqId,contract,'5','TRADES',0); pause(1);

I get this error: No method 'reqRealTimeBars' with matching signature found for class 'com.ib.client.EClientSocket'.

do you know why is that ?

ciaoitaly commented 6 years ago

was able to fix it with 5 instead of '5'.

softwarespartan commented 6 years ago

yes, that’s right

Don’t forget to setup listener to process realtime bar events. Something like …

this.rtblh = event.listener( ... TWS.Events.getInstance ,... TWS.Events.REALTIMEBAR ,... @(s,e)this.processRealtimeBar(e.event) ... );

On Mar 16, 2018, at 11:24 AM, ciaoitaly notifications@github.com wrote:

was able to fix it with 5 instead of '5'.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/softwarespartan/IB4m/issues/22#issuecomment-373747758, or mute the thread https://github.com/notifications/unsubscribe-auth/AEWq1DsJgkK7y7iQQ-v3SGjpPpiF-iFvks5te9kTgaJpZM4SsmoK.

softwarespartan commented 5 years ago

Updates for API ver 9.73 have been pushed to HEAD. Let me know if you need anything additional.