softwarespartan / IB4m

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

Connect to IB TWS from multiple instance of matlab #3

Closed manishranjan99 closed 8 years ago

manishranjan99 commented 8 years ago

Hi Abel,

Thank you again for your great work! I have run into issue where I can not connect the IB4m through multiple instances of Matlab. For example, if I have a function in batch mode that is trying to connect while it is already connected to another function. You can test it by opening two matlabs and try to connect through each. Once it is connected to one, if throws java.eof.exception error into other.

Would you recommend a workaround for this? Always appreciate any help I can get on this.

Kind Regards, Manish

softwarespartan commented 8 years ago

Hi Manish,

Great to hear from you.

Off the top of my head, you'll want to make sure that the CLIENTID in the session.eConnect call are unique. Typically, in matlab just use client id of "0", so you want to increment that Id for each matlab instance.

See link: https://www.interactivebrokers.com/en/software/api/apiguide/java/econnect.htm

I'll look into this more tonight or tomorrow morning when I'm back at my computer.

Cheers -abel

Sent from my iPhone

On Mar 18, 2016, at 4:26 PM, manishranjan99 notifications@github.com wrote:

Hi Abel,

Thank you again for your great work! I have run into issue where I can not connect the IB4m through multiple instances of Matlab. For example, if I have a function in batch mode that is trying to connect while it is already connected to another function. You can test it by opening two matlabs and try to connect through each. Once it is connected to one, if throws java.eof.exception error into other.

Would you recommend a workaround for this? Always appreciate any help I can get on this.

Kind Regards, Manish

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub

softwarespartan commented 8 years ago

Hi Manish

I confirmed with multiple instances of matlab that as long as the CLIENT_ID is different for each matlab instance there does not appear to be any issues with multiple TWS connections.

Don’t hesitate to follow up if for some reason it’s still not working on your end with unique client id’s. I’m happy to look into it some more.

Cheers -abel

On Mar 18, 2016, at 4:26 PM, manishranjan99 notifications@github.com wrote:

Hi Abel,

Thank you again for your great work! I have run into issue where I can not connect the IB4m through multiple instances of Matlab. For example, if I have a function in batch mode that is trying to connect while it is already connected to another function. You can test it by opening two matlabs and try to connect through each. Once it is connected to one, if throws java.eof.exception error into other.

Would you recommend a workaround for this? Always appreciate any help I can get on this.

Kind Regards, Manish

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/softwarespartan/IB4m/issues/3

manishranjan99 commented 8 years ago

Hi Abel,

It does work with different client ID. Thank you so much you for your help again.

Kind Regards, Manish

manishranjan99 commented 8 years ago

Hi Abel,

I appreciate your help. If you don't mind me asking, are you a matlab IB algo trader? I am still a newbie, working on a small gui based trading routine in matlab and wondering if you have any experience in this. .

Manish

On Sat, Mar 19, 2016 at 3:46 PM, Abel Brown notifications@github.com wrote:

Hi Manish

I confirmed with multiple instances of matlab that as long as the CLIENT_ID is different for each matlab instance there does not appear to be any issues with multiple TWS connections.

Don’t hesitate to follow up if for some reason it’s still not working on your end with unique client id’s. I’m happy to look into it some more.

Cheers -abel

On Mar 18, 2016, at 4:26 PM, manishranjan99 notifications@github.com wrote:

Hi Abel,

Thank you again for your great work! I have run into issue where I can not connect the IB4m through multiple instances of Matlab. For example, if I have a function in batch mode that is trying to connect while it is already connected to another function. You can test it by opening two matlabs and try to connect through each. Once it is connected to one, if throws java.eof.exception error into other.

Would you recommend a workaround for this? Always appreciate any help I can get on this.

Kind Regards, Manish

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub < https://github.com/softwarespartan/IB4m/issues/3>

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/softwarespartan/IB4m/issues/3#issuecomment-198802682

softwarespartan commented 8 years ago

Hi Manish

I have a lot of matlab experience both as a trader and scientist.

What can I help you with?

Cheers -abel

On Mar 22, 2016, at 7:45 PM, manishranjan99 notifications@github.com wrote:

Hi Abel,

I appreciate your help. If you don't mind me asking, are you a matlab IB algo trader? I am still a newbie, working on a small gui based trading routine in matlab and wondering if you have any experience in this. .

Manish

On Sat, Mar 19, 2016 at 3:46 PM, Abel Brown <notifications@github.com mailto:notifications@github.com> wrote:

Hi Manish

I confirmed with multiple instances of matlab that as long as the CLIENT_ID is different for each matlab instance there does not appear to be any issues with multiple TWS connections.

Don’t hesitate to follow up if for some reason it’s still not working on your end with unique client id’s. I’m happy to look into it some more.

Cheers -abel

On Mar 18, 2016, at 4:26 PM, manishranjan99 <notifications@github.com mailto:notifications@github.com> wrote:

Hi Abel,

