market.go 439 B

1234567891011121314151617181920
  1. package sentio
  2. import "context"
  3. type Market interface {
  4. Connect(done chan struct{}) (chan int, error)
  5. Subscribe(symbol string) error
  6. IsMarketOpened() bool
  7. Buy(ctx context.Context, symbol string, amount float64) (Order, error)
  8. Sell(ctx context.Context, symbol string) (Order, error)
  9. CancelOrder(id string) error
  10. Orders() ([]Order, error)
  11. Portfolio() (Portfolio, error)
  12. AvailableCash() (float64, error)
  13. MaxBudget() float64
  14. }