diff --git a/docs/endpointFunctionList.md b/docs/endpointFunctionList.md index 91d34e34..81e5ba01 100644 --- a/docs/endpointFunctionList.md +++ b/docs/endpointFunctionList.md @@ -76,7 +76,7 @@ This table includes all endpoints from the official Exchange API docs and corres | [cancelOrder()](https://github.com/sieblyio/binance/blob/master/src/main-client.ts#L1007) | :closed_lock_with_key: | DELETE | `api/v3/order` | | [cancelAllSymbolOrders()](https://github.com/sieblyio/binance/blob/master/src/main-client.ts#L1011) | :closed_lock_with_key: | DELETE | `api/v3/openOrders` | | [replaceOrder()](https://github.com/sieblyio/binance/blob/master/src/main-client.ts#L1017) | :closed_lock_with_key: | POST | `api/v3/order/cancelReplace` | -| [amendOrderKeepPriority()](https://github.com/sieblyio/binance/blob/master/src/main-client.ts#L1031) | :closed_lock_with_key: | PUT | `fapi/v1/order/amend/keepPriority` | +| [amendOrderKeepPriority()](https://github.com/sieblyio/binance/blob/master/src/main-client.ts#L1031) | :closed_lock_with_key: | PUT | `api/v3/order/amend/keepPriority` | | [getOpenOrders()](https://github.com/sieblyio/binance/blob/master/src/main-client.ts#L1038) | :closed_lock_with_key: | GET | `api/v3/openOrders` | | [getAllOrders()](https://github.com/sieblyio/binance/blob/master/src/main-client.ts#L1042) | :closed_lock_with_key: | GET | `api/v3/allOrders` | | [submitNewOCO()](https://github.com/sieblyio/binance/blob/master/src/main-client.ts#L1049) | :closed_lock_with_key: | POST | `api/v3/order/oco` | diff --git a/src/main-client.ts b/src/main-client.ts index 8361e753..20054e35 100644 --- a/src/main-client.ts +++ b/src/main-client.ts @@ -1026,13 +1026,13 @@ export class MainClient extends BaseRestClient { /** * Reduce the quantity of an existing open order while keeping its priority in the order book. * The new quantity must be less than the current quantity. - * https://binance-docs.github.io/apidocs/futures/en/#order-amend-keep-priority-trade + * https://binance-docs.github.io/apidocs/spot/en/#order-amend-keep-priority-trade */ amendOrderKeepPriority( params: AmendKeepPriorityParams, ): Promise { this.validateOrderId(params, 'newClientOrderId'); - return this.putPrivate('fapi/v1/order/amend/keepPriority', params); + return this.putPrivate('api/v3/order/amend/keepPriority', params); } getOpenOrders(params?: { symbol?: string }): Promise { diff --git a/test/spot/amendKeepPriority.test.ts b/test/spot/amendKeepPriority.test.ts new file mode 100644 index 00000000..4a35d2ae --- /dev/null +++ b/test/spot/amendKeepPriority.test.ts @@ -0,0 +1,28 @@ +import { MainClient } from '../../src/index'; + +describe('amendOrderKeepPriority()', () => { + it('sends the request to the spot endpoint', async () => { + const api = new MainClient({ + api_key: 'test-api-key', + api_secret: 'test-api-secret', + }); + const putPrivate = jest + .spyOn(api, 'putPrivate') + .mockResolvedValue({} as any); + + await api.amendOrderKeepPriority({ + symbol: 'BTCUSDT', + orderId: 4000000024153137, + newQty: '0.5', + }); + + expect(putPrivate).toHaveBeenCalledWith( + 'api/v3/order/amend/keepPriority', + expect.objectContaining({ + symbol: 'BTCUSDT', + orderId: 4000000024153137, + newQty: '0.5', + }), + ); + }); +});