mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +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"
|
"github.com/stretchr/testify/assert"
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
|
|
||||||
|
"github.com/c9s/bbgo/pkg/fixedpoint"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -14,11 +16,11 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
type TestStrategy struct {
|
type TestStrategy struct {
|
||||||
Symbol string `json:"symbol"`
|
Symbol string `json:"symbol"`
|
||||||
Interval string `json:"interval"`
|
Interval string `json:"interval"`
|
||||||
BaseQuantity float64 `json:"baseQuantity"`
|
BaseQuantity fixedpoint.Value `json:"baseQuantity"`
|
||||||
MaxAssetQuantity float64 `json:"maxAssetQuantity"`
|
MaxAssetQuantity fixedpoint.Value `json:"maxAssetQuantity"`
|
||||||
MinDropPercentage float64 `json:"minDropPercentage"`
|
MinDropPercentage fixedpoint.Value `json:"minDropPercentage"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TestStrategy) ID() string {
|
func (s *TestStrategy) ID() string {
|
||||||
|
@ -69,9 +71,9 @@ func TestLoadConfig(t *testing.T) {
|
||||||
Strategy: &TestStrategy{
|
Strategy: &TestStrategy{
|
||||||
Symbol: "BTCUSDT",
|
Symbol: "BTCUSDT",
|
||||||
Interval: "1m",
|
Interval: "1m",
|
||||||
BaseQuantity: 0.1,
|
BaseQuantity: fixedpoint.NewFromFloat(0.1),
|
||||||
MaxAssetQuantity: 1.1,
|
MaxAssetQuantity: fixedpoint.NewFromFloat(1.1),
|
||||||
MinDropPercentage: -0.05,
|
MinDropPercentage: fixedpoint.NewFromFloat(-0.05),
|
||||||
},
|
},
|
||||||
}}, config.ExchangeStrategies)
|
}}, config.ExchangeStrategies)
|
||||||
|
|
||||||
|
@ -82,10 +84,14 @@ func TestLoadConfig(t *testing.T) {
|
||||||
"max": map[string]interface{}{
|
"max": map[string]interface{}{
|
||||||
"exchange": "max",
|
"exchange": "max",
|
||||||
"envVarPrefix": "MAX",
|
"envVarPrefix": "MAX",
|
||||||
|
"takerFeeRate": 0.,
|
||||||
|
"makerFeeRate": 0.,
|
||||||
},
|
},
|
||||||
"binance": map[string]interface{}{
|
"binance": map[string]interface{}{
|
||||||
"exchange": "binance",
|
"exchange": "binance",
|
||||||
"envVarPrefix": "BINANCE",
|
"envVarPrefix": "BINANCE",
|
||||||
|
"takerFeeRate": 0.,
|
||||||
|
"makerFeeRate": 0.,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"build": map[string]interface{}{
|
"build": map[string]interface{}{
|
||||||
|
|
|
@ -50,7 +50,7 @@ func TestAdjustQuantityByMinAmount(t *testing.T) {
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
q := AdjustFloatQuantityByMinAmount(test.args.quantity, test.args.price, test.args.minAmount)
|
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:
|
max:
|
||||||
exchange: max
|
exchange: max
|
||||||
envVarPrefix: MAX
|
envVarPrefix: MAX
|
||||||
|
takerFeeRate: 0
|
||||||
|
makerFeeRate: 0
|
||||||
binance:
|
binance:
|
||||||
exchange: binance
|
exchange: binance
|
||||||
envVarPrefix: BINANCE
|
envVarPrefix: BINANCE
|
||||||
|
takerFeeRate: 0
|
||||||
|
makerFeeRate: 0
|
||||||
|
|
||||||
exchangeStrategies:
|
exchangeStrategies:
|
||||||
- on: ["binance"]
|
- on: ["binance"]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user