ajhpark / ib_nope

Automated trading system for NOPE strategy over IBKR TWS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use different source for NOPE

ajhpark opened this issue · comments

Reason for using Questrade for NOPE data is because there's no efficient way to use IB API to get NOPE, especially since we need to update frequently. Click here see how to get option chain data using the IB API. You need to send a separate request for each contract in the chain which is too slow and there is no endpoint to get it all at once.

Why Questrade? Because I happened to have a Questrade account and their API is good for NOPE, that's about it. Good news is this project can very easily be modified to use a different source for NOPE such as TDA or ORATS if you don't have a Questrade account.

How:

  1. Remove these two lines in NopeStrategy.__init__:
    self.qt = QuestradeClient(token_yaml=self.QT_ACCESS_TOKEN)
    self.run_qt_tasks()
  2. Change NopeStrategy.set_nope_value to use the client you want. For example if using TDA, import the TDAClient from tda/tda_client.py and replace self.qt.get_nope() with self.tda.get_nope(). If using neither TDA or Questrade, you will need to write your own client for your NOPE source.
  3. Add an asyncio task to run NopeStrategy.set_nope_value every minute (see NopeStrategy.run_qt_tasks to see how it's done)

The rest of NopeStrategy doesn't care how the NOPE value is set and should work fine.