xdepthmaker

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: AGPL-3.0 Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const ID = "xdepthmaker"

Variables

Functions

This section is empty.

Types

type CrossExchangeMarketMakingStrategy

type CrossExchangeMarketMakingStrategy struct {
	Environ *bbgo.Environment

	// persistence fields
	Position        *types.Position    `json:"position,omitempty" persistence:"position"`
	ProfitStats     *types.ProfitStats `json:"profitStats,omitempty" persistence:"profit_stats"`
	CoveredPosition fixedpoint.Value   `json:"coveredPosition,omitempty" persistence:"covered_position"`

	MakerOrderExecutor, HedgeOrderExecutor *bbgo.GeneralOrderExecutor
	// contains filtered or unexported fields
}

func (*CrossExchangeMarketMakingStrategy) Initialize

func (s *CrossExchangeMarketMakingStrategy) Initialize(
	ctx context.Context, environ *bbgo.Environment,
	makerSession, hedgeSession *bbgo.ExchangeSession,
	symbol, strategyID, instanceID string,
) error

type ProfitStats

type ProfitStats struct {
	*types.ProfitStats

	MakerExchange types.ExchangeName `json:"makerExchange"`

	AccumulatedMakerVolume    fixedpoint.Value `json:"accumulatedMakerVolume,omitempty"`
	AccumulatedMakerBidVolume fixedpoint.Value `json:"accumulatedMakerBidVolume,omitempty"`
	AccumulatedMakerAskVolume fixedpoint.Value `json:"accumulatedMakerAskVolume,omitempty"`

	TodayMakerVolume    fixedpoint.Value `json:"todayMakerVolume,omitempty"`
	TodayMakerBidVolume fixedpoint.Value `json:"todayMakerBidVolume,omitempty"`
	TodayMakerAskVolume fixedpoint.Value `json:"todayMakerAskVolume,omitempty"`
	// contains filtered or unexported fields
}

func (*ProfitStats) AddTrade

func (s *ProfitStats) AddTrade(trade types.Trade)

func (*ProfitStats) ResetToday

func (s *ProfitStats) ResetToday()

type State

type State struct {
	CoveredPosition fixedpoint.Value `json:"coveredPosition,omitempty"`

	// Deprecated:
	Position *types.Position `json:"position,omitempty"`

	// Deprecated:
	ProfitStats ProfitStats `json:"profitStats,omitempty"`
}

type Strategy

type Strategy struct {
	*CrossExchangeMarketMakingStrategy

	Environment *bbgo.Environment

	Symbol string `json:"symbol"`

	// HedgeExchange session name
	HedgeExchange string `json:"hedgeExchange"`

	// MakerExchange session name
	MakerExchange string `json:"makerExchange"`

	UpdateInterval types.Duration `json:"updateInterval"`
	HedgeInterval  types.Duration `json:"hedgeInterval"`

	FullReplenishInterval types.Duration `json:"fullReplenishInterval"`

	OrderCancelWaitTime types.Duration `json:"orderCancelWaitTime"`

	Margin    fixedpoint.Value `json:"margin"`
	BidMargin fixedpoint.Value `json:"bidMargin"`
	AskMargin fixedpoint.Value `json:"askMargin"`

	StopHedgeQuoteBalance fixedpoint.Value `json:"stopHedgeQuoteBalance"`
	StopHedgeBaseBalance  fixedpoint.Value `json:"stopHedgeBaseBalance"`

	// Quantity is used for fixed quantity of the first layer
	Quantity fixedpoint.Value `json:"quantity"`

	// QuantityScale helps user to define the quantity by layer scale
	QuantityScale *bbgo.LayerScale `json:"quantityScale,omitempty"`

	// DepthScale helps user to define the depth by layer scale
	DepthScale *bbgo.LayerScale `json:"depthScale,omitempty"`

	// MaxExposurePosition defines the unhedged quantity of stop
	MaxExposurePosition fixedpoint.Value `json:"maxExposurePosition"`

	DisableHedge bool `json:"disableHedge"`

	NotifyTrade bool `json:"notifyTrade"`

	// RecoverTrade tries to find the missing trades via the REStful API
	RecoverTrade bool `json:"recoverTrade"`

	RecoverTradeScanPeriod types.Duration `json:"recoverTradeScanPeriod"`

	NumLayers int `json:"numLayers"`

	// Pips is the pips of the layer prices
	Pips fixedpoint.Value `json:"pips"`

	ProfitFixerConfig *common.ProfitFixerConfig `json:"profitFixer"`
	// contains filtered or unexported fields
}

func (*Strategy) CrossRun

func (s *Strategy) CrossRun(
	ctx context.Context, _ bbgo.OrderExecutionRouter,
	sessions map[string]*bbgo.ExchangeSession,
) error

func (*Strategy) CrossSubscribe

func (s *Strategy) CrossSubscribe(sessions map[string]*bbgo.ExchangeSession)

func (*Strategy) Defaults

func (s *Strategy) Defaults() error

func (*Strategy) Hedge

func (s *Strategy) Hedge(ctx context.Context, pos fixedpoint.Value)

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) Validate

func (s *Strategy) Validate() error

Jump to

Keyboard shortcuts

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