Skip to content

Commit

Permalink
Merge pull request #42 from alpacahq/feature/advanced-order-types
Browse files Browse the repository at this point in the history
Add support for advanced order types
  • Loading branch information
ttt733 authored Feb 6, 2020
2 parents 0a71261 + 426d80f commit f7b09d9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/resources/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

const { omitBy, isNil } = require('lodash')

function getAll({ status, until, after, limit, direction } = {}) {
function getAll({ status, until, after, limit, direction, nested } = {}) {
const queryParams = omitBy({
status,
until,
after,
limit,
direction
direction,
nested
}, isNil)
return this.httpRequest('/orders', queryParams)
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alpacahq/alpaca-trade-api",
"version": "1.2.6",
"version": "1.2.8",
"description": "Javascript library for the Alpaca Trade API",
"main": "lib/alpaca-trade-api.js",
"scripts": {
Expand Down Expand Up @@ -42,4 +42,4 @@
"mocha": "^5.2.0",
"sinon": "^6.2.0"
}
}
}
1 change: 1 addition & 0 deletions test/resources/order.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe('order resource', function () {
after: new Date(),
direction: 'asc',
limit: 4,
nested: false,
})).to.eventually.be.an('array')
})
})
Expand Down
1 change: 1 addition & 0 deletions test/support/mock-alpaca.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ module.exports = function createAlpacaMock() {
after: joi.string().isoDate().optional(),
until: joi.string().isoDate().optional(),
direction: joi.string().optional().valid('asc', 'desc'),
nested: joi.string().optional(),
})
return [orderEntity]
}))
Expand Down

0 comments on commit f7b09d9

Please sign in to comment.