Skip to content

Commit 4cdb498

Browse files
authored
Merge pull request #144 from JJ-Cro/update02102025
feat(v3.0.7): Expand RFQ types and settle/fee endpoints
2 parents f4cd660 + a0e89af commit 4cdb498

File tree

12 files changed

+544
-366
lines changed

12 files changed

+544
-366
lines changed

docs/endpointFunctionList.md

Lines changed: 356 additions & 354 deletions
Large diffs are not rendered by default.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const { RestClient } = require('okx-api');
2+
3+
// 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
4+
// This OKX API SDK is available on npm via "npm install okx-api"
5+
// ENDPOINT: /api/v5/account/set-fee-type
6+
// METHOD: POST
7+
// PUBLIC: NO
8+
9+
const client = new RestClient({
10+
apiKey: 'apiKeyHere',
11+
apiSecret: 'apiSecretHere',
12+
apiPass: 'apiPassHere',
13+
});
14+
15+
client.setFeeType(params)
16+
.then((response) => {
17+
console.log(response);
18+
})
19+
.catch((error) => {
20+
console.error(error);
21+
});
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const { RestClient } = require('okx-api');
2+
3+
// 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
4+
// This OKX API SDK is available on npm via "npm install okx-api"
5+
// ENDPOINT: /api/v5/account/set-settle-currency
6+
// METHOD: POST
7+
// PUBLIC: NO
8+
9+
const client = new RestClient({
10+
apiKey: 'apiKeyHere',
11+
apiSecret: 'apiSecretHere',
12+
apiPass: 'apiPassHere',
13+
});
14+
15+
client.setSettleCurrency(params)
16+
.then((response) => {
17+
console.log(response);
18+
})
19+
.catch((error) => {
20+
console.error(error);
21+
});

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "okx-api",
3-
"version": "3.0.6",
3+
"version": "3.0.7",
44
"description": "Complete Node.js SDK for OKX's REST APIs and WebSockets, with TypeScript & end-to-end tests",
55
"scripts": {
66
"test": "jest",

src/rest-client.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ import {
1313
GetVIPLoanOrderListRequest,
1414
PositionBuilderRequest,
1515
QuickMarginBorrowRepayRequest,
16+
SetFeeTypeRequest,
1617
SetLeverageRequest,
1718
SetMMPConfigRequest,
19+
SetSettleCurrencyRequest,
1820
SubmitFixedLoanBorrowingOrderRequest,
1921
UpdateFixedLoanBorrowingOrderRequest,
2022
WithdrawalHistoryRequest,
@@ -165,7 +167,9 @@ import {
165167
MMPConfig,
166168
QuickMarginBorrowRepayRecord,
167169
QuickMarginBorrowRepayResult,
170+
SetFeeTypeResult,
168171
SetMMPConfigResult,
172+
SetSettleCurrencyResult,
169173
VIPInterest,
170174
VIPLoanOrder,
171175
VIPLoanOrderDetail,
@@ -175,6 +179,7 @@ import {
175179
BlockMakerInstrumentSettings,
176180
BlockMMPConfig,
177181
BlockRFQResult,
182+
BlockTradeResult,
178183
CancelBlockQuoteResult,
179184
CancelBlockRFQResult,
180185
CreateBlockQuoteResult,
@@ -467,6 +472,16 @@ export class RestClient extends BaseRestClient {
467472
return this.postPrivate('/api/v5/account/set-position-mode', params);
468473
}
469474

475+
setSettleCurrency(
476+
params: SetSettleCurrencyRequest,
477+
): Promise<SetSettleCurrencyResult[]> {
478+
return this.postPrivate('/api/v5/account/set-settle-currency', params);
479+
}
480+
481+
setFeeType(params: SetFeeTypeRequest): Promise<SetFeeTypeResult[]> {
482+
return this.postPrivate('/api/v5/account/set-fee-type', params);
483+
}
484+
470485
setLeverage(params: SetLeverageRequest): Promise<AccountLeverageResult[]> {
471486
return this.postPrivate('/api/v5/account/set-leverage', params);
472487
}
@@ -1920,11 +1935,11 @@ export class RestClient extends BaseRestClient {
19201935
return this.getPrivate('/api/v5/rfq/quotes', params);
19211936
}
19221937

1923-
getBlockTrades(params?: any): Promise<any[]> {
1938+
getBlockTrades(params?: any): Promise<BlockTradeResult[]> {
19241939
return this.getPrivate('/api/v5/rfq/trades', params);
19251940
}
19261941

1927-
getPublicRFQBlockTrades(params?: any): Promise<any[]> {
1942+
getPublicRFQBlockTrades(params?: any): Promise<PublicBlockTrade[]> {
19281943
return this.get('/api/v5/rfq/public-trades', params);
19291944
}
19301945

src/types/rest/request/account.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,11 @@ export interface SetMMPConfigRequest {
165165
frozenInterval: string;
166166
qtyLimit: string;
167167
}
168+
169+
export interface SetSettleCurrencyRequest {
170+
settleCcy: string;
171+
}
172+
173+
export interface SetFeeTypeRequest {
174+
feeType: '0' | '1';
175+
}

src/types/rest/request/block-trading.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
11
import { OrderSide, RFQLeg } from '../shared.js';
2+
export interface AccountAllocationLeg {
3+
sz: string;
4+
instId: string;
5+
tdMode?: string;
6+
ccy?: string;
7+
posSide?: string;
8+
}
9+
10+
export interface AccountAllocation {
11+
acct: string;
12+
legs: AccountAllocationLeg[];
13+
}
214

315
export interface CreateBlockRFQRequest {
416
counterparties: string[];
517
anonymous?: boolean;
618
clRfqId?: string;
19+
tag?: string;
20+
allowPartialExecution?: boolean;
721
legs: RFQLeg[];
22+
acctAlloc?: AccountAllocation[];
823
}
924

1025
export interface CancelBlockRFQRequest {

src/types/rest/request/trade.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,9 @@ export interface AmendAlgoOrderRequest {
120120
}
121121

122122
export interface CancelAlgoOrderRequest {
123-
algoId: string;
124123
instId: string;
124+
algoId?: string;
125+
algoClOrdId?: string;
125126
}
126127

127128
export interface ClosePositionRequest {

src/types/rest/response/private-account.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export interface AccountBalance {
5555
uTime: string;
5656
spotCopyTradingEq: string;
5757
upl: string;
58+
frpType?: string;
5859
}
5960

6061
export interface AccountPosition {
@@ -169,6 +170,8 @@ export interface AccountBill {
169170
to: string;
170171
ts: string;
171172
type: string;
173+
earnAmt?: string;
174+
earnApr?: string;
172175
}
173176

174177
export interface AccountHistoryBill {
@@ -201,6 +204,9 @@ export interface AccountConfiguration {
201204
discountType: '0' | '1';
202205
enableSpotBorrow: boolean;
203206
spotBorrowAutoRepay: boolean;
207+
feeType: string;
208+
settleCcy: string;
209+
settleCcyList: string[];
204210
}
205211

206212
export interface AccountPositionModeResult {
@@ -493,3 +499,11 @@ export interface GetCollateralAssetsResult {
493499
ccy: string;
494500
collateralEnabled: boolean;
495501
}
502+
503+
export interface SetSettleCurrencyResult {
504+
settleCcy: string;
505+
}
506+
507+
export interface SetFeeTypeResult {
508+
feeType: string;
509+
}

0 commit comments

Comments
 (0)