mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
rename
This commit is contained in:
parent
2982be1cbc
commit
6857734282
|
@ -45,7 +45,6 @@ func getBestPriceUntilSuccess(ctx context.Context, ex types.Exchange, symbol str
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Strategy) generateOpenPositionOrders(short bool, budget, price, priceDeviation fixedpoint.Value, maxOrderNum int64) ([]types.SubmitOrder, error) {
|
func (s *Strategy) generateOpenPositionOrders(short bool, budget, price, priceDeviation fixedpoint.Value, maxOrderNum int64) ([]types.SubmitOrder, error) {
|
||||||
// TODO: not implement short part yet
|
|
||||||
factor := fixedpoint.One.Sub(priceDeviation)
|
factor := fixedpoint.One.Sub(priceDeviation)
|
||||||
if short {
|
if short {
|
||||||
factor = fixedpoint.One.Add(priceDeviation)
|
factor = fixedpoint.One.Add(priceDeviation)
|
||||||
|
@ -67,7 +66,7 @@ func (s *Strategy) generateOpenPositionOrders(short bool, budget, price, priceDe
|
||||||
|
|
||||||
notional, orderNum := calculateNotionalAndNum(s.Market, short, budget, prices)
|
notional, orderNum := calculateNotionalAndNum(s.Market, short, budget, prices)
|
||||||
if orderNum == 0 {
|
if orderNum == 0 {
|
||||||
return nil, fmt.Errorf("failed to calculate DCA maker order notional and num, price: %s, budget: %s", price, budget)
|
return nil, fmt.Errorf("failed to calculate notional and num of open position orders, price: %s, budget: %s", price, budget)
|
||||||
}
|
}
|
||||||
|
|
||||||
var submitOrders []types.SubmitOrder
|
var submitOrders []types.SubmitOrder
|
||||||
|
|
|
@ -39,7 +39,7 @@ func newTestStrategy(va ...string) *Strategy {
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGenerateMakerOrder(t *testing.T) {
|
func TestGenerateOpenPositionOrders(t *testing.T) {
|
||||||
assert := assert.New(t)
|
assert := assert.New(t)
|
||||||
|
|
||||||
strategy := newTestStrategy()
|
strategy := newTestStrategy()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user