Skip to content

Commit a4098e9

Browse files
committed
chore(): bump node build version to node LTS, fix export, add simple portfolio margin nodejs examples
1 parent 8159c37 commit a4098e9

File tree

8 files changed

+527
-50
lines changed

8 files changed

+527
-50
lines changed

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v20.9.0
1+
v22.11.0
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { PortfolioClient } from '../src/index';
2+
3+
// or
4+
// import { PortfolioClient } from 'binance';
5+
6+
const key = process.env.API_KEY_COM || 'APIKEY';
7+
const secret = process.env.API_SECRET_COM || 'APISECRET';
8+
9+
const client = new PortfolioClient({
10+
api_key: key,
11+
api_secret: secret,
12+
beautifyResponses: true,
13+
});
14+
15+
(async () => {
16+
try {
17+
const res = await client.getBalance();
18+
console.log('res', res);
19+
20+
const listenKey = await client.getPMUserDataListenKey();
21+
console.log('listen key res: ', listenKey);
22+
23+
// const newOrderRes = await client.submitNewUMOrder({
24+
// symbol: 'BTCUSDT',
25+
// side: 'BUY',
26+
// type: 'MARKET',
27+
// quantity: '10',
28+
// });
29+
30+
// console.log('new order res: ', newOrderRes);
31+
32+
// console.log('merged: ', arrayData);
33+
} catch (e) {
34+
console.error('request failed: ', e);
35+
}
36+
})();
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { PortfolioClient } from '../src/index';
2+
3+
// or
4+
// import { USDMClient } from 'binance';
5+
6+
const client = new PortfolioClient({
7+
beautifyResponses: true,
8+
});
9+
10+
(async () => {
11+
try {
12+
// const serverTime = await client.getServerTime();
13+
// console.log('serverTime: ', serverTime);
14+
15+
const res = await client.testConnectivity();
16+
console.log('res', res);
17+
} catch (e) {
18+
console.error('request failed: ', e);
19+
}
20+
})();

0 commit comments

Comments
 (0)