File tree 1 file changed +13
-6
lines changed
1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
3
const { Liquidations } = 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' )
6
+
7
+ async function execute ( ) {
8
+ const ws = new WSv2 ( {
9
+ apiKey,
10
+ apiSecret
11
+ } )
12
+ ws . on ( 'error' , e => debug ( 'WSv2 error: %s' , e . message | e ) )
13
+ await ws . open ( )
5
14
6
- module . exports = runExample ( {
7
- name : 'ws2-liquidations' ,
8
- ws : { env : true , connect : true , keepOpen : true }
9
- } , async ( { ws, debug } ) => {
10
15
ws . onStatus ( { key : 'liq:global' } , ( data ) => {
11
16
data . forEach ( liq => (
12
17
debug ( 'liquidation: %s' , new Liquidations ( liq ) . toString ( ) )
13
18
) )
14
19
} )
15
20
16
21
await ws . subscribeStatus ( 'liq:global' )
17
- } )
22
+ }
23
+
24
+ execute ( )
You can’t perform that action at this time.
0 commit comments