¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io
Date

TWS API Python reqMktData all-day stream delay

 

Hey folks,

Relatively new to TWS API. Can reqMktData be used to stream market data:

- in real time
- for the entire day of trading hours
- for multiple contracts?

Or would attempting this cause a delay? I am looking to stream about 30 stocks simultaneously and have signals based on price action in real time. What's an appropriate database tool to use? Would sqlite3 be sufficient?

Thanks,
M Fitch


Locked Please ensure you email address is up-to-date

 

It has recently become clear to me that there are about 450 members of this group whose email address is broken (no longer exists, mailbox is full and so on). This means they cannot receive any communications from the group (this is technically known as 'bouncing').

My policy going forward is to remove the memberships of those whose accounts start hard bouncing (this is where the bouncing state has persisted after a number of repeated attempts to send to the relevant email address).

This is unlikely to cause much inconvenience, as anyone, member or not, can view the group messages via the group's website. It will only affect you if you subsequently try to post a message, which will not be permitted: it will then be necessary to re-join the group.

To avoid this minor irritation, can you please check that the email address recorded in your membership is correct. If you have recently received group messages via email, then there is no need to check, so this primarily applies to members who have chosen to receive only Special Messages (like this one).

I will start removing hard-bouncing memberships on 23 January 2021, so if you want to ensure your membership continues please make sure you have a valid email address before then.

Thanks

Richard King Group Owner and Moderator


Locked Calling David Crookes

 

@David Crookes

If you see this, will you please telephone me.

Apologies to the Group for abusing my owner privileges, but these are awkward circumstances.

Richard King Group Owner and Moderator


Re: Starting with TWS APi using C++, looking for advice

 

¿ªÔÆÌåÓý

Hi,
  1. I think it doesn't matter much. But I am using 9.76. It is pretty stable. Unless you need the need features in the new version, you don't need to use it.
  2. I used to use TWSApiC++. But I believe it is a little bit out-date and not maintained any more. So I switched to use the c++ library provided by IB. It is much easier if IB has any upgrade.?


From: [email protected] <[email protected]> on behalf of ron.hardock@... <ron.hardock@...>
Sent: Wednesday, January 13, 2021 12:27 AM
To: [email protected] <[email protected]>
Subject: [TWS API] Starting with TWS APi using C++, looking for advice
?
I'm just getting started with using the TWS APi.? I'm using c++ as that's the language I'm most familiar with.
Questions:
1) Is it better for me to use the latest APi version 9.81 or the stable version 9.76 ?
2) Should I use the TWS APi library provided by IB, or should I try using the TWSApiC++ library (at?) ?

My goal is to be able to get my account balance, view current positions and submit/cancel/change/track orders.
Thanks.


Re: Linked accounts

 

Ah I think now I got it, you are logged in just one account and there you have data. Then you only have to choose in which account you place the orders.

But still can you be logged into the account with two clients simultaneously? This is possible when you have just one account so this should work, shouldn't it? I'm just wondering because I want to run two different strategies (via the API; this is an API-forum ;-)) and having two accounts would be an easy and clean way to separate the positions from each other. Just paying twice for the market data would be a little bit annoying.


Re: Linked accounts

 

¿ªÔÆÌåÓý

From API you need to select the account you want to place the trade in. Can¡¯t remember the method off top of my head. Was straight forward.?


On Jan 13, 2021, at 11:16 AM, trader api <traderapi1@...> wrote:

?Linked account setup is like FA account. One login to get in and you need to select account to trade from a drop down menu.?
Data is shared and before every order you need to select (or use last account used ) the account.?


On Jan 13, 2021, at 9:12 AM, Jonathan S <jsheena@...> wrote:

?I believe that only one can use the subscription at a time.? When you launch trading with one user, it pauses the other.? You can test it out easily enough by running two instances of TWS and see what happens.??


Re: Linked accounts

 

¿ªÔÆÌåÓý

Linked account setup is like FA account. One login to get in and you need to select account to trade from a drop down menu.?
Data is shared and before every order you need to select (or use last account used ) the account.?


On Jan 13, 2021, at 9:12 AM, Jonathan S <jsheena@...> wrote:

?I believe that only one can use the subscription at a time.? When you launch trading with one user, it pauses the other.? You can test it out easily enough by running two instances of TWS and see what happens.??


Re: How to get longer historical data?

 

Hi David,

For the??() call I would recommend to use "formatDate" argument value 2
This will make incoming bars timestamp to be in the format, which is same for all the time zones on the planet and epoch time does not care about summer daylight saving time jumps and it brings other sanity aspects and order back into our lives.

Find some way to convert epoch time to whatever format you need, for example for the next reqHistoricalData() you'll need "endDateTime" argument?to have format "yyyyMMdd HH:mm:ss {TMZ}" (example: "20210113 23:59:59 GMT").

Cheers,
Dmitry

On Wed, Jan 13, 2021 at 4:50 AM <david03kimo@...> wrote:
Hi,Dmitry,

I got a problem and can you guide me?
I used the code below and everything went well except the timezone.I queried my local time and sent back UTC time.How shall I modify the timezone?I cannot find in the API document.
self.QueryTime=datetime.strftime(self.FX_df[reqId]['DateTime'][0],'%Y%m%d %H:%M:%S %Z')
--

Thanks and Cheers,
------
Forex trader
David Liao


Re: Linked accounts

 

