|
@@ -9,7 +9,7 @@ var Strategy = alpacaQQQ{}
|
|
type alpacaQQQ struct{}
|
|
type alpacaQQQ struct{}
|
|
|
|
|
|
func (s alpacaQQQ) Name() string {
|
|
func (s alpacaQQQ) Name() string {
|
|
- return "Alpaca: QQQ / SQQQ"
|
|
|
|
|
|
+ return "Alpaca: QQQ [TQQQ : SQQQ]"
|
|
}
|
|
}
|
|
|
|
|
|
func (s alpacaQQQ) Model() string {
|
|
func (s alpacaQQQ) Model() string {
|
|
@@ -22,7 +22,8 @@ func (s alpacaQQQ) MarketId() string {
|
|
|
|
|
|
func (s alpacaQQQ) PositionSymbols() map[sentio.Side]string {
|
|
func (s alpacaQQQ) PositionSymbols() map[sentio.Side]string {
|
|
return map[sentio.Side]string{
|
|
return map[sentio.Side]string{
|
|
- sentio.LONG: "QQQ",
|
|
|
|
|
|
+ sentio.BASE: "QQQ",
|
|
|
|
+ sentio.LONG: "TQQQ",
|
|
sentio.SHORT: "SQQQ",
|
|
sentio.SHORT: "SQQQ",
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -44,6 +45,10 @@ func (s alpacaQQQ) Handle(market sentio.Market, proba float64) ([]sentio.Strateg
|
|
}
|
|
}
|
|
|
|
|
|
for side, symbol := range s.PositionSymbols() {
|
|
for side, symbol := range s.PositionSymbols() {
|
|
|
|
+ if sentio.BASE == side {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+
|
|
var (
|
|
var (
|
|
position sentio.Position
|
|
position sentio.Position
|
|
t = market.Time().Now()
|
|
t = market.Time().Now()
|
|
@@ -91,7 +96,7 @@ func (s alpacaQQQ) Handle(market sentio.Market, proba float64) ([]sentio.Strateg
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
|
|
|
|
- if sentio.LONG == side && proba > 1.00109 {
|
|
|
|
|
|
+ if sentio.LONG == side && proba > 1.00119 {
|
|
if ok && position != nil && position.GetCurrentPrice() > position.GetAvgPrice() {
|
|
if ok && position != nil && position.GetCurrentPrice() > position.GetAvgPrice() {
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
@@ -100,7 +105,7 @@ func (s alpacaQQQ) Handle(market sentio.Market, proba float64) ([]sentio.Strateg
|
|
Symbol: symbol,
|
|
Symbol: symbol,
|
|
Action: sentio.OrderBuy,
|
|
Action: sentio.OrderBuy,
|
|
Ratio: func() float64 {
|
|
Ratio: func() float64 {
|
|
- if t.Hour() >= 16 {
|
|
|
|
|
|
+ if t.Hour() >= 18 {
|
|
return .3
|
|
return .3
|
|
}
|
|
}
|
|
|
|
|
|
@@ -114,7 +119,7 @@ func (s alpacaQQQ) Handle(market sentio.Market, proba float64) ([]sentio.Strateg
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
|
|
|
|
- if sentio.SHORT == side && proba < .9998 {
|
|
|
|
|
|
+ if sentio.SHORT == side && proba < .99955 {
|
|
// prevent extra orders if our position is cheaper
|
|
// prevent extra orders if our position is cheaper
|
|
if ok && position != nil && position.GetCurrentPrice() > position.GetAvgPrice() {
|
|
if ok && position != nil && position.GetCurrentPrice() > position.GetAvgPrice() {
|
|
continue
|
|
continue
|
|
@@ -124,7 +129,7 @@ func (s alpacaQQQ) Handle(market sentio.Market, proba float64) ([]sentio.Strateg
|
|
Symbol: symbol,
|
|
Symbol: symbol,
|
|
Action: sentio.OrderBuy,
|
|
Action: sentio.OrderBuy,
|
|
Ratio: func() float64 {
|
|
Ratio: func() float64 {
|
|
- if t.Hour() >= 16 {
|
|
|
|
|
|
+ if t.Hour() >= 18 {
|
|
return .3
|
|
return .3
|
|
}
|
|
}
|
|
|
|
|