Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect to IB TWS from multiple instance of matlab #3

Closed
manishranjan99 opened this issue Mar 18, 2016 · 6 comments
Closed

Connect to IB TWS from multiple instance of matlab #3

manishranjan99 opened this issue Mar 18, 2016 · 6 comments

Comments

@manishranjan99
Copy link

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
Copy link
Owner

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
Copy link
Owner

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 #3

@manishranjan99
Copy link
Author

Hi Abel,

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

Kind Regards,
Manish

@manishranjan99
Copy link
Author

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
#3 (comment)

@softwarespartan
Copy link
Owner

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 <
#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
<#3 (comment) #3 (comment)>


You are receiving this because you commented.
Reply to this email directly or view it on GitHub #3 (comment)

@softwarespartan
Copy link
Owner

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 <
#3 #3 <
#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
<
#3 (comment) #3 (comment) <
#3 (comment) 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 <
#3 (comment) 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
<#3 (comment) #3 (comment)>


You are receiving this because you commented.
Reply to this email directly or view it on GitHub #3 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants