@@ -30,6 +30,24 @@ var BudFox = function(config) {
3030
3131 // BudFox data flow:
3232
33+ // relay a marketUpdate event
34+ this . marketDataProvider . on (
35+ 'marketUpdate' ,
36+ e => this . emit ( 'marketUpdate' , e )
37+ ) ;
38+
39+ // relay a marketStart event
40+ this . marketDataProvider . on (
41+ 'marketStart' ,
42+ e => this . emit ( 'marketStart' , e )
43+ ) ;
44+
45+ // Output the candles
46+ this . candleManager . on (
47+ 'candles' ,
48+ this . pushCandles
49+ ) ;
50+
3351 // on every `tick` retrieve trade data
3452 this . heart . on (
3553 'tick' ,
@@ -42,26 +60,7 @@ var BudFox = function(config) {
4260 this . candleManager . processTrades
4361 ) ;
4462
45- // Output the candles
46- this . candleManager . on (
47- 'candles' ,
48- this . pushCandles
49- ) ;
50-
5163 this . heart . pump ( ) ;
52-
53- // Budfox also reports:
54-
55- // Trades & last trade
56- //
57- // this.marketDataProvider.on(
58- // 'trades',
59- // this.broadcast('trades')
60- // );
61- // this.marketDataProvider.on(
62- // 'trades',
63- // this.broadcastTrade
64- // );
6564}
6665
6766var Readable = require ( 'stream' ) . Readable ;
@@ -76,18 +75,4 @@ BudFox.prototype.pushCandles = function(candles) {
7675 _ . each ( candles , this . push ) ;
7776}
7877
79- // BudFox.prototype.broadcastTrade = function(trades) {
80- // _.defer(function() {
81- // this.emit('trade', trades.last);
82- // }.bind(this));
83- // }
84-
85- // BudFox.prototype.broadcast = function(message) {
86- // return function(payload) {
87- // _.defer(function() {
88- // this.emit(message, payload);
89- // }.bind(this));
90- // }.bind(this);
91- // }
92-
9378module . exports = BudFox ;
0 commit comments