浏览代码

MKT

- draft
Alexey Kim 1 周之前
父节点
当前提交
11a576b687
共有 2 个文件被更改,包括 22 次插入7 次删除
  1. 5 6
      mkt.go
  2. 17 1
      order.go

+ 5 - 6
mkt.go

@@ -1,7 +1,6 @@
 package sentio
 
 import (
-	"context"
 	"time"
 )
 
@@ -11,13 +10,13 @@ type MKT interface {
 
 	Account() (MarketAccount, error)
 
-	CreateOrder(ctx context.Context, symbol string, quantity uint, sl float64) (Order, error)
-	UpdateOrder(ctx context.Context, orderID string, sl float64) error
-	CloseOrder(ctx context.Context, orderID string) (Order, error)
+	CreateOrder(symbol string, quantity uint, sl float64) (Order, error)
+	UpdateOrder(orderID string, sl float64) error
+	CloseOrder(orderID string) (Order, error)
 
-	Orders(ctx context.Context, status string, nested bool) ([]Order, error)
+	Orders(status string, nested bool) ([]Order, error)
 	Portfolio() (Portfolio, error)
 	PortfolioHistory() ([]PortfolioRecord, error)
-	Quotes(ctx context.Context, symbols ...string) (map[string]Quote, error)
+	Quotes(symbols ...string) (map[string]Quote, error)
 	HistoricalBars(symbol string, interval time.Duration, from *time.Time) ([]Bar, error)
 }

+ 17 - 1
order.go

@@ -1,15 +1,31 @@
 package sentio
 
+import "time"
+
 type Order interface {
 	Market() string
 	AccountId() string
-
 	GetId() string
+
+	GetCreatedAt() time.Time
+	GetUpdatedAt() time.Time
+
+	// HasReplacedBy The order ID that this order was replaced by
+	HasReplacedBy() *string
+
+	// HasReplaced The order ID that this order replaces
+	HasReplaced() *string
+
+	// Legs an array of Order entities associated with this order
+	Legs() []Order
+
 	GetSymbol() string
 	GetAction() OrderAction
 	GetTimeInForce() TimeInForce
 	GetSize() float64
 	GetPrice() float64
+	GetStopLossPrice() *float64
+	GetPnL() float64
 	GetCurrency() string
 	GetStatus() string
 }