brndnmtthws / thetagang

ThetaGang is an IBKR bot for collecting money
GNU Affero General Public License v3.0
1.9k stars 249 forks source link

RuntimeError: No valid contracts found for ABNB. #327

Closed brndvg22 closed 9 months ago

brndvg22 commented 9 months ago

Hi,

Thanks for making this project. I started using the Docker image, it will find several contracts, filter them out by open interest and then stop with all of the default contracts (TLT, SPY, ABNB etc...). I ran it multiple times during market hours and also looked manually through some of these options chains, but couldn't find anything that would fall outside of the ranges specified in the config.ini and thetagang.toml file. Everything is still at default values except for Market_data_type = 3, since this is a paper account (hoping to switch to live later :) ) this is the only option. I'm not sure if there may be an issue with market data still.

Thanks very much for any feedback

Searching option chain for symbol=ABNB right=P, strike_limit=None, minimum_price=$0.000 preferred_minimum_price= this can take a while... Scanning between strikes 104.0 and 118.0, from expirations 20231215 to 20240419 Filtering invalid prices for ABNB from 12 tickers... ━━━━━━━━━━━━━━ 100% 0:00:00 Timeout waiting on market data for contracts=[Option(conId=647961780, symbol='ABNB', lastTradeDateOrContractMonth='20231215', strike=105.0, right='P', multiplier='100', exchange='SMART', currency='USD', localSymbol='ABNB
231215P00105000', tradingClass='ABNB'), Option(conId=515426714, symbol='ABNB', lastTradeDateOrContractMonth='20240119', strike=105.0, right='P', multiplier='100', exchange='SMART', currency='USD', localSymbol='ABNB
240119P00105000', tradingClass='ABNB'), Option(conId=644112199, symbol='ABNB', lastTradeDateOrContractMonth='20240315', strike=105.0, right='P', multiplier='100', exchange='SMART', currency='USD', localSymbol='ABNB
240315P00105000', tradingClass='ABNB')], continuing... Filtering by open interest for ABNB from 3 tickers... ━━━━━━━━━━━━━ 100% 0:00:00 ╭───────────────────── Traceback (most recent call last) ──────────────────────╮ │ /usr/local/lib/python3.10/dist-packages/thetagang/portfolio_manager.py:897 │ │ in write_puts │ │ │ │ 894 │ def write_puts(self, puts): │ │ 895 │ │ for symbol, primary_exchange, quantity, strike_limit in puts: │ │ 896 │ │ │ try: │ │ ❱ 897 │ │ │ │ sell_ticker = self.find_eligible_contracts( │ │ 898 │ │ │ │ │ Stock( │ │ 899 │ │ │ │ │ │ symbol, │ │ 900 │ │ │ │ │ │ self.get_order_exchange(), │ │ │ │ /usr/local/lib/python3.10/dist-packages/thetagang/portfolio_manager.py:1518 │ │ in find_eligible_contracts │ │ │ │ 1515 │ │ │ │ if len(tickers) == 0: │ │ 1516 │ │ │ │ │ # if there are still no tickers remaining, ther │ │ 1517 │ │ │ │ │ # more we can do │ │ ❱ 1518 │ │ │ │ │ raise RuntimeError( │ │ 1519 │ │ │ │ │ │ f"No valid contracts found for {main_contract │ │ 1520 │ │ │ │ │ ) │ │ 1521 │ │ │ elif preferred_minimum_price is not None: │ ╰──────────────────────────────────────────────────────────────────────────────╯ RuntimeError: No valid contracts found for ABNB. Continuing anyway... Finding eligible contracts for ABNB failed. Continuing anyway...

brndnmtthws commented 9 months ago

I have never been able to get the delayed/frozen data to work correctly all the time, I think it's because the IBKR API only includes some parts of the data in the non-live feed, but I never bothered diving into why it doesn't work. You can use live data (either type 1 or 2) in a paper account, the only catch is that you can't have competing sessions (i.e., you can't have both the paper and live accounts using the live data feed simultaneously.

It's a bit annoying, but it is what it is.

brndvg22 commented 9 months ago

Switched market data type back to 1 and made sure I had the realtime data in the paper account (wasn't aware earlier that this is possible). Indeed the program submitted its first two orders now. Thanks!