mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-03 23:16:53 +00:00
(Exchange Interface) Convert Fetch & Update orderbook/ticker methods to return pointers (#398)
* moved order and ticker fetching to return a pointer * return nil instead of empty struct * fixed incorrect nil * general cleanup
This commit is contained in:
@@ -15,12 +15,12 @@ import (
|
||||
|
||||
// Get checks and returns the orderbook given an exchange name and currency pair
|
||||
// if it exists
|
||||
func Get(exchange string, p currency.Pair, a asset.Item) (Base, error) {
|
||||
func Get(exchange string, p currency.Pair, a asset.Item) (*Base, error) {
|
||||
o, err := service.Retrieve(exchange, p, a)
|
||||
if err != nil {
|
||||
return Base{}, err
|
||||
return nil, err
|
||||
}
|
||||
return *o, nil
|
||||
return o, nil
|
||||
}
|
||||
|
||||
// SubscribeOrderbook subcribes to an orderbook and returns a communication
|
||||
|
||||
@@ -395,7 +395,7 @@ func TestProcessOrderbook(t *testing.T) {
|
||||
t.Error("Process() error", err)
|
||||
}
|
||||
|
||||
result, err = Get("Blah", c, "quarterly")
|
||||
_, err = Get("Blah", c, "quarterly")
|
||||
if err != nil {
|
||||
t.Fatal("TestProcessOrderbook failed to create new orderbook")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user