Closed Graeme22 closed 2 years ago
Rough idea of what options-based commands could look like:
tw chain SPY
- show the options chain for SPY closest to 45 DTE, with options to set a specific date or list available dates.
tw short call --delta 30
OR --strike 400
For multi-legged:
tw short call -d 16;short put -d 16
(defaults to closest to 45 DTE strangle at 16 delta)
Different expirations:
tw short call --strike 400 --expiration mar;long call -s 400 -e apr
Criticism, concerns, suggestions, etc. welcome.
More examples:
tw short call -s 400 --width 10
becomes a call spread.
tw short call -s 400 -w 10;short put -s 300 -w 10
an iron condor!
Realized I forgot to include a price. That could default to the median of the bid/ask spread, then be another option --price
or --premium
. So
tw short call -s 400 -e mar -w 10 -p 1.50
would sell a 400/410 call spread in March for $1.50 credit.
I also forgot underlying, maybe --underlying
/-u SPY
and that could go before or after the long
/short
modifier but only used once since we can't trade multiple underlyings in a single order obviously.
Example:
tw -u XLF short put -e apr -p 0.50 -s 20
OR
tw short put -e apr -p 0.50 -s 20 -u XLF
Alternately, it could be an option passed to long
or short
, and we just check that at least one of the options has an underlying. Then we could accept both (redundant), and throw an error if they're different or none is provided.
Another alternative: Underlying is a required argument, must come at the very end, and requires no flag (I think I like this one best):
tw long call -s 45 -w 5 -p 1.10 USO
buys the 45/50 call spread on USO for $1.10 closest to 45 DTE.
To match #6, let's move underlying to the front:
tw long call USO -s 45 -w 5 -p 1.10
So in total we have two main subcommands for buying and selling: long
and short
.
Within those, there are five subcommands each: call
, put
, future
, crypto
, and stock
.
Any objections to that as the primary structure?
One of the most obvious questions at first glance is the question of how to express potentially complex options trades in a simple and explicit way. How does one go about trading a calendar? How do we differentiate opening and closing trades? If we're rolling, it'll be both at once. What about multi-legged strategies?
Just brainstorming some of the functionality we'll need and thinking how it could look in a CLI format. We'll likely split the application into several distinct subcategories dealing with different functions, like placing orders or analyzing the portfolio.