¿ªÔÆÌåÓý

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

Re: check if running in Paper or Live trading mode programatically

 

Check the connecting port number


check if running in Paper or Live trading mode programatically

 

Hi Is there any way to determine via IBKR APIs - whether the program is running in Paper Trading more or Live Trading Mode.? ?


Re: IV Rank and Percentile through API

 

I don't think the OP meant the GUI more the API. I'm wondering if the OP is right that they only provide a limited set of data points for IV even if you ask for 1Y. I can't see WHY they would do that but I haven't checked recently.


Re: IV Rank and Percentile through API

 

Thanks! You where right, it's possible to get volatility for whole year and probably more! I got confused as Option prices are restricted for a month or two, but looks like volatility is associated with stock history. Ok, then it should be pretty easy to calculate iv rank and percentile.


Re: IV Rank and Percentile through API

 

In TWS those columns certainly do work, I use them all the time, see attached screenshot. I wouldn't think they would dare to remove them as as you say some other platforms have them and they are quite widely used when trading options.


Re: TWS vs TWS API volumes

 

Take a look at the section of the API Reference Guide's chapter. Lots are 100 shares traditionally but IBKR recommends that you use #shares instead going foreward. The newer versions of TWS/IBGW have an API configuration option now where you can select lots or #shares for API market data.

I am not sure which TWS version you use and which screen you are looking at, but I was under the impression that TWS also is migrating away from lots.

´³¨¹°ù²µ±ð²Ô

From TWS 10.17.1w


TWS vs TWS API volumes

 

Just doing some checks on the data I get from??vs what I see on TWS itself. It looks like the volume displayed on TWS is 100 times more than what I get through the API. I assume the API is giving results in terms of a multiple of the lot size. Is this lot size the same across all instruments/markets/countries? Is there a way for me to get the multiplier via the API appropriate for each instrument/market?

Thanks.


Re: Shortable instruments

 

@´³¨¹°ù²µ±ð²Ô Reinold
Aug 23???

Thank you. So if I understand corrrectly, there is no simple True/False flag for shortable. Essentially all stocks can be shorted depending how many shares available to be shorted (?)



Re: IV Rank and Percentile through API

 

Are you sure about the one month restriction? I would have thought the below would work.

 bars = ib.reqHistoricalData(
               contract,
               endDateTime=dt,
               durationStr='1 Y', # 1 D  5 D etc
               barSizeSetting='1 day',
               whatToShow='OPTION_IMPLIED_VOLATILITY',
               useRTH=True,
               formatDate=1)

can't test it out as I've shut down my machines.


Re: Why is my reqMktData thread not running with IB TWS Python API?

 

I haven't tried your code and am not an expert in python multithreading but it seems like your thread is finished.? Try printing something when it asks for data or use? a debugger.


Re: IV Rank and Percentile through API

 

I contacted IB support approximately 9 months ago because I couldn't get my TWS (Win 10 64bit) to show these values -- neither IV percentile nor IV rank would show up.

They replied that they have removed this feature and thus these columns wouldn't show any values, and that they would remove the option to select these columns in a later release. I couldn't believe it because it's a valuable feature, especially for option sellers (and given that IBKR's legacy is essentially options), and many other platforms have it.

Max


Re: IV Rank and Percentile through API

 

I know this is very old thread but I started experimenting with API and still see no option to retrieve iv rank and iv?percentile from API even though you can see them in TWS. Anyone maybe knows tips and tricks how to get it? Maybe it has been added but docs haven't been updated?

I thought about getting historical option data and calculating them myself but to get IV Rank 52 one would need data for a year but IB only offers historical Option data for a month as far as I know.


Re: Why is my reqMktData thread not running with IB TWS Python API?

papuchon
 

Hey @btw, thanks for the response. Yes no callback in this simple code sample, in my other larger script I have a ticktype callback to see pricing data and so on.
But here I'm mostly testing for the thread to be live.
Can I ask you if you have tried without the parentheses, and did you get the streamdata thread to be live (True)?
I tried and it still shows False on my end, but I'm wondering if that is because it's the weekend and the CME exchange is closed. Would the streamdata thread not be live in that instance maybe?


Re: Market of Euronext-Amsterdam (AEB) but somehow it stopped

 

Hi Enrich,

YES I see the same message.

So good the hear you opened a ticket.?

Thanks for your reply.

Kind regards

Arnoud


Re: Market of Euronext-Amsterdam (AEB) but somehow it stopped

 

In Addition to error 354 after requesting data:
When you double click on "Data" in TWS you will notice a yellow message at the bottom saying something like "Some of the requested market data is not allowed for API users".

regards
Erich


Re: Market of Euronext-Amsterdam (AEB) but somehow it stopped

 

Hi Amoud,
one of our clients reported the similar problem with Tradegate starting a few days ago, (e.g GLE@TGATE)
I was able to reproduce the problem and opened a ticket at IB.
They confirmed changes on their side last week. The issue is known and they are working on a fix (hopefully...).
So it's an issue at the end of IB and not on your side.

Regards
Erich


Re: How do I retrieve the timestamp of the last trade

 

Thank you for the advice BTW.? The first time I've used groups to solve a problem.


Re: How do I retrieve the timestamp of the last trade

 

If you're using? ib_insync try asking in this group -> /g/insync/messages


How do I retrieve the timestamp of the last trade

 

From the outset I need to clarify I am a newbie to both python and the IBKR API. I can successfully connect to the platform and retrieve data on the last traded price and last traded size, code snippet below. What I'd like to retrieve but can't, is the timestamp of last trade, i.e. what time did the stock trade last.

I see in the documentation a references to Ticker Id 45, "Last Timestamp - Time of the last trade (in UNIX time)", but I don't know how to access this or a method which will give me this timestamp.

Python Code snippet below

from ib_insync import *

thisClientId = 101

def main():
    ib = IB()
    ib.connect(host='127.0.0.1', port=7496, clientId=thisClientId)
    ib.reqMarketDataType(4)

    contract = Stock('BHP', 'SMART', 'AUD')
    stock_data = ib.reqMktData(contract, 225)
    ib.sleep(1.5)

    print("225 stock_data.last: ", stock_data.last)
    print("225 stock_data.lastSize: ", stock_data.lastSize)
    

if __name__ == '__main__':
    try:
        main()
    except:
        print('Interrupted')




Re: Why is my reqMktData thread not running with IB TWS Python API?

 

On Fri, Aug 26, 2022 at 08:32 PM, papuchon wrote:
target=streamData()
s/b target=streamData

Note the lack of parentheses.? Also, there is no callback for the data stream in?class TradingApp so you won't actually see the data.