mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
* Fill go test * Add return error into Update function * Update exchanges/fill/fill_test.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * GateIO: Fix websocket trade tests * GateIO: More test coverage * GateIO: Options tests * GateIO: Fix woopsies * Address nits * GateIO: Fix nitters --------- Co-authored-by: Scott <gloriousCode@users.noreply.github.com> Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
30 lines
596 B
Go
30 lines
596 B
Go
package fill
|
|
|
|
import "errors"
|
|
|
|
// ErrFeedDisabled is an error that indicates the fill feed is disabled
|
|
var ErrFeedDisabled = errors.New("fill feed disabled")
|
|
|
|
// 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 {
|
|
return ErrFeedDisabled
|
|
}
|
|
|
|
f.dataHandler <- data
|
|
|
|
return nil
|
|
}
|