forked from zgsrc/ibjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsystem.js
28 lines (22 loc) · 878 Bytes
/
system.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
"use strict";
const sdk = require("../index");
sdk.open({ port: 4001 }, (err, session) => {
if (err) {
console.log(err);
}
else {
// IB news bulletins (margin calls, special labelling, etc)
let bulletins = session.bulletins;
session.on("bulletin", data => console.log(data));
// Market data farm connections
let connectivity = session.connectivity;
session.on("connectivity", data => console.log(data));
// Access display groups
session.displayGroups.forEach(group => console.log(group.contract));
session.on("displayGroupUpdated", group => console.log(group.contract));
// Update display group
session.displayGroups[0].update(8314);
// Close connection and fire 'disconnect' event
setTimeout(() => session.close(), 2500);
}
});