Keyboard Shortcuts
Likes
- Twsapi
- Messages
Search
Re: TWS API for FUTURE response 200 No security definition has been found for the request
The financial futures trade calendar quarter-end deliveries: March, June, September, December
Commodity futures deliveries coincide with production or consumption cycles (e.g. growing season in agriculture, usage in gold/silver) [rwk] |
TWS API for FUTURE response 200 No security definition has been found for the request
breakout.soul@gmail.com
Hi,
I am trying to get the FUTURE data of some indexes like ES,?NQ, so I write the following code: contract = Contract()
contract.symbol = "ES"
contract.secType = "FUT"
contract.exchange = "GLOBEX"
contract.lastTradeDateOrContractMonth = "202204"
reqMarketDataType(1)
reqMktData(2, contract, "", False, False, []) But its responses --> 200 No security definition has been found for the request Can anyone help me to figure out what is the exact reason for my code so it does not return any data? - Thanks Ihtesham |
Re: Conditions on twsactivex API.... AGAIN :)
Just for whoever finds this thread and because they had the same problem as me, to circumvent this issue I had to cancel the order and send it again with a new order Id, every day. Hope there will be a solution to prevent?this from happening again. El sáb, 2 abr 2022 a las 12:57, joanmarcel119 via (<joanmarcel=gmail.com@groups.io>) escribió:
|
Conditions on twsactivex API.... AGAIN :)
First of all, I hope this message finds you well. Here we go again with an issue related to price conditions. It seems that I'm the only one person in the world using these conditions on the TwsActiveX API... I need to be able to send the order changes to the TWS every day at the first hour in the morning, so I'm not keeping the TWS and the excel always connected nor the computer turned on. I think we have found another bug on IB, because the price condition doesn't get updated if you turn off the TWS and restart it again! For the tests, I used the Excel sample IB provides: 1) On the sheet "Conditional Orders" and after connecting to TWS I sent a MKT order on IBM stock with price condition: "last of bid/ask Price of 37018770(SMART) is >= 30" (conid 37018770 is T stock) After placing the focus on the row and clicking on the "Place /Modify Order" button, the order is sent and the Order Id is set on T column "Id" so we can resend the order and update the price condition. The result was as expected on TWS. 2) Update the price condition to: "last of bid/ask Price of 37018770(SMART) is >= 32" again after clicking on the button to send this modification, the result was right on TWS. 3) Now turn off the TWS and the excel 4) turn on again the TWS and the excel 5) Update the price condition to: "last of bid/ask Price of 37018770(SMART) is >= 30" ? After clicking on the button the modification is not sent, well I've taken a look at the API log and it is sent but the order is not modified on TWS and no error returned, so it is not working as expected. Any clues on this? What can I do or?test? I attach the excel demo workbook with the test row as explained here and the api log which shows the order is sent to the TWS and an answer comes from it with the price unchanged Thank you very much |
Re: Pairs trading: Parent vs Child order placement
I want to add my experience with combo orders. I also was at the beginning worried because they were not guaranteed. However it happened extremely seldom that not both legs filled almost simultaneously. I was usually satisfied with the executions I got. It might be different if one side is illiquid.
|
Re: Pairs trading: Parent vs Child order placement
Thank you for your support, I had a read at this page:??
which enlightened me a bit; essentially pairs are what I am looking after, however for the two stocks I am after, it cannot be guaranteed, therefore I do not see any interest in using this. Moreover it only allows a diff trading for convenience, but say you have a stock priced $1 and the other 9$, your pair is co-integrated, you want to buy 9 shared of the first type and sell 1 of the second type. Well with this tool you only know that you will take a $10 position for your pair, but if you had the 9$ one at a fair price, and the 1$ one you paid a disgusting spread, well your pairs trade is worth much less now because you will have to pay that spread 9 times as opposed to 1 time for the $9 one. Not sure if the above makes sense, but anyways I will stick to submitting orders 1 after the other, first take position on the $1 at a good limit price, then hedge it immediately with the $9 at any price. |
Re: Pairs trading: Parent vs Child order placement
I do use this type of orders for one special effect, which excludes trading in different securities (it's more of a simpler reversion trade). There are a some quirks to all of varieties of IB's bracket order, this one being no exception. Although my code for managing this was hacked a long time ago and I couldn't find any clear comments or side notes, I found in my code a check giving a strong warning which concerns automatically assigning the calculated values of 'hedgeParam' below 1.0. In particular the only accepted values for the apper to be 0.1, 0.2 and 0.5, which I probably found experientially. Other than that it likely should work. Hope that helps. вт, 29 мар. 2022 г., 19:09 John <serorjb@...>: For context, the goal is pairs trading, but one of the two securities is somewhat less liquid than the other, |
Problem with specific symbols
cohenkobi1@gmail.com
Hi all,
I am using ib_insync to buy/sell NYSE stocks, and generally the script works fine. In some cases, when I buy or sell specific symbols - orders are not filled. This happens with those symbols evey single time. When using TWS GUI- there is no issue, orders are carried out the same as any other symbol. Can you help understnading what makes those symbols 'special'?? Any idea how to handle this? Examples for problematic symbols: SOFI, ABEV Symbol with correct functioning: PLUG, AAPL Thanks, Kobi |
Re: Pairs trading: Parent vs Child order placement
Thank you very much both.
With trial and error, I found that Transmit=False is of no use in this case, as I need the orders transmitted; the child order got blocked in the current format as not on the same contract. I did not manage to use?hedgeType='P', hedgeParams=f'ratio = {self.ratio}', it seems like whatever I put in hedgeParam(s?) I get an "invalid ratio" error in return. How would I place these conditional orders manually, that's an excellent question and I honestly don't know. Algos seem interesting and I would love to do some profiling with them at a later stage, but these are not available for testing on paper money as I understand, so no use at this time for me. Execution Conditions seem to offer every possible condition, except the condition of another order getting executed, or maybe I am missing something. Combo orders might be closest to what I am looking for, but I spent a few hours on it thus far without understanding the concept.. Apparently I need to define a "BAG" contract like "AAPL, AMZN", put an action "BUY"/"SELL" and a ratio on each leg, and then append both legs to a?contract.comboLegs object. What is not clear at all from? is what to do next with this contract.comboLegs object? According to??I need to define an order with the orderComboLegs properties in there, but it suggests that this order must also have an action, and orderType e.g. "LMT", a quantity and/or a limit price? what does that mean? the quantity of what? the limit price of what exactly?
Also how does the guaranteed flag work? if I need both legs or nothing, I should simply not mention it? |
Re: TWS order has reqId=0; how to cancel it from API?
开云体育Thanks for the reply. I found the root cause of this.
I used ‘reqAllOpenOrders’ instead of ‘reqOpenOrders’ and that does not receive the ‘orderBound’ callback. The confusing thing is that it seems that only on new orders that were submitted in TWS after a last API call to ‘reqOpenOrders’ the orderId is 0 when you retrieve via ‘reqAllOpenOrders’ later. On orders that were submitted before a last call to ‘reqOpenOrders’, even when you retrieve them via ‘reqAllOpenOrders’ later, still a valid (negative) orderId is returned.? The API doc indeed only mentions the orderBound callback for ‘reqOpenOrders’ and says to use ‘reqAllOpenOrders’ to ‘obtain those orders created via the API regardless of client application’. So while it does retrieve orders from TWS also, their orderId will be zero if not bound prior. Bart On Mar 27, 2022, 1:28 PM -0700, 闯ü谤驳别苍 Reinold via groups.io <TwsApiOnGroupsIo@...>, wrote:
|
Re: Pairs trading: Parent vs Child order placement
A few quick thoughts, John:
|
Re: Pairs trading: Parent vs Child order placement
Actually regarding the missing parent order, I believe I need to add transmit =False on the child order too,
unlike the example given in? It then appears to work, at least it populated the orders correctly as conditionals in TWS, but then it give me the button "Transmit" and it seems like the orders are just parked there waiting for me to manually click "Transmit" ? |
Pairs trading: Parent vs Child order placement
Hello Group,
Currently implementing mean reverting pairs trading (e.g. long SLV, short SSLN), would like to have the second leg order conditional on the execution of the first leg order. Tried an approach similar to the??hedging one (with hedgeType='P'), but I get the below "missing parent order" error despite giving it a few seconds between the two.
Then I tried to attach the order?? , which is essentially a regular order with the parentId specified, but then it gives me the absurd:
then once that one is completed, trigger another one which deals with the hedging leg asap, on another contract/instrument. Should I track the order execution via?execDetails? or is there a simpler way to attach them that works? Thanks, Jonathan |
Re: Install TWS or IB gateway on Ubuntu and ARM64 bit processor
I last tried to do this a year ago on a Raspberry Pi 4B (4GB) running Ubuntu 21.04 64 bit. Andy |
TWS API GUI
Hello All, I have a C# application working for years. I am considering using the GUI features to see if I can plot / create my own charts. Is that possible? Does anyone have experience doing / attempting this? I am considering using 1-2 symbols to create custom charts using?tick data. Cheers, TraderAPI |