Skip to content

Commit 19af361

Browse files
committed
chore(): update Readme to include Portfolio Margin
1 parent 7ef27c6 commit 19af361

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Updated & performant JavaScript & Node.js SDK for the Binance REST APIs and WebS
6969
- [REST Main Client](#rest-main-client)
7070
- [REST USD-M Futures](#rest-usd-m-futures)
7171
- [REST COIN-M Futures](#rest-coin-m-futures)
72+
- [REST Portfolio Margin](#rest-portfolio-margin)
7273
- [WebSockets](#websockets)
7374
- [WebSocket Consumers](#websocket-consumers)
7475
- [WebSocket API](#websocket-api)
@@ -306,6 +307,52 @@ client
306307

307308
See [coinm-client.ts](./src/coinm-client.ts) for further information.
308309

310+
### REST Portfolio Margin
311+
312+
Start by importing the Portfolio client. API credentials are optional, though an error is thrown when attempting any private API calls without credentials.
313+
314+
```javascript
315+
import { PortfolioClient } from 'binance';
316+
317+
// or, if you prefer `require()`:
318+
// const { PortfolioClient } = require('binance');
319+
320+
const API_KEY = 'xxx';
321+
const API_SECRET = 'yyy';
322+
323+
const client = new PortfolioClient({
324+
api_key: API_KEY,
325+
api_secret: API_SECRET,
326+
// Connect to testnet environment
327+
// testnet: true,
328+
});
329+
330+
client
331+
.getBalance()
332+
.then((result) => {
333+
console.log('getBalance result: ', result);
334+
})
335+
.catch((err) => {
336+
console.error('getBalance error: ', err);
337+
});
338+
339+
client
340+
.submitNewUMOrder({
341+
side: 'SELL',
342+
symbol: 'BTCUSDT',
343+
type: 'MARKET',
344+
quantity: 0.001,
345+
})
346+
.then((result) => {
347+
console.log('submitNewUMOrder result: ', result);
348+
})
349+
.catch((err) => {
350+
console.error('submitNewUMOrder error: ', err);
351+
});
352+
```
353+
354+
See [portfolio-client.ts](./src/portfolio-client.ts) for further information.
355+
309356
## WebSockets
310357

311358
### WebSocket Consumers
@@ -424,6 +471,7 @@ wsClient.subscribeSpotUserDataStream();
424471
wsClient.subscribeMarginUserDataStream();
425472
wsClient.subscribeIsolatedMarginUserDataStream('BTCUSDT');
426473
wsClient.subscribeUsdFuturesUserDataStream();
474+
wsClient.subscribePortfolioMarginUserDataStream();
427475
```
428476
429477
See [websocket-client.ts](./src/websocket-client.ts) for further information. Also see [ws-userdata.ts](./examples/ws-userdata.ts) for user data examples.

0 commit comments

Comments
 (0)