mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-21 15:10:12 +00:00
* golangci-lint: Enable usetesting and unused linters * tests: Improve assertions in various test cases for clarity and accuracy * tests: Enhance error assertions in TestExecuteStrategyFromFile for improved clarity * tests: Update assertions for improved clarity and accuracy * tests: Replace assert with require for task count checks * config/versions/v7: Replace context.Background() with t.Context() * Bithumb: Centralise and consoliate testPair, relax UpdateTickers check with some glorious Doom Eternal music * Bithumb: Use UpdatePairsOnce and update remaining pair string * Bithumb: Add UpdatePairsOnce to TestUpdateTickers
40 lines
833 B
Go
40 lines
833 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.NewPair(currency.BTC, currency.USD), 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)
|
|
}
|
|
}
|