coinbase-pro-node
Advanced tools
Comparing version 2.11.0 to 2.12.0
@@ -0,1 +1,12 @@ | ||
### 2.12.0 (2020-10-18) | ||
##### Chores | ||
- yarn upgrade --latest ([f25ba578](https://github.com/bennyn/coinbase-pro-node/commit/f25ba57804becc145beac34a18f7f3393475bd4d)) | ||
##### New Features | ||
- Support product ids in order cancellations ([02fd7634](https://github.com/bennyn/coinbase-pro-node/commit/02fd76342f48cd29a3eaaf6d5f7eedd0ae2b4f8c)) | ||
- Add ability to cancel a single order using the order id ([#283](https://github.com/bennyn/coinbase-pro-node/pull/283)) ([98eb86eb](https://github.com/bennyn/coinbase-pro-node/commit/98eb86eb70110135247b626ec4d63fe44d486924)) | ||
### 2.11.0 (2020-10-12) | ||
@@ -2,0 +13,0 @@ |
@@ -95,4 +95,3 @@ import { AxiosInstance } from 'axios'; | ||
/** | ||
* Cancel a previously placed order. Order must belong to the profile that the API key belongs to. If no product is | ||
* specified, all open orders from the profile that the API key belongs to will be canceled. | ||
* With best effort, cancel all open orders from the profile that the API key belongs to. | ||
* | ||
@@ -105,2 +104,11 @@ * @param productId - Representation for base and counter | ||
/** | ||
* Cancel a previously placed order. Order must belong to the profile that the API key belongs to. | ||
* | ||
* @param orderId - ID of the order to cancel | ||
* @param productId - While not required, the request will be more performant if you include the product ID | ||
* @returns The ID of the canceled order | ||
* @see https://docs.pro.coinbase.com/#cancel-an-order | ||
*/ | ||
cancelOrder(orderId: string, productId?: string): Promise<string>; | ||
/** | ||
* List your current open orders from the profile that the API key belongs to. Only open or un-settled | ||
@@ -107,0 +115,0 @@ * orders are returned. As soon as an order is no longer open and settled, it will no longer appear |
@@ -51,4 +51,3 @@ "use strict"; | ||
/** | ||
* Cancel a previously placed order. Order must belong to the profile that the API key belongs to. If no product is | ||
* specified, all open orders from the profile that the API key belongs to will be canceled. | ||
* With best effort, cancel all open orders from the profile that the API key belongs to. | ||
* | ||
@@ -69,2 +68,19 @@ * @param productId - Representation for base and counter | ||
/** | ||
* Cancel a previously placed order. Order must belong to the profile that the API key belongs to. | ||
* | ||
* @param orderId - ID of the order to cancel | ||
* @param productId - While not required, the request will be more performant if you include the product ID | ||
* @returns The ID of the canceled order | ||
* @see https://docs.pro.coinbase.com/#cancel-an-order | ||
*/ | ||
cancelOrder(orderId, productId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const resource = `${OrderAPI.URL.ORDERS}/${orderId}`; | ||
const response = yield this.apiClient.delete(resource, { | ||
params: productId ? { product_id: productId } : {}, | ||
}); | ||
return response.data; | ||
}); | ||
} | ||
/** | ||
* List your current open orders from the profile that the API key belongs to. Only open or un-settled | ||
@@ -71,0 +87,0 @@ * orders are returned. As soon as an order is no longer open and settled, it will no longer appear |
@@ -128,2 +128,20 @@ "use strict"; | ||
}); | ||
describe('cancelOrder', () => { | ||
it('correctly deletes a specific order', () => __awaiter(void 0, void 0, void 0, function* () { | ||
nock_1.default(global.REST_URL) | ||
.delete(`${OrderAPI_1.OrderAPI.URL.ORDERS}/8eba9e7b-08d6-4667-90ca-6db445d743c1`) | ||
.query(true) | ||
.reply(200, '8eba9e7b-08d6-4667-90ca-6db445d743c1'); | ||
const canceledOrderId = yield global.client.rest.order.cancelOrder('8eba9e7b-08d6-4667-90ca-6db445d743c1'); | ||
expect(canceledOrderId).toEqual('8eba9e7b-08d6-4667-90ca-6db445d743c1'); | ||
})); | ||
it('creates more performant requests when passing the product ID', () => __awaiter(void 0, void 0, void 0, function* () { | ||
nock_1.default(global.REST_URL) | ||
.delete(`${OrderAPI_1.OrderAPI.URL.ORDERS}/8eba9e7b-08d6-4667-90ca-6db445d743c1`) | ||
.query(true) | ||
.reply(200, '8eba9e7b-08d6-4667-90ca-6db445d743c1'); | ||
const canceledOrderId = yield global.client.rest.order.cancelOrder('8eba9e7b-08d6-4667-90ca-6db445d743c1', 'BTC-USD'); | ||
expect(canceledOrderId).toEqual('8eba9e7b-08d6-4667-90ca-6db445d743c1'); | ||
})); | ||
}); | ||
describe('cancelOpenOrders', () => { | ||
@@ -130,0 +148,0 @@ it('correctly deletes all open orders if no productId is passed', () => __awaiter(void 0, void 0, void 0, function* () { |
@@ -19,8 +19,8 @@ { | ||
"@types/jasmine": "3.5.14", | ||
"@typescript-eslint/eslint-plugin": "4.4.0", | ||
"@typescript-eslint/parser": "4.4.0", | ||
"@typescript-eslint/eslint-plugin": "4.4.1", | ||
"@typescript-eslint/parser": "4.4.1", | ||
"cross-env": "7.0.2", | ||
"dotenv-defaults": "2.0.1", | ||
"eslint": "7.11.0", | ||
"eslint-config-prettier": "6.12.0", | ||
"eslint-config-prettier": "6.13.0", | ||
"eslint-plugin-prettier": "3.1.4", | ||
@@ -30,12 +30,12 @@ "eslint-plugin-typescript-sort-keys": "1.5.0", | ||
"husky": "4.3.0", | ||
"jasmine": "3.6.1", | ||
"lint-staged": "10.4.0", | ||
"jasmine": "3.6.2", | ||
"lint-staged": "10.4.2", | ||
"nock": "13.0.4", | ||
"nyc": "15.1.0", | ||
"prettier": "2.1.2", | ||
"pretty-quick": "3.0.2", | ||
"pretty-quick": "3.1.0", | ||
"rimraf": "3.0.2", | ||
"ts-node": "9.0.0", | ||
"typedoc": "0.19.2", | ||
"typedoc-plugin-markdown": "3.0.8", | ||
"typedoc-plugin-markdown": "3.0.10", | ||
"typescript": "4.0.3" | ||
@@ -107,3 +107,3 @@ }, | ||
}, | ||
"version": "2.11.0" | ||
"version": "2.12.0" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
397082
4830