The UX for PositionManager is complete. The UX is a simple Buy, Buy 10, Buy Max, Sell, Sell 10, Sell Max shown on a spreadsheet in Jupyter. Not rocket science, but getting the basics right. PositionManager is an alternate interface to trading. The idea is to watch the stock you want to buy on Thinkorswim and then use the Jupyter notebook to place the order. The eventual goal is to create automation but baby steps.
I was trying to figure out the best way to create the UX and went down the rabbit hole of Jupyter widgets. They are great! Super simple to implement and works with the existing Python code. Highly recommend it as a way to write data-driven GUIs. Python is not my favorite language, but Jupyter has some majors plus points, especially with widgets.
Lastly, I implemented the broker interface. The broker abstracts different brokerage firms behind a standard API. For example, every broker will have a common interface that provides the same data. TD Ameritrade, Alpaca, and any future broker will have to implement:
- account info
- list orders
- list positions
- buy position
- close position
Major props to tda-api for simplifying the TD Ameritrade API. Currently, I am only trading stocks, so I am not focused on options or other instruments.
Here is the current status of the engine. The green are done, the yellow are things that are partially done.
The next part is the OrderManager. The order manager will have two goals:
- Track every buy and sell order into a database.
- Track order executions.
- Place effective buy and sell orders into the market starting with a simple strategy.