Keyboard Shortcuts
Likes
- Twsapi
- Messages
Search
Re: How Can I Locate Hard to Borrow Shares to Short with TWS API?
Do you mean the borrow rate, or the price you can sell them at???
I believe there's an ftp somewhere with a daily file containing the borrow rates.? I'd think it was also a tick in the API somewhere but that may be wishful thinking. As for what you can sell them for, that's up to the market to decide.. -Peter |
What is the best way to get the open price of today for some symbols
I am looking to get the open price of today for around 30 symbols as early as possible. It can be done by the following process:
The problem is that if I reqHistoricalData within 5 seconds after the market is open, the daily candle will be the previous day's data. I have to wait until the time is after 9:30:05 instead of 9:30:00 to request the daily data. May I ask if you have any suggestions to get the open price data from IB avoiding waiting 5 seconds after the market is open?
|
Re: TwsActiveX class not registered run-time error '-2147221164 (80040154)
Update/workaround:
|
Excel DDE scanner - live market data
Hi all!? I am new to this community and have been reading a ton of useful info on the TWS API.? However, as my (basic) VBA skills have been left unused over the past ten years and much has been forgotten, I wanted to ask your help in getting a simple market scanner up and running in Excel.
I am trying to run an existing scanner - (take?TOP_PERC_GAIN as an example) - and have found out that while it will provide a list of instruments which ties in with what you would get in TWS, the Excel scanner does not provide corresponding market data (last price or anything else, columns are just blank).?? I tried to link symbols with live and historical market data as per IB guidance and tutorials, but it appears that you cannot use DDE links with cell references in them and as the scanner results would change through the course of the day, just copy-pasting them in live data tab won't work. As I understand the workflow at the moment: - start market scanner, results are populated in Top_Gain sheet and updated while subscription is active - pull live and historical market data on the basis of the tickers that are provided - repeat the market data query based on updated tickers every time the scanner is refreshed? - stop both scanner and market data pulls when subscription is no longer active What is not clear to me is how to integrate the market data pulls so that they don't just pull data once (and the data could be wrong a few seconds later as tickers change / move order), but the code keeps iterating while the scanner subscription is active. Could you please advise how / where in VBA modules you would add corresponding macro to pull live data for the same tickers that come out from the market scanner?? This is just for stocks and am only looking at US stocks at the moment just to get an understanding of how the code works. The file that I am using is TWS DDE sample Excel that comes with the API. Thank you very much in advance! |
Re: Error: 1 321 Error validating request.-'bW' : cause - Please enter a local symbol or an expiry
Nick
¿ªÔÆÌåÓýThat's because there are a zillion ways to calculate continuous
futures prices and the continuous contract price may be far from
the actual futures contract price. If you trade based on
continuous futures you're trying to navigate Chicago with a map of
Detroit. On 3/13/2022 7:30 PM, dent wrote:
|
Re: Error: 1 321 Error validating request.-'bW' : cause - Please enter a local symbol or an expiry
¿ªÔÆÌåÓýExcellent I will get on that immediately, seems like a GREAT solution and thank you so much for taking the time. cp
On 3/13/22 18:51, ´³¨¹°ù²µ±ð²Ô Reinold via
groups.io wrote:
|
Re: Error: 1 321 Error validating request.-'bW' : cause - Please enter a local symbol or an expiry
We do use CONTFUT with real time data, But not directly. As a matter of practice we follow this work flow:
For CONTFUT contracts, reqContractDetails returns the contract for the actual current front-month future (such as ESH2 today). That contract has a SecType of FUT and reqMktData is happy. ´³¨¹°ù²µ±ð²Ô |
Re: Error: 1 321 Error validating request.-'bW' : cause - Please enter a local symbol or an expiry
¿ªÔÆÌåÓýUh OH just found this
``` Continuous futures are available from the API with TWS v971 and higher. Continuous futures cannot be used with real time data or to place orders, but only for historical data. ```
On 3/13/22 18:28, ´³¨¹°ù²µ±ð²Ô Reinold via
groups.io wrote:
No problem. has an overview of most (if not all) SecTypes as well as the contract object fields you want to set to properly describe the instrument you are interested in. |
Re: Error: 1 321 Error validating request.-'bW' : cause - Please enter a local symbol or an expiry
¿ªÔÆÌåÓýHi jurgen I think you've spotted the flaw in my cunning plan. I hadn't AND
when I did it I got ``` Error: 1 321 Error validating request.-'bW' : cause - Please
enter a valid security type ?I didn't know that security type existed so I'm going to go through the code to see if I can actually send that. Thanks for the headsup on CONTFUT. cp
On 3/13/22 18:10, ´³¨¹°ù²µ±ð²Ô Reinold via
groups.io wrote:
Are you setting SecType = "CONTFUT" somewhere ? |
Error: 1 321 Error validating request.-'bW' : cause - Please enter a local symbol or an expiry
I want to get continuous futures and don't want to mess around with expiration et al. Basically what I see in the TWS watchlist. I tried
and got the error in the subject line. Is there ANY variant of reqMktData that might work OR do I have to resort to reqRealTimeBars and pick the last bar? No point in posting code as I am writing in julia. The calls to the TWS api are populated the same so ANY help would be appreciated. thanks and got the error in the subject line. |
Re: bunch of reqMktData requests for options
Do you also get the message that they will stop the support for older versions after 31st March 2022? I'm still unsure what this actually means. It could be that starting from this day, this client will not work anymore. It could also mean that they would just don't process any tickets regarding this version anymore.
So hopefully, they will fix it asap. |
Re: bunch of reqMktData requests for options
Sorry for my late reply, But I've opened several tickets about it.
The IB development is investigating it.? Hope they will patch it soon. I opened my first tickets about this issue more than 2 years ago. We still use TWS 9.73 as it was the last release before the 'regression/bug' was introduced in their code. |
Re: OCA Group Orders being placed, and executed, but the stop loss orders or Take profit order are not being cancelled after one of the bracket orders are executed
Nick
Probably because you are not placing a bracket order, you're just sending 3 independent orders.
toggle quoted message
Show quoted text
See bracket order info here: On 3/13/2022 8:46 AM, alcatrazam wrote:
Hey everyone, so I am placing the bracket orders, they are going to IB, being placed, and executed, but once one part is triggered, the remaining ordered is hanging, and not being canceled, then my python program crashes as it sees the remaining fragment of the order. |