|
@@ -30,12 +30,12 @@ func (strategy qqq) PositionSymbols() map[sentio.Side]string {
|
|
|
return map[sentio.Side]string{
|
|
|
sentio.BASE: "QQQ",
|
|
|
sentio.LONG: "TQQQ",
|
|
|
- sentio.SHORT: "SQQQ",
|
|
|
+ sentio.SHORT: "QQQ",
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (strategy qqq) MaxTradeDuration() time.Duration {
|
|
|
- return time.Duration(strategy.Interval()) * time.Minute * 5
|
|
|
+ return time.Duration(strategy.Interval()) * time.Minute * 15
|
|
|
}
|
|
|
|
|
|
func (strategy qqq) Handle(turn *sentio.Turn, market sentio.Market, rs sentio.RiskManager) error {
|
|
@@ -70,15 +70,11 @@ func (strategy qqq) Handle(turn *sentio.Turn, market sentio.Market, rs sentio.Ri
|
|
|
}
|
|
|
|
|
|
// update stoplosses or close running orders
|
|
|
- var (
|
|
|
- ts = turn.Time.AsTime().Round(time.Minute)
|
|
|
- hasClosedOrders = false
|
|
|
- )
|
|
|
+ var hasClosedOrders = false
|
|
|
|
|
|
for i := range orders {
|
|
|
- if util.IsLongOrder(orders[i], strategy) &&
|
|
|
- sentio.Action_SELL == turn.Action &&
|
|
|
- ts.Before(time.Now()) {
|
|
|
+ if sentio.LONG == orders[i].Intent() &&
|
|
|
+ sentio.Action_SELL == turn.Action {
|
|
|
if _, err = market.CloseOrder(orders[i], nil); err != nil {
|
|
|
return err
|
|
|
}
|
|
@@ -87,9 +83,8 @@ func (strategy qqq) Handle(turn *sentio.Turn, market sentio.Market, rs sentio.Ri
|
|
|
continue
|
|
|
}
|
|
|
|
|
|
- if util.IsShortOrder(orders[i], strategy) &&
|
|
|
- sentio.Action_BUY == turn.Action &&
|
|
|
- ts.Before(time.Now()) {
|
|
|
+ if sentio.SHORT == orders[i].Intent() &&
|
|
|
+ sentio.Action_BUY == turn.Action {
|
|
|
if _, err = market.CloseOrder(orders[i], nil); err != nil {
|
|
|
return err
|
|
|
}
|