2
0
Pārlūkot izejas kodu

BaseStrategy

- refactoring
Alexey Kim 3 dienas atpakaļ
vecāks
revīzija
148ced3565

+ 1 - 32
strategy.go

@@ -30,38 +30,7 @@ const (
 )
 
 type BaseStrategy struct {
-}
-
-func (strategy BaseStrategy) Name() string {
-	panic("implement me")
-}
-
-func (strategy BaseStrategy) Model() string {
-	panic("implement me")
-}
-
-func (strategy BaseStrategy) MarketId() string {
-	return "alpaca"
-}
-
-func (strategy BaseStrategy) PositionSymbols() map[Side]string {
-	return nil
-}
-
-func (strategy BaseStrategy) PositionProbabilities() map[Side]float64 {
-	return nil
-}
-
-func (strategy BaseStrategy) Interval() uint8 {
-	return 5
-}
-
-func (strategy BaseStrategy) Cooldown(periods uint8) time.Duration {
-	return time.Minute * time.Duration(strategy.Interval()*periods)
-}
-
-func (strategy BaseStrategy) Handle(market Market, probability Probability) error {
-	return nil
+	Strategy
 }
 
 func (strategy BaseStrategy) Symbols() []string {

+ 12 - 0
strategy/alpaca/qqq15/strategy.go

@@ -19,6 +19,18 @@ func (strategy qqq) Model() string {
 	return "qqq15"
 }
 
+func (strategy qqq) MarketId() string {
+	return "alpaca"
+}
+
+func (strategy qqq) Interval() uint8 {
+	return 5
+}
+
+func (strategy qqq) Cooldown(periods uint8) time.Duration {
+	return time.Minute * time.Duration(strategy.Interval()*periods)
+}
+
 func (strategy qqq) PositionSymbols() map[sentio.Side]string {
 	return map[sentio.Side]string{
 		sentio.BASE:  "QQQ",

+ 13 - 0
strategy/alpaca/qqq15_nodelay/strategy.go

@@ -2,6 +2,7 @@ package main
 
 import (
 	"git.beejay.kim/Gshopper/sentio"
+	"time"
 )
 
 var Strategy = qqq{}
@@ -18,6 +19,18 @@ func (strategy qqq) Model() string {
 	return "qqq15"
 }
 
+func (strategy qqq) MarketId() string {
+	return "alpaca"
+}
+
+func (strategy qqq) Interval() uint8 {
+	return 5
+}
+
+func (strategy qqq) Cooldown(periods uint8) time.Duration {
+	return time.Minute * time.Duration(strategy.Interval()*periods)
+}
+
 func (strategy qqq) PositionSymbols() map[sentio.Side]string {
 	return map[sentio.Side]string{
 		sentio.BASE:  "QQQ",