azbot

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SideTypeBuy                    = model.SideTypeBuy
	SideTypeSell                   = model.SideTypeSell
	OrderTypeLimit                 = model.OrderTypeLimit
	OrderTypeMarket                = model.OrderTypeMarket
	OrderTypeLimitMaker            = model.OrderTypeLimitMaker
	OrderTypeStopLoss              = model.OrderTypeStopLoss
	OrderTypeStopLossLimit         = model.OrderTypeStopLossLimit
	OrderTypeTakeProfit            = model.OrderTypeTakeProfit
	OrderTypeTakeProfitLimit       = model.OrderTypeTakeProfitLimit
	OrderStatusTypeNew             = model.OrderStatusTypeNew
	OrderStatusTypePartiallyFilled = model.OrderStatusTypePartiallyFilled
	OrderStatusTypeFilled          = model.OrderStatusTypeFilled
	OrderStatusTypeCanceled        = model.OrderStatusTypeCanceled
	OrderStatusTypePendingCancel   = model.OrderStatusTypePendingCancel
	OrderStatusTypeRejected        = model.OrderStatusTypeRejected
	OrderStatusTypeExpired         = model.OrderStatusTypeExpired
)

Functions

This section is empty.

Types

type AzBot

type AzBot struct {
	// contains filtered or unexported fields
}

func NewBot

func NewBot(ctx context.Context, settings model.Settings, exch service.Exchange, str strategy.Strategy,
	options ...Option) (*AzBot, error)

func (*AzBot) Controller

func (n *AzBot) Controller() *order.Controller

func (*AzBot) Run

func (n *AzBot) Run(ctx context.Context) error

Run will initialize the strategy controller, order controller, preload data and start the bot

func (*AzBot) SubscribeCandle

func (n *AzBot) SubscribeCandle(subscriptions ...CandleSubscriber)

func (*AzBot) SubscribeOrder

func (n *AzBot) SubscribeOrder(subscriptions ...OrderSubscriber)

func (*AzBot) Summary

func (n *AzBot) Summary()

Summary function displays all trades, accuracy and some bot metrics in stdout To access the raw data, you may access `bot.Controller().Results`

type CandleSubscriber

type CandleSubscriber interface {
	OnCandle(model.Candle)
}

type Dataframe

type Dataframe = model.Dataframe

type Option

type Option func(*AzBot)

func WithBacktest

func WithBacktest(wallet *exchange.PaperWallet) Option

WithBacktest sets the bot to run in backtest mode, it is required for backtesting environments Backtest mode optimize the input read for CSV and deal with race conditions

func WithCandleSubscription

func WithCandleSubscription(subscriber CandleSubscriber) Option

WithCandleSubscription subscribes a given struct to the candle feed

func WithLogLevel

func WithLogLevel(level log.Level) Option

WithLogLevel sets the log level. eg: log.DebugLevel, log.InfoLevel, log.WarnLevel, log.ErrorLevel, log.FatalLevel

func WithNotifier

func WithNotifier(notifier service.Notifier) Option

WithNotifier registers a notifier to the bot, currently only email and telegram are supported

func WithOrderSubscription

func WithOrderSubscription(subscriber OrderSubscriber) Option

func WithPaperWallet

func WithPaperWallet(wallet *exchange.PaperWallet) Option

WithPaperWallet sets the paper wallet for the bot (used for backtesting and live simulation)

func WithStorage

func WithStorage(storage storage.Storage) Option

WithStorage sets the storage for the bot, by default it uses a local file called azbot.db

type OrderStatusType

type OrderStatusType = model.OrderStatusType

type OrderSubscriber

type OrderSubscriber interface {
	OnOrder(model.Order)
}

type OrderType

type OrderType = model.OrderType

type Series

type Series = model.Series[float64]

type Settings

type Settings = model.Settings

type SideType

type SideType = model.SideType

type TelegramSettings

type TelegramSettings = model.TelegramSettings

Directories

Path Synopsis
cmd
log

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL