Versions in this module Expand all Collapse all v0 v0.0.1 May 4, 2024 Changes in this version + const DefaultCancelOrderWaitTime + const IsolationContextKey + const MaxNumOfKLines + const MaxNumOfKLinesTruncate + const TemplateOrderReport + var BackTestService *service.BacktestService + var DefaultBacktestAccount = BacktestAccount + var DefaultFeeRate = fixedpoint.NewFromFloat(0.075 * 0.01) + var DefaultSubmitOrderRetryTimeout = 5 * time.Minute + var ErrAssetBalanceLevelTooHigh = errors.New("asset balance level too high") + var ErrAssetBalanceLevelTooLow = errors.New("asset balance level too low") + var ErrEmptyMarketInfo = errors.New("market info should not be empty, 0 markets loaded") + var ErrExceededSubmitOrderRetryLimit = errors.New("exceeded submit order retry limit") + var ErrInsufficientAssetBalance = errors.New("insufficient asset balance") + var ErrInsufficientQuoteBalance = errors.New("insufficient quote balance") + var ErrPositionAlreadyClosing = errors.New("position is already in closing process") + var ErrQuoteBalanceLevelTooLow = errors.New("quote balance level is too low") + var ErrSessionAlreadyInitialized = errors.New("session is already initialized") + var IsBackTesting = false + var IsWrapperBinary = false + var KLinePreloadLimit int64 = 1000 + var LoadedCrossExchangeStrategies = make(map[string]CrossExchangeStrategy) + var LoadedExchangeStrategies = make(map[string]SingleExchangeStrategy) + var LocalTimeZone *time.Location + var Notification = &Notifiability + func AdjustFloatQuantityByMaxAmount(quantity fixedpoint.Value, price fixedpoint.Value, maxAmount fixedpoint.Value) fixedpoint.Value + func AdjustFloatQuantityByMinAmount(quantity, currentPrice, minAmount fixedpoint.Value) fixedpoint.Value + func AdjustQuantityByMaxAmount(quantity, currentPrice, maxAmount fixedpoint.Value) fixedpoint.Value + func AdjustQuantityByMinAmount(quantity, currentPrice, minAmount fixedpoint.Value) fixedpoint.Value + func BacktestFeeModeStrings() []string + func BatchPlaceOrder(ctx context.Context, exchange types.Exchange, orderCallback OrderCallback, ...) (types.OrderSlice, []int, error) + func BatchRetryPlaceOrder(ctx context.Context, exchange types.Exchange, errIdx []int, ...) (types.OrderSlice, []int, error) + func BootstrapBacktestEnvironment(ctx context.Context, environ *Environment) error + func BootstrapEnvironment(ctx context.Context, environ *Environment, userConfig *Config) error + func BootstrapEnvironmentLightweight(ctx context.Context, environ *Environment, userConfig *Config) error + func Build(ctx context.Context, userConfig *Config, targetConfig BuildTargetConfig) (string, error) + func BuildTarget(ctx context.Context, userConfig *Config, target BuildTargetConfig) (string, error) + func CalculateBaseQuantity(session *ExchangeSession, market types.Market, ...) (fixedpoint.Value, error) + func CalculateQuoteQuantity(ctx context.Context, session *ExchangeSession, quoteCurrency string, ...) (fixedpoint.Value, error) + func ConfigurePersistence(ctx context.Context, environ *Environment, conf *PersistenceConfig) error + func GetCurrentEnv() string + func NewContextWithDefaultIsolation(parent context.Context) context.Context + func NewContextWithIsolation(parent context.Context, isolation *Isolation) context.Context + func NewLogFormatter(logFormatter LogFormatterType) log.Formatter + func NewLogFormatterWithEnv(env string) log.Formatter + func NewPersistenceServiceFacade(conf *PersistenceConfig) (*service.PersistenceServiceFacade, error) + func NewTodoContextWithExistingIsolation(parent context.Context) context.Context + func Notify(obj interface{}, args ...interface{}) + func NotifyTo(channel string, obj interface{}, args ...interface{}) + func OnShutdown(ctx context.Context, f ShutdownHandler) + func RegisterCommand(command, desc string, f interface{}) *interact.Command + func RegisterModifier(s interface{}) + func RegisterStrategy(key string, s interface{}) + func SendPhoto(buffer *bytes.Buffer) + func SendPhotoTo(channel string, buffer *bytes.Buffer) + func SetBackTesting(s *service.BacktestService) + func SetWrapperBinary() + func Shutdown(shutdownCtx context.Context) + func Sync(ctx context.Context, obj interface{}) + type AccountValueCalculator struct + func NewAccountValueCalculator(session *ExchangeSession, quoteCurrency string) *AccountValueCalculator + func (c *AccountValueCalculator) AvailableQuote(ctx context.Context) (fixedpoint.Value, error) + func (c *AccountValueCalculator) DebtValue(ctx context.Context) (fixedpoint.Value, error) + func (c *AccountValueCalculator) MarginLevel(ctx context.Context) (fixedpoint.Value, error) + func (c *AccountValueCalculator) MarketValue(ctx context.Context) (fixedpoint.Value, error) + func (c *AccountValueCalculator) NetValue(ctx context.Context) (fixedpoint.Value, error) + func (c *AccountValueCalculator) UpdatePrices(ctx context.Context) error + type ActiveOrderBook struct + C sigchan.Chan + Symbol string + func NewActiveOrderBook(symbol string) *ActiveOrderBook + func (b *ActiveOrderBook) Add(orders ...types.Order) + func (b *ActiveOrderBook) Backup() []types.SubmitOrder + func (b *ActiveOrderBook) BindStream(stream types.Stream) + func (b *ActiveOrderBook) EmitCanceled(o types.Order) + func (b *ActiveOrderBook) EmitFilled(o types.Order) + func (b *ActiveOrderBook) EmitNew(o types.Order) + func (b *ActiveOrderBook) Exists(order types.Order) bool + func (b *ActiveOrderBook) FastCancel(ctx context.Context, ex types.Exchange, orders ...types.Order) error + func (b *ActiveOrderBook) Get(orderID uint64) (types.Order, bool) + func (b *ActiveOrderBook) GracefulCancel(ctx context.Context, ex types.Exchange, specifiedOrders ...types.Order) error + func (b *ActiveOrderBook) Lookup(f func(o types.Order) bool) *types.Order + func (b *ActiveOrderBook) MarshalJSON() ([]byte, error) + func (b *ActiveOrderBook) NumOfOrders() int + func (b *ActiveOrderBook) OnCanceled(cb func(o types.Order)) + func (b *ActiveOrderBook) OnFilled(cb func(o types.Order)) + func (b *ActiveOrderBook) OnNew(cb func(o types.Order)) + func (b *ActiveOrderBook) Orders() types.OrderSlice + func (b *ActiveOrderBook) Print() + func (b *ActiveOrderBook) Remove(order types.Order) bool + func (b *ActiveOrderBook) SetCancelOrderWaitTime(duration time.Duration) + func (b *ActiveOrderBook) Update(order types.Order) + type AverageCostPnLReporter struct + Sessions []string + Symbols []string + func (reporter *AverageCostPnLReporter) Of(sessions ...string) *AverageCostPnLReporter + func (reporter *AverageCostPnLReporter) Run() + func (reporter *AverageCostPnLReporter) When(specs ...string) *AverageCostPnLReporter + type BA BacktestAccount + type Backtest struct + Account map[string]BacktestAccount + Accounts map[string]BacktestAccount + EndTime *types.LooseFormatTime + FeeMode BacktestFeeMode + RecordTrades bool + Sessions []string + StartTime types.LooseFormatTime + Symbols []string + SyncSecKLines bool + func (b *Backtest) GetAccount(n string) BacktestAccount + type BacktestAccount struct + Balances BacktestAccountBalanceMap + MakerFeeRate fixedpoint.Value + TakerFeeRate fixedpoint.Value + func (b *BacktestAccount) UnmarshalJSON(input []byte) error + func (b *BacktestAccount) UnmarshalYAML(value *yaml.Node) error + type BacktestAccountBalanceMap map[string]fixedpoint.Value + func (m BacktestAccountBalanceMap) BalanceMap() types.BalanceMap + type BacktestFeeMode int + const BacktestFeeModeNative + const BacktestFeeModeQuote + const BacktestFeeModeToken + func BacktestFeeModeString(s string) (BacktestFeeMode, error) + func BacktestFeeModeValues() []BacktestFeeMode + func (i *BacktestFeeMode) UnmarshalJSON(data []byte) error + func (i *BacktestFeeMode) UnmarshalYAML(unmarshal func(interface{}) error) error + func (i BacktestFeeMode) IsABacktestFeeMode() bool + func (i BacktestFeeMode) MarshalJSON() ([]byte, error) + func (i BacktestFeeMode) MarshalYAML() (interface{}, error) + func (i BacktestFeeMode) String() string + type BaseOrderExecutor struct + func (e *BaseOrderExecutor) ActiveMakerOrders() *ActiveOrderBook + func (e *BaseOrderExecutor) GracefulCancel(ctx context.Context, orders ...types.Order) error + func (e *BaseOrderExecutor) OrderStore() *core.OrderStore + type BasicRiskController struct + Logger *log.Logger + MaxBaseAssetBalance fixedpoint.Value + MaxOrderAmount fixedpoint.Value + MinBaseAssetBalance fixedpoint.Value + MinQuoteBalance fixedpoint.Value + func (c *BasicRiskController) ProcessOrders(session *ExchangeSession, orders ...types.SubmitOrder) (outOrders []types.SubmitOrder, errs []error) + type BuildConfig struct + BuildDir string + Imports []string + Targets []BuildTargetConfig + type BuildTargetConfig struct + Arch string + GCFlags datatype.StringSlice + Imports []string + LDFlags datatype.StringSlice + Name string + OS string + func GetNativeBuildTargetConfig() BuildTargetConfig + type Config struct + Backtest *Backtest + Build *BuildConfig + CrossExchangeStrategies []CrossExchangeStrategy + DatabaseConfig *DatabaseConfig + Environment *EnvironmentConfig + ExchangeStrategies []ExchangeStrategyMount + Imports []string + Logging *LoggingConfig + Notifications *NotificationConfig + Persistence *PersistenceConfig + PnLReporters []PnLReporterConfig + RiskControls *RiskControls + Service *ServiceConfig + Sessions map[string]*ExchangeSession + Sync *SyncConfig + func Load(configFile string, loadStrategies bool) (*Config, error) + func LoadBuildConfig(configFile string) (*Config, error) + func (c *Config) GetSignature() string + func (c *Config) Map() (map[string]interface{}, error) + func (c *Config) YAML() ([]byte, error) + type CoreInteraction struct + func NewCoreInteraction(environment *Environment, trader *Trader) *CoreInteraction + func (it *CoreInteraction) Commands(i *interact.Interact) + func (it *CoreInteraction) Initialize() error + type CrossExchangeSessionSubscriber interface + CrossSubscribe func(sessions map[string]*ExchangeSession) + type CrossExchangeStrategy interface + CrossRun func(ctx context.Context, orderExecutionRouter OrderExecutionRouter, ...) error + type CumulatedVolumeTakeProfit struct + MinQuoteVolume fixedpoint.Value + Ratio fixedpoint.Value + Symbol string + func (s *CumulatedVolumeTakeProfit) Bind(session *ExchangeSession, orderExecutor *GeneralOrderExecutor) + type DatabaseConfig struct + DSN string + Driver string + ExtraMigrationPackages []string + type EmergencyStopper interface + EmergencyStop func() error + type Environment struct + AccountService *service.AccountService + BacktestService *service.BacktestService + DatabaseService *service.DatabaseService + DepositService *service.DepositService + GoogleSpreadSheetService *googleservice.SpreadSheetService + MarginService *service.MarginService + OrderService *service.OrderService + PersistentService *service.PersistenceServiceFacade + PositionService *service.PositionService + ProfitService *service.ProfitService + RewardService *service.RewardService + SyncService *service.SyncService + TradeService *service.TradeService + WithdrawService *service.WithdrawService + func NewEnvironment() *Environment + func (environ *Environment) AddExchange(name string, exchange types.Exchange) (session *ExchangeSession) + func (environ *Environment) AddExchangeSession(name string, session *ExchangeSession) *ExchangeSession + func (environ *Environment) AddExchangesByViperKeys() error + func (environ *Environment) AddExchangesFromSessionConfig(sessions map[string]*ExchangeSession) error + func (environ *Environment) BindSync(config *SyncConfig) + func (environ *Environment) ConfigureDatabase(ctx context.Context, config *Config) error + func (environ *Environment) ConfigureDatabaseDriver(ctx context.Context, driver string, dsn string, extraPkgNames ...string) error + func (environ *Environment) ConfigureExchangeSessions(userConfig *Config) error + func (environ *Environment) ConfigureNotification(config *NotificationConfig) error + func (environ *Environment) ConfigureNotificationSystem(ctx context.Context, userConfig *Config) error + func (environ *Environment) ConfigureService(ctx context.Context, srvConfig *ServiceConfig) error + func (environ *Environment) Connect(ctx context.Context) error + func (environ *Environment) Init(ctx context.Context) (err error) + func (environ *Environment) IsBackTesting() bool + func (environ *Environment) IsSyncing() (status SyncStatus) + func (environ *Environment) Logger() log.FieldLogger + func (environ *Environment) RecordAsset(t time.Time, session *ExchangeSession, assets types.AssetMap) + func (environ *Environment) RecordPosition(position *types.Position, trade types.Trade, profit *types.Profit) + func (environ *Environment) RecordProfit(profit types.Profit) + func (environ *Environment) SelectSessions(names ...string) map[string]*ExchangeSession + func (environ *Environment) Session(name string) (*ExchangeSession, bool) + func (environ *Environment) Sessions() map[string]*ExchangeSession + func (environ *Environment) SetLogging(config *LoggingConfig) + func (environ *Environment) SetStartTime(t time.Time) *Environment + func (environ *Environment) SetSyncStartTime(t time.Time) *Environment + func (environ *Environment) Start(ctx context.Context) (err error) + func (environ *Environment) StartTime() time.Time + func (environ *Environment) Sync(ctx context.Context, userConfig ...*Config) error + func (environ *Environment) SyncSession(ctx context.Context, session *ExchangeSession, defaultSymbols ...string) error + type EnvironmentConfig struct + DisableDefaultKLineSubscription bool + DisableHistoryKLinePreload bool + DisableMarketDataStore bool + DisableSessionTradeBuffer bool + DisableStartupBalanceQuery bool + MaxSessionTradeBufferSize int + type ExchangeOrderExecutionRouter struct + func (e *ExchangeOrderExecutionRouter) CancelOrdersTo(ctx context.Context, session string, orders ...types.Order) error + func (e *ExchangeOrderExecutionRouter) SubmitOrdersTo(ctx context.Context, session string, orders ...types.SubmitOrder) (types.OrderSlice, error) + type ExchangeOrderExecutor struct + Session *ExchangeSession + func (e *ExchangeOrderExecutor) CancelOrders(ctx context.Context, orders ...types.Order) error + func (e *ExchangeOrderExecutor) EmitOrderUpdate(order types.Order) + func (e *ExchangeOrderExecutor) EmitTradeUpdate(trade types.Trade) + func (e *ExchangeOrderExecutor) OnOrderUpdate(cb func(order types.Order)) + func (e *ExchangeOrderExecutor) OnTradeUpdate(cb func(trade types.Trade)) + func (e *ExchangeOrderExecutor) SubmitOrders(ctx context.Context, orders ...types.SubmitOrder) (types.OrderSlice, error) + type ExchangeSession struct + Account *types.Account + EnvVarPrefix string + Exchange types.Exchange + ExchangeName types.ExchangeName + Futures bool + IsInitialized bool + IsolatedFutures bool + IsolatedFuturesSymbol string + IsolatedMargin bool + IsolatedMarginSymbol string + Key string + MakerFeeRate fixedpoint.Value + Margin bool + MarketDataStream types.Stream + ModifyOrderAmountForFee bool + Name string + OrderExecutor *ExchangeOrderExecutor + Passphrase string + PrivateChannelSymbols []string + PrivateChannels []string + PublicOnly bool + Secret string + SubAccount string + Subscriptions map[types.Subscription]types.Subscription + TakerFeeRate fixedpoint.Value + Trades map[string]*types.TradeSlice + UseHeikinAshi bool + UserDataStream types.Stream + Withdrawal bool + func NewExchangeSession(name string, exchange types.Exchange) *ExchangeSession + func (session *ExchangeSession) AllLastPrices() map[string]fixedpoint.Value + func (session *ExchangeSession) FindPossibleAssetSymbols() (symbols []string, err error) + func (session *ExchangeSession) FormatOrder(order types.SubmitOrder) (types.SubmitOrder, error) + func (session *ExchangeSession) FormatOrders(orders []types.SubmitOrder) (formattedOrders []types.SubmitOrder, err error) + func (session *ExchangeSession) GetAccount() (a *types.Account) + func (session *ExchangeSession) Indicators(symbol string) *IndicatorSet + func (session *ExchangeSession) Init(ctx context.Context, environ *Environment) error + func (session *ExchangeSession) InitExchange(name string, ex types.Exchange) error + func (session *ExchangeSession) InitSymbols(ctx context.Context, environ *Environment) error + func (session *ExchangeSession) LastPrice(symbol string) (price fixedpoint.Value, ok bool) + func (session *ExchangeSession) LastPrices() map[string]fixedpoint.Value + func (session *ExchangeSession) MarginType() string + func (session *ExchangeSession) Market(symbol string) (market types.Market, ok bool) + func (session *ExchangeSession) MarketDataStore(symbol string) (s *MarketDataStore, ok bool) + func (session *ExchangeSession) Markets() types.MarketMap + func (session *ExchangeSession) OrderBook(symbol string) (s *types.StreamOrderBook, ok bool) + func (session *ExchangeSession) OrderStore(symbol string) (store *core.OrderStore, ok bool) + func (session *ExchangeSession) OrderStores() map[string]*core.OrderStore + func (session *ExchangeSession) Position(symbol string) (pos *types.Position, ok bool) + func (session *ExchangeSession) Positions() map[string]*types.Position + func (session *ExchangeSession) SerialMarketDataStore(ctx context.Context, symbol string, intervals []types.Interval, ...) (store *SerialMarketDataStore, ok bool) + func (session *ExchangeSession) SetMarkets(markets types.MarketMap) + func (session *ExchangeSession) SlackAttachment() slack.Attachment + func (session *ExchangeSession) StandardIndicatorSet(symbol string) *StandardIndicatorSet + func (session *ExchangeSession) StartPrice(symbol string) (price fixedpoint.Value, ok bool) + func (session *ExchangeSession) Subscribe(channel types.Channel, symbol string, options types.SubscribeOptions) *ExchangeSession + func (session *ExchangeSession) UpdateAccount(ctx context.Context) (*types.Account, error) + func (session *ExchangeSession) UpdatePrices(ctx context.Context, currencies []string, fiat string) (err error) + type ExchangeSessionSubscriber interface + Subscribe func(session *ExchangeSession) + type ExchangeStrategyMount struct + Mounts []string + Strategy SingleExchangeStrategy + func (m *ExchangeStrategyMount) Map() (map[string]interface{}, error) + type ExitMethod struct + CumulatedVolumeTakeProfit *CumulatedVolumeTakeProfit + HigherHighLowerLowStop *HigherHighLowerLowStop + LowerShadowTakeProfit *LowerShadowTakeProfit + ProtectiveStopLoss *ProtectiveStopLoss + RoiStopLoss *RoiStopLoss + RoiTakeProfit *RoiTakeProfit + SupportTakeProfit *SupportTakeProfit + TrailingStop *TrailingStop2 + func (e ExitMethod) String() string + func (m *ExitMethod) Bind(session *ExchangeSession, orderExecutor *GeneralOrderExecutor) + func (m *ExitMethod) Inherit(parent interface{}) + func (m *ExitMethod) Subscribe(session *ExchangeSession) + type ExitMethodSet []ExitMethod + func (s *ExitMethodSet) Bind(session *ExchangeSession, orderExecutor *GeneralOrderExecutor) + func (s *ExitMethodSet) SetAndSubscribe(session *ExchangeSession, parent interface{}) + type ExponentialScale struct + Domain [2]float64 + Range [2]float64 + func (s *ExponentialScale) Call(x float64) (y float64) + func (s *ExponentialScale) Formula() string + func (s *ExponentialScale) FormulaOf(x float64) string + func (s *ExponentialScale) Solve() error + func (s *ExponentialScale) String() string + func (s *ExponentialScale) Sum(step float64) float64 + type FastOrderExecutor struct + func NewFastOrderExecutor(session *ExchangeSession, symbol, strategy, strategyInstanceID string, ...) *FastOrderExecutor + func (e *FastOrderExecutor) Cancel(ctx context.Context, orders ...types.Order) error + func (e *FastOrderExecutor) SubmitOrders(ctx context.Context, submitOrders ...types.SubmitOrder) (types.OrderSlice, error) + type GeneralOrderExecutor struct + func NewGeneralOrderExecutor(session *ExchangeSession, symbol, strategy, strategyInstanceID string, ...) *GeneralOrderExecutor + func (e *GeneralOrderExecutor) Bind() + func (e *GeneralOrderExecutor) BindEnvironment(environ *Environment) + func (e *GeneralOrderExecutor) BindProfitStats(profitStats *types.ProfitStats) + func (e *GeneralOrderExecutor) BindTradeStats(tradeStats *types.TradeStats) + func (e *GeneralOrderExecutor) CancelOrders(ctx context.Context, orders ...types.Order) error + func (e *GeneralOrderExecutor) ClosePosition(ctx context.Context, percentage fixedpoint.Value, tags ...string) error + func (e *GeneralOrderExecutor) CurrentPosition() *types.Position + func (e *GeneralOrderExecutor) DisableNotify() + func (e *GeneralOrderExecutor) GracefulCancel(ctx context.Context, orders ...types.Order) error + func (e *GeneralOrderExecutor) GracefulCancelActiveOrderBook(ctx context.Context, activeOrders *ActiveOrderBook) error + func (e *GeneralOrderExecutor) NewOrderFromOpenPosition(ctx context.Context, options *OpenPositionOptions) (*types.SubmitOrder, error) + func (e *GeneralOrderExecutor) OpenPosition(ctx context.Context, options OpenPositionOptions) (types.OrderSlice, error) + func (e *GeneralOrderExecutor) Position() *types.Position + func (e *GeneralOrderExecutor) ResetPosition() error + func (e *GeneralOrderExecutor) Session() *ExchangeSession + func (e *GeneralOrderExecutor) SetLogger(logger log.FieldLogger) + func (e *GeneralOrderExecutor) SetMaxRetries(maxRetries uint) + func (e *GeneralOrderExecutor) SubmitOrders(ctx context.Context, submitOrders ...types.SubmitOrder) (types.OrderSlice, error) + func (e *GeneralOrderExecutor) TradeCollector() *core.TradeCollector + type GoogleSpreadSheetServiceConfig struct + JsonTokenFile string + SpreadSheetID string + type GracefulShutdown struct + func (g *GracefulShutdown) EmitShutdown(ctx context.Context, wg *sync.WaitGroup) + func (g *GracefulShutdown) OnShutdown(cb ShutdownHandler) + func (g *GracefulShutdown) Shutdown(shutdownCtx context.Context) + type HigherHighLowerLowStop struct + ActivationRatio fixedpoint.Value + DeactivationRatio fixedpoint.Value + HighLowWindow int + MaxHighLow int + MinHighLow int + OppositeDirectionAsPosition bool + Symbol string + func (s *HigherHighLowerLowStop) Bind(session *ExchangeSession, orderExecutor *GeneralOrderExecutor) + func (s *HigherHighLowerLowStop) Subscribe(session *ExchangeSession) + type IndicatorSet struct + Symbol string + func NewIndicatorSet(symbol string, stream types.Stream, store *MarketDataStore) *IndicatorSet + func (i *IndicatorSet) ADX(interval types.Interval, window int) *indicatorv2.ADXStream + func (i *IndicatorSet) ATR(interval types.Interval, window int) *indicatorv2.ATRStream + func (i *IndicatorSet) ATRP(interval types.Interval, window int) *indicatorv2.ATRPStream + func (i *IndicatorSet) BOLL(iw types.IntervalWindow, k float64) *indicatorv2.BOLLStream + func (i *IndicatorSet) CLOSE(interval types.Interval) *indicatorv2.PriceStream + func (i *IndicatorSet) EMA(iw types.IntervalWindow) *indicatorv2.EWMAStream + func (i *IndicatorSet) EWMA(iw types.IntervalWindow) *indicatorv2.EWMAStream + func (i *IndicatorSet) HIGH(interval types.Interval) *indicatorv2.PriceStream + func (i *IndicatorSet) KLines(interval types.Interval) *indicatorv2.KLineStream + func (i *IndicatorSet) Keltner(iw types.IntervalWindow, atrLength int) *indicatorv2.KeltnerStream + func (i *IndicatorSet) LOW(interval types.Interval) *indicatorv2.PriceStream + func (i *IndicatorSet) MACD(interval types.Interval, shortWindow, longWindow, signalWindow int) *indicatorv2.MACDStream + func (i *IndicatorSet) OPEN(interval types.Interval) *indicatorv2.PriceStream + func (i *IndicatorSet) RSI(iw types.IntervalWindow) *indicatorv2.RSIStream + func (i *IndicatorSet) STOCH(iw types.IntervalWindow, dPeriod int) *indicatorv2.StochStream + func (i *IndicatorSet) VOLUME(interval types.Interval) *indicatorv2.PriceStream + type Isolation struct + func GetIsolationFromContext(ctx context.Context) *Isolation + func NewDefaultIsolation() *Isolation + func NewIsolation(persistenceFacade *service.PersistenceServiceFacade) *Isolation + type LayerScale struct + LayerRule *SlideRule + func (s *LayerScale) Scale(layer int) (quantity float64, err error) + func (s *LayerScale) UnmarshalJSON(data []byte) error + type LinearScale struct + Domain [2]float64 + Range [2]float64 + func (s *LinearScale) Call(x float64) (y float64) + func (s *LinearScale) Formula() string + func (s *LinearScale) FormulaOf(x float64) string + func (s *LinearScale) Solve() error + func (s *LinearScale) String() string + func (s *LinearScale) Sum(step float64) float64 + type LogFormatterType string + const LogFormatterTypeJson + const LogFormatterTypePrefixed + const LogFormatterTypeText + type LogarithmicScale struct + Domain [2]float64 + Range [2]float64 + func (s *LogarithmicScale) Call(x float64) (y float64) + func (s *LogarithmicScale) Formula() string + func (s *LogarithmicScale) FormulaOf(x float64) string + func (s *LogarithmicScale) Solve() error + func (s *LogarithmicScale) String() string + func (s *LogarithmicScale) Sum(step float64) float64 + type Logger interface + Errorf func(message string, args ...interface{}) + Infof func(message string, args ...interface{}) + Warnf func(message string, args ...interface{}) + type Logging interface + DisableLogging func() + EnableLogging func() + type LoggingConfig struct + Balance bool + Fields map[string]interface{} + FilledOrderOnly bool + Order bool + Trade bool + type LowerShadowTakeProfit struct + Ratio fixedpoint.Value + Symbol string + func (s *LowerShadowTakeProfit) Bind(session *ExchangeSession, orderExecutor *GeneralOrderExecutor) + func (s *LowerShadowTakeProfit) Subscribe(session *ExchangeSession) + type MACDConfig struct + type MarketDataStore struct + KLineWindows map[types.Interval]*types.KLineWindow + Symbol string + func NewMarketDataStore(symbol string) *MarketDataStore + func (store *MarketDataStore) AddKLine(k types.KLine) + func (store *MarketDataStore) BindStream(stream types.Stream) + func (store *MarketDataStore) EmitKLineClosed(k types.KLine) + func (store *MarketDataStore) EmitKLineWindowUpdate(interval types.Interval, klines types.KLineWindow) + func (store *MarketDataStore) KLinesOfInterval(interval types.Interval) (kLines *types.KLineWindow, ok bool) + func (store *MarketDataStore) OnKLineClosed(cb func(k types.KLine)) + func (store *MarketDataStore) OnKLineWindowUpdate(cb func(interval types.Interval, klines types.KLineWindow)) + func (store *MarketDataStore) SetKLineWindows(windows map[types.Interval]*types.KLineWindow) + type MovingAverageSettings struct + Interval types.Interval + Side *types.SideType + Type string + Window int + func (settings *MovingAverageSettings) Indicator(indicatorSet *StandardIndicatorSet) (inc types.Float64Indicator, err error) + func (settings MovingAverageSettings) IntervalWindow() types.IntervalWindow + type Notifiability struct + ObjectChannelRouter *ObjectChannelRouter + SessionChannelRouter *PatternChannelRouter + SymbolChannelRouter *PatternChannelRouter + func (m *Notifiability) AddNotifier(notifier Notifier) + func (m *Notifiability) Notify(obj interface{}, args ...interface{}) + func (m *Notifiability) NotifyTo(channel string, obj interface{}, args ...interface{}) + func (m *Notifiability) RouteObject(obj interface{}) (channel string, ok bool) + func (m *Notifiability) RouteSession(session string) (channel string, ok bool) + func (m *Notifiability) RouteSymbol(symbol string) (channel string, ok bool) + func (m *Notifiability) SendPhoto(buffer *bytes.Buffer) + func (m *Notifiability) SendPhotoTo(channel string, buffer *bytes.Buffer) + type NotificationConfig struct + Slack *SlackNotification + Switches *NotificationSwitches + Telegram *TelegramNotification + type NotificationSwitches struct + OrderUpdate bool + Position bool + SubmitOrder bool + Trade bool + type Notifier interface + Notify func(obj interface{}, args ...interface{}) + NotifyTo func(channel string, obj interface{}, args ...interface{}) + SendPhoto func(buffer *bytes.Buffer) + SendPhotoTo func(channel string, buffer *bytes.Buffer) + type NullNotifier struct + func (n *NullNotifier) Notify(obj interface{}, args ...interface{}) + func (n *NullNotifier) NotifyTo(channel string, obj interface{}, args ...interface{}) + func (n *NullNotifier) SendPhoto(buffer *bytes.Buffer) + func (n *NullNotifier) SendPhotoTo(channel string, buffer *bytes.Buffer) + type ObjectChannelHandler func(obj interface{}) (channel string, ok bool) + type ObjectChannelRouter struct + func NewObjectChannelRouter() *ObjectChannelRouter + func (router *ObjectChannelRouter) AddRoute(f ObjectChannelHandler) + func (router *ObjectChannelRouter) Route(obj interface{}) (channel string, ok bool) + type OpenPositionOptions struct + Leverage fixedpoint.Value + LimitOrder bool + LimitOrderTakerRatio fixedpoint.Value + Long bool + Price fixedpoint.Value + Quantity fixedpoint.Value + Short bool + Tags []string + type OrderCallback func(order types.Order) + type OrderExecutionRouter interface + CancelOrdersTo func(ctx context.Context, session string, orders ...types.Order) error + SubmitOrdersTo func(ctx context.Context, session string, orders ...types.SubmitOrder) (createdOrders types.OrderSlice, err error) + type OrderExecutor interface + CancelOrders func(ctx context.Context, orders ...types.Order) error + SubmitOrders func(ctx context.Context, orders ...types.SubmitOrder) (createdOrders types.OrderSlice, err error) + type OrderExecutorExtended interface + CancelOrders func(ctx context.Context, orders ...types.Order) error + Position func() *types.Position + SubmitOrders func(ctx context.Context, orders ...types.SubmitOrder) (createdOrders types.OrderSlice, err error) + TradeCollector func() *core.TradeCollector + type PatternChannelRouter struct + func NewPatternChannelRouter(routes map[string]string) *PatternChannelRouter + func (router *PatternChannelRouter) AddRoute(routes map[string]string) + func (router *PatternChannelRouter) Route(text string) (channel string, ok bool) + type PercentageScale struct + ByPercentage *SlideRule + func (s *PercentageScale) Scale(percentage float64) (float64, error) + type PersistenceConfig struct + Json *service.JsonPersistenceConfig + Redis *service.RedisPersistenceConfig + type PnLReporter interface + Run func() + type PnLReporterConfig struct + AverageCostBySymbols datatype.StringSlice + Of datatype.StringSlice + When datatype.StringSlice + type PnLReporterManager struct + func NewPnLReporter(notifier Notifier) *PnLReporterManager + func (manager *PnLReporterManager) AverageCostBySymbols(symbols ...string) *AverageCostPnLReporter + type PositionCloser interface + ClosePosition func(ctx context.Context, percentage fixedpoint.Value) error + type PositionReader interface + CurrentPosition func() *types.Position + type PositionResetter interface + ResetPosition func() error + type PriceVolumeScale struct + ByPriceRule *SlideRule + ByVolumeRule *SlideRule + func (s *PriceVolumeScale) Scale(price float64, volume float64) (quantity float64, err error) + func (s *PriceVolumeScale) ScaleByPrice(price float64) (float64, error) + func (s *PriceVolumeScale) ScaleByVolume(volume float64) (float64, error) + type ProtectiveStopLoss struct + ActivationRatio fixedpoint.Value + Interval types.Interval + PlaceStopOrder bool + StopLossRatio fixedpoint.Value + Symbol string + func (s *ProtectiveStopLoss) Bind(session *ExchangeSession, orderExecutor *GeneralOrderExecutor) + func (s *ProtectiveStopLoss) Subscribe(session *ExchangeSession) + type QuadraticScale struct + Domain [3]float64 + Range [3]float64 + func (s *QuadraticScale) Call(x float64) (y float64) + func (s *QuadraticScale) Formula() string + func (s *QuadraticScale) FormulaOf(x float64) string + func (s *QuadraticScale) Solve() error + func (s *QuadraticScale) String() string + func (s *QuadraticScale) Sum(step float64) float64 + type QuantityOrAmount struct + Amount fixedpoint.Value + Quantity fixedpoint.Value + func (qa *QuantityOrAmount) CalculateQuantity(currentPrice fixedpoint.Value) fixedpoint.Value + func (qa *QuantityOrAmount) IsSet() bool + func (qa *QuantityOrAmount) Validate() error + type Quota struct + Available fixedpoint.Value + Locked fixedpoint.Value + func (q *Quota) Add(fund fixedpoint.Value) + func (q *Quota) Commit() + func (q *Quota) Lock(fund fixedpoint.Value) bool + func (q *Quota) Rollback() + type QuotaTransaction struct + BaseAsset Quota + QuoteAsset Quota + func (m *QuotaTransaction) Commit() bool + func (m *QuotaTransaction) Rollback() bool + type RiskControlOrderExecutor struct + BySymbol map[string]*SymbolBasedRiskController + func (e *RiskControlOrderExecutor) SubmitOrders(ctx context.Context, orders ...types.SubmitOrder) (retOrders types.OrderSlice, err error) + type RiskControls struct + SessionBasedRiskControl map[string]*SessionBasedRiskControl + type RoiStopLoss struct + CancelActiveOrders bool + Interval types.Interval + Percentage fixedpoint.Value + Symbol string + func (s *RoiStopLoss) Bind(session *ExchangeSession, orderExecutor *GeneralOrderExecutor) + func (s *RoiStopLoss) Subscribe(session *ExchangeSession) + type RoiTakeProfit struct + CancelActiveOrders bool + Interval types.Interval + Percentage fixedpoint.Value + Symbol string + func (s *RoiTakeProfit) Bind(session *ExchangeSession, orderExecutor *GeneralOrderExecutor) + func (s *RoiTakeProfit) Subscribe(session *ExchangeSession) + type Scale interface + Call func(x float64) (y float64) + Formula func() string + FormulaOf func(x float64) string + Solve func() error + Sum func(step float64) float64 + type SerialMarketDataStore struct + KLines map[types.Interval]*types.KLine + MinInterval types.Interval + Subscription []types.Interval + UseMarketTrade bool + func NewSerialMarketDataStore(symbol string, minInterval types.Interval, useMarketTrade ...bool) *SerialMarketDataStore + func (store *SerialMarketDataStore) AddKLine(kline types.KLine, async ...bool) + func (store *SerialMarketDataStore) BindStream(ctx context.Context, stream types.Stream) + func (store *SerialMarketDataStore) Subscribe(interval types.Interval) + type ServiceConfig struct + GoogleSpreadSheetService *GoogleSpreadSheetServiceConfig + type Session struct + EnvVarPrefix string + ExchangeName string + IsolatedMargin bool + IsolatedMarginSymbol string + Key string + Margin bool + Name string + PublicOnly bool + Secret string + type SessionBasedRiskControl struct + OrderExecutor *RiskControlOrderExecutor + func (control *SessionBasedRiskControl) SetBaseOrderExecutor(executor *ExchangeOrderExecutor) + type ShutdownHandler func(ctx context.Context, wg *sync.WaitGroup) + type SilentLogger struct + func (logger *SilentLogger) Errorf(string, ...interface{}) + func (logger *SilentLogger) Infof(string, ...interface{}) + func (logger *SilentLogger) Warnf(string, ...interface{}) + type SimpleInteraction struct + Cmd *interact.Command + Command string + Description string + F interface{} + func (it *SimpleInteraction) Commands(i *interact.Interact) + type SimpleOrderExecutor struct + func NewSimpleOrderExecutor(session *ExchangeSession) *SimpleOrderExecutor + func (e *SimpleOrderExecutor) Bind() + func (e *SimpleOrderExecutor) CancelOrders(ctx context.Context, orders ...types.Order) error + func (e *SimpleOrderExecutor) SubmitOrders(ctx context.Context, submitOrders ...types.SubmitOrder) (types.OrderSlice, error) + type SingleExchangeStrategy interface + Run func(ctx context.Context, orderExecutor OrderExecutor, session *ExchangeSession) error + func NewStrategyFromMap(id string, conf interface{}) (SingleExchangeStrategy, error) + type SlackNotification struct + DefaultChannel string + ErrorChannel string + type SlackNotificationRouting struct + Order string + PnL string + SubmitOrder string + Trade string + type SlideRule struct + ExpScale *ExponentialScale + LinearScale *LinearScale + LogScale *LogarithmicScale + QuadraticScale *QuadraticScale + func (rule *SlideRule) Range() ([2]float64, error) + func (rule *SlideRule) Scale() (Scale, error) + type SourceFunc func(*types.KLine) fixedpoint.Value + type SourceSelector struct + Source selectorInternal + func (s *SourceSelector) GetSource(kline *types.KLine) fixedpoint.Value + type StandardIndicatorSet struct + Symbol string + func NewStandardIndicatorSet(symbol string, stream types.Stream, store *MarketDataStore) *StandardIndicatorSet + func (s *StandardIndicatorSet) ATR(iw types.IntervalWindow) *indicator.ATR + func (s *StandardIndicatorSet) ATRP(iw types.IntervalWindow) *indicator.ATRP + func (s *StandardIndicatorSet) BOLL(iw types.IntervalWindow, bandWidth float64) *indicator.BOLL + func (s *StandardIndicatorSet) CCI(iw types.IntervalWindow) *indicator.CCI + func (s *StandardIndicatorSet) EMV(iw types.IntervalWindow) *indicator.EMV + func (s *StandardIndicatorSet) EWMA(iw types.IntervalWindow) *indicator.EWMA + func (s *StandardIndicatorSet) GHFilter(iw types.IntervalWindow) *indicator.GHFilter + func (s *StandardIndicatorSet) HULL(iw types.IntervalWindow) *indicator.HULL + func (s *StandardIndicatorSet) KalmanFilter(iw types.IntervalWindow) *indicator.KalmanFilter + func (s *StandardIndicatorSet) MACD(iw types.IntervalWindow, shortPeriod, longPeriod int) *indicator.MACDLegacy + func (s *StandardIndicatorSet) PivotHigh(iw types.IntervalWindow) *indicator.PivotHigh + func (s *StandardIndicatorSet) PivotLow(iw types.IntervalWindow) *indicator.PivotLow + func (s *StandardIndicatorSet) RSI(iw types.IntervalWindow) *indicator.RSI + func (s *StandardIndicatorSet) SMA(iw types.IntervalWindow) *indicator.SMA + func (s *StandardIndicatorSet) STOCH(iw types.IntervalWindow) *indicator.STOCH + func (s *StandardIndicatorSet) VWMA(iw types.IntervalWindow) *indicator.VWMA + type Stash map[string]interface + type StopEMA struct + Range fixedpoint.Value + func (s *StopEMA) Allowed(closePrice fixedpoint.Value) bool + func (s *StopEMA) Bind(session *ExchangeSession, orderExecutor *GeneralOrderExecutor) + type StrategyController struct + Status types.StrategyStatus + func (s *StrategyController) EmergencyStop() error + func (s *StrategyController) EmitEmergencyStop() + func (s *StrategyController) EmitResume() + func (s *StrategyController) EmitSuspend() + func (s *StrategyController) GetStatus() types.StrategyStatus + func (s *StrategyController) OnEmergencyStop(cb func()) + func (s *StrategyController) OnResume(cb func()) + func (s *StrategyController) OnSuspend(cb func()) + func (s *StrategyController) Resume() error + func (s *StrategyController) Suspend() error + type StrategyControllerEventHub interface + OnEmergencyStop func(cb func()) + OnResume func(cb func()) + OnSuspend func(cb func()) + type StrategyDefaulter interface + Defaults func() error + type StrategyID interface + ID func() string + type StrategyInitializer interface + Initialize func() error + type StrategyShutdown interface + Shutdown func(ctx context.Context, wg *sync.WaitGroup) + type StrategyStatusReader interface + GetStatus func() types.StrategyStatus + type StrategyToggler interface + Resume func() error + Suspend func() error + type StrategyValidator interface + Validate func() error + type SupportTakeProfit struct + Ratio fixedpoint.Value + Symbol string + func (s *SupportTakeProfit) Bind(session *ExchangeSession, orderExecutor *GeneralOrderExecutor) + func (s *SupportTakeProfit) Subscribe(session *ExchangeSession) + type SymbolBasedRiskController struct + BasicRiskController *BasicRiskController + type SyncConfig struct + DepositHistory bool + MarginAssets []string + MarginHistory bool + RewardHistory bool + Sessions []string + Since *types.LooseFormatTime + Symbols []SyncSymbol + UserDataStream ... + WithdrawHistory bool + type SyncStatus int + const SyncDone + const SyncNotStarted + const Syncing + type SyncSymbol struct + Session string + Symbol string + func (ss *SyncSymbol) UnmarshalYAML(unmarshal func(a interface{}) error) (err error) + type TelegramNotification struct + Broadcast bool + type TradeReporter struct + type Trader struct + func NewTrader(environ *Environment) *Trader + func (trader *Trader) AttachCrossExchangeStrategy(strategy CrossExchangeStrategy) *Trader + func (trader *Trader) AttachStrategyOn(session string, strategies ...SingleExchangeStrategy) error + func (trader *Trader) Configure(userConfig *Config) error + func (trader *Trader) DisableLogging() + func (trader *Trader) EnableLogging() + func (trader *Trader) Initialize(ctx context.Context) error + func (trader *Trader) IterateStrategies(f func(st StrategyID) error) error + func (trader *Trader) LoadState(ctx context.Context) error + func (trader *Trader) Run(ctx context.Context) error + func (trader *Trader) RunAllSingleExchangeStrategy(ctx context.Context) error + func (trader *Trader) RunSingleExchangeStrategy(ctx context.Context, strategy SingleExchangeStrategy, session *ExchangeSession, ...) error + func (trader *Trader) SaveState(ctx context.Context) error + func (trader *Trader) SetRiskControls(riskControls *RiskControls) + func (trader *Trader) Shutdown(ctx context.Context) + type TrailingStop2 struct + ActivationRatio fixedpoint.Value + CallbackRate fixedpoint.Value + ClosePosition fixedpoint.Value + Interval types.Interval + MinProfit fixedpoint.Value + Side types.SideType + Symbol string + func (s *TrailingStop2) Bind(session *ExchangeSession, orderExecutor *GeneralOrderExecutor) + func (s *TrailingStop2) Subscribe(session *ExchangeSession) + type TrendEMA struct + MaxGradient float64 + MinGradient float64 + func (s *TrendEMA) Bind(session *ExchangeSession, orderExecutor *GeneralOrderExecutor) + func (s *TrendEMA) Gradient() float64 + func (s *TrendEMA) GradientAllowed() bool + type TwapExecution struct + DeadlineTime time.Time + NumOfTicks int + Session *ExchangeSession + Side types.SideType + SliceQuantity fixedpoint.Value + StopPrice fixedpoint.Value + Symbol string + TargetQuantity fixedpoint.Value + UpdateInterval time.Duration + func (e *TwapExecution) Done() (c <-chan struct{}) + func (e *TwapExecution) Run(parentCtx context.Context) error + func (e *TwapExecution) Shutdown(shutdownCtx context.Context)