¿ªÔÆÌåÓý

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

Re: TWS API | Options market data request issue.

 

Probably problem fixed in 981th version,
try to use TWS latest of IB Gateway latest version.


Re: TWS API | Options market data request issue.

 

Worth mentioning, you should register a trial account.
In demo account without registration (I think it's called demo_tws user)
API team said it [having 10197 error] is possible.


TWS API | Options market data request issue.

 

Hello!?
I'm trying?to request option chain and subscribe market data, to get prices for options on a given STK contract.

I do
client().reqMarketDataType(DELAYED);
client().reqContractDetails(requestId, stkOptionContract);
at this moment I have a number of Put\Call contracts,?
then I try?
client().reqMktData(nextReqId(), optionContract, "", false, false, null);
for each option contract.?

Aaand after that I keep getting this message?| 10197 | No market data during competing live session,
In very rare cases I could get data, but mostly errors and nothing (like 95% of requests failed).
I don't have any other device with TWS, or accounts. Only one I?logged in from this computer.
I'm using a paper account for development, and I don't have any subscriptions to IB, could that be a problem?

Still STK market data arrives as it should for any number of requests.?

Thanks!


Re: Hoping for some help on individual lot information

 

OrderRef is available in flex reports but only for the last 24 hours so they have to be received daily to avoid losing track.


Re: Hoping for some help on individual lot information

Nick
 

¿ªÔÆÌåÓý

I think the OrderRef field is available in Flex reports. You can set that text field to any value you want when you place the order.


On 11/18/2020 8:48 PM, jsheena@... wrote:

Thanks, Nick.
One issue I had with Flex reports was in trying to match up executions in reports with executions reported through the API.? I couldn't find any matching identifier (like executionID, permID, or orderID) between the API and the flex report.? Do you know what might work??
Thanks again


Re: Hoping for some help on individual lot information

 

Thanks, Nick.
One issue I had with Flex reports was in trying to match up executions in reports with executions reported through the API.? I couldn't find any matching identifier (like executionID, permID, or orderID) between the API and the flex report.? Do you know what might work??
Thanks again


Third Party Library

 

Is anybody know fundamentalslib library of python. I have googled but find nothing about it, I tried to implement someone's code and there have fundamentalslib library.?

Thanks in advance!


Re: Hoping for some help on individual lot information

Nick
 

¿ªÔÆÌåÓý

You can request executions for up to 1 week previous to the current day. You have to set the Trade Log in TWS to check the boxes for all days of the week.

You might also look into Flex reports. They are not part of the api but some people have semi-automated the process of running the reports and scraping desired info from them.


On 11/18/2020 4:35 PM, jsheena@... wrote:

Thank you Nich, and J G

Alas.? I'll store everything in my own database and maybe come up with a way to check against an offline IB report.

This group is a fantastic resource.? Thank you for helping!

--Jonathan


Re: Hoping for some help on individual lot information

 

Thank you Nich, and J G

Alas.? I'll store everything in my own database and maybe come up with a way to check against an offline IB report.

This group is a fantastic resource.? Thank you for helping!

--Jonathan


Re: Hoping for some help on individual lot information

 

You can request a list of all today¡¯s executions, and/or set up to receive both order and execution (and commission report) records every time they are created.

Then you can either store them in a database to maintain ¡°state¡± with IB, or just hold them in memory to work out which are part of the current open positions.


Re: How are stops triggered?

 

Thanks ds-avatar this is very helpful.? Looks like for stocks the Last Price method this default which is what was hoping for in any case.? Now that I know which data to review hopefully my analysis will be more productive.


Re: How are stops triggered?

 

The Order class has a field to specify what price(s) to use to define the trigger point. It is called TriggerMethod(). This might be of help to you:? http://interactivebrokers.github.io/tws-api/classIBApi_1_1Order.html


Re: Hoping for some help on individual lot information

 

On Wed, Nov 18, 2020 at 01:03 AM, <jsheena@...> wrote:
Is there any way to get individual lot information through the API instead of the aggregate? Thank you in advance.
No, there isn't with IB. For your open positions they only provide the total shares and the total cost of buying these shares.
You would have to build and store your own database with the details of each trade. Then you can calculate yourself what you are looking for.


Hoping for some help on individual lot information

 

Hello!??

I'm a long time reader, first time poster.?

I have one contract which I purchase multiple times at multiple prices. So for example:

10 shares AAPL at $100
10 shares AAPL at $200

reqPositions() returns a single Position of 20 shares AAPL with avg price of $150.??

Is there any way to get individual lot information through the API instead of the aggregate? Thank you in advance.

--Jonathan


Re: How are stops triggered?

 

There are about half a dozen different stop trigger methods. They are documented (C#) under?IBApi.TriggerMethod enumeration and specified using Order::TriggerMethod property, as well as when manually submitting an order in TWS. Rules governing these methods are sometimes somewhat intricate so pay attention to what documentation say, and I suggest you should ideally?look at documentations for both API and TWS since IBKR docs can be somewhat sparse. Trigger methods can make a lot of difference especially in the less liquid stocks.


How are stops triggered?

 

I have an algorithm I'm testing and I'm trying to figure out if I should implement stops and what level is appropriate.? I downloaded a bunch of historical bid data from my recent trades but the bids are all over the place -- sometimes at 50% of the current market price of the stock.? On close reading of the I noticed that it doesn't really specify what "price" actually will trigger a stop.? I have typically?been forced to choose a bid or ask level (or percentage) to trigger a stop or trailing stop in the past on other trading platforms.? Does IB use the actual trades to determine price at a given moment?? This implies I should be using the historical trade data as a price determinant rather than bids (or asks)? That does seem to be available from IB.

Any insights here would be appreciated...

Thanks


Re: VWAP question

Nick
 

¿ªÔÆÌåÓý

The realtime volume (not realtime bars) gives trades and volume in the same message so it's probably the easiest to work with.

TickByTick data also includes volume but by default is limited to 3 concurrent tickers.

There is volume in the mktdata stream but you have to deal with multiple tick types and include logic to process them so it's not worth it unless you need other info from that stream.


On 11/16/2020 1:01 PM, kat wrote:

Hoping someone can point me in the right direction....

I need the 2¦Ò VWAP bands calculated with 1 min bars... what¡¯s the best way to go about this? I¡¯m streaming tick data for my strategy, but from my understanding that¡¯s not gonna get me volume. So I need to also stream the 5 sec bars and then use that to calculate VWAP and the bands? Am I on the right track or is there an easier way to go about this?

Would appreciate any advice on what is the most efficient way to go about this or if anyone can point me to existing code (python) someplace that addresses this. I'm still learning how to work with the API. Thanks :-)



VWAP question

 

Hoping someone can point me in the right direction....

I need the 2¦Ò VWAP bands calculated with 1 min bars... what¡¯s the best way to go about this? I¡¯m streaming tick data for my strategy, but from my understanding that¡¯s not gonna get me volume. So I need to also stream the 5 sec bars and then use that to calculate VWAP and the bands? Am I on the right track or is there an easier way to go about this?

Would appreciate any advice on what is the most efficient way to go about this or if anyone can point me to existing code (python) someplace that addresses this. I'm still learning how to work with the API.

Thanks :-)


Re: Primary Exchange for TCEHY and MNST

 

I just tried both.

I had no problem with MNST irrespective of primary exch (none, ISLAND, NASDAQ). I typically prefer ISLAND since this is what the documentations seems to suggest for outgoing requests (not sure this is up to date, but it doesn't cause problems).

I had weird problems with TCEHY initially, with the API complaining I have no subscription for?ARCAEDGE data for some reason, which doesn't look right and indeed all real time and historical data are available for me in TWS for this stock. However after a few attempts with no intentional changes to TWS or obvious side effects, these problem are now gone for me and I can receive historical bars through API with ANY primaryExch including none, PINK (which is its primary exch per contract details) and even SMART, ARCAEDGE or OTCLNKECN. I can't reproduce what I did exactly to bring it back to its senses but one of key things seems to be requesting contract details, though I didn't use them for getting historical data.


Primary Exchange for TCEHY and MNST

 

I am using Excel to download historical bars for a number of stocks (over 100). It has worked for all but TCEHY and MNST. I had some issues with a few other ones and added a primary exchange of NASDAQ for them and they then worked. I am guessing that may be the problem with TCEHY and MNST, but I tried changing the primary exchange and it still wouldn't work. For TCEHY, i tried PINK, ARCAEDGE, and OTCLNKECN. For MNST, I tried NASDAQ, NMS, and NYSE. Anyone have any idea what I should use?

This may not even be the problem, so if you have another idea of what the problem is, that would be appreciated as well.

Thanks,
Shaun