rebalance

package
v0.0.0-...-c0411a1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ID = "rebalance"

Variables

This section is empty.

Functions

This section is empty.

Types

type GeneralOrderExecutorMap

type GeneralOrderExecutorMap map[string]*bbgo.GeneralOrderExecutor

func NewGeneralOrderExecutorMap

func NewGeneralOrderExecutorMap(session *bbgo.ExchangeSession, strategyID string, instanceID string, positionMap PositionMap) GeneralOrderExecutorMap

func (GeneralOrderExecutorMap) Bind

func (m GeneralOrderExecutorMap) Bind()

func (GeneralOrderExecutorMap) BindEnvironment

func (m GeneralOrderExecutorMap) BindEnvironment(environ *bbgo.Environment)

func (GeneralOrderExecutorMap) BindProfitStats

func (m GeneralOrderExecutorMap) BindProfitStats(profitStatsMap ProfitStatsMap)

func (GeneralOrderExecutorMap) GracefulCancel

func (m GeneralOrderExecutorMap) GracefulCancel(ctx context.Context) error

func (GeneralOrderExecutorMap) SubmitOrders

func (m GeneralOrderExecutorMap) SubmitOrders(ctx context.Context, submitOrders ...types.SubmitOrder) (types.OrderSlice, error)

type MultiMarketStrategy

type MultiMarketStrategy struct {
	Environ *bbgo.Environment
	Session *bbgo.ExchangeSession

	PositionMap      PositionMap    `persistence:"position_map"`
	ProfitStatsMap   ProfitStatsMap `persistence:"profit_stats_map"`
	OrderExecutorMap GeneralOrderExecutorMap
	// contains filtered or unexported fields
}

func (*MultiMarketStrategy) Initialize

func (s *MultiMarketStrategy) Initialize(ctx context.Context, environ *bbgo.Environment, session *bbgo.ExchangeSession, markets map[string]types.Market, strategyID string, instanceID string)

type PositionMap

type PositionMap map[string]*types.Position

type ProfitStatsMap

type ProfitStatsMap map[string]*types.ProfitStats

type Strategy

type Strategy struct {
	*MultiMarketStrategy

	Environment *bbgo.Environment

	Schedule      string            `json:"schedule"`
	QuoteCurrency string            `json:"quoteCurrency"`
	TargetWeights types.ValueMap    `json:"targetWeights"`
	Threshold     fixedpoint.Value  `json:"threshold"`
	MaxAmount     fixedpoint.Value  `json:"maxAmount"` // max amount to buy or sell per order
	OrderType     types.OrderType   `json:"orderType"`
	PriceType     types.PriceType   `json:"priceType"`
	BalanceType   types.BalanceType `json:"balanceType"`
	DryRun        bool              `json:"dryRun"`
	OnStart       bool              `json:"onStart"` // rebalance on start
	// contains filtered or unexported fields
}

func (*Strategy) Defaults

func (s *Strategy) Defaults() error

func (*Strategy) ID

func (s *Strategy) ID() string

func (*Strategy) Initialize

func (s *Strategy) Initialize() error

func (*Strategy) InstanceID

func (s *Strategy) InstanceID() string

func (*Strategy) Run

func (*Strategy) Subscribe

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

func (*Strategy) Validate

func (s *Strategy) Validate() error

Jump to

Keyboard shortcuts

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