ftx: remove back slash from symbol

This commit is contained in:
ycdesu 2021-04-01 11:54:16 +08:00
parent 28c9ac95ac
commit a659bacb0d
3 changed files with 9 additions and 5 deletions

View File

@ -17,7 +17,7 @@ func toGlobalCurrency(original string) string {
}
func toGlobalSymbol(original string) string {
return TrimUpperString(original)
return strings.ReplaceAll(TrimUpperString(original), "/", "")
}
func TrimUpperString(original string) string {
@ -133,7 +133,7 @@ func toGlobalTrade(f fill) (types.Trade, error) {
func toGlobalKLine(symbol string, interval types.Interval, h Candle) (types.KLine, error) {
return types.KLine{
Exchange: types.ExchangeFTX.String(),
Symbol: symbol,
Symbol: toGlobalSymbol(symbol),
StartTime: h.StartTime.Time,
EndTime: h.StartTime.Add(interval.Duration()),
Interval: interval,

View File

@ -96,3 +96,7 @@ func TestTrimLowerString(t *testing.T) {
})
}
}
func Test_toGlobalSymbol(t *testing.T) {
assert.Equal(t, "BTCUSDT", toGlobalSymbol("BTC/USDT"))
}

View File

@ -416,7 +416,7 @@ func TestExchange_QueryMarkets(t *testing.T) {
assert.Len(t, resp, 1)
assert.Equal(t, types.Market{
Symbol: "BTC/USD",
Symbol: "BTCUSD",
PricePrecision: 0,
VolumePrecision: 4,
QuoteCurrency: "USD",
@ -424,7 +424,7 @@ func TestExchange_QueryMarkets(t *testing.T) {
MinQuantity: 0.001,
StepSize: 0.0001,
TickSize: 1,
}, resp["BTC/USD"])
}, resp["BTCUSD"])
}
func TestExchange_QueryDepositHistory(t *testing.T) {
@ -606,7 +606,7 @@ func TestExchange_QueryTrades(t *testing.T) {
Price: 672.5,
Quantity: 1.0,
QuoteQuantity: 672.5 * 1.0,
Symbol: "TSLA/USD",
Symbol: "TSLAUSD",
Side: types.SideTypeSell,
IsBuyer: false,
IsMaker: true,