Files
gocryptotrader/exchanges/fill/fill.go
Romano 555bb76f4d exchanges/fill: Add test coverage (#1223)
* 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>
2023-08-10 12:33:42 +10:00

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
}