feat: start work on axios integration, deprecating request.

This commit is contained in:
tiagosiebler
2020-10-04 14:22:59 +01:00
parent 327007b307
commit b201d364bf
13 changed files with 5488 additions and 58 deletions

View File

@@ -1,7 +1,7 @@
const assert = require('assert');
const Request = require('./request.js');
const Request = require('./request-v2');
module.exports = class RestClient {
@@ -17,7 +17,7 @@ module.exports = class RestClient {
assert(params.qty, 'Parameter qty is required');
assert(params.time_in_force, 'Parameter time_in_force is required');
if(params.order_type === 'Limit') assert(params.price, 'Parameter price is required for limit orders');
if (params.order_type === 'Limit') assert(params.price, 'Parameter price is required for limit orders');
return await this.request.post('v2/private/order/create', params);
}
@@ -67,7 +67,7 @@ module.exports = class RestClient {
assert(params.base_price, 'Parameter base_price is required');
assert(params.stop_px, 'Parameter stop_px is required');
if(params.order_type === 'Limit') assert(params.price, 'Parameter price is required for limit orders');
if (params.order_type === 'Limit') assert(params.price, 'Parameter price is required for limit orders');
return await this.request.post('open-api/stop-order/create', params);
}
@@ -274,4 +274,4 @@ module.exports = class RestClient {
async getTimeOffset() {
return await this.request.getTimeOffset();
}
}
};