Skip to content

Commit 33f920c

Browse files
committed
feat: add new API endpoints and examples for currency conversion and max buy/sell amount
- Added `getConvertCurrencyPair` and `getMaxBuySellAmount` endpoints to the documentation. - Created example scripts for calling the new endpoints using the OKX API client.
1 parent ffe904e commit 33f920c

3 files changed

Lines changed: 48 additions & 0 deletions

File tree

docs/endpointFunctionList.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ This table includes all endpoints from the official Exchange API docs and corres
6464
| [setSettleCurrency()](https://github.com/tiagosiebler/okx-api/blob/master/src/rest-client.ts#L528) | :closed_lock_with_key: | POST | `/api/v5/account/set-settle-currency` |
6565
| [setFeeType()](https://github.com/tiagosiebler/okx-api/blob/master/src/rest-client.ts#L534) | :closed_lock_with_key: | POST | `/api/v5/account/set-fee-type` |
6666
| [setLeverage()](https://github.com/tiagosiebler/okx-api/blob/master/src/rest-client.ts#L538) | :closed_lock_with_key: | POST | `/api/v5/account/set-leverage` |
67+
| [getMaxBuySellAmount()](https://github.com/tiagosiebler/okx-api/blob/master/src/rest-client.ts#L543) | :closed_lock_with_key: | GET | `/api/v5/account/max-size` |
6768
| [getMaxAvailableTradableAmount()](https://github.com/tiagosiebler/okx-api/blob/master/src/rest-client.ts#L556) | :closed_lock_with_key: | GET | `/api/v5/account/max-avail-size` |
6869
| [changePositionMargin()](https://github.com/tiagosiebler/okx-api/blob/master/src/rest-client.ts#L566) | :closed_lock_with_key: | POST | `/api/v5/account/position/margin-balance` |
6970
| [getLeverage()](https://github.com/tiagosiebler/okx-api/blob/master/src/rest-client.ts#L572) | :closed_lock_with_key: | GET | `/api/v5/account/leverage-info` |
@@ -345,6 +346,7 @@ This table includes all endpoints from the official Exchange API docs and corres
345346
| [applyForMonthlyStatement()](https://github.com/tiagosiebler/okx-api/blob/master/src/rest-client.ts#L2569) | :closed_lock_with_key: | POST | `/api/v5/asset/monthly-statement` |
346347
| [getMonthlyStatement()](https://github.com/tiagosiebler/okx-api/blob/master/src/rest-client.ts#L2573) | :closed_lock_with_key: | GET | `/api/v5/asset/monthly-statement` |
347348
| [getConvertCurrencies()](https://github.com/tiagosiebler/okx-api/blob/master/src/rest-client.ts#L2577) | :closed_lock_with_key: | GET | `/api/v5/asset/convert/currencies` |
349+
| [getConvertCurrencyPair()](https://github.com/tiagosiebler/okx-api/blob/master/src/rest-client.ts#L2581) | :closed_lock_with_key: | GET | `/api/v5/asset/convert/currency-pair` |
348350
| [estimateConvertQuote()](https://github.com/tiagosiebler/okx-api/blob/master/src/rest-client.ts#L2590) | :closed_lock_with_key: | POST | `/api/v5/asset/convert/estimate-quote` |
349351
| [convertTrade()](https://github.com/tiagosiebler/okx-api/blob/master/src/rest-client.ts#L2594) | :closed_lock_with_key: | POST | `/api/v5/asset/convert/trade` |
350352
| [getConvertHistory()](https://github.com/tiagosiebler/okx-api/blob/master/src/rest-client.ts#L2598) | :closed_lock_with_key: | GET | `/api/v5/asset/convert/history` |
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { RestClient } from 'okx-api';
2+
// or, if require is preferred:
3+
// const { RestClient } = require('okx-api');
4+
5+
// This example shows how to call this OKX API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "okx-api" for OKX exchange
6+
// This OKX API SDK is available on npm via "npm install okx-api"
7+
// ENDPOINT: /api/v5/asset/convert/currency-pair
8+
// METHOD: GET
9+
// PUBLIC: NO
10+
11+
const client = new RestClient({
12+
apiKey: 'apiKeyHere',
13+
apiSecret: 'apiSecretHere',
14+
apiPass: 'apiPassHere',
15+
});
16+
17+
client.getConvertCurrencyPair(params)
18+
.then((response) => {
19+
console.log(response);
20+
})
21+
.catch((error) => {
22+
console.error(error);
23+
});
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { RestClient } from 'okx-api';
2+
// or, if require is preferred:
3+
// const { RestClient } = require('okx-api');
4+
5+
// This example shows how to call this OKX API endpoint with either node.js, javascript (js) or typescript (ts) with the npm module "okx-api" for OKX exchange
6+
// This OKX API SDK is available on npm via "npm install okx-api"
7+
// ENDPOINT: /api/v5/account/max-size
8+
// METHOD: GET
9+
// PUBLIC: NO
10+
11+
const client = new RestClient({
12+
apiKey: 'apiKeyHere',
13+
apiSecret: 'apiSecretHere',
14+
apiPass: 'apiPassHere',
15+
});
16+
17+
client.getMaxBuySellAmount(params)
18+
.then((response) => {
19+
console.log(response);
20+
})
21+
.catch((error) => {
22+
console.error(error);
23+
});

0 commit comments

Comments
 (0)