mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-18 15:10:03 +00:00
* Tests: Use currency.NewUSD and NewUSDT Simple refactor to use the provided shortcut methods * Github: Add CI check to ensure NewPair not used Add a step to ensure NewPair(BTC, USD*) isn't used
40 lines
809 B
Go
40 lines
809 B
Go
package simulator
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/thrasher-corp/gocryptotrader/currency"
|
|
"github.com/thrasher-corp/gocryptotrader/exchanges/asset"
|
|
"github.com/thrasher-corp/gocryptotrader/exchanges/bitstamp"
|
|
)
|
|
|
|
func TestSimulate(t *testing.T) {
|
|
b := bitstamp.Bitstamp{}
|
|
b.SetDefaults()
|
|
b.Verbose = false
|
|
b.CurrencyPairs = currency.PairsManager{
|
|
UseGlobalFormat: true,
|
|
RequestFormat: ¤cy.PairFormat{
|
|
Uppercase: true,
|
|
},
|
|
Pairs: map[asset.Item]*currency.PairStore{
|
|
asset.Spot: {
|
|
AssetEnabled: true,
|
|
},
|
|
},
|
|
}
|
|
o, err := b.UpdateOrderbook(t.Context(),
|
|
currency.NewBTCUSD(), asset.Spot)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
_, err = o.SimulateOrder(10000000, true)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
_, err = o.SimulateOrder(2171, false)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|