Skip to content
This repository was archived by the owner on Oct 30, 2023. It is now read-only.

Commit 019c97f

Browse files
author
Jon Eyrick
authored
Allow instances and singletons (Thanks bmino!!) ((BREAKING))
Allow Instances and Singletons
2 parents 72c959e + a04fcaa commit 019c97f

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,27 @@ npm install node-binance-api --save
2020

2121
#### Getting started
2222
```javascript
23-
const Binance = require('node-binance-api');
24-
const binance = new Binance().options({
23+
const binance = require('node-binance-api').options({
2524
APIKEY: '<key>',
2625
APISECRET: '<secret>',
2726
useServerTime: true, // If you get timestamp errors, synchronize to server time at startup
2827
test: true // If you want to use sandbox mode where orders are simulated
2928
});
3029
```
3130

31+
#### Instantiating Multiple Instances
32+
```javascript
33+
const Binance = require('node-binance-api');
34+
35+
const instance1 = new Binance().options({
36+
// ...
37+
});
38+
39+
const instance2 = new Binance().options({
40+
// ...
41+
});
42+
```
43+
3244
#### Getting latest price of a symbol
3345
```js
3446
binance.prices('BNBBTC', (error, ticker) => {

node-binance-api.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
*/
1414
let api = function Binance() {
1515
'use strict';
16-
if (!(this instanceof Binance)) {
17-
return new Binance();
18-
}
1916
const WebSocket = require('ws');
2017
const request = require('request');
2118
const crypto = require('crypto');

0 commit comments

Comments
 (0)