mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-04 07:26:47 +00:00
orderbook: change Base struct name to Book (#1914)
* orderbook: change Base struct name to Snapshot * linter: fix * Update exchanges/exchange.go Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> * Update exchanges/orderbook/depth.go Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> * Update exchanges/orderbook/orderbook_types.go Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> * Snapshot -> Book * Tranche(s) -> Level(s) * Tranche(s) -> Level(s) * rm tranche ref * linter: fix * linter: rides again * update tests * Update exchange/websocket/buffer/buffer.go Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> * Update backtester/eventhandlers/exchange/slippage/slippage.go Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> * Update exchange/websocket/buffer/buffer.go Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io> * Update exchange/websocket/buffer/buffer.go Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io> * Update exchanges/orderbook/orderbook_test.go Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io> * Update exchanges/orderbook/orderbook_test.go Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io> * Update exchanges/orderbook/orderbook_test.go Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io> * Update exchanges/orderbook/orderbook_types.go Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io> * Update exchanges/orderbook/orderbook_types.go Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io> * fixup tests * Update exchanges/orderbook/orderbook_test.go Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> * Update exchanges/orderbook/orderbook_test.go Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> * Update exchanges/orderbook/orderbook_test.go Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> * Update exchanges/orderbook/orderbook_test.go Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> * Update exchanges/orderbook/orderbook_test.go Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> * Update exchanges/orderbook/orderbook_test.go Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> * Update exchanges/orderbook/orderbook_test.go Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> * Update exchanges/orderbook/orderbook_test.go Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> * Update exchanges/orderbook/orderbook_types.go Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> * Update exchanges/orderbook/orderbook_types.go Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> * gk: nits and rm stuff that is not needed * Update exchanges/orderbook/orderbook_test.go Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> * gk: nits --------- Co-authored-by: shazbert <ryan.oharareid@thrasher.io> Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
This commit is contained in:
@@ -203,14 +203,14 @@ func (e *EXMO) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item)
|
||||
}
|
||||
|
||||
// UpdateOrderbook updates and returns the orderbook for a currency pair
|
||||
func (e *EXMO) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error) {
|
||||
func (e *EXMO) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Book, error) {
|
||||
if p.IsEmpty() {
|
||||
return nil, currency.ErrCurrencyPairEmpty
|
||||
}
|
||||
if err := e.CurrencyPairs.IsAssetEnabled(assetType); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
callingBook := &orderbook.Base{
|
||||
callingBook := &orderbook.Book{
|
||||
Exchange: e.Name,
|
||||
Pair: p,
|
||||
Asset: assetType,
|
||||
@@ -232,7 +232,7 @@ func (e *EXMO) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType a
|
||||
}
|
||||
|
||||
for i := range enabledPairs {
|
||||
book := &orderbook.Base{
|
||||
book := &orderbook.Book{
|
||||
Exchange: e.Name,
|
||||
Pair: enabledPairs[i],
|
||||
Asset: assetType,
|
||||
@@ -249,13 +249,13 @@ func (e *EXMO) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType a
|
||||
continue
|
||||
}
|
||||
|
||||
book.Asks = make(orderbook.Tranches, len(data.Asks))
|
||||
book.Asks = make(orderbook.Levels, len(data.Asks))
|
||||
for y := range data.Asks {
|
||||
book.Asks[y].Price = data.Asks[y][0].Float64()
|
||||
book.Asks[y].Amount = data.Asks[y][1].Float64()
|
||||
}
|
||||
|
||||
book.Bids = make(orderbook.Tranches, len(data.Bids))
|
||||
book.Bids = make(orderbook.Levels, len(data.Bids))
|
||||
for y := range data.Bids {
|
||||
book.Bids[y].Price = data.Bids[y][0].Float64()
|
||||
book.Bids[y].Amount = data.Bids[y][1].Float64()
|
||||
|
||||
Reference in New Issue
Block a user