mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-18 07:26:50 +00:00
Link up websocket handler to routes after refactor and various improvements
This commit is contained in:
@@ -54,6 +54,16 @@ func Add(exchange string, p pair.CurrencyPair, assetType string, price, volume f
|
||||
return
|
||||
}
|
||||
|
||||
if p.FirstCurrency == "XBT" {
|
||||
newPair := pair.NewCurrencyPair("BTC", p.SecondCurrency.String())
|
||||
Append(exchange, newPair, assetType, price, volume)
|
||||
}
|
||||
|
||||
if p.SecondCurrency == "USDT" {
|
||||
newPair := pair.NewCurrencyPair(p.FirstCurrency.String(), "USD")
|
||||
Append(exchange, newPair, assetType, price, volume)
|
||||
}
|
||||
|
||||
Append(exchange, p, assetType, price, volume)
|
||||
}
|
||||
|
||||
|
||||
@@ -114,6 +114,20 @@ func TestAdd(t *testing.T) {
|
||||
if len(Items) != 1 {
|
||||
t.Error("Test Failed - stats Add did not add exchange info.")
|
||||
}
|
||||
|
||||
p.FirstCurrency = "XBT"
|
||||
Add("ANX", p, "SPOT", 1201, 43)
|
||||
|
||||
if Items[1].Pair.Pair() != "XBTUSD" {
|
||||
t.Fatal("Test failed. stats Add did not add exchange info.")
|
||||
}
|
||||
|
||||
p = pair.NewCurrencyPair("ETH", "USDT")
|
||||
Add("ANX", p, "SPOT", 300, 1000)
|
||||
|
||||
if Items[2].Pair.Pair() != "ETHUSD" {
|
||||
t.Fatal("Test failed. stats Add did not add exchange info.")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAppend(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user