Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option spreads? #98

Open
klepsydra opened this issue Jun 2, 2020 · 1 comment
Open

option spreads? #98

klepsydra opened this issue Jun 2, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request
Projects

Comments

@klepsydra
Copy link

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

@JestonBlu JestonBlu self-assigned this Jan 6, 2021
@JestonBlu JestonBlu added the enhancement New feature or request label Jan 6, 2021
@JestonBlu JestonBlu added this to To Do in 1.x via automation Jan 6, 2021
@klepsydra
Copy link
Author

And what might be a suitable ID field for this joint position, the "id" field fifth from the top in the above Response body?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
1.x
  
To Do
Development

No branches or pull requests

2 participants