Save trades to OptionStrat and get shareable links.
Windows (PowerShell):
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"macOS/Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh-
Clone the repository:
git clone https://github.com/amithegde/StratHelper.git cd StratHelper -
Install dependencies:
uv sync
-
Configure credentials:
cp .env.example .env
Edit
.envand add your OptionStrat credentials:[email protected] OPTIONSTRAT_PWD=your_password
Save an OptionStrat build URL and get a shareable link:
uv run save-trade "https://optionstrat.com/build/custom/RUT/.RUTW260209P2555"
uv run save-trade "https://optionstrat.com/build/double-diagonal/SPX/-.SPXW260209P6915,-.SPXW260209C6965,.SPXW260218P6890,.SPXW260218C6990"
uv run save-trade "https://optionstrat.com/build/inverse-iron-butterfly/SPX/-.SPXW260209P6915,.SPXW260209P6940,.SPXW260209C6940,-.SPXW260209C6965"With a custom name:
uv run save-trade "https://optionstrat.com/build/custom/RUT/.RUTW260209P2555" --name "My RUT Trade"OptionStrat lets you organize saved trades into groups (shown as portfolios
in the web app; the API calls them "accounts"). To save a trade into a group,
pass --group with the group's name or UUID:
uv run save-trade "https://optionstrat.com/build/custom/RUT/.RUTW260209P2555" --group "Test Group"The name is matched case-insensitively. If no group with that name exists, it
is created automatically and the trade is saved into it. --account is accepted
as an alias.
List the groups available on your account:
uv run save-trade --list-groupsWithout
--group, the trade is saved to your default group. The special "All" group (uuid 00000000-...) is a virtual view and cannot be saved to.
from strathelper import OptionStratClient
client = OptionStratClient()
client.login()
# Resolve a group by name, creating it if it doesn't exist (optional)
group_uuid = client.get_or_create_group("My Strategy Group")
url = client.save_trade(
name="My Strategy",
symbol="SPX",
items=[
{"symbol": ".SPXW260207C6000", "basis": 10.50, "quantity": 1},
{"symbol": ".SPXW260207P5900", "basis": 5.25, "quantity": -1},
],
account=group_uuid,
)
print(f"Trade saved: {url}")The CLI parses OptionStrat build URLs in this format:
https://optionstrat.com/build/{strategy}/{symbol}/{legs}
Leg format:
.SYMBOL= long 1 contract-.SYMBOL= short 1 contract.SYMBOLx2= long 2 contracts-.SYMBOLx2= short 2 contracts- Multiple legs separated by commas