Thank you again for your great work! I have run into issue where I can not connect the IB4m through multiple instances of Matlab. For example, if I have a function in batch mode that is trying to connect while it is already connected to another function. You can test it by opening two matlabs and try to connect through each. Once it is connected to one, if throws java.eof.exception error into other.

Would you recommend a workaround for this? Always appreciate any help I can get on this.

Kind Regards, Manish

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub < https://github.com/softwarespartan/IB4m/issues/3 https://github.com/softwarespartan/IB4m/issues/3>

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub <https://github.com/softwarespartan/IB4m/issues/3#issuecomment-198802682 https://github.com/softwarespartan/IB4m/issues/3#issuecomment-198802682>

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/softwarespartan/IB4m/issues/3#issuecomment-200081917

softwarespartan commented 8 years ago

Hi Manish

Sounds like many of the typical growing pains of getting going in algo trading.

I went through similar experiences in the beginning.

There are a lot of great books out there. I got started with books by Ernie Chan and Jack Schwager (Market Wizards!!).

Most important is to find your own groove. Develop strategy that resonates with your personality and tolerance levels for risk/reward.

Backtesting is really important. Don’t skimp on backtesting! I’v coded up some strategies that look great on paper but fall flat as a real algorithm.

Go slow and focus on building good “sea legs” and your intuition for the market.

I don’t have a blog … but maybe I’ll start one :)

Cheers -abel

On Mar 23, 2016, at 5:55 PM, manishranjan99 notifications@github.com wrote:

Hi Abel,

How is your overall experience trading with matlab-IB? Are there lot of retail traders using it? What were some of the challenges you faced during trading with matlab-IB? Is there any disadvantage of using matlab-IB? Do you use a fully automated trading with matlab-IB interface or semiautomated? I am working on a matlab ui based system which I hope can make it fully automated one day. It uses historic data from IB, reqrealtime 5s bars from IB for trading. At this point I haven't fully implemented the who thing but I have some crude setup for paper trading. I am still implementing checks and double checks to foolproof my system but it is still very crude at this stage. I have a few technical indicator based trading strategy in mind and few options combo based but I haven't done much of back testing as yet. What kind of strategy would you recommend? Do you have any blogs? Sorry for asking too many questions. Please take your time to answer it.

Regards, Manish

On Tue, Mar 22, 2016 at 7:22 PM, Abel Brown <notifications@github.com mailto:notifications@github.com> wrote:

Hi Manish

I have a lot of matlab experience both as a trader and scientist.

What can I help you with?

Cheers -abel

On Mar 22, 2016, at 7:45 PM, manishranjan99 <notifications@github.com mailto:notifications@github.com> wrote:

Hi Abel,

I appreciate your help. If you don't mind me asking, are you a matlab IB algo trader? I am still a newbie, working on a small gui based trading routine in matlab and wondering if you have any experience in this. .

Manish

On Sat, Mar 19, 2016 at 3:46 PM, Abel Brown <notifications@github.com mailto:notifications@github.com <mailto:notifications@github.com mailto:notifications@github.com>> wrote:

Hi Manish

I confirmed with multiple instances of matlab that as long as the CLIENT_ID is different for each matlab instance there does not appear to be any issues with multiple TWS connections.

Don’t hesitate to follow up if for some reason it’s still not working on your end with unique client id’s. I’m happy to look into it some more.

Cheers -abel

On Mar 18, 2016, at 4:26 PM, manishranjan99 < notifications@github.com mailto:notifications@github.com <mailto:notifications@github.com mailto:notifications@github.com>> wrote:

Hi Abel,

Thank you again for your great work! I have run into issue where I can not connect the IB4m through multiple instances of Matlab. For example, if I have a function in batch mode that is trying to connect while it is already connected to another function. You can test it by opening two matlabs and try to connect through each. Once it is connected to one, if throws java.eof.exception error into other.

Would you recommend a workaround for this? Always appreciate any help I can get on this.

Kind Regards, Manish

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub < https://github.com/softwarespartan/IB4m/issues/3 https://github.com/softwarespartan/IB4m/issues/3 < https://github.com/softwarespartan/IB4m/issues/3 https://github.com/softwarespartan/IB4m/issues/3>>

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub < https://github.com/softwarespartan/IB4m/issues/3#issuecomment-198802682 https://github.com/softwarespartan/IB4m/issues/3#issuecomment-198802682 < https://github.com/softwarespartan/IB4m/issues/3#issuecomment-198802682 https://github.com/softwarespartan/IB4m/issues/3#issuecomment-198802682>>

— You are receiving this because you commented. Reply to this email directly or view it on GitHub < https://github.com/softwarespartan/IB4m/issues/3#issuecomment-200081917 https://github.com/softwarespartan/IB4m/issues/3#issuecomment-200081917>

— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub <https://github.com/softwarespartan/IB4m/issues/3#issuecomment-200134886 https://github.com/softwarespartan/IB4m/issues/3#issuecomment-200134886>

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/softwarespartan/IB4m/issues/3#issuecomment-200559111