Files
gocryptotrader/exchanges/fill/fill.go
Luis Rascão 4531fdcb4a exchanges/websocket: Expose Trades/Fills feed through data channel (#814)
* Expose trade feed websocket exchange data through data channel

Most relevant to applications that import GCT as a lib, this allows
them to (through configuration, disabled by default) receive trade data
through the data channel similarly to the orderbook feed.

* exchanges: allow exposure of trade websocket feed through data channel

* Expose fill feed websocket abstracted exchange data through data channel

* exchanges: allow exposure of fill websocket feed through data channel
2021-10-28 10:25:15 +11:00

23 lines
425 B
Go

package fill
// Setup sets up the fill processor
func (f *Fills) Setup(fillsFeedEnabled bool, c chan interface{}) {
f.dataHandler = c
f.fillsFeedEnabled = fillsFeedEnabled
}
// Update disseminates fill data through the data channel if so
// configured
func (f *Fills) Update(data ...Data) error {
if len(data) == 0 {
// nothing to do
return nil
}
if f.fillsFeedEnabled {
f.dataHandler <- data
}
return nil
}