Преглед изворни кода

Market

- add LatestBar(symbol string) (Bar, error)
Alexey Kim пре 1 година
родитељ
комит
5ce02a0436
2 измењених фајлова са 15 додато и 0 уклоњено
  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