mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
fix stop price formating
This commit is contained in:
parent
b75ebf2f0f
commit
4f399ebb9f
|
@ -266,6 +266,12 @@ func formatOrder(session *ExchangeSession, order types.SubmitOrder) (types.Submi
|
||||||
|
|
||||||
order.Market = market
|
order.Market = market
|
||||||
|
|
||||||
|
switch order.Type {
|
||||||
|
case types.OrderTypeStopMarket, types.OrderTypeStopLimit:
|
||||||
|
order.StopPriceString = market.FormatPrice(order.StopPrice)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
switch order.Type {
|
switch order.Type {
|
||||||
case types.OrderTypeMarket, types.OrderTypeStopMarket:
|
case types.OrderTypeMarket, types.OrderTypeStopMarket:
|
||||||
order.Price = 0.0
|
order.Price = 0.0
|
||||||
|
|
|
@ -373,6 +373,15 @@ func (e *Exchange) SubmitOrders(ctx context.Context, orders ...types.SubmitOrder
|
||||||
req.Price(order.PriceString)
|
req.Price(order.PriceString)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch order.Type {
|
||||||
|
case types.OrderTypeStopLimit, types.OrderTypeStopMarket:
|
||||||
|
if len(order.StopPriceString) == 0 {
|
||||||
|
return createdOrders, fmt.Errorf("stop price string can not be empty")
|
||||||
|
}
|
||||||
|
|
||||||
|
req.StopPrice(order.StopPriceString)
|
||||||
|
}
|
||||||
|
|
||||||
if len(order.TimeInForce) > 0 {
|
if len(order.TimeInForce) > 0 {
|
||||||
// TODO: check the TimeInForce value
|
// TODO: check the TimeInForce value
|
||||||
req.TimeInForce(binance.TimeInForceType(order.TimeInForce))
|
req.TimeInForce(binance.TimeInForceType(order.TimeInForce))
|
||||||
|
|
|
@ -181,6 +181,15 @@ func (e *Exchange) SubmitOrders(ctx context.Context, orders ...types.SubmitOrder
|
||||||
req.ClientOrderID(clientOrderID)
|
req.ClientOrderID(clientOrderID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch order.Type {
|
||||||
|
case types.OrderTypeStopLimit, types.OrderTypeStopMarket:
|
||||||
|
if len(order.StopPriceString) == 0 {
|
||||||
|
return createdOrders, fmt.Errorf("stop price string can not be empty")
|
||||||
|
}
|
||||||
|
|
||||||
|
req.StopPrice(order.StopPriceString)
|
||||||
|
}
|
||||||
|
|
||||||
if len(order.PriceString) > 0 {
|
if len(order.PriceString) > 0 {
|
||||||
req.Price(order.PriceString)
|
req.Price(order.PriceString)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user