Browse Source

MarketConnection

Alexey Kim 6 months ago
parent
commit
e6f6703e32
2 changed files with 11 additions and 2 deletions
  1. 1 2
      market.go
  2. 10 0
      market_connection.go

+ 1 - 2
market.go

@@ -3,9 +3,8 @@ package sentio
 import "context"
 
 type Market interface {
-	Connect(done chan struct{}) (chan int, error)
+	Connect(done chan struct{}) (chan MarketConnection, error)
 	Subscribe(symbol string) error
-
 	IsMarketOpened() bool
 
 	Buy(ctx context.Context, symbol string, amount float64) (Order, error)

+ 10 - 0
market_connection.go

@@ -0,0 +1,10 @@
+package sentio
+
+type MarketConnection int
+
+const (
+	SubscriptionGracefulStop MarketConnection = iota
+	SubscriptionConnectionError
+	SubscriptionUnexpectedError
+	SubscriptionAuthenticated
+)