types: split exchange interface

This commit is contained in:
c9s 2023-05-17 13:24:04 +08:00
parent ee0dcc788b
commit b544d51772
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -76,9 +76,8 @@ type ExchangeMinimal interface {
//go:generate mockgen -destination=mocks/mock_exchange.go -package=mocks . Exchange
type Exchange interface {
ExchangeMinimal
ExchangeMarketDataService
ExchangeAccountService
ExchangeTradeService
}
@ -90,11 +89,13 @@ type ExchangeOrderQueryService interface {
QueryOrderTrades(ctx context.Context, q OrderQuery) ([]Trade, error)
}
type ExchangeTradeService interface {
type ExchangeAccountService interface {
QueryAccount(ctx context.Context) (*Account, error)
QueryAccountBalances(ctx context.Context) (BalanceMap, error)
}
type ExchangeTradeService interface {
SubmitOrder(ctx context.Context, order SubmitOrder) (createdOrder *Order, err error)
QueryOpenOrders(ctx context.Context, symbol string) (orders []Order, err error)