mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-05 23:16:53 +00:00
Optimisation: large structs/huge param fixes (part 2) (#262)
* updated golangci config to enable hugeparam linter * ModifyOrder struct usage converted to a pointer * OrderBook conversion to struct * More conversion of large structs to pointers * updated golangci config to enable hugeparam linter * ModifyOrder struct usage converted to a pointer * OrderBook conversion to struct * More conversion of large structs to pointers * disabled hugeParam check for golang again * changed based on suggested feedback and fix for no default provider * fixed typing
This commit is contained in:
@@ -437,7 +437,7 @@ func (b *Binance) GetBestPrice(symbol string) (BestPrice, error) {
|
||||
}
|
||||
|
||||
// NewOrder sends a new order to Binance
|
||||
func (b *Binance) NewOrder(o NewOrderRequest) (NewOrderResponse, error) {
|
||||
func (b *Binance) NewOrder(o *NewOrderRequest) (NewOrderResponse, error) {
|
||||
var resp NewOrderResponse
|
||||
|
||||
path := fmt.Sprintf("%s%s", b.APIUrl, newOrder)
|
||||
|
||||
@@ -143,7 +143,7 @@ func TestNewOrder(t *testing.T) {
|
||||
if testAPIKey == "" || testAPISecret == "" {
|
||||
t.Skip()
|
||||
}
|
||||
_, err := b.NewOrder(NewOrderRequest{
|
||||
_, err := b.NewOrder(&NewOrderRequest{
|
||||
Symbol: "BTCUSDT",
|
||||
Side: BinanceRequestParamsSideSell,
|
||||
TradeType: BinanceRequestParamsOrderLimit,
|
||||
@@ -466,7 +466,7 @@ func TestGetAccountInfo(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestModifyOrder(t *testing.T) {
|
||||
_, err := b.ModifyOrder(exchange.ModifyOrder{})
|
||||
_, err := b.ModifyOrder(&exchange.ModifyOrder{})
|
||||
if err == nil {
|
||||
t.Error("Test failed - ModifyOrder() error")
|
||||
}
|
||||
|
||||
@@ -61,11 +61,11 @@ func (b *Binance) SeedLocalCache(p currency.Pair) error {
|
||||
newOrderBook.Pair = currency.NewPairFromString(formattedPair.String())
|
||||
newOrderBook.AssetType = ticker.Spot
|
||||
|
||||
return b.Websocket.Orderbook.LoadSnapshot(newOrderBook, b.GetName(), false)
|
||||
return b.Websocket.Orderbook.LoadSnapshot(&newOrderBook, b.GetName(), false)
|
||||
}
|
||||
|
||||
// UpdateLocalCache updates and returns the most recent iteration of the orderbook
|
||||
func (b *Binance) UpdateLocalCache(ob WebsocketDepthStream) error {
|
||||
func (b *Binance) UpdateLocalCache(ob *WebsocketDepthStream) error {
|
||||
m.Lock()
|
||||
ID, ok := lastUpdateID[ob.Pair]
|
||||
if !ok {
|
||||
@@ -323,7 +323,7 @@ func (b *Binance) WsHandleData() {
|
||||
continue
|
||||
}
|
||||
|
||||
err = b.UpdateLocalCache(depth)
|
||||
err = b.UpdateLocalCache(&depth)
|
||||
if err != nil {
|
||||
b.Websocket.DataHandler <- fmt.Errorf("binance_websocket.go - UpdateLocalCache error: %s",
|
||||
err)
|
||||
|
||||
@@ -232,7 +232,7 @@ func (b *Binance) SubmitOrder(p currency.Pair, side exchange.OrderSide, orderTyp
|
||||
TimeInForce: BinanceRequestParamsTimeGTC,
|
||||
}
|
||||
|
||||
response, err := b.NewOrder(orderRequest)
|
||||
response, err := b.NewOrder(&orderRequest)
|
||||
|
||||
if response.OrderID > 0 {
|
||||
submitOrderResponse.OrderID = fmt.Sprintf("%v", response.OrderID)
|
||||
@@ -247,7 +247,7 @@ func (b *Binance) SubmitOrder(p currency.Pair, side exchange.OrderSide, orderTyp
|
||||
|
||||
// ModifyOrder will allow of changing orderbook placement and limit to
|
||||
// market conversion
|
||||
func (b *Binance) ModifyOrder(action exchange.ModifyOrder) (string, error) {
|
||||
func (b *Binance) ModifyOrder(action *exchange.ModifyOrder) (string, error) {
|
||||
return "", common.ErrFunctionNotSupported
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user