The objective of this project is to transpose an existing script for TWS API into a script that works with tastyworks application.
The script itself is relatively simple: it measures whether the previous bar on given interal (i.e. 5min) was an inside bar and based on that information sends to the exchange breakout orders with predetermined take-profit/stop-loss levels. The script was written in Python for Interactive Brokers TWS/Gateway API and I will make it available for you as a starting point once we agree on terms.
Note that there is no official API for tastyworks, however a reverse-engineered one is freely available and should be sufficient to serve the purpose Also, as tastyworks does not have paper accounts, the script will have to be tested on production: we can agree on whether I will be running tests on live account, or set up a real account with a few dollars on it for you to run the script.
Here are some other requirements:
- Speed of execution is a paramount
- Due to the above I would prefer that tastyworks script pulls the data from exchange directly, without need to communicate with TWS API to obtain price and bar information.
- Execution price of orders should be MID by default, with possibility to change to market price or limit (adjustable by predetermined number of ticks)
- If only partial fill is received, the orders for remainder should be killed within x seconds
- If current market price is greater (lower) than parent order by x ticks, kill all orders
- Safeguard: if loss exceeds x, immediately sell at market price
- Safeguard: the script does not turn off when order is rejected due to insufficient purchase power
- The script should work both for stocks, futures and options
- Script must connect to two accounts of the same user simultaneously as tastyworks does not allow for long and short order on the same instrument
- Preferably written in Python so it can be run both on macOS and Windows
- Multiple instruments can be traded at once
Variables that must be adjustable:
- Ticker
- Order type (MKT, LMT, MID)
- Bar interval (i.e. 3min, 5 min etc.) for each instrument
- Profit/stop loss levels for each instrument
- Maximal number of units to be bought/sold
- Maximal capital at risk for each instrumeny
- Time limit for the orders to remain active