Commit fef538f Vitaliy Stoliarov
committed Jul 6, 2021
1 parent e1c276d commit fef538f Copy full SHA for fef538f
File tree 1 file changed +15
-12
lines changed
1 file changed +15
-12
lines changed Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
3
const { Order } = require ( 'bfx-api-node-models' )
4
- const runExample = require ( '../util/run_example' )
4
+ const { args : { apiKey, apiSecret } , debug } = require ( '../util/setup' )
5
+ const WSv2 = require ( '../../lib/transports/ws2' )
5
6
6
7
const oA = new Order ( {
7
8
symbol : 'tBTCUSD' ,
@@ -24,16 +25,16 @@ const oC = new Order({
24
25
type : 'EXCHANGE LIMIT'
25
26
} )
26
27
27
- module . exports = runExample ( {
28
- name : 'ws2-ox-multi' ,
29
- ws : {
30
- env : true ,
31
- connect : true ,
32
- auth : true ,
33
- transform : true ,
34
- keepOpen : true
35
- }
36
- } , async ( { ws , debug } ) => {
28
+ async function execute ( ) {
29
+ const ws = new WSv2 ( {
30
+ apiKey ,
31
+ apiSecret ,
32
+ transform : true
33
+ } )
34
+ ws . on ( 'error' , e => debug ( 'WSv2 error: %s' , e . message | e ) )
35
+ await ws . open ( )
36
+ await ws . auth ( )
37
+
37
38
oA . registerListeners ( ws )
38
39
oB . registerListeners ( ws )
39
40
oC . registerListeners ( ws )
@@ -78,4 +79,6 @@ module.exports = runExample({
78
79
] )
79
80
80
81
debug ( 'sent ox_multi to cancel order A and orders [B, C]' )
81
- } )
82
+ }
83
+
84
+ execute ( )
You can’t perform that action at this time.
0 commit comments