瀏覽代碼

Market

- add `PortfolioHistory`
Alexey Kim 11 月之前
父節點
當前提交
1669ce6ea3
共有 2 個文件被更改,包括 11 次插入2 次删除
  1. 1 2
      market.go
  2. 10 0
      portfolio_record.go

+ 1 - 2
market.go

@@ -17,14 +17,13 @@ type Market interface {
 	IsMarketOpened() bool
 	IsMarketOpened() bool
 	Time() Clock
 	Time() Clock
 
 
-	LatestBar(symbol string) (*Bar, error)
-
 	Buy(ctx context.Context, symbol string, ratio float64) (Order, error)
 	Buy(ctx context.Context, symbol string, ratio float64) (Order, error)
 	Sell(ctx context.Context, symbol string, ratio float64) (Order, error)
 	Sell(ctx context.Context, symbol string, ratio float64) (Order, error)
 	CancelOrder(id string) error
 	CancelOrder(id string) error
 
 
 	Orders() ([]Order, error)
 	Orders() ([]Order, error)
 	Portfolio() (Portfolio, error)
 	Portfolio() (Portfolio, error)
+	PortfolioHistory() ([]PortfolioRecord, error)
 
 
 	Cash() (float64, error)
 	Cash() (float64, error)
 	Equity() (float64, error)
 	Equity() (float64, error)

+ 10 - 0
portfolio_record.go

@@ -0,0 +1,10 @@
+package sentio
+
+import "time"
+
+type PortfolioRecord struct {
+	TS     time.Time
+	Equity float64
+	PnL    float64
+	PnLPct float64
+}