Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 8b60942

Browse files
committed
feat: update get all accounts balance reset
1 parent 599f82c commit 8b60942

File tree

9 files changed

+57
-13
lines changed

9 files changed

+57
-13
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,12 @@ const futuresSDK = new KuCoinFutures({
7575
#### Get Account Overview
7676

7777
```js
78+
// Get Account Detail
7879
futuresSDK.futuresAccount('XBT', console.log);
80+
81+
// Get All Accounts Balance
82+
futuresSDK.futuresAccountOverview('XBT', console.log);
83+
7984
```
8085

8186
#### Get Transaction History

example/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ futuresSDK.futuresStatus(console.log);
1212

1313
// futuresSDK.futuresAccount('USDT', console.log);
1414

15+
futuresSDK.futuresAccountOverview('USDT', console.log);
16+
1517
// futuresSDK.futuresBuy(
1618
// {
1719
// symbol: 'ETHUSDTM',

lib/index.d.ts

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default class KuCoinFutures {
1111
});
1212
private makeRequest;
1313
futuresAccount: (currency?: string, callback?: Function) => Promise<any>;
14+
futuresAccountOverview: (currency?: string, callback?: Function) => Promise<any>;
1415
/**
1516
* search to transaction history
1617
* @param params.type string -- 'RealisedPNL' | 'Deposit' | 'Withdrawal' | 'TransferIn' | 'TransferOut'
@@ -212,18 +213,28 @@ export default class KuCoinFutures {
212213
futuresGetCacheSocketInstance: (isPrivate: boolean) => Promise<WebSocketClient>;
213214
futuresSocketSubscribe: (topic: string, callback?: Callback, isPrivate?: boolean, strict?: boolean) => Promise<false | undefined>;
214215
get websocket(): {
215-
tickerV2: (symbols: string | [], callback?: (d: any) => void) => Promise<false | (false | undefined)[] | undefined>;
216-
ticker: (symbols: string | [], callback?: (d: any) => void) => Promise<false | (false | undefined)[] | undefined>;
217-
level2: (symbols: string | [], callback?: (d: any) => void) => Promise<false | (false | undefined)[] | undefined>;
218-
execution: (symbols: string | [], callback?: (d: any) => void) => Promise<false | (false | undefined)[] | undefined>;
219-
level2Depth5: (symbols: string | [], callback?: (d: any) => void) => Promise<false | (false | undefined)[] | undefined>;
220-
level2Depth50: (symbols: string | [], callback?: (d: any) => void) => Promise<false | (false | undefined)[] | undefined>;
221-
instrument: (symbols: string | [], callback?: (d: any) => void) => Promise<false | (false | undefined)[] | undefined>;
216+
tickerV2: (symbols: string | [
217+
], callback?: (d: any) => void) => Promise<false | (false | undefined)[] | undefined>;
218+
ticker: (symbols: string | [
219+
], callback?: (d: any) => void) => Promise<false | (false | undefined)[] | undefined>;
220+
level2: (symbols: string | [
221+
], callback?: (d: any) => void) => Promise<false | (false | undefined)[] | undefined>;
222+
execution: (symbols: string | [
223+
], callback?: (d: any) => void) => Promise<false | (false | undefined)[] | undefined>;
224+
level2Depth5: (symbols: string | [
225+
], callback?: (d: any) => void) => Promise<false | (false | undefined)[] | undefined>;
226+
level2Depth50: (symbols: string | [
227+
], callback?: (d: any) => void) => Promise<false | (false | undefined)[] | undefined>;
228+
instrument: (symbols: string | [
229+
], callback?: (d: any) => void) => Promise<false | (false | undefined)[] | undefined>;
222230
announcement: (callback?: (d: any) => void) => Promise<false | undefined>;
223-
snapshot: (symbols: string | [], callback?: (d: any) => void) => Promise<false | (false | undefined)[] | undefined>;
224-
tradeOrders: (symbols: string | [], callback?: (d: any) => void) => Promise<false | (false | undefined)[] | undefined>;
231+
snapshot: (symbols: string | [
232+
], callback?: (d: any) => void) => Promise<false | (false | undefined)[] | undefined>;
233+
tradeOrders: (symbols: string | [
234+
], callback?: (d: any) => void) => Promise<false | (false | undefined)[] | undefined>;
225235
advancedOrders: (callback?: (d: any) => void) => Promise<false | undefined>;
226236
wallet: (callback?: (d: any) => void) => Promise<false | undefined>;
227-
position: (symbols: string | [], callback?: (d: any) => void) => Promise<false | (false | undefined)[] | undefined>;
237+
position: (symbols: string | [
238+
], callback?: (d: any) => void) => Promise<false | (false | undefined)[] | undefined>;
228239
};
229240
}

lib/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,19 @@ var KuCoinFutures = /** @class */ (function () {
113113
});
114114
});
115115
};
116+
this.futuresAccountOverview = function (currency, callback) {
117+
if (currency === void 0) { currency = 'XBT'; }
118+
return __awaiter(_this_1, void 0, void 0, function () {
119+
return __generator(this, function (_a) {
120+
return [2 /*return*/, this.makeRequest({
121+
body: { currency: currency },
122+
method: constants_1.GET,
123+
endpoint: resetAPI_1.FUTURES_ACCOUNT_OVERVIEW_ALL_EP,
124+
callback: callback
125+
})];
126+
});
127+
});
128+
};
116129
/**
117130
* search to transaction history
118131
* @param params.type string -- 'RealisedPNL' | 'Deposit' | 'Withdrawal' | 'TransferIn' | 'TransferOut'

lib/resetAPI/constants.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export declare const FUTURES_ACCOUNT_OVERVIEW_EP = "/api/v1/account-overview";
2+
export declare const FUTURES_ACCOUNT_OVERVIEW_ALL_EP = "/api/v1/account-overview-all";
23
export declare const FUTURES_TRANSACTION_HISTORY_EP = "/api/v1/transaction-history";
34
export declare const FUTURES_SUB_API_EP = "/api/v1/sub/api-key";
45
export declare const FUTURES_UPDATE_SUB_API_EP = "/api/v1/sub/api-key/update";

lib/resetAPI/constants.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
3-
exports.FUTURES_KLINE_EP = exports.FUTURES_SERVICE_STATUS_EP = exports.FUTURES_TIMESTAMP_EP = exports.FUTURES_FUNDING_RATE_EP = exports.FUTURES_PREMIUM_EP = exports.FUTURES_MARK_PRICE_EP = exports.FUTURES_INDEX_EP = exports.FUTURES_INTEREST_EP = exports.FUTURES_TRADE_HISTORY_EP = exports.FUTURES_LEVEL2_100_EP = exports.FUTURES_LEVEL2_20_EP = exports.FUTURES_LEVEL2_EP = exports.FUTURES_TICKER_EP = exports.FUTURES_CONTRACTS_DETAIL_EP = exports.FUTURES_CONTRACTS_ACTIVE_EP = exports.FUTURES_FUNDING_HISTORY_EP = exports.FUTURES_CHANGE_RISK_LIMIT_EP = exports.FUTURES_RISK_LIMIT_EP = exports.FUTURES_POSITION_MARGIN_EP = exports.FUTURES_POSITION_AUTO_DEPOSIT_STATUS_EP = exports.FUTURES_POSITIONS_EP = exports.FUTURES_POSITION_EP = exports.FUTURES_TOTAL_OPEN_ORDERS_MARGIN_EP = exports.FUTURES_RECENT_FILLS_EP = exports.FUTURES_FILLS_EP = exports.FUTURES_RECENT_DONE_ORDERS_EP = exports.FUTURES_STOP_ORDER_EP = exports.FUTURES_ORDER_EP = exports.FUTURES_TRANSFER_LIST_EP = exports.FUTURES_TRANSFER_IN_EP = exports.FUTURES_TRANSFER_OUT_EP = exports.FUTURES_UPDATE_SUB_API_EP = exports.FUTURES_SUB_API_EP = exports.FUTURES_TRANSACTION_HISTORY_EP = exports.FUTURES_ACCOUNT_OVERVIEW_EP = void 0;
3+
exports.FUTURES_KLINE_EP = exports.FUTURES_SERVICE_STATUS_EP = exports.FUTURES_TIMESTAMP_EP = exports.FUTURES_FUNDING_RATE_EP = exports.FUTURES_PREMIUM_EP = exports.FUTURES_MARK_PRICE_EP = exports.FUTURES_INDEX_EP = exports.FUTURES_INTEREST_EP = exports.FUTURES_TRADE_HISTORY_EP = exports.FUTURES_LEVEL2_100_EP = exports.FUTURES_LEVEL2_20_EP = exports.FUTURES_LEVEL2_EP = exports.FUTURES_TICKER_EP = exports.FUTURES_CONTRACTS_DETAIL_EP = exports.FUTURES_CONTRACTS_ACTIVE_EP = exports.FUTURES_FUNDING_HISTORY_EP = exports.FUTURES_CHANGE_RISK_LIMIT_EP = exports.FUTURES_RISK_LIMIT_EP = exports.FUTURES_POSITION_MARGIN_EP = exports.FUTURES_POSITION_AUTO_DEPOSIT_STATUS_EP = exports.FUTURES_POSITIONS_EP = exports.FUTURES_POSITION_EP = exports.FUTURES_TOTAL_OPEN_ORDERS_MARGIN_EP = exports.FUTURES_RECENT_FILLS_EP = exports.FUTURES_FILLS_EP = exports.FUTURES_RECENT_DONE_ORDERS_EP = exports.FUTURES_STOP_ORDER_EP = exports.FUTURES_ORDER_EP = exports.FUTURES_TRANSFER_LIST_EP = exports.FUTURES_TRANSFER_IN_EP = exports.FUTURES_TRANSFER_OUT_EP = exports.FUTURES_UPDATE_SUB_API_EP = exports.FUTURES_SUB_API_EP = exports.FUTURES_TRANSACTION_HISTORY_EP = exports.FUTURES_ACCOUNT_OVERVIEW_ALL_EP = exports.FUTURES_ACCOUNT_OVERVIEW_EP = void 0;
44
// account endpoint
55
exports.FUTURES_ACCOUNT_OVERVIEW_EP = '/api/v1/account-overview';
6+
exports.FUTURES_ACCOUNT_OVERVIEW_ALL_EP = '/api/v1/account-overview-all';
67
exports.FUTURES_TRANSACTION_HISTORY_EP = '/api/v1/transaction-history';
78
exports.FUTURES_SUB_API_EP = '/api/v1/sub/api-key';
89
exports.FUTURES_UPDATE_SUB_API_EP = '/api/v1/sub/api-key/update';

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "kucoin-futures-node-sdk",
3-
"version": "2.0.0",
3+
"version": "2.0.2",
44
"description": "KuCoin Futures API SDK for Node.js language",
55
"main": "lib/index.js",
66
"license": "MIT",

src/index.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ import {
4040
FUTURES_UPDATE_SUB_API_EP,
4141
FUTURES_TRANSFER_OUT_EP,
4242
FUTURES_TRANSFER_IN_EP,
43-
FUTURES_TRANSFER_LIST_EP
43+
FUTURES_TRANSFER_LIST_EP,
44+
FUTURES_ACCOUNT_OVERVIEW_ALL_EP
4445
} from './resetAPI';
4546
import {
4647
PUBLIC_BULLET_EP,
@@ -127,6 +128,15 @@ export default class KuCoinFutures {
127128
});
128129
};
129130

131+
futuresAccountOverview = async (currency: string = 'XBT', callback?: Function) => {
132+
return this.makeRequest({
133+
body: { currency },
134+
method: GET,
135+
endpoint: FUTURES_ACCOUNT_OVERVIEW_ALL_EP,
136+
callback
137+
});
138+
};
139+
130140
/**
131141
* search to transaction history
132142
* @param params.type string -- 'RealisedPNL' | 'Deposit' | 'Withdrawal' | 'TransferIn' | 'TransferOut'

src/resetAPI/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// account endpoint
22
export const FUTURES_ACCOUNT_OVERVIEW_EP = '/api/v1/account-overview';
3+
export const FUTURES_ACCOUNT_OVERVIEW_ALL_EP = '/api/v1/account-overview-all';
34
export const FUTURES_TRANSACTION_HISTORY_EP = '/api/v1/transaction-history';
45
export const FUTURES_SUB_API_EP = '/api/v1/sub/api-key';
56
export const FUTURES_UPDATE_SUB_API_EP = '/api/v1/sub/api-key/update';

0 commit comments

Comments
 (0)