Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Adding Options Orders History #121

Merged
merged 1 commit into from
Oct 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

<!-- toc stop -->
Expand Down Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions src/robinhood.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/',

Expand Down Expand Up @@ -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;
Expand Down