Ver código fonte

Market

- add LatestBar(symbol string) (Bar, error)
Alexey Kim 1 ano atrás
pai
commit
5ce02a0436
2 arquivos alterados com 15 adições e 0 exclusões
  1. 13 0
      bar.go
  2. 2 0
      market.go

+ 13 - 0
bar.go

@@ -0,0 +1,13 @@
+package sentio
+
+import "time"
+
+type Bar struct {
+	Datetime time.Time `json:"datetime" yaml:"datetime"`
+	Open     float64   `json:"open" yaml:"open"`
+	High     float64   `json:"high" yaml:"high"`
+	Low      float64   `json:"low" yaml:"low"`
+	Close    float64   `json:"close" yaml:"close"`
+	Volume   float64   `json:"volume" yaml:"volume"`
+	Trades   int       `json:"trades" yaml:"trades"`
+}

+ 2 - 0
market.go

@@ -19,6 +19,8 @@ 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