Documentation
¶
Overview ¶
Package exchanges is a generated GoMock package.
Index ¶
- Variables
- func RevPrice(p *apd.Decimal) *apd.Decimal
- type Account
- type AccountBalance
- type AccountPosition
- type BulkCancelExchange
- type BulkCancelResult
- type Exchange
- type MockBulkCancelExchange
- type MockBulkCancelExchangeMockRecorder
- type MockExchange
- func (m *MockExchange) CancelOrder(arg0 context.Context, symbol, id string) error
- func (m *MockExchange) EXPECT() *MockExchangeMockRecorder
- func (m *MockExchange) GenerateClientOrderID(ctx context.Context, identifierID string) (string, error)
- func (m *MockExchange) GetAccount(arg0 context.Context) (Account, error)
- func (m *MockExchange) GetName() string
- func (m *MockExchange) GetOpenOrders(arg0 context.Context) ([]OrderDetailInfo, error)
- func (m *MockExchange) GetOrderInfo(arg0 context.Context, symbol, id string, createdAt *time.Time) (OrderInfo, error)
- func (m *MockExchange) GetOrderInfoByClientOrderID(arg0 context.Context, symbol, clientOrderID string, createdAt *time.Time) (OrderInfo, error)
- func (m *MockExchange) GetOrders(ctx context.Context, filter OrderFilter) ([]OrderDetailInfo, error)
- func (m *MockExchange) GetPrefix() string
- func (m *MockExchange) GetPrice(arg0 context.Context, symbol string) (*apd.Decimal, error)
- func (m *MockExchange) GetTradableSymbols(arg0 context.Context) ([]SymbolInfo, error)
- func (m *MockExchange) PlaceBuyOrder(arg0 context.Context, isRetry bool, symbol string, price, qty *apd.Decimal, ...) (string, error)
- func (m *MockExchange) PlaceBuyOrderV2(arg0 context.Context, isRetry bool, symbol string, price, qty *apd.Decimal, ...) (string, error)
- func (m *MockExchange) PlaceSellOrder(arg0 context.Context, isRetry bool, symbol string, price, qty *apd.Decimal, ...) (string, error)
- func (m *MockExchange) PlaceSellOrderV2(arg0 context.Context, isRetry bool, symbol string, price, qty *apd.Decimal, ...) (string, error)
- func (m *MockExchange) ReleaseOrder(arg0 context.Context, symbol, id string) error
- func (m *MockExchange) RoundPrice(arg0 context.Context, symbol string, price *apd.Decimal, tickSize *string) (*apd.Decimal, error)
- func (m *MockExchange) RoundQuantity(arg0 context.Context, symbol string, qty *apd.Decimal) (*apd.Decimal, error)
- func (m *MockExchange) WatchAccountPositions(arg0 context.Context) (<-chan PositionEvent, error)
- func (m *MockExchange) WatchOrdersStatuses(arg0 context.Context) (<-chan OrderEvent, error)
- func (m *MockExchange) WatchSymbolPrice(arg0 context.Context, symbol string) (<-chan PriceEvent, error)
- type MockExchangeMockRecorder
- func (mr *MockExchangeMockRecorder) CancelOrder(arg0, symbol, id interface{}) *gomock.Call
- func (mr *MockExchangeMockRecorder) GenerateClientOrderID(ctx, identifierID interface{}) *gomock.Call
- func (mr *MockExchangeMockRecorder) GetAccount(arg0 interface{}) *gomock.Call
- func (mr *MockExchangeMockRecorder) GetName() *gomock.Call
- func (mr *MockExchangeMockRecorder) GetOpenOrders(arg0 interface{}) *gomock.Call
- func (mr *MockExchangeMockRecorder) GetOrderInfo(arg0, symbol, id, createdAt interface{}) *gomock.Call
- func (mr *MockExchangeMockRecorder) GetOrderInfoByClientOrderID(arg0, symbol, clientOrderID, createdAt interface{}) *gomock.Call
- func (mr *MockExchangeMockRecorder) GetOrders(ctx, filter interface{}) *gomock.Call
- func (mr *MockExchangeMockRecorder) GetPrefix() *gomock.Call
- func (mr *MockExchangeMockRecorder) GetPrice(arg0, symbol interface{}) *gomock.Call
- func (mr *MockExchangeMockRecorder) GetTradableSymbols(arg0 interface{}) *gomock.Call
- func (mr *MockExchangeMockRecorder) PlaceBuyOrder(arg0, isRetry, symbol, price, qty, clientOrderID interface{}) *gomock.Call
- func (mr *MockExchangeMockRecorder) PlaceBuyOrderV2(arg0, isRetry, symbol, price, qty, clientOrderID, orderType interface{}) *gomock.Call
- func (mr *MockExchangeMockRecorder) PlaceSellOrder(arg0, isRetry, symbol, price, qty, clientOrderID interface{}) *gomock.Call
- func (mr *MockExchangeMockRecorder) PlaceSellOrderV2(arg0, isRetry, symbol, price, qty, clientOrderID, orderType interface{}) *gomock.Call
- func (mr *MockExchangeMockRecorder) ReleaseOrder(arg0, symbol, id interface{}) *gomock.Call
- func (mr *MockExchangeMockRecorder) RoundPrice(arg0, symbol, price, tickSize interface{}) *gomock.Call
- func (mr *MockExchangeMockRecorder) RoundQuantity(arg0, symbol, qty interface{}) *gomock.Call
- func (mr *MockExchangeMockRecorder) WatchAccountPositions(arg0 interface{}) *gomock.Call
- func (mr *MockExchangeMockRecorder) WatchOrdersStatuses(arg0 interface{}) *gomock.Call
- func (mr *MockExchangeMockRecorder) WatchSymbolPrice(arg0, symbol interface{}) *gomock.Call
- type OrderDetailInfo
- type OrderEvent
- type OrderEventPayload
- type OrderEventReconnector
- type OrderEventReconnectorFn
- type OrderFilter
- type OrderInfo
- type OrderSide
- type OrderStatusType
- type OrderTimeInForce
- type OrderType
- type PayloadType
- type PositionEvent
- type PositionPayload
- type PriceEvent
- type PriceEventReconnector
- type PriceEventReconnectorFn
- type RetryeableExchange
- func (re *RetryeableExchange) CancelOrder(ctx context.Context, symbol, id string) error
- func (re *RetryeableExchange) GenerateClientOrderID(ctx context.Context, identifierID string) (string, error)
- func (re *RetryeableExchange) GetAccount(ctx context.Context) (res Account, e error)
- func (re *RetryeableExchange) GetName() string
- func (re *RetryeableExchange) GetOpenOrders(ctx context.Context) (res []OrderDetailInfo, e error)
- func (re *RetryeableExchange) GetOrderInfo(ctx context.Context, symbol, id string, createdAt *time.Time) (info OrderInfo, e error)
- func (re *RetryeableExchange) GetOrderInfoByClientOrderID(ctx context.Context, symbol, clientOrderID string, createdAt *time.Time) (info OrderInfo, e error)
- func (re *RetryeableExchange) GetOrders(ctx context.Context, filter OrderFilter) (res []OrderDetailInfo, e error)
- func (re *RetryeableExchange) GetPrefix() string
- func (re *RetryeableExchange) GetPrice(ctx context.Context, symbol string) (price *apd.Decimal, e error)
- func (re *RetryeableExchange) GetTradableSymbols(ctx context.Context) (info []SymbolInfo, e error)
- func (re *RetryeableExchange) PlaceBuyOrder(ctx context.Context, isRetry bool, symbol string, price, quantity *apd.Decimal, ...) (id string, e error)
- func (re *RetryeableExchange) PlaceBuyOrderV2(ctx context.Context, isRetry bool, symbol string, price, qty *apd.Decimal, ...) (id string, e error)
- func (re *RetryeableExchange) PlaceSellOrder(ctx context.Context, isRetry bool, symbol string, price, quantity *apd.Decimal, ...) (id string, e error)
- func (re *RetryeableExchange) PlaceSellOrderV2(ctx context.Context, isRetry bool, symbol string, price, qty *apd.Decimal, ...) (id string, e error)
- func (re *RetryeableExchange) ReleaseOrder(ctx context.Context, symbol, id string) error
- func (re *RetryeableExchange) RoundPrice(ctx context.Context, symbol string, price *apd.Decimal, tickSize *string) (result *apd.Decimal, e error)
- func (re *RetryeableExchange) RoundQuantity(ctx context.Context, symbol string, quantity *apd.Decimal) (result *apd.Decimal, e error)
- func (re *RetryeableExchange) WatchAccountPositions(ctx context.Context) (<-chan PositionEvent, error)
- func (re *RetryeableExchange) WatchOrdersStatuses(ctx context.Context) (<-chan OrderEvent, error)
- func (re *RetryeableExchange) WatchSymbolPrice(ctx context.Context, symbol string) (<-chan PriceEvent, error)
- type ReversedExchange
- func (re *ReversedExchange) CancelOrder(ctx context.Context, symbol, id string) error
- func (re *ReversedExchange) GetOrderInfo(ctx context.Context, symbol, id string, createdAt *time.Time) (OrderInfo, error)
- func (re *ReversedExchange) GetOrderInfoByClientOrderID(ctx context.Context, symbol, clientOrderID string, createdAt *time.Time) (OrderInfo, error)
- func (re *ReversedExchange) GetPrice(ctx context.Context, symbol string) (*apd.Decimal, error)
- func (re *ReversedExchange) GetTradableSymbols(ctx context.Context) ([]SymbolInfo, error)
- func (re *ReversedExchange) PlaceBuyOrder(ctx context.Context, isRetry bool, symbol string, price, quantity *apd.Decimal, ...) (id string, e error)
- func (re *ReversedExchange) PlaceSellOrder(ctx context.Context, isRetry bool, symbol string, price, quantity *apd.Decimal, ...) (id string, e error)
- func (re *ReversedExchange) WatchOrdersStatuses(ctx context.Context) (<-chan OrderEvent, error)
- func (re *ReversedExchange) WatchSymbolPrice(ctx context.Context, symbol string) (<-chan PriceEvent, error)
- type SequentialBulkCancelExchange
- type SymbolInfo
- type TypeEvent
- type TypeEventReconnector
- type TypeEventReconnectorFn
Constants ¶
This section is empty.
Variables ¶
var NewOrderRejectedError = errors.New("new order was rejected")
var OrderExecutedError = errors.New("order was executed")
var OrderNotFoundError = errors.New("order not found")
Functions ¶
Types ¶
type Account ¶
type Account struct { AccountBalances []AccountBalance AccountPositions []AccountPosition }
type AccountBalance ¶
type AccountPosition ¶
type BulkCancelExchange ¶
type BulkCancelExchange interface { // can return `OrderExecutedError` in case of executed order. // can return `OrderNotFoundError` in case of not found order. BulkCancelOrder(symbol string, ids []string) ([]BulkCancelResult, error) }
type BulkCancelResult ¶
type Exchange ¶
type Exchange interface { GetPrefix() string GetName() string RoundPrice(_ context.Context, symbol string, price *apd.Decimal, tickSize *string) (*apd.Decimal, error) RoundQuantity(_ context.Context, symbol string, qty *apd.Decimal) (*apd.Decimal, error) // This method should use `clientOrderID` if it's possible PlaceBuyOrder( _ context.Context, isRetry bool, symbol string, price, qty *apd.Decimal, clientOrderID string, ) (id string, e error) // This method should use `clientOrderID` if it's possible PlaceSellOrder( _ context.Context, isRetry bool, symbol string, price, qty *apd.Decimal, clientOrderID string, ) (id string, e error) // can return `OrderExecutedError` in case of executed order. // can return `OrderNotFoundError` in case of not found order. // It's important to have Canceled state if no error returned // !Always release order after cancellation CancelOrder(_ context.Context, symbol, id string) error // Order should be released after cancellation ReleaseOrder(_ context.Context, symbol, id string) error GetPrice(_ context.Context, symbol string) (*apd.Decimal, error) // `createdAt` can be omitted. But some exchanges can require it GetOrderInfo(_ context.Context, symbol, id string, createdAt *time.Time) (OrderInfo, error) GetOrderInfoByClientOrderID(_ context.Context, symbol, clientOrderID string, createdAt *time.Time) (OrderInfo, error) GetTradableSymbols(context.Context) ([]SymbolInfo, error) // Returns control immediately // If error is sent then channel will be closed automatically // Channel will be closed in two ways: by context and by disconnection WatchOrdersStatuses(context.Context) (<-chan OrderEvent, error) // Returns control immediately // If error is sent then channel will be closed automatically // Channel will be closed in two ways: by context and by disconnection WatchSymbolPrice(_ context.Context, symbol string) (<-chan PriceEvent, error) PlaceBuyOrderV2( _ context.Context, isRetry bool, symbol string, price, qty *apd.Decimal, clientOrderID string, orderType string, ) (id string, e error) PlaceSellOrderV2( _ context.Context, isRetry bool, symbol string, price, qty *apd.Decimal, clientOrderID string, orderType string, ) (id string, e error) WatchAccountPositions(context.Context) (<-chan PositionEvent, error) GetOpenOrders(context.Context) ([]OrderDetailInfo, error) GetOrders(ctx context.Context, filter OrderFilter) ([]OrderDetailInfo, error) GetAccount(context.Context) (Account, error) GenerateClientOrderID(ctx context.Context, identifierID string) (string, error) }
`id` of orders placing result should be consistent (accept/return) with other methods.
The Exchange is responsible for all tryings to reconnect to WebSockets, the implementation should try the best to make connection reliable, but if for several retries it can't connect it should send error without closing the channel. Call an Unwatch method is not required in this case.
type MockBulkCancelExchange ¶
type MockBulkCancelExchange struct {
// contains filtered or unexported fields
}
MockBulkCancelExchange is a mock of BulkCancelExchange interface.
func NewMockBulkCancelExchange ¶
func NewMockBulkCancelExchange(ctrl *gomock.Controller) *MockBulkCancelExchange
NewMockBulkCancelExchange creates a new mock instance.
func (*MockBulkCancelExchange) BulkCancelOrder ¶
func (m *MockBulkCancelExchange) BulkCancelOrder(symbol string, ids []string) ([]BulkCancelResult, error)
BulkCancelOrder mocks base method.
func (*MockBulkCancelExchange) EXPECT ¶
func (m *MockBulkCancelExchange) EXPECT() *MockBulkCancelExchangeMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockBulkCancelExchangeMockRecorder ¶
type MockBulkCancelExchangeMockRecorder struct {
// contains filtered or unexported fields
}
MockBulkCancelExchangeMockRecorder is the mock recorder for MockBulkCancelExchange.
func (*MockBulkCancelExchangeMockRecorder) BulkCancelOrder ¶
func (mr *MockBulkCancelExchangeMockRecorder) BulkCancelOrder(symbol, ids interface{}) *gomock.Call
BulkCancelOrder indicates an expected call of BulkCancelOrder.
type MockExchange ¶
type MockExchange struct {
// contains filtered or unexported fields
}
MockExchange is a mock of Exchange interface.
func NewMockExchange ¶
func NewMockExchange(ctrl *gomock.Controller) *MockExchange
NewMockExchange creates a new mock instance.
func (*MockExchange) CancelOrder ¶
func (m *MockExchange) CancelOrder(arg0 context.Context, symbol, id string) error
CancelOrder mocks base method.
func (*MockExchange) EXPECT ¶
func (m *MockExchange) EXPECT() *MockExchangeMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockExchange) GenerateClientOrderID ¶
func (m *MockExchange) GenerateClientOrderID(ctx context.Context, identifierID string) (string, error)
GenerateClientOrderID mocks base method.
func (*MockExchange) GetAccount ¶
func (m *MockExchange) GetAccount(arg0 context.Context) (Account, error)
GetAccount mocks base method.
func (*MockExchange) GetOpenOrders ¶
func (m *MockExchange) GetOpenOrders(arg0 context.Context) ([]OrderDetailInfo, error)
GetOpenOrders mocks base method.
func (*MockExchange) GetOrderInfo ¶
func (m *MockExchange) GetOrderInfo(arg0 context.Context, symbol, id string, createdAt *time.Time) (OrderInfo, error)
GetOrderInfo mocks base method.
func (*MockExchange) GetOrderInfoByClientOrderID ¶
func (m *MockExchange) GetOrderInfoByClientOrderID(arg0 context.Context, symbol, clientOrderID string, createdAt *time.Time) (OrderInfo, error)
GetOrderInfoByClientOrderID mocks base method.
func (*MockExchange) GetOrders ¶
func (m *MockExchange) GetOrders(ctx context.Context, filter OrderFilter) ([]OrderDetailInfo, error)
GetOrders mocks base method.
func (*MockExchange) GetPrefix ¶
func (m *MockExchange) GetPrefix() string
GetPrefix mocks base method.
func (*MockExchange) GetTradableSymbols ¶
func (m *MockExchange) GetTradableSymbols(arg0 context.Context) ([]SymbolInfo, error)
GetTradableSymbols mocks base method.
func (*MockExchange) PlaceBuyOrder ¶
func (m *MockExchange) PlaceBuyOrder(arg0 context.Context, isRetry bool, symbol string, price, qty *apd.Decimal, clientOrderID string) (string, error)
PlaceBuyOrder mocks base method.
func (*MockExchange) PlaceBuyOrderV2 ¶
func (m *MockExchange) PlaceBuyOrderV2(arg0 context.Context, isRetry bool, symbol string, price, qty *apd.Decimal, clientOrderID, orderType string) (string, error)
PlaceBuyOrderV2 mocks base method.
func (*MockExchange) PlaceSellOrder ¶
func (m *MockExchange) PlaceSellOrder(arg0 context.Context, isRetry bool, symbol string, price, qty *apd.Decimal, clientOrderID string) (string, error)
PlaceSellOrder mocks base method.
func (*MockExchange) PlaceSellOrderV2 ¶
func (m *MockExchange) PlaceSellOrderV2(arg0 context.Context, isRetry bool, symbol string, price, qty *apd.Decimal, clientOrderID, orderType string) (string, error)
PlaceSellOrderV2 mocks base method.
func (*MockExchange) ReleaseOrder ¶
func (m *MockExchange) ReleaseOrder(arg0 context.Context, symbol, id string) error
ReleaseOrder mocks base method.
func (*MockExchange) RoundPrice ¶
func (m *MockExchange) RoundPrice(arg0 context.Context, symbol string, price *apd.Decimal, tickSize *string) (*apd.Decimal, error)
RoundPrice mocks base method.
func (*MockExchange) RoundQuantity ¶
func (m *MockExchange) RoundQuantity(arg0 context.Context, symbol string, qty *apd.Decimal) (*apd.Decimal, error)
RoundQuantity mocks base method.
func (*MockExchange) WatchAccountPositions ¶
func (m *MockExchange) WatchAccountPositions(arg0 context.Context) (<-chan PositionEvent, error)
WatchAccountPositions mocks base method.
func (*MockExchange) WatchOrdersStatuses ¶
func (m *MockExchange) WatchOrdersStatuses(arg0 context.Context) (<-chan OrderEvent, error)
WatchOrdersStatuses mocks base method.
func (*MockExchange) WatchSymbolPrice ¶
func (m *MockExchange) WatchSymbolPrice(arg0 context.Context, symbol string) (<-chan PriceEvent, error)
WatchSymbolPrice mocks base method.
type MockExchangeMockRecorder ¶
type MockExchangeMockRecorder struct {
// contains filtered or unexported fields
}
MockExchangeMockRecorder is the mock recorder for MockExchange.
func (*MockExchangeMockRecorder) CancelOrder ¶
func (mr *MockExchangeMockRecorder) CancelOrder(arg0, symbol, id interface{}) *gomock.Call
CancelOrder indicates an expected call of CancelOrder.
func (*MockExchangeMockRecorder) GenerateClientOrderID ¶
func (mr *MockExchangeMockRecorder) GenerateClientOrderID(ctx, identifierID interface{}) *gomock.Call
GenerateClientOrderID indicates an expected call of GenerateClientOrderID.
func (*MockExchangeMockRecorder) GetAccount ¶
func (mr *MockExchangeMockRecorder) GetAccount(arg0 interface{}) *gomock.Call
GetAccount indicates an expected call of GetAccount.
func (*MockExchangeMockRecorder) GetName ¶
func (mr *MockExchangeMockRecorder) GetName() *gomock.Call
GetName indicates an expected call of GetName.
func (*MockExchangeMockRecorder) GetOpenOrders ¶
func (mr *MockExchangeMockRecorder) GetOpenOrders(arg0 interface{}) *gomock.Call
GetOpenOrders indicates an expected call of GetOpenOrders.
func (*MockExchangeMockRecorder) GetOrderInfo ¶
func (mr *MockExchangeMockRecorder) GetOrderInfo(arg0, symbol, id, createdAt interface{}) *gomock.Call
GetOrderInfo indicates an expected call of GetOrderInfo.
func (*MockExchangeMockRecorder) GetOrderInfoByClientOrderID ¶
func (mr *MockExchangeMockRecorder) GetOrderInfoByClientOrderID(arg0, symbol, clientOrderID, createdAt interface{}) *gomock.Call
GetOrderInfoByClientOrderID indicates an expected call of GetOrderInfoByClientOrderID.
func (*MockExchangeMockRecorder) GetOrders ¶
func (mr *MockExchangeMockRecorder) GetOrders(ctx, filter interface{}) *gomock.Call
GetOrders indicates an expected call of GetOrders.
func (*MockExchangeMockRecorder) GetPrefix ¶
func (mr *MockExchangeMockRecorder) GetPrefix() *gomock.Call
GetPrefix indicates an expected call of GetPrefix.
func (*MockExchangeMockRecorder) GetPrice ¶
func (mr *MockExchangeMockRecorder) GetPrice(arg0, symbol interface{}) *gomock.Call
GetPrice indicates an expected call of GetPrice.
func (*MockExchangeMockRecorder) GetTradableSymbols ¶
func (mr *MockExchangeMockRecorder) GetTradableSymbols(arg0 interface{}) *gomock.Call
GetTradableSymbols indicates an expected call of GetTradableSymbols.
func (*MockExchangeMockRecorder) PlaceBuyOrder ¶
func (mr *MockExchangeMockRecorder) PlaceBuyOrder(arg0, isRetry, symbol, price, qty, clientOrderID interface{}) *gomock.Call
PlaceBuyOrder indicates an expected call of PlaceBuyOrder.
func (*MockExchangeMockRecorder) PlaceBuyOrderV2 ¶
func (mr *MockExchangeMockRecorder) PlaceBuyOrderV2(arg0, isRetry, symbol, price, qty, clientOrderID, orderType interface{}) *gomock.Call
PlaceBuyOrderV2 indicates an expected call of PlaceBuyOrderV2.
func (*MockExchangeMockRecorder) PlaceSellOrder ¶
func (mr *MockExchangeMockRecorder) PlaceSellOrder(arg0, isRetry, symbol, price, qty, clientOrderID interface{}) *gomock.Call
PlaceSellOrder indicates an expected call of PlaceSellOrder.
func (*MockExchangeMockRecorder) PlaceSellOrderV2 ¶
func (mr *MockExchangeMockRecorder) PlaceSellOrderV2(arg0, isRetry, symbol, price, qty, clientOrderID, orderType interface{}) *gomock.Call
PlaceSellOrderV2 indicates an expected call of PlaceSellOrderV2.
func (*MockExchangeMockRecorder) ReleaseOrder ¶
func (mr *MockExchangeMockRecorder) ReleaseOrder(arg0, symbol, id interface{}) *gomock.Call
ReleaseOrder indicates an expected call of ReleaseOrder.
func (*MockExchangeMockRecorder) RoundPrice ¶
func (mr *MockExchangeMockRecorder) RoundPrice(arg0, symbol, price, tickSize interface{}) *gomock.Call
RoundPrice indicates an expected call of RoundPrice.
func (*MockExchangeMockRecorder) RoundQuantity ¶
func (mr *MockExchangeMockRecorder) RoundQuantity(arg0, symbol, qty interface{}) *gomock.Call
RoundQuantity indicates an expected call of RoundQuantity.
func (*MockExchangeMockRecorder) WatchAccountPositions ¶
func (mr *MockExchangeMockRecorder) WatchAccountPositions(arg0 interface{}) *gomock.Call
WatchAccountPositions indicates an expected call of WatchAccountPositions.
func (*MockExchangeMockRecorder) WatchOrdersStatuses ¶
func (mr *MockExchangeMockRecorder) WatchOrdersStatuses(arg0 interface{}) *gomock.Call
WatchOrdersStatuses indicates an expected call of WatchOrdersStatuses.
func (*MockExchangeMockRecorder) WatchSymbolPrice ¶
func (mr *MockExchangeMockRecorder) WatchSymbolPrice(arg0, symbol interface{}) *gomock.Call
WatchSymbolPrice indicates an expected call of WatchSymbolPrice.
type OrderDetailInfo ¶
type OrderEvent ¶
type OrderEvent struct { DisconnectedWithErr error Reconnected *struct{} Payload *OrderEventPayload }
Should be one of three In case of first connection no reconnection event should be sent
func (OrderEvent) String ¶
func (ev OrderEvent) String() string
type OrderEventPayload ¶
type OrderEventPayload struct { OrderID string OrderStatus OrderStatusType Symbol *string // Now it is optional. But it's better to fill it if possible }
func (*OrderEventPayload) String ¶
func (oep *OrderEventPayload) String() string
type OrderEventReconnector ¶
type OrderEventReconnector struct {
// contains filtered or unexported fields
}
func NewOrderEventReconnector ¶
func NewOrderEventReconnector( connect OrderEventReconnectorFn, reconnectOpts []retry.Option, l *zap.Logger, ) *OrderEventReconnector
func (*OrderEventReconnector) Watch ¶
func (r *OrderEventReconnector) Watch( ctx context.Context, ) (<-chan OrderEvent, error)
type OrderEventReconnectorFn ¶
type OrderEventReconnectorFn func(context.Context) (<-chan OrderEvent, error)
type OrderFilter ¶
type OrderInfo ¶
type OrderInfo struct { ID string ClientOrderID *string // optional Status OrderStatusType }
type OrderStatusType ¶
type OrderStatusType int
const ( UnknownOST OrderStatusType = 0 NewOST OrderStatusType = 1 // NEW - The order has been accepted by the engine. PartiallyFilledOST OrderStatusType = 2 // PARTIALLY_FILLED - A part of the order has been filled. FilledOST OrderStatusType = 3 // FILLED - The order has been completely filled. CanceledOST OrderStatusType = 4 // CANCELED - The order has been canceled by the user. // PENDING_CANCEL (currently unused) RejectedOST OrderStatusType = 5 // REJECTED - The order was not accepted by the engine and not processed. ExpiredOST OrderStatusType = 6 // EXPIRED - The order was canceled according to the order type's rules (e.g. LIMIT FOK orders with no fill, LIMIT IOC or MARKET orders that partially fill) or by the exchange, (e.g. orders canceled during liquidation, orders canceled during maintenance) OpenOST OrderStatusType = 7 // OPEN status for FTX exchange ClosedOST OrderStatusType = 8 // Closed status for FTX exchange )
Defenition from Binance
func (OrderStatusType) IsFinalStatus ¶
func (ost OrderStatusType) IsFinalStatus() bool
func (OrderStatusType) String ¶
func (ost OrderStatusType) String() string
type OrderTimeInForce ¶
type OrderTimeInForce string
const ( GTC_TIME_IN_FORCE OrderTimeInForce = "GTC" IOC_TIME_IN_FORCE OrderTimeInForce = "IOC" FOK_TIME_IN_FORCE OrderTimeInForce = "FOK" DAY_TIME_IN_FORCE OrderTimeInForce = "DAY" GOOD_TILL_CANCEL_TIME_IN_FORCE OrderTimeInForce = "GOOD_TILL_CANCEL" IMMEDIATE_OR_CANCEL_TIME_IN_FORCE OrderTimeInForce = "IMMEDIATE_OR_CANCEL" FILL_OR_KILL_TIME_IN_FORCE OrderTimeInForce = "FILL_OR_KILL" )
type OrderType ¶
type OrderType string
const ( LIMIT OrderType = "LIMIT" MARKET OrderType = "MARKET" LIMIT_MAKER OrderType = "LIMIT_MAKER" STOP_LOSS OrderType = "STOP_LOSS" STOP_LOSS_LIMIT OrderType = "STOP_LOSS_LIMIT" TAKE_PROFIT OrderType = "TAKE_PROFIT" TAKE_PROFIT_LIMIT OrderType = "TAKE_PROFIT_LIMIT" MARKET_IF_TOUCHED OrderType = "MARKET_IF_TOUCHED" LIMIT_IF_TOUCHED OrderType = "LIMIT_IF_TOUCHED" PEGGED OrderType = "PEGGED" )
type PayloadType ¶
type PositionEvent ¶
type PositionEvent struct { DisconnectedWithErr error Reconnected *struct{} Payload []*PositionPayload }
type PositionPayload ¶
type PriceEvent ¶
Should be one of three In case of first connection no reconnection event should be sent
func (PriceEvent) String ¶
func (ev PriceEvent) String() string
type PriceEventReconnector ¶
type PriceEventReconnector struct {
// contains filtered or unexported fields
}
func NewPriceEventReconnector ¶
func NewPriceEventReconnector( connect PriceEventReconnectorFn, reconnectOpts []retry.Option, l *zap.Logger, ) *PriceEventReconnector
func (*PriceEventReconnector) Watch ¶
func (r *PriceEventReconnector) Watch( ctx context.Context, ) (<-chan PriceEvent, error)
type PriceEventReconnectorFn ¶
type PriceEventReconnectorFn func(context.Context) (<-chan PriceEvent, error)
type RetryeableExchange ¶
type RetryeableExchange struct { Target Exchange RetryOptions []retry.Option // optional CancelRetryOptions []retry.Option // optional Logger *zap.Logger }
All methods are retryeable except of watch/unwatch methods TODO: all methods shouldn't think result of `NotFound` error (or similar erorrs) should be retryed
func (*RetryeableExchange) CancelOrder ¶
func (re *RetryeableExchange) CancelOrder(ctx context.Context, symbol, id string) error
func (*RetryeableExchange) GenerateClientOrderID ¶
func (*RetryeableExchange) GetAccount ¶
func (re *RetryeableExchange) GetAccount(ctx context.Context) (res Account, e error)
func (*RetryeableExchange) GetName ¶
func (re *RetryeableExchange) GetName() string
func (*RetryeableExchange) GetOpenOrders ¶
func (re *RetryeableExchange) GetOpenOrders(ctx context.Context) (res []OrderDetailInfo, e error)
func (*RetryeableExchange) GetOrderInfo ¶
func (*RetryeableExchange) GetOrderInfoByClientOrderID ¶
func (*RetryeableExchange) GetOrders ¶
func (re *RetryeableExchange) GetOrders(ctx context.Context, filter OrderFilter) (res []OrderDetailInfo, e error)
func (*RetryeableExchange) GetPrefix ¶
func (re *RetryeableExchange) GetPrefix() string
func (*RetryeableExchange) GetTradableSymbols ¶
func (re *RetryeableExchange) GetTradableSymbols(ctx context.Context) (info []SymbolInfo, e error)
func (*RetryeableExchange) PlaceBuyOrder ¶
func (*RetryeableExchange) PlaceBuyOrderV2 ¶
func (*RetryeableExchange) PlaceSellOrder ¶
func (*RetryeableExchange) PlaceSellOrderV2 ¶
func (*RetryeableExchange) ReleaseOrder ¶
func (re *RetryeableExchange) ReleaseOrder(ctx context.Context, symbol, id string) error
func (*RetryeableExchange) RoundPrice ¶
func (*RetryeableExchange) RoundQuantity ¶
func (*RetryeableExchange) WatchAccountPositions ¶
func (re *RetryeableExchange) WatchAccountPositions(ctx context.Context) (<-chan PositionEvent, error)
func (*RetryeableExchange) WatchOrdersStatuses ¶
func (re *RetryeableExchange) WatchOrdersStatuses(ctx context.Context) (<-chan OrderEvent, error)
func (*RetryeableExchange) WatchSymbolPrice ¶
func (re *RetryeableExchange) WatchSymbolPrice(ctx context.Context, symbol string) (<-chan PriceEvent, error)
type ReversedExchange ¶
type ReversedExchange struct {
// contains filtered or unexported fields
}
func NewReversedExchange ¶
func NewReversedExchange(target Exchange, lg *zap.Logger) *ReversedExchange
func (*ReversedExchange) CancelOrder ¶
func (re *ReversedExchange) CancelOrder(ctx context.Context, symbol, id string) error
func (*ReversedExchange) GetOrderInfo ¶
func (*ReversedExchange) GetOrderInfoByClientOrderID ¶
func (*ReversedExchange) GetTradableSymbols ¶
func (re *ReversedExchange) GetTradableSymbols(ctx context.Context) ([]SymbolInfo, error)
func (*ReversedExchange) PlaceBuyOrder ¶
func (*ReversedExchange) PlaceSellOrder ¶
func (*ReversedExchange) WatchOrdersStatuses ¶
func (re *ReversedExchange) WatchOrdersStatuses( ctx context.Context, ) (<-chan OrderEvent, error)
func (*ReversedExchange) WatchSymbolPrice ¶
func (re *ReversedExchange) WatchSymbolPrice( ctx context.Context, symbol string, ) (<-chan PriceEvent, error)
type SequentialBulkCancelExchange ¶
type SequentialBulkCancelExchange struct {
Exchange
}
func (*SequentialBulkCancelExchange) BulkCancelOrder ¶
func (this *SequentialBulkCancelExchange) BulkCancelOrder( ctx context.Context, symbol string, ids []string, ) ([]BulkCancelResult, error)
type SymbolInfo ¶
type TypeEvent ¶
type TypeEvent struct { DisconnectedWithErr error Reconnected *struct{} Payload *PayloadType }
Should be one of three In case of first connection no reconnection event should be sent
type TypeEventReconnector ¶
type TypeEventReconnector struct {
// contains filtered or unexported fields
}
func NewTypeEventReconnector ¶
func NewTypeEventReconnector( connect TypeEventReconnectorFn, reconnectOpts []retry.Option, l *zap.Logger, ) *TypeEventReconnector