I believe that only one can use the subscription at a time.? When you launch trading with one user, it pauses the other.? You can test it out easily enough by running two instances of TWS and see what happens.??


Starting with TWS APi using C++, looking for advice

 

I'm just getting started with using the TWS APi.? I'm using c++ as that's the language I'm most familiar with.
Questions:
1) Is it better for me to use the latest APi version 9.81 or the stable version 9.76 ?
2) Should I use the TWS APi library provided by IB, or should I try using the TWSApiC++ library (at?) ?

My goal is to be able to get my account balance, view current positions and submit/cancel/change/track orders.
Thanks.


DDE Socket Bridge with Virtual Windows Server

 

Hi, I've been successfully using an Excel trading model and DDE Socket Bridge to automate my trading on a local desktop computer.? I'm trying to move that to the cloud.? I tried to run it all in a Virtual Machine using Windows Server on Google Cloud Platform.? When I run the runDdeSocketBridge file, instead of the command window popping up and showing "Connected", a command window pops up for a fraction of a second and then closes so that I can't read anything.? The Excel workbook does not seem to connect after that.? Any ideas?? Thanks so much, David.


Re: Combo STK/STK position update delay

 

I meant it occasionally takes a moment for the position to update.
Upon receiving the filled event I immediately request the current position and send out a reactionary order.
I had initially assumed that that the position update would always occur prior receiving the the filled event.
Since that does not appear to the the case I will use your suggestion and use the details of the filled event to update an internal position ledger.
I will use the internal position ledger to determine quantity of reactionary order.
Thank you


Re: How to write report for Algotrading

 

Hello,

You need to answer that for yourself. It is not possible for others to say what you might find informative or not.

I very strongly recommend you think about what you are trying to do, and then structure your code around achieving your purpose. You've made a start, you just need to refine it. Of course, receiving a lot of data might be wasteful, but it is a start, you can look at the values it gives you and then keep those that you think are useful to your purposes.

Best wishes,

M


On Tue, 12 Jan 2021 at 13:31, AnerG corp <ahunatajanov@...> wrote:
Good evening!
I am a newbie?for algo trading
How to write an account summary, positions report in Algo Trading.
What is the main parameters that needs to pay attention, there is a lot of parameters, I can get account summary whole with self.reqAccountSummary(90001, 'All', '$LEDGER:ALL'), but there is a lot of parameters that is not essential.

I hope I explain what is the problem, if you have questions please let me know, thanks in advance



--
+44 (0) 7528 551604?
Gulfstream Software - Winner Risk Management Awards 2010
This message is subject to :


How to write report for Algotrading

 

Good evening!
I am a newbie?for algo trading
How to write an account summary, positions report in Algo Trading.
What is the main parameters that needs to pay attention, there is a lot of parameters, I can get account summary whole with self.reqAccountSummary(90001, 'All', '$LEDGER:ALL'), but there is a lot of parameters that is not essential.

I hope I explain what is the problem, if you have questions please let me know, thanks in advance


Re: Combo STK/STK position update delay

 

What do you mean by "it takes to update the position"?

I'm using STK/STK orders myself. Directly after an order is executed I receive updates for the order status (usually a whole bunch of events), execution details and commissions reports.
If you subscribe to account updates you will also receive an update of your open positions. All this happens without noticeable delay. So you don't have to pull the open positions every time an order is filled, just subscribe to account updates.
This will give you an update of your portfolio every 3 minutes or when a position is opened or closed.


Re: Combo STK/STK position update delay

 

Also, is it best practice to pull current position from IB periodically or instead to just pull position once at algo inception and keep an internal ledger based on filled confirms?


Combo STK/STK position update delay

 

Hello,
I am using the IB Combo trader to route an order in a stock/stock combo.
I check the position after receiving an order filled event, however I've noticed there is often a delay in the time it takes to update the position.
Has anyone else experienced this?
Any suggestions on how to fix or workaround this issue?
Thanks


Re: soft token issue at IB server

 

Sunday often has issues, but last night there was something up: I lost contact to some accounts at 05:30 GMT, and the login servers failed for a while. It came back up though. So I'm guessing all fixed ?

Best wishes,

M


On Mon, 11 Jan 2021 at 04:54, Stuart Cracraft via <smcracraft=[email protected]> wrote:
Odd, just when I thought all was well.

Had restarted and relogged into IB¡¯s TWS app a day ago after it had run perfectly for a week.

The restart and login went well and it was running fine from yesterday to today.

On an off-hand chance, checked it tonight and found this.

Tried logging in a couple times without restarting it, no luck, same error as below.

After stopping and starting and logining in again, got past it.?

Anyone seen this one? Looks like a problemo at one of IB¡¯s servers¡­.




--
+44 (0) 7528 551604?
Gulfstream Software - Winner Risk Management Awards 2010
This message is subject to :


soft token issue at IB server

Stuart Cracraft
 

Odd, just when I thought all was well.

Had restarted and relogged into IB¡¯s TWS app a day ago after it had run perfectly for a week.

The restart and login went well and it was running fine from yesterday to today.

On an off-hand chance, checked it tonight and found this.

Tried logging in a couple times without restarting it, no luck, same error as below.

After stopping and starting and logining in again, got past it.?

Anyone seen this one? Looks like a problemo at one of IB¡¯s servers¡­.



Linked accounts

 

If you create two linked accounts with a shared market data subscription, is it possible to be logged in to both accounts simultaneously via the API and have market data on both?