Kaynağa Gözat

QQQ15

- extend trading window
- adjust LONG enter and exit probabilities
- adjust SHORT enter and exit probabilities
Alexey Kim 2 hafta önce
ebeveyn
işleme
c3de83261c
1 değiştirilmiş dosya ile 9 ekleme ve 11 silme
  1. 9 11
      strategy/alpaca/qqq15/strategy.go

+ 9 - 11
strategy/alpaca/qqq15/strategy.go

@@ -46,7 +46,7 @@ func (s alpacaQQQ) Handle(market sentio.Market, ts time.Time, proba float64) ([]
 	)
 
 	// skip too early trades
-	if now.Hour() == 9 && now.Minute() < 40 {
+	if now.Hour() == 9 && now.Minute() < 45 {
 		return orders, nil
 	}
 
@@ -73,14 +73,12 @@ func (s alpacaQQQ) Handle(market sentio.Market, ts time.Time, proba float64) ([]
 		}
 
 		// Close positions before market closed
-		if ok && now.Hour() == 15 && now.Minute() > 45 {
-			orders = append(orders, sentio.StrategyOrder{
+		if ok && now.Hour() == 15 && now.Minute() > 55 {
+			return []sentio.StrategyOrder{{
 				Symbol: symbol,
 				Action: sentio.OrderSell,
 				Ratio:  1,
-			})
-
-			continue
+			}}, nil
 		}
 
 		if proba < 0 {
@@ -88,7 +86,7 @@ func (s alpacaQQQ) Handle(market sentio.Market, ts time.Time, proba float64) ([]
 		}
 
 		// Close LONG position
-		if ok && sentio.LONG == side && proba < 1.0001 {
+		if ok && sentio.LONG == side && proba < 1.0008 {
 			return []sentio.StrategyOrder{{
 				Symbol: symbol,
 				Action: sentio.OrderSell,
@@ -97,7 +95,7 @@ func (s alpacaQQQ) Handle(market sentio.Market, ts time.Time, proba float64) ([]
 		}
 
 		// Close SHORT position
-		if ok && sentio.SHORT == side && proba > .9999 {
+		if ok && sentio.SHORT == side && proba > .9998 {
 			return []sentio.StrategyOrder{{
 				Symbol: symbol,
 				Action: sentio.OrderSell,
@@ -111,7 +109,7 @@ func (s alpacaQQQ) Handle(market sentio.Market, ts time.Time, proba float64) ([]
 		}
 
 		// Prevent BUYs on closing market
-		if now.Hour() == 15 && now.Minute() > 35 {
+		if now.Hour() == 15 && now.Minute() > 46 {
 			continue
 		}
 
@@ -121,7 +119,7 @@ func (s alpacaQQQ) Handle(market sentio.Market, ts time.Time, proba float64) ([]
 			if ok && position.GetAvgPrice()/position.GetCurrentPrice() > 1.002 {
 				// extra position with cheaper price
 				size = .4
-			} else if !ok && proba > 1.00065 {
+			} else if !ok && proba > 1.0008 {
 				// new trade position
 				size = .6
 			}
@@ -143,7 +141,7 @@ func (s alpacaQQQ) Handle(market sentio.Market, ts time.Time, proba float64) ([]
 			if ok && position.GetAvgPrice()/position.GetCurrentPrice() > 1.002 {
 				// extra position with cheaper price
 				size = .4
-			} else if !ok && proba < .9992 {
+			} else if !ok && proba < .9990 {
 				// new trade position
 				size = .6
 			}