From 0a6f9c8b65c9a28000763e221792d19f7d3fa049 Mon Sep 17 00:00:00 2001 From: Brendan Do Date: Mon, 11 Jan 2021 20:11:17 -0500 Subject: [PATCH] Adding the ability to pull in not just orders from stock transactions but options as well --- README.md | 18 ++++++++++++++++++ src/robinhood.js | 10 ++++++++++ 2 files changed, 28 insertions(+) diff --git a/README.md b/README.md index d7272e4..5370701 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ FYI [Robinhood's Terms and Conditions](https://brokerage-static.s3.amazonaws.com * [`tag(tag, callback)`](#tagtag-callback) * [`popularity(symbol, callback)`](#popularitysymbol-callback) * [`options_positions`](#options_positions) + * [`options_orders`](#options_orders) * [Contributors](#contributors) @@ -917,6 +918,23 @@ var Robinhood = require('robinhood')(credentials, function() { ``` +### `options_orders` + +Obtain list of history of option orders + +```typescript +var credentials = require("../credentials.js")(); +var Robinhood = require('robinhood')(credentials, function() { + Robinhood.options_orders((err, response, body) => { + if (err) { + console.error(err); + } else { + console.log(body); + } + }); +}); +``` + ### `options_dates` Obtain list of options expirations for a ticker diff --git a/src/robinhood.js b/src/robinhood.js index 83839cf..f788ccc 100644 --- a/src/robinhood.js +++ b/src/robinhood.js @@ -54,6 +54,7 @@ function RobinhoodWebApi(opts, callback) { options_chains: 'options/chains/', options_positions: 'options/aggregate_positions/', + options_orders: 'options/orders/', options_instruments: 'options/instruments/', options_marketdata: 'marketdata/options/', @@ -528,6 +529,15 @@ function RobinhoodWebApi(opts, callback) { ); }; + api.options_orders = function (callback) { + return _request.get( + { + uri: _apiUrl + _endpoints.options_orders + }, + callback + ); + }; + api.options_dates = function (symbol, callback) { api.instruments(symbol, function (err, response, { results }) { if (err) throw err;