currency: Adds matching lookup table built from available pairs (#1312)

* currency: Add pair matching update (cherry-pick)

* exchange/currency: Add tests and update func

* linter fix, also if using json unmarshal functionality stop usage of string conversion without delimiter

* gemini: fix test

* currency/manager: potential optimisation

* exchanges: purge derive from wrapper cases and add warning comment

* glorious: nits

* glorious: nits

* linter: fix

* glorious: nits

* whoops

* whoops

* glorious: nits continued

* glorious: diff THANKS!

* hitbtc: fix update tradable pairs strings splitting. continue if not enabled tickers update pair.

* glorious: nits

* linter: fix

* Update exchanges/exmo/exmo_wrapper.go

Co-authored-by: Scott <gloriousCode@users.noreply.github.com>

* bitstamp: fix test when 32 biterinos architecturinos

* capture more strings for speed

* swapsies because whos running 32bit \0/?

---------

Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
This commit is contained in:
Ryan O'Hara-Reid
2023-10-18 11:57:27 +11:00
committed by GitHub
parent d3bf4a460a
commit ceef7a14e0
32 changed files with 621 additions and 264 deletions

View File

@@ -266,11 +266,15 @@ func (by *Bybit) wsHandleData(respRaw []byte) error {
if err != nil {
return err
}
p, err := by.extractCurrencyPair(data.OBData.Symbol, asset.Spot)
p, enabled, err := by.MatchSymbolCheckEnabled(data.OBData.Symbol, asset.Spot, false)
if err != nil {
return err
}
if !enabled {
return nil
}
err = by.wsUpdateOrderbook(&data.OBData, p, asset.Spot)
if err != nil {
return err
@@ -286,11 +290,15 @@ func (by *Bybit) wsHandleData(respRaw []byte) error {
return err
}
p, err := by.extractCurrencyPair(data.Parameters.Symbol, asset.Spot)
p, enabled, err := by.MatchSymbolCheckEnabled(data.Parameters.Symbol, asset.Spot, false)
if err != nil {
return err
}
if !enabled {
return nil
}
side := order.Sell
if data.TradeData.Side {
side = order.Buy
@@ -313,11 +321,15 @@ func (by *Bybit) wsHandleData(respRaw []byte) error {
return err
}
p, err := by.extractCurrencyPair(data.Ticker.Symbol, asset.Spot)
p, enabled, err := by.MatchSymbolCheckEnabled(data.Ticker.Symbol, asset.Spot, false)
if err != nil {
return err
}
if !enabled {
return nil
}
by.Websocket.DataHandler <- &ticker.Price{
ExchangeName: by.Name,
Bid: data.Ticker.Bid.Float64(),
@@ -334,11 +346,15 @@ func (by *Bybit) wsHandleData(respRaw []byte) error {
return err
}
p, err := by.extractCurrencyPair(data.Kline.Symbol, asset.Spot)
p, enabled, err := by.MatchSymbolCheckEnabled(data.Kline.Symbol, asset.Spot, false)
if err != nil {
return err
}
if !enabled {
return nil
}
by.Websocket.DataHandler <- stream.KlineData{
Pair: p,
AssetType: asset.Spot,
@@ -425,11 +441,15 @@ func (by *Bybit) wsHandleData(respRaw []byte) error {
}
}
p, err := by.extractCurrencyPair(data[j].Symbol, asset.Spot)
p, enabled, err := by.MatchSymbolCheckEnabled(data[j].Symbol, asset.Spot, false)
if err != nil {
return err
}
if !enabled {
continue
}
by.Websocket.DataHandler <- order.Detail{
Price: data[j].Price.Float64(),
Amount: data[j].Quantity.Float64(),
@@ -475,11 +495,15 @@ func (by *Bybit) wsHandleData(respRaw []byte) error {
}
}
p, err := by.extractCurrencyPair(data[j].Symbol, asset.Spot)
p, enabled, err := by.MatchSymbolCheckEnabled(data[j].Symbol, asset.Spot, false)
if err != nil {
return err
}
if !enabled {
continue
}
by.Websocket.DataHandler <- &order.Detail{
Exchange: by.Name,
OrderID: data[j].OrderID,