psemdel / py-trading-bot

Trading-bot in python using django, vertorbt lib and interactive-brokers
MIT License
141 stars 34 forks source link

Request #8

Closed ben1628 closed 1 year ago

ben1628 commented 1 year ago

from Discord #Random

polakowo — Today at 9:54 AM If you know any simple way to call IB and fetch data, I can create a data instance for that process, I'm not familiar with IB tbh

May not be a bad idea to do something like this, would probably make more people aware your awesome project.

psemdel commented 1 year ago

Yes, I had the idea too to add a class in VBT. Actually my class IBData(RemoteData) in orders/models already use the right class from VBT. But IB does not use REST request but socker connection, which makes it from the start quite different from the other brokers out there. So I need a kwargs and give it an already created instance of myIB from ib_insync... In addition, in IB one tickers can lead to different products, which is not the way VBT normally works. So right now, it is not good enough to be merged in VBT. But basically, I use the same logic.

ben1628 commented 1 year ago

Ic. Thanks for providing more detail

psemdel commented 1 year ago

I still need to spend more effort on this point. It is feasible. I am reading again VBT code, and my "myIB" can be passed as client. I will give it a try when I find some time.

psemdel commented 1 year ago

For info, I am working on it.

psemdel commented 1 year ago

Hum, an issue is if I use the same logic as let's say TVData, it connects and disconnects for every downloaded symbol :(

edit: I opened an issue on VBT to find a solution.

ben1628 commented 1 year ago

Could we ask him to add an option like keepOpen=true

Sent from Outlook for iOShttps://aka.ms/o0ukef


From: psemdel @.> Sent: Saturday, December 31, 2022 12:34:16 PM To: psemdel/py-trading-bot @.> Cc: ben1628 @.>; State change @.> Subject: Re: [psemdel/py-trading-bot] Request (Issue #8)

Hum, an issue is if I use the same logic as let's say TVData, it connects and disconnects for every downloaded symbol :(

— Reply to this email directly, view it on GitHubhttps://github.com/psemdel/py-trading-bot/issues/8#issuecomment-1368256382, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHJERBTITZQFP27V4KE742TWQBVBRANCNFSM6AAAAAATKPY6ZI. You are receiving this because you modified the open/close state.Message ID: @.***>

psemdel commented 1 year ago

Ok, I created a branch here and a branch by vbt. I tested it yesterday and it works. It is quite a big change, but it is definitely a progress. We can wait for the merge from IB side to use it, otherwise, it is also possible to copy the code in the bot. Anyhow, I will beta test it, most probably there are still things to improve.

ben1628 commented 1 year ago

Wow that’s great I will take a look, looks like the next release is around the corner

Sent from Outlook for iOShttps://aka.ms/o0ukef


From: psemdel @.> Sent: Thursday, January 5, 2023 3:49:11 PM To: psemdel/py-trading-bot @.> Cc: ben1628 @.>; State change @.> Subject: Re: [psemdel/py-trading-bot] Request (Issue #8)

Ok, I created a branch here and a branch by vbt. I tested it yesterday and it works. It is quite a big change, but it is definitely a progress. We can wait for the merge from IB side to use it, otherwise, it is also possible to copy the code in the bot. Anyhow, I will beta test it, most probably there are still things to improve.

— Reply to this email directly, view it on GitHubhttps://github.com/psemdel/py-trading-bot/issues/8#issuecomment-1372729021, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHJERBWJ377J3ODUT72AMXLWQ4XUPANCNFSM6AAAAAATKPY6ZI. You are receiving this because you modified the open/close state.Message ID: @.***>

psemdel commented 1 year ago

The branch IBhandling_moved_to_vbt contains the change, as polakowo cannot test IB. But basically it is the same, we just have to move the code there, when he is ready. The hint about beta testing remains valid.

ben1628 commented 1 year ago

Can you update your code to corresponding vectorbt pro 1.9.0, thanks.