Documentation ¶
Index ¶
- Variables
- type CandleSubscriber
- type Dataframe
- type NinjaBot
- func (n *NinjaBot) Controller() *order.Controller
- func (n *NinjaBot) Run(ctx context.Context) error
- func (n NinjaBot) SaveReturns(outputDir string) error
- func (n *NinjaBot) SubscribeCandle(subscriptions ...CandleSubscriber)
- func (n *NinjaBot) SubscribeOrder(subscriptions ...OrderSubscriber)
- func (n *NinjaBot) Summary()
- type Option
- func WithBacktest(wallet *exchange.PaperWallet) Option
- func WithCandleSubscription(subscriber CandleSubscriber) Option
- func WithLogLevel(level log.Level) Option
- func WithNotifier(notifier service.Notifier) Option
- func WithOrderSubscription(subscriber OrderSubscriber) Option
- func WithPaperWallet(wallet *exchange.PaperWallet) Option
- func WithStorage(storage storage.Storage) Option
- type OrderStatusType
- type OrderSubscriber
- type OrderType
- type Series
- type Settings
- type SideType
- type TelegramSettings
Constants ¶
This section is empty.
Variables ¶
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 CandleSubscriber ¶
type NinjaBot ¶
type NinjaBot struct {
// contains filtered or unexported fields
}
func (*NinjaBot) Controller ¶
func (n *NinjaBot) Controller() *order.Controller
func (*NinjaBot) Run ¶
Run will initialize the strategy controller, order controller, preload data and start the bot
func (NinjaBot) SaveReturns ¶
func (*NinjaBot) SubscribeCandle ¶
func (n *NinjaBot) SubscribeCandle(subscriptions ...CandleSubscriber)
func (*NinjaBot) SubscribeOrder ¶
func (n *NinjaBot) SubscribeOrder(subscriptions ...OrderSubscriber)
type Option ¶
type Option func(*NinjaBot)
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 ¶
WithLogLevel sets the log level. eg: log.DebugLevel, log.InfoLevel, log.WarnLevel, log.ErrorLevel, log.FatalLevel
func WithNotifier ¶
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 ¶
WithStorage sets the storage for the bot, by default it uses a local file called ninjabot.db
type OrderStatusType ¶
type OrderStatusType = model.OrderStatusType
type OrderSubscriber ¶
type TelegramSettings ¶
type TelegramSettings = model.TelegramSettings