Documentation ¶
Overview ¶
Package app provides functionality for the application logic and startup as well as types to manage the application resources.
Package app is a generated GoMock package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewmockExchangeClient ¶
func NewmockExchangeClient(ctrl *gomock.Controller) *mockExchangeClient
NewmockExchangeClient creates a new mock instance.
func NewmockIDGenerator ¶
func NewmockIDGenerator(ctrl *gomock.Controller) *mockIDGenerator
NewmockIDGenerator creates a new mock instance.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App represents the encapsulation of the application state. This struct is the main application handler of the trading bot.
func New ¶
func New(logger *zap.Logger, exchange ExchangeClient, opts ...Option) *App
New acts as the default constructor for the application. Use this method to create a new instance of the applcation. This method should be called over directly instantiating the App struct as it initializes internal attributes so that the application can run as expected.
type Config ¶
type Config struct { }
Config acts as an encapsulation of the application configuration.
type ExchangeClient ¶
type ExchangeClient interface { GetLastPrice(ctx context.Context, pair trading.Pair) (string, error) CreateLimitOrder(ctx context.Context, order order.Limit) (exchange.Order, error) CancelOrders(ctx context.Context, orderIDs ...string) error ListOpenOrders(ctx context.Context) ([]exchange.Order, error) GetBalance(ctx context.Context, asset trading.Asset) (int64, error) }
ExchangeClient represents a type that is able to communicate with an exchange.
type IDGenerator ¶
type Option ¶
type Option func(a *App)
Option allows for overriding of the internals of the application. These options are typically only meant for internal testing.
func WithIDGenerator ¶
func WithIDGenerator(gen IDGenerator) Option
WithIDGenerator overrides the internal ID generator of the app. Use this method for testing or for use with an exchange that does not support the id format in use by the app.