Browse Source

Market

- CloseOrder: refactoring
Alexey Kim 17 hours ago
parent
commit
f079b42109
3 changed files with 7 additions and 7 deletions
  1. 1 1
      market.go
  2. 4 4
      strategy/alpaca/qqq15/strategy.go
  3. 2 2
      strategy/alpaca/qqq15_nodelay/strategy.go

+ 1 - 1
market.go

@@ -15,7 +15,7 @@ type Market interface {
 
 	CreateOrder(symbol string, quantity uint, sl float64) (Order, error)
 	UpdateOrder(orderID string, sl float64) error
-	CloseOrder(orderID string) (Order, error)
+	CloseOrder(order Order) (Order, error)
 
 	Order(orderID string, nested bool) (Order, error)
 	Orders(criteria OrderListCriteria) ([]Order, error)

+ 4 - 4
strategy/alpaca/qqq15/strategy.go

@@ -9,8 +9,8 @@ import (
 
 const (
 	ATR_MULTIPLIER = 1.5
-	ATR_PERIOD     = 4
-	ATR_HHV        = 5
+	ATR_PERIOD     = 14
+	ATR_HHV        = 4
 )
 
 var Strategy = qqq{}
@@ -86,7 +86,7 @@ func (strategy qqq) Handle(market sentio.Market, probability sentio.Probability)
 	for i := range orders {
 		if strategy.PositionSymbols()[sentio.LONG] == orders[i].GetSymbol() &&
 			probability.Value < 1.0008 {
-			if _, err = market.CloseOrder(orders[i].GetId()); err != nil {
+			if _, err = market.CloseOrder(orders[i]); err != nil {
 				return err
 			}
 
@@ -96,7 +96,7 @@ func (strategy qqq) Handle(market sentio.Market, probability sentio.Probability)
 
 		if strategy.PositionSymbols()[sentio.SHORT] == orders[i].GetSymbol() &&
 			probability.Value > .9998 {
-			if _, err = market.CloseOrder(orders[i].GetId()); err != nil {
+			if _, err = market.CloseOrder(orders[i]); err != nil {
 				return err
 			}
 

+ 2 - 2
strategy/alpaca/qqq15_nodelay/strategy.go

@@ -8,8 +8,8 @@ import (
 
 const (
 	ATR_MULTIPLIER = 1.5
-	ATR_PERIOD     = 4
-	ATR_HHV        = 5
+	ATR_PERIOD     = 14
+	ATR_HHV        = 4
 )
 
 var Strategy = qqq{}