forked from SteveFromTheOffice/probit-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProbit.js
54 lines (47 loc) · 1.8 KB
/
Probit.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const EventEmitter = require("./EventEmitter.js");
const ProbitRest = require("./ProbitRest.js");
const ProbitSocket = require("./ProbitSocket.js");
class Probit extends EventEmitter {
constructor(key, secret, demo = false) {
super();
this.socket = new ProbitSocket(key, secret, demo);
this.socket.on('balance', (balance) => {
this.emit('balance', balance);
});
this.socket.on('ticker', (ticker) => {
this.emit('ticker', ticker);
});
this.socket.on('trade', (trade) => {
this.emit('trade', trade);
});
this.socket.on('order', (order) => {
this.emit('order', order);
});
this.socket.on('orderbook', (orderbook) => {
this.emit('orderbook', orderbook);
});
this.socket.on('orderbookL0', (orderbook) => {
this.emit('orderbookL0', orderbook);
});
this.socket.on('orderbookL1', (orderbook) => {
this.emit('orderbookL1', orderbook);
});
this.socket.on('orderbookL2', (orderbook) => {
this.emit('orderbookL2', orderbook);
});
this.socket.on('orderbookL3', (orderbook) => {
this.emit('orderbookL3', orderbook);
});
this.socket.on('orderbookL4', (orderbook) => {
this.emit('orderbookL4', orderbook);
});
this.socket.on('tradehistory', (tradehistory) => {
this.emit('tradehistory', tradehistory);
});
this.rest = new ProbitRest(key, secret, demo);
this.rest.on('ready', () => {
this.emit('ready');
});
}
}
module.exports = Probit;