RobinHood
RobinHood copied to clipboard
option spreads?
Very nice work!
Lately I've been dealing mostly with option spreads, eg. vertical bull put credit spreads, etc. Typically involving both a long and a short leg of different strike prices, or/and different strike dates, into a single order / position.
Might there be any support for that?
Here is an example of such an order in JSON:
# composed inside very hacky CLI I've written in Ruby and Python:
./rhPlaceOrder -m order_option_spread -p '(direction="debit",price=2.04,symbol="SPXL",quantity=1.0,spread=[{"expirationDate":"2020-07-17","strike":44.0,"optionType":"call","action":"sell","effect":"open"},{"expirationDate":"2020-07-17","strike":40.0,"optionType":"call","action":"buy","effect":"open"}],timeInForce="gfd")'
# Response from REST API
# jq . cache/Robinhood.Order.853681d1-a10c-4865-b95e-f22f7d007153.json
{
"cancel_url": "https://api.robinhood.com/options/orders/853681d1-a10c-4865-b95e-f22f7d007153/cancel/",
"canceled_quantity": "0.00000",
"created_at": "2020-06-02T05:07:41.048593Z",
"direction": "debit",
"id": "853681d1-a10c-4865-b95e-f22f7d007153",
"legs": [
{
"executions": [],
"id": "01c980fb-72e6-4a81-a693-943653378097",
"option": "https://api.robinhood.com/options/instruments/c79ce5d4-632d-4260-94ba-addad93aabc1/",
"position_effect": "open",
"ratio_quantity": 1,
"side": "buy"
},
{
"executions": [],
"id": "a6dfd55a-fa15-4509-8839-c2790261bcb9",
"option": "https://api.robinhood.com/options/instruments/5a5ba193-efdc-4d8b-9cce-99706cffb211/",
"position_effect": "open",
"ratio_quantity": 1,
"side": "sell"
}
],
"pending_quantity": "1.00000",
"premium": "204.00000000",
"processed_premium": "0.0000",
"price": "2.04000000",
"processed_quantity": "0.00000",
"quantity": "1.00000",
"ref_id": "50b4e018-3c8d-4856-b89c-0fffff218cc6",
"state": "unconfirmed",
"time_in_force": "gfd",
"trigger": "immediate",
"type": "limit",
"updated_at": "2020-06-02T05:07:41.048618Z",
"chain_id": "1f2564f7-8c98-48e1-b33d-cc6745f5215d",
"chain_symbol": "SPXL",
"response_category": null,
"opening_strategy": "long_call_spread",
"closing_strategy": null,
"stop_price": null
}
For reference on setting up the proper POST Request body, I checked the source behind https://robin-stocks.readthedocs.io/en/latest/functions.html#robin_stocks.orders.order_option_spread
And what might be a suitable ID field for this joint position, the "id" field fifth from the top in the above Response body?