Getting back on this topic, I found a website providing useful code samples for common use cases of TWI API:?
Some contents:
Just wanted to share and hope it can help others too.
toggle quoted message
Show quoted text
Hi all,
I wonder if there are sample codes of recommended methods for the most common use cases. I know IB
API has sample code, but it's on very low level (e.g. get price of a stock). Sample codes of such use cases can be very helpful:
- monitor the price of stock XYZ. If the price reaches x1, send a limit order of price x2. If the price drops to x3, cancel the order
if not executed yet.
- get option chain of SPX, filter the expirations and strikes by some defined rules, and monitor the prices (bid/ask) for the options
filtered. If some condition is met, send an order to buy a spread (buy x and sell y)
I know IB API takes an async approach and implementing the above use cases can have various ways. I think any method from an experienced programmer would be good to start. It teaches
newbies how to organize all pieces into a functional trading software.
Thank you!