Keyboard Shortcuts
Likes
- Twsapi
- Messages
Search
Re: ReqHistoricalTicks() & Futures Data Limitations, Rolling Expiring Contracts
This is a numbers game and you'll have to just try it out yourselves. It all depends on the number of ticks (trades, BidAsk, Midpoint) the future produces, whether you want data just for the front month or whether you want to download all ticks for all tradable futures for each day. ES easily gets to 800K or1Mio trades a day, NQ is probably 1/2 that, ZN 1/5 and VIX 1/10. BidAsk or Midpoint ticks are 5x to 10x those of trades. So you'll be looking at several 100Mio to 1B ticks for two years worth of data. I'll take a long time but then you'll only do that once. IBKR paces the speed at which they provide the data and speeds may be higher on weekends and during the night. Speeds also tend to be higher at the start and slow down if your process keeps on requesting data for extended periods of time. When I did a quick run yesterday to see whether our tool still works (we never really download historical data any longer) it took 200 seconds to get 71,000 ES trades in 71 requests. That's an initial rate of 1.25 Mio trades per hour but will very likely get slower if you keep on doing that for several hours. ´³¨¹°ù²µ±ð²Ô On Wed, Sep 20, 2023 at 03:33 PM, <blydon12@...> wrote:
Also, right now this strategy will only require having useRTH set to true. With that being said, I will probably just get it over with and download all hours. If I didn't though, what would you estimate the difference in time would be for retrieving NQ e-minis tick data for 2 years? |
Bid Ask data missing for a period of time (minutes)
Hi there, Just curious if someone had any issue regarding getting some data (in my case some option strikes) at the beginning of the SPX index session, around 8:33 US/Central time.? My system was receiving all the data from the beginning of the session but at some point around 8:33:36 got -1 for the Bid & -1 for the Ask on all option contracts. Half an hour later I checked and I found out the system stopped running and after restarting it, it worked again. I've checked the Gateway log and didn't see any connection error. Have any of you had this experience?? Thank you |
Re: Multi-profit taker order
I am not sure that bracket orders would be involved in modelling what you are trying to do. Bracket orders suggest that at most one of the child orders will execute (and the others get cancelled) and IBKR will adjust child order quantities? to the actual fill quantity of the parent. This sounds to me as if you simply place three orders:
Your client application would stick around and and would monitor order progress by observing openOrder, orderStatus, and execDetails callbacks. You can adjust pricing/quantities for these orders up to the moment that they actually execute. Your client will also want to implement some logic to handle failure cases such as when previously accepted orders get cancelled without fill for some reason or when profit takers at lower price levels fill only partially. Alternatively, you could do some window-shopping over at the explorer. You may be able to model your requirements with a Scale order or with one of the Algos. That adds a level of robustness in that orders keep operating at the exchange or at IBKR even if your client, TWS/IBGW, or your internet connection fail. Actual commissions heavily depend on the instrument you are trading, whether you use tiered pricing, and other account specific parameters. But for the most part we found that commissions we observe in paper trading are very similar or even identical to those in a an equivalent live account. And if your strategy yields significantly better sales prices, slightly higher commissions should be more than offset. ´³¨¹°ù²µ±ð²Ô On Wed, Sep 20, 2023 at 01:49 PM, amar wrote:
|
Re: ReqHistoricalTicks() & Futures Data Limitations, Rolling Expiring Contracts
Also, right now this strategy will only require having useRTH set to true. With that being said, I will probably just get it over with and download all hours. If I didn't though, what would you estimate the difference in time would be for retrieving NQ e-minis tick data for 2 years?
|
Re: ReqHistoricalTicks() & Futures Data Limitations, Rolling Expiring Contracts
Jurgen,
Awesome news. How long did it take you request and retrieve that amount of data? I assume you went the route the thread suggests, where you store the most recent timestamp and make a request with said timestamp as your startDateTime until you hit current day? Thanks, Brendan |
Re: Multi-profit taker order
¿ªÔÆÌåÓýThe first thing that comes to my mind is to split this up into multiple bracket orders and/or oca orders each dealing with a part (as you specified) of the total trading volume.Greetings, Raoul On 20-09-2023 21:15, amar wrote:
Forgot to add that, as profit-takers are hit, I would also need to adjust my stops, specifically share size and price point. |
Multi-profit taker order
Hello,
I was wondering what would be the best way to place multi-profit taker order? For e.g. if I buy 240 shares of AAPL at $100, I would like to set a Stop at $98, take 80 shares off the table if price reaches $102, another 80 at $104, and if price reaches $106 I would like to set a trailing-stop order for the remaining 80 shares. I know I can place 3 separate bracket orders. But is there a better way to accomplish this? Two concerns I have with separate orders is increased slippage due to delay in processing each order separately and higher commissions. I am currently paper trading so not sure how much of a difference will commissions make if placing 3 separate orders as I mostly see commissions around $1 for each order being executed and am not clear if they are close what I will see with live trades!
?
Any thoughts/ideas are appreciated.
Thanks. |
Re: reqOpenOrders() returns none
Python1382
The client that placed an order was asked to return the open contracts a few minutes later (the contracts were present in TWS but the code returned none).?
Your comment explains why the orders I had in TWS from an earlier client were not viewable (good to know). |
Re: reqOpenOrders() returns none
How did the orders in TWS get created? Manually in TWS or by a different client? You might want to read up on the concept of "Master Client" and "Client 0" as described in the chapter. You can also make a "super client" (my term) when you configure the Master Client Id as "0". The background is that clients get only information about the orders they placed themselves. The exception are the Master Client (which can receive details from all clients) and Client "0" (which can receive details from orders placed manually in TWS). ´³¨¹°ù²µ±ð²Ô |
Re: ReqHistoricalTicks() & Futures Data Limitations, Rolling Expiring Contracts
You can indeed get approx 2 years of high resolution tick data for expired futures with Just grabbed trade ticks for VXV1 on 2021-09-21. But you have to be patient since requesting that amount of data will take some time and you want to have some kind or restart logic to work around TWS/IBGW daily restarts and other disruptions. For very active futures, be prepared to get more than 1,000 ticks per call occasionally since returned data is always for full seconds. Contract rolling can be implemented by requesting lists of active and expired contracts via . Those contracts contain each future's expiration details so you can construct a "continuous future" from that list. There are various data services out there that sell or rent historical futures ticks data but I have no experience to share and some of them can expensive. They may be interesting, though, if you need data for many futures or if you need event times with a resolution of higher than one second. ´³¨¹°ù²µ±ð²Ô |
reqContractDetails() suddenly not working?
My code which has been running perfectly for a long time suddenly stopped working properly.
I always called reqContractDetails() with SMART. and no PRIMARY EXCHANGE and then select the contract I want from the list. Now I am getting no response and the code will only work when I add a PRIMARY EXCHANGE. TWS recently upgraded to 10.25.1h Before I start a lengthy debugging process, has anyone else seen this? |