Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FeeBudget ¶ added in v1.60.0
type FeeBudget struct {
DailyFeeBudgets map[string]fixedpoint.Value `json:"dailyFeeBudgets,omitempty"`
State *State `persistence:"state"`
// contains filtered or unexported fields
}
func (*FeeBudget) HandleTradeUpdate ¶ added in v1.60.0
func (*FeeBudget) Initialize ¶ added in v1.60.0
func (f *FeeBudget) Initialize()
func (*FeeBudget) IsBudgetAllowed ¶ added in v1.60.0
type InventorySkew ¶ added in v1.60.0
type InventorySkew struct {
InventoryRangeMultiplier fixedpoint.Value `json:"inventoryRangeMultiplier"`
TargetBaseRatio fixedpoint.Value `json:"targetBaseRatio"`
}
https://hummingbot.org/strategy-configs/inventory-skew/ https://github.com/hummingbot/hummingbot/blob/31fc61d5e71b2c15732142d30983f3ea2be4d466/hummingbot/strategy/pure_market_making/inventory_skew_calculator.pyx
func (*InventorySkew) CalculateBidAskRatios ¶ added in v1.60.0
func (s *InventorySkew) CalculateBidAskRatios(quantity fixedpoint.Value, price fixedpoint.Value, baseBalance fixedpoint.Value, quoteBalance fixedpoint.Value) *InventorySkewBidAskRatios
func (*InventorySkew) Validate ¶ added in v1.60.0
func (s *InventorySkew) Validate() error
type InventorySkewBidAskRatios ¶ added in v1.60.0
type InventorySkewBidAskRatios struct {
BidRatio fixedpoint.Value
AskRatio fixedpoint.Value
}
type ProfitFixer ¶ added in v1.58.0
type ProfitFixer struct {
core.ConverterManager
*bbgo.Environment
// contains filtered or unexported fields
}
ProfitFixer implements a trade-history-based profit fixer
func NewProfitFixer ¶ added in v1.58.0
func NewProfitFixer(config ProfitFixerConfig, environment *bbgo.Environment) *ProfitFixer
func (*ProfitFixer) AddExchange ¶ added in v1.58.0
func (f *ProfitFixer) AddExchange(sessionName string, service types.ExchangeTradeHistoryService)
func (*ProfitFixer) SetConverter ¶ added in v1.64.0
func (f *ProfitFixer) SetConverter(converter *core.ConverterManager)
type ProfitFixerBundle ¶ added in v1.60.0
type ProfitFixerBundle struct {
ProfitFixerConfig *ProfitFixerConfig `json:"profitFixer,omitempty"`
*bbgo.Environment
}
func (*ProfitFixerBundle) Fix ¶ added in v1.60.0
func (f *ProfitFixerBundle) Fix( ctx context.Context, symbol string, position *types.Position, profitStats *types.ProfitStats, sessions ...*bbgo.ExchangeSession, ) error
type ProfitFixerConfig ¶ added in v1.58.0
type ProfitFixerConfig struct {
Apply bool `json:"apply,omitempty"`
Enabled bool `json:"enabled,omitempty"`
TradesSince types.Time `json:"tradesSince,omitempty"`
Patch string `json:"patch,omitempty"`
UseDatabaseTrades bool `json:"useDatabaseTrades,omitempty"`
ProfitCurrency string `json:"profitCurrency,omitempty"` // the currency to calculate profit in
FeeCurrencies []string `json:"feeCurrencies,omitempty"` // list of fee currencies to consider for fee price conversion
// ExtraSymbolSelectors is a list of symbol selectors to include in profit fixing
// In the format of "sessionName.symbol", e.g. "coinbase.BTCUSD"
// The trades selected by the selectors will also be included in profit fixing
ExtraSymbolSelectors []string `json:"extraSymbolSelectors,omitempty"`
}
ProfitFixerConfig is used for fixing profitStats and position by re-playing the trade history
func (ProfitFixerConfig) Equal ¶ added in v1.64.0
func (c ProfitFixerConfig) Equal(other ProfitFixerConfig) bool
type RiskController ¶
type RiskController struct {
PositionHardLimit fixedpoint.Value `json:"positionHardLimit"`
MaxPositionQuantity fixedpoint.Value `json:"maxPositionQuantity"`
CircuitBreakLossThreshold fixedpoint.Value `json:"circuitBreakLossThreshold"`
// contains filtered or unexported fields
}
type State ¶ added in v1.60.0
type State struct {
AccumulatedFeeStartedAt time.Time `json:"accumulatedFeeStartedAt,omitempty"`
AccumulatedFees map[string]fixedpoint.Value `json:"accumulatedFees,omitempty"`
}
func (*State) IsOver24Hours ¶ added in v1.60.0
type StatusCallbacks ¶ added in v1.56.0
type StatusCallbacks struct {
// contains filtered or unexported fields
}
func (*StatusCallbacks) EmitClosed ¶ added in v1.56.0
func (c *StatusCallbacks) EmitClosed()
func (*StatusCallbacks) EmitError ¶ added in v1.56.0
func (c *StatusCallbacks) EmitError(err error)
func (*StatusCallbacks) EmitReady ¶ added in v1.56.0
func (c *StatusCallbacks) EmitReady()
func (*StatusCallbacks) OnClosed ¶ added in v1.56.0
func (c *StatusCallbacks) OnClosed(cb func())
func (*StatusCallbacks) OnError ¶ added in v1.56.0
func (c *StatusCallbacks) OnError(cb func(err error))
func (*StatusCallbacks) OnReady ¶ added in v1.56.0
func (c *StatusCallbacks) OnReady(cb func())
type Strategy ¶
type Strategy struct {
Position *types.Position `json:"position,omitempty" persistence:"position"`
ProfitStats *types.ProfitStats `json:"profitStats,omitempty" persistence:"profit_stats"`
TradeStats *types.TradeStats `json:"tradeStats,omitempty" persistence:"trade_stats"`
Environ *bbgo.Environment
Session *bbgo.ExchangeSession
OrderExecutor *bbgo.GeneralOrderExecutor
RiskController
// contains filtered or unexported fields
}
Strategy provides the core functionality that is required by a long/short strategy.
func (*Strategy) Initialize ¶
func (s *Strategy) Initialize( ctx context.Context, environ *bbgo.Environment, session *bbgo.ExchangeSession, market types.Market, strategyID, instanceID string, )
type StrategyProfitFixer ¶ added in v1.64.0
type StrategyProfitFixer struct {
LastProfitFixConfig *ProfitFixerConfig `persistence:"last_profit_fix_config"`
ProfitFixerConfig *ProfitFixerConfig `json:"profitFixer,omitempty"`
}
func (*StrategyProfitFixer) Fix ¶ added in v1.64.0
func (s *StrategyProfitFixer) Fix( ctx context.Context, environment *bbgo.Environment, converter *core.ConverterManager, market types.Market, sessions []*bbgo.ExchangeSession, oriPosition *types.Position, ) (*types.Position, *types.ProfitStats, error)
func (*StrategyProfitFixer) NeedsProfitFixing ¶ added in v1.64.0
func (s *StrategyProfitFixer) NeedsProfitFixing() bool
type StrategySummarizer ¶ added in v1.64.0
type StrategySummarizer interface {
// SummaryStats returns two maps keyed by logical grouping names
// (e.g., "trades", "positions", "profits", "daily_metrics", "hourly_metrics").
// The first map contains TabularStats for CSV/tabular output, and the second contains
// json.Marshaler instances for JSON output. Keys are typically used as output file names
// or section identifiers. Time series metrics with different granularities should each
// have their own entry in the maps.
SummaryStats() (map[string]TabularStats, map[string]json.Marshaler)
}
StrategySummarizer provides a convenient way for strategies to export detailed performance metrics in tabular (CSV) and JSON formats. This interface is designed to produce structured, human-readable summaries of strategy performance, useful for inspection and post-analysis. It differs from the backtest module's StateRecorder interface, which is primarily a logger that records state transitions over time. TabularStats formats comprehensive performance data (e.g., trade statistics, profit analysis, position summaries) as structured tables, while json.Marshaler entries provide the same or additional data in JSON form. It can also export time series metrics with varying time granularities (e.g., daily, hourly, 1m metrics), with each time series represented as a separate entry in the returned maps.