Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BrokerService ¶
type BrokerService interface { Start() Stop() GetClient(login string) (Client, error) GetProfile(login string) (Profile, error) Create(deal Deal) (Deal, error) Cancel(dealID int64) (bool, error) History(ticker string) ([]OHLCV, error) }
BrokerService broker service.
type ClientRepo ¶
type ClientRepo interface { Add(client *Client) error Get(login string) (Client, bool, error) SumBalance(clientID int64, amount float64) error SubBalance(clientID int64, amount float64) error }
ClientRepo client repository.
type Deal ¶
type Deal struct { ID int64 ClientID int64 Ticker string Type DealType Amount int32 Partial bool Price float64 Status DealStatus Time time.Time }
Deal user deal.
type DealRepo ¶
type DealRepo interface { Add(deal Deal) error GetOpened(clientID int64) ([]Deal, error) Update(deal Deal) error UpdateStatus(dealID int64, status DealStatus) error }
DealRepo deal repository.
type DealStatus ¶
type DealStatus string
DealStatus deal status.
const ( // DealStatusNew new deal status. DealStatusNew DealStatus = "NEW" // DealStatusCompleted completed deal status. DealStatusCompleted DealStatus = "COMPLETED" // DealStatusCanceled canceled deal status. DealStatusCanceled DealStatus = "CANCELED" )
type ExchangeService ¶
type ExchangeService interface { Statistic(ctx context.Context, out chan OHLCV) error Create(deal Deal) (int64, error) Cancel(dealID int64) (bool, error) Results(ctx context.Context, out chan Deal) error }
ExchangeService stock exchange service.
type OHLCV ¶
type OHLCV struct { ID int64 Ticker string Time time.Time Interval time.Duration Open float64 High float64 Low float64 Close float64 Volume int32 }
OHLCV statistic.
type PositionRepo ¶
type PositionRepo interface { Add(position Position) error Get(clientID int64) ([]Position, error) Remove(position Position) error }
PositionRepo position repository.
Click to show internal directories.
Click to hide internal directories.