|
@@ -80,11 +80,8 @@ func (strategy qqq) Handle(turn *sentio.Turn, market sentio.Market, rs sentio.Ri
|
|
shouldClose := false
|
|
shouldClose := false
|
|
side := util.SideOf(orders[i].GetIntent())
|
|
side := util.SideOf(orders[i].GetIntent())
|
|
|
|
|
|
- if sentio.LONG == side && sentio.Action_SELL == turn.Action {
|
|
|
|
- shouldClose = true
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if sentio.SHORT == side && sentio.Action_BUY == turn.Action {
|
|
|
|
|
|
+ if sentio.LONG == side && sentio.Action_SELL == turn.Action ||
|
|
|
|
+ sentio.SHORT == side && sentio.Action_BUY == turn.Action {
|
|
shouldClose = true
|
|
shouldClose = true
|
|
}
|
|
}
|
|
|
|
|
|
@@ -104,7 +101,7 @@ func (strategy qqq) Handle(turn *sentio.Turn, market sentio.Market, rs sentio.Ri
|
|
opts := sentio.OrderUpdateOptions{
|
|
opts := sentio.OrderUpdateOptions{
|
|
TakeProfit: rs.TakeProfit(orders[i].GetSymbol(), quotes[orders[i].GetSymbol()].BidPrice),
|
|
TakeProfit: rs.TakeProfit(orders[i].GetSymbol(), quotes[orders[i].GetSymbol()].BidPrice),
|
|
StopLoss: rs.StopLoss(orders[i].GetSymbol(), quotes[orders[i].GetSymbol()].BidPrice),
|
|
StopLoss: rs.StopLoss(orders[i].GetSymbol(), quotes[orders[i].GetSymbol()].BidPrice),
|
|
- EnableStopLoss: strategy.EnableStopLoss(),
|
|
|
|
|
|
+ EnableStopLoss: strategy.EnableStopLoss() || rs.IsHalted(),
|
|
}
|
|
}
|
|
|
|
|
|
if err = market.UpdateOrder(orders[i].GetId(), opts); err != nil {
|
|
if err = market.UpdateOrder(orders[i].GetId(), opts); err != nil {
|
|
@@ -128,7 +125,7 @@ func (strategy qqq) Handle(turn *sentio.Turn, market sentio.Market, rs sentio.Ri
|
|
}
|
|
}
|
|
|
|
|
|
// Disable StopLoss
|
|
// Disable StopLoss
|
|
- if !strategy.EnableStopLoss() {
|
|
|
|
|
|
+ if !(strategy.EnableStopLoss() || rs.IsHalted()) {
|
|
opts.StopLoss = nil
|
|
opts.StopLoss = nil
|
|
}
|
|
}
|
|
|
|
|