Documentation
¶
Index ¶
- Constants
- func DrawCumPNL(instanceID string, cumProfit types.Series) *types.Canvas
- func DrawPNL(instanceID string, profit types.Series) *types.Canvas
- type AccumulatedProfitReport
- func (r *AccumulatedProfitReport) DailyUpdate(tradeStats *types.TradeStats)
- func (r *AccumulatedProfitReport) Initialize()
- func (r *AccumulatedProfitReport) Output(symbol string)
- func (r *AccumulatedProfitReport) RecordProfit(profit fixedpoint.Value)
- func (r *AccumulatedProfitReport) RecordTrade(fee fixedpoint.Value)
- type SHARK
- func (inc *SHARK) BindK(target indicator.KLineClosedEmitter, symbol string, interval types.Interval)
- func (inc *SHARK) EmitUpdate(value float64)
- func (inc *SHARK) Index(i int) float64
- func (inc *SHARK) Last() float64
- func (inc *SHARK) Length() int
- func (inc *SHARK) LoadK(allKLines []types.KLine)
- func (inc *SHARK) OnUpdate(cb func(value float64))
- func (inc *SHARK) PushK(k types.KLine)
- func (inc SHARK) SharkLong(highs, lows floats.Slice, p float64, lookback int) float64
- func (inc SHARK) SharkShort(highs, lows floats.Slice, p float64, lookback int) float64
- func (inc *SHARK) Update(high, low, price float64)
- type Strategy
- func (s *Strategy) CalcAssetValue(price fixedpoint.Value) fixedpoint.Value
- func (s *Strategy) Draw(profit, cumProfit types.Series) error
- func (s *Strategy) ID() string
- func (s *Strategy) InitDrawCommands(profit, cumProfit types.Series)
- func (s *Strategy) InstanceID() string
- func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, ...) error
- func (s *Strategy) Subscribe(session *bbgo.ExchangeSession)
Constants ¶
View Source
const ID = "harmonic"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccumulatedProfitReport ¶
type AccumulatedProfitReport struct {
// AccumulatedProfitMAWindow Accumulated profit SMA window, in number of trades
AccumulatedProfitMAWindow int `json:"accumulatedProfitMAWindow"`
// IntervalWindow interval window, in days
IntervalWindow int `json:"intervalWindow"`
// NumberOfInterval How many intervals to output to TSV
NumberOfInterval int `json:"NumberOfInterval"`
// TsvReportPath The path to output report to
TsvReportPath string `json:"tsvReportPath"`
// AccumulatedDailyProfitWindow The window to sum up the daily profit, in days
AccumulatedDailyProfitWindow int `json:"accumulatedDailyProfitWindow"`
// contains filtered or unexported fields
}
AccumulatedProfitReport For accumulated profit report output
func (*AccumulatedProfitReport) DailyUpdate ¶
func (r *AccumulatedProfitReport) DailyUpdate(tradeStats *types.TradeStats)
func (*AccumulatedProfitReport) Initialize ¶
func (r *AccumulatedProfitReport) Initialize()
func (*AccumulatedProfitReport) Output ¶
func (r *AccumulatedProfitReport) Output(symbol string)
Output Accumulated profit report to a TSV file
func (*AccumulatedProfitReport) RecordProfit ¶
func (r *AccumulatedProfitReport) RecordProfit(profit fixedpoint.Value)
func (*AccumulatedProfitReport) RecordTrade ¶
func (r *AccumulatedProfitReport) RecordTrade(fee fixedpoint.Value)
type SHARK ¶
type SHARK struct {
types.IntervalWindow
types.SeriesBase
Lows floats.Slice
Highs floats.Slice
LongScores floats.Slice
ShortScores floats.Slice
Values floats.Slice
EndTime time.Time
// contains filtered or unexported fields
}
func (*SHARK) EmitUpdate ¶
func (SHARK) SharkShort ¶
type Strategy ¶
type Strategy struct {
Environment *bbgo.Environment
Symbol string `json:"symbol"`
Market types.Market
types.IntervalWindow
// persistence fields
Position *types.Position `persistence:"position"`
ProfitStats *types.ProfitStats `persistence:"profit_stats"`
TradeStats *types.TradeStats `persistence:"trade_stats"`
ExitMethods bbgo.ExitMethodSet `json:"exits"`
bbgo.QuantityOrAmount
// StrategyController
bbgo.StrategyController
AccountValueCalculator *bbgo.AccountValueCalculator
// whether to draw graph or not by the end of backtest
DrawGraph bool `json:"drawGraph"`
GraphPNLPath string `json:"graphPNLPath"`
GraphCumPNLPath string `json:"graphCumPNLPath"`
// Accumulated profit report
AccumulatedProfitReport *AccumulatedProfitReport `json:"accumulatedProfitReport"`
// contains filtered or unexported fields
}
func (*Strategy) CalcAssetValue ¶
func (s *Strategy) CalcAssetValue(price fixedpoint.Value) fixedpoint.Value
func (*Strategy) InitDrawCommands ¶
func (*Strategy) InstanceID ¶
func (*Strategy) Run ¶
func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, session *bbgo.ExchangeSession) error
func (*Strategy) Subscribe ¶
func (s *Strategy) Subscribe(session *bbgo.ExchangeSession)
Click to show internal directories.
Click to hide internal directories.