|
@@ -36,14 +36,14 @@ func NewOrder(
|
|
opts.StopLoss = sentio.ToFixed(rm.StopLoss(opts.Symbol, bid), 2)
|
|
opts.StopLoss = sentio.ToFixed(rm.StopLoss(opts.Symbol, bid), 2)
|
|
|
|
|
|
// Prevent orders those have too small expected profit
|
|
// Prevent orders those have too small expected profit
|
|
- if opts.TakeProfit < bid+TradingRange {
|
|
|
|
|
|
+ if opts.TakeProfit < bid*(1+TradingRange) {
|
|
err = sentio.ErrLowTakeProfit
|
|
err = sentio.ErrLowTakeProfit
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
// Prevent cases when order will be closed ASAP they were opened.
|
|
// Prevent cases when order will be closed ASAP they were opened.
|
|
// Also, Alpaca requires at least 0.01 gap against base_price
|
|
// Also, Alpaca requires at least 0.01 gap against base_price
|
|
- if opts.StopLoss > bid-TradingRange {
|
|
|
|
|
|
+ if opts.StopLoss > bid*(1-TradingRange) {
|
|
err = sentio.ErrHighStoploss
|
|
err = sentio.ErrHighStoploss
|
|
return
|
|
return
|
|
}
|
|
}
|