mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
fix takerfeerate column and makerfeerate column issue in yaml
This commit is contained in:
parent
fad85d0992
commit
5315378b9e
|
@ -7,6 +7,8 @@ import (
|
|||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"gopkg.in/yaml.v3"
|
||||
|
||||
"github.com/c9s/bbgo/pkg/fixedpoint"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -16,9 +18,9 @@ func init() {
|
|||
type TestStrategy struct {
|
||||
Symbol string `json:"symbol"`
|
||||
Interval string `json:"interval"`
|
||||
BaseQuantity float64 `json:"baseQuantity"`
|
||||
MaxAssetQuantity float64 `json:"maxAssetQuantity"`
|
||||
MinDropPercentage float64 `json:"minDropPercentage"`
|
||||
BaseQuantity fixedpoint.Value `json:"baseQuantity"`
|
||||
MaxAssetQuantity fixedpoint.Value `json:"maxAssetQuantity"`
|
||||
MinDropPercentage fixedpoint.Value `json:"minDropPercentage"`
|
||||
}
|
||||
|
||||
func (s *TestStrategy) ID() string {
|
||||
|
@ -69,9 +71,9 @@ func TestLoadConfig(t *testing.T) {
|
|||
Strategy: &TestStrategy{
|
||||
Symbol: "BTCUSDT",
|
||||
Interval: "1m",
|
||||
BaseQuantity: 0.1,
|
||||
MaxAssetQuantity: 1.1,
|
||||
MinDropPercentage: -0.05,
|
||||
BaseQuantity: fixedpoint.NewFromFloat(0.1),
|
||||
MaxAssetQuantity: fixedpoint.NewFromFloat(1.1),
|
||||
MinDropPercentage: fixedpoint.NewFromFloat(-0.05),
|
||||
},
|
||||
}}, config.ExchangeStrategies)
|
||||
|
||||
|
@ -82,10 +84,14 @@ func TestLoadConfig(t *testing.T) {
|
|||
"max": map[string]interface{}{
|
||||
"exchange": "max",
|
||||
"envVarPrefix": "MAX",
|
||||
"takerFeeRate": 0.,
|
||||
"makerFeeRate": 0.,
|
||||
},
|
||||
"binance": map[string]interface{}{
|
||||
"exchange": "binance",
|
||||
"envVarPrefix": "BINANCE",
|
||||
"takerFeeRate": 0.,
|
||||
"makerFeeRate": 0.,
|
||||
},
|
||||
},
|
||||
"build": map[string]interface{}{
|
||||
|
|
|
@ -50,7 +50,7 @@ func TestAdjustQuantityByMinAmount(t *testing.T) {
|
|||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
q := AdjustFloatQuantityByMinAmount(test.args.quantity, test.args.price, test.args.minAmount)
|
||||
assert.Equal(t, test.wanted, q.String())
|
||||
assert.Equal(t, fixedpoint.MustNewFromString(test.wanted), q)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
4
pkg/bbgo/testdata/strategy.yaml
vendored
4
pkg/bbgo/testdata/strategy.yaml
vendored
|
@ -3,9 +3,13 @@ sessions:
|
|||
max:
|
||||
exchange: max
|
||||
envVarPrefix: MAX
|
||||
takerFeeRate: 0
|
||||
makerFeeRate: 0
|
||||
binance:
|
||||
exchange: binance
|
||||
envVarPrefix: BINANCE
|
||||
takerFeeRate: 0
|
||||
makerFeeRate: 0
|
||||
|
||||
exchangeStrategies:
|
||||
- on: ["binance"]
|
||||
|
|
Loading…
Reference in New Issue
Block a user