drift

package
v1.38.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: AGPL-3.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const ID = "drift"

Variables

View Source
var Fee = fixedpoint.NewFromFloat(0.0008) // taker fee % * 2, for upper bound

Functions

This section is empty.

Types

type DriftMA

type DriftMA struct {
	types.SeriesBase
	// contains filtered or unexported fields
}

func (*DriftMA) Clone

func (s *DriftMA) Clone() *DriftMA

func (*DriftMA) Index

func (s *DriftMA) Index(i int) float64

func (*DriftMA) Last

func (s *DriftMA) Last() float64

func (*DriftMA) Length

func (s *DriftMA) Length() int

func (*DriftMA) TestUpdate

func (s *DriftMA) TestUpdate(v float64) *DriftMA

func (*DriftMA) Update

func (s *DriftMA) Update(value float64)

func (*DriftMA) ZeroPoint

func (s *DriftMA) ZeroPoint() float64

type SourceFunc

type SourceFunc func(*types.KLine) fixedpoint.Value

type Strategy

type Strategy struct {
	Symbol string `json:"symbol"`

	bbgo.StrategyController
	types.Market
	types.IntervalWindow

	*bbgo.Environment
	*types.Position    `persistence:"position"`
	*types.ProfitStats `persistence:"profit_stats"`
	*types.TradeStats  `persistence:"trade_stats"`

	Source                    string           `json:"source,omitempty"`
	TakeProfitFactor          float64          `json:"takeProfitFactor"`
	ProfitFactorWindow        int              `json:"profitFactorWindow"`
	StopLoss                  fixedpoint.Value `json:"stoploss"`
	CanvasPath                string           `json:"canvasPath"`
	PredictOffset             int              `json:"predictOffset"`
	HighLowVarianceMultiplier float64          `json:"hlVarianceMultiplier"`
	NoTrailingStopLoss        bool             `json:"noTrailingStopLoss"`
	HLRangeWindow             int              `json:"hlRangeWindow"`
	SmootherWindow            int              `json:"smootherWindow"`
	FisherTransformWindow     int              `json:"fisherTransformWindow"`
	ATRWindow                 int              `json:"atrWindow"`

	// This is not related to trade but for statistics graph generation
	// Will deduct fee in percentage from every trade
	GraphPNLDeductFee bool   `json:"graphPNLDeductFee"`
	GraphPNLPath      string `json:"graphPNLPath"`
	GraphCumPNLPath   string `json:"graphCumPNLPath"`
	// Whether to generate graph when shutdown
	GenerateGraph bool `json:"generateGraph"`

	ExitMethods bbgo.ExitMethodSet `json:"exits"`
	Session     *bbgo.ExchangeSession
	*bbgo.GeneralOrderExecutor
	// contains filtered or unexported fields
}

func (*Strategy) ClosePosition

func (s *Strategy) ClosePosition(ctx context.Context, percentage fixedpoint.Value) error

func (*Strategy) CurrentPosition

func (s *Strategy) CurrentPosition() *types.Position

func (*Strategy) Draw

func (s *Strategy) Draw(time types.Time, priceLine types.SeriesExtend, profit types.Series, cumProfit types.Series, zeroPoints types.Series)

func (*Strategy) ID

func (s *Strategy) ID() string

func (*Strategy) InstanceID

func (s *Strategy) InstanceID() string

func (*Strategy) Print

func (s *Strategy) Print(o *os.File)

func (*Strategy) Run

func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, session *bbgo.ExchangeSession) error

func (*Strategy) SourceFuncGenerator

func (s *Strategy) SourceFuncGenerator() SourceFunc

func (*Strategy) Subscribe

func (s *Strategy) Subscribe(session *bbgo.ExchangeSession)

Jump to

Keyboard shortcuts

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