Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iloire/tastyworks-risk
Test the max upside and potential drawdowns of your Tastyworks account for a certain percentage change in the SPY
https://github.com/iloire/tastyworks-risk
tastyworks
Last synced: about 2 months ago
JSON representation
Test the max upside and potential drawdowns of your Tastyworks account for a certain percentage change in the SPY
- Host: GitHub
- URL: https://github.com/iloire/tastyworks-risk
- Owner: iloire
- Created: 2019-11-18T01:12:49.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-14T14:12:52.000Z (over 1 year ago)
- Last Synced: 2024-06-03T02:33:05.820Z (4 months ago)
- Topics: tastyworks
- Language: JavaScript
- Homepage:
- Size: 926 KB
- Stars: 6
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Tastyworks risk simulator
![I, Robot](https://raw.githubusercontent.com/iloire/tastyworks-risk/master/robot-trader.png)
Test the max upside and potential drawdowns of your Tastyworks account for a certain percentage change in the SPY.
The software will give you the estimated upside or drawdown by forecasting option prices (using Black Scholes formula) for your current positions according to their SPY beta weight.
## Example output
```
{
"ZM": {
"meta": {
"beta": 1,
"currentPriceUnderlying": 74.55,
"volatility": "0.611642779",
"riskFreeInterestRate": 0.03
},
"byChangeInSPYIndex": [
{
"changePercentage": -3,
"simulation": {
"newUnderlyingSimulatedPrice": 72.31349999999999,
"betaWeightedChangePercentage": -3,
"positions": {
"ZM 200117P00075000": {
"direction": "Short",
"quantity": 3,
"currentPrice": 6.25,
"simulatedPrice": 8.003068758248162,
"currentValue": -1875,
"simulatedValue": -2400.9206274744483,
"pl": -525.9206274744483
}
},
"pl": -525.9206274744483
}
}
}
...
```## Chart:
![Risk simulator](./example/simulation.png)
## Install and run
Install the dependencies and set the tastyworks account details in the shell environment:
```
yarn
export TW_USER=; export TW_PASSWORD=; export TW_ACCOUNT_ID=
```Now run the simulation or create a chart witht the estimated max drawdown and upside:
```
node example/index.js
node example/chart.js
```## Next
- Move to Typescript in the next chance I have.