mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
core: add TestSymbolConverter
This commit is contained in:
parent
00e860df26
commit
df8d52adda
31
pkg/core/converter_test.go
Normal file
31
pkg/core/converter_test.go
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
package core
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
|
"github.com/c9s/bbgo/pkg/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestSymbolConverter(t *testing.T) {
|
||||||
|
converter := NewSymbolConverter("MAXEXCHANGEUSDT", "MAXUSDT")
|
||||||
|
trade, err := converter.ConvertTrade(types.Trade{
|
||||||
|
Symbol: "MAXEXCHANGEUSDT",
|
||||||
|
})
|
||||||
|
|
||||||
|
if assert.NoError(t, err) {
|
||||||
|
assert.Equal(t, "MAXUSDT", trade.Symbol)
|
||||||
|
}
|
||||||
|
|
||||||
|
order, err := converter.ConvertOrder(types.Order{
|
||||||
|
SubmitOrder: types.SubmitOrder{
|
||||||
|
Symbol: "MAXEXCHANGEUSDT",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
if assert.NoError(t, err) {
|
||||||
|
assert.Equal(t, "MAXUSDT", order.Symbol)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user