processor

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseError

func ParseError(err error) error

func ParserErr1003

func ParserErr1003(msg string) (ip, time string, err error)

Types

type DepthConstructor

type DepthConstructor func() *depth_types.Depths

type GetBaseBalanceFunction

type GetBaseBalanceFunction func() items_types.ValueType

type GetCallbackRateFunction

type GetCallbackRateFunction func() items_types.PricePercentType

type GetCurrentPriceFunction

type GetCurrentPriceFunction func() items_types.PriceType

type GetDeltaPriceFunction

type GetDeltaPriceFunction func() items_types.PricePercentType

type GetDeltaQuantityFunction

type GetDeltaQuantityFunction func() items_types.QuantityPercentType

type GetFreeBalanceFunction

type GetFreeBalanceFunction func() items_types.ValueType

type GetLeverageFunction

type GetLeverageFunction func() int

type GetLimitOnPositionFunction

type GetLimitOnPositionFunction func() items_types.ValueType

type GetLimitOnTransactionFunction

type GetLimitOnTransactionFunction func() items_types.ValuePercentType

type GetLockedBalanceFunction

type GetLockedBalanceFunction func() items_types.ValueType

type GetMarginTypeFunction

type GetMarginTypeFunction func() types.MarginType

type GetPositionRiskFunction

type GetPositionRiskFunction func() *futures.PositionRisk

type GetTargetBalanceFunction

type GetTargetBalanceFunction func() items_types.QuantityType

type GetUpAndLowBoundFunction

type GetUpAndLowBoundFunction func() items_types.PricePercentType

type OrdersConstructor

type OrdersConstructor func() *orders_types.Orders

type Processor

type Processor struct {
	// contains filtered or unexported fields
}

func New

func New(
	stop chan struct{},
	symbol string,
	symbolInfo *symbol_types.Symbol,

	getBaseBalance GetBaseBalanceFunction,
	getTargetBalance GetTargetBalanceFunction,
	getFreeBalance GetFreeBalanceFunction,
	getLockedBalance GetLockedBalanceFunction,
	getCurrentPrice GetCurrentPriceFunction,

	getPositionRisk func(*Processor) GetPositionRiskFunction,
	getLeverage GetLeverageFunction,
	setLeverage func(*Processor) SetLeverageFunction,

	getMarginType GetMarginTypeFunction,
	setMarginType func(*Processor) SetMarginTypeFunction,

	setPositionMargin func(*Processor) SetPositionMarginFunction,

	getDeltaPrice GetDeltaPriceFunction,
	getDeltaQuantity GetDeltaQuantityFunction,
	getLimitOnPosition GetLimitOnPositionFunction,
	getLimitOnTransaction GetLimitOnTransactionFunction,
	getUpAndLowBound GetUpAndLowBoundFunction,

	getCallbackRate GetCallbackRateFunction,

	debug ...bool) (pp *Processor, err error)

func (*Processor) CalcQuantityByUPnL

func (pp *Processor) CalcQuantityByUPnL(
	upOrDown depth_types.UpOrDown,
	price items_types.PriceType,
	debug ...*futures.PositionRisk) (newQuantity items_types.QuantityType, err error)

func (*Processor) CeilPrice

func (pp *Processor) CeilPrice(price items_types.PriceType) items_types.PriceType

func (*Processor) CeilQuantity

func (pp *Processor) CeilQuantity(quantity items_types.QuantityType) items_types.QuantityType

func (*Processor) CeilValue

func (pp *Processor) CeilValue(value items_types.ValueType) items_types.ValueType

func (*Processor) CheckPosition

func (pp *Processor) CheckPosition(
	price items_types.PriceType,
	debug ...*futures.PositionRisk) (err error)

func (*Processor) DeltaLiquidation

func (pp *Processor) DeltaLiquidation(price items_types.PriceType, leverage int, lossPercent ...items_types.ValuePercentType) (res items_types.DeltaPriceType)

func (*Processor) DeltaPrice

func (pp *Processor) DeltaPrice(price items_types.PriceType, percentDelta items_types.PricePercentType) (res items_types.DeltaPriceType)

func (*Processor) FloorPrice

func (pp *Processor) FloorPrice(price items_types.PriceType) items_types.PriceType

func (*Processor) FloorQuantity

func (pp *Processor) FloorQuantity(quantity items_types.QuantityType) items_types.QuantityType

func (*Processor) FloorValue

func (pp *Processor) FloorValue(value items_types.ValueType) items_types.ValueType

func (*Processor) GetBaseBalance

func (pp *Processor) GetBaseBalance() items_types.ValueType

func (*Processor) GetBaseSymbol

func (pp *Processor) GetBaseSymbol() symbol_types.QuoteAsset

func (*Processor) GetCallbackRate

func (pp *Processor) GetCallbackRate() items_types.PricePercentType

func (*Processor) GetCurrentPrice

func (pp *Processor) GetCurrentPrice() items_types.PriceType

func (*Processor) GetDeltaPrice

func (pp *Processor) GetDeltaPrice() items_types.PricePercentType

func (*Processor) GetDeltaQuantity

func (pp *Processor) GetDeltaQuantity() items_types.QuantityPercentType

func (*Processor) GetFreeBalance

func (pp *Processor) GetFreeBalance() items_types.ValueType

func (*Processor) GetLeverage

func (pp *Processor) GetLeverage() int

func (*Processor) GetLimitOnPosition

func (pp *Processor) GetLimitOnPosition() (limit items_types.ValueType)

func (*Processor) GetLimitOnTransaction

func (pp *Processor) GetLimitOnTransaction() (limit items_types.ValueType)

func (*Processor) GetLiquidationDistance

func (pp *Processor) GetLiquidationDistance(price float64, debug ...*futures.PositionRisk) (distance float64)

func (*Processor) GetLockedBalance

func (pp *Processor) GetLockedBalance() items_types.ValueType

func (*Processor) GetLowBound

func (pp *Processor) GetLowBound(price items_types.PriceType) items_types.PriceType

func (*Processor) GetMarginType

func (pp *Processor) GetMarginType() types.MarginType

MarginTypeIsolated MarginType = "ISOLATED" MarginTypeCrossed MarginType = "CROSSED"

func (*Processor) GetMaxPrice

func (pp *Processor) GetMaxPrice() items_types.PriceType

func (*Processor) GetMaxQty

func (pp *Processor) GetMaxQty() items_types.QuantityType

func (*Processor) GetMinPrice

func (pp *Processor) GetMinPrice() items_types.PriceType

func (*Processor) GetMinQty

func (pp *Processor) GetMinQty() items_types.QuantityType

func (*Processor) GetNotional

func (pp *Processor) GetNotional() items_types.ValueType

func (*Processor) GetPositionAmt

func (pp *Processor) GetPositionAmt(debug ...*futures.PositionRisk) (positionAmt items_types.QuantityType)

func (*Processor) GetPositionMargin

func (pp *Processor) GetPositionMargin(debug ...*futures.PositionRisk) (margin float64)

func (*Processor) GetPositionRisk

func (pp *Processor) GetPositionRisk(debug ...*futures.PositionRisk) *futures.PositionRisk

func (*Processor) GetStepSizeExp

func (pp *Processor) GetStepSizeExp() (res int)

Округлення ціни до StepSize знаків після коми

func (*Processor) GetSymbol

func (pp *Processor) GetSymbol() string

func (*Processor) GetSymbolInfo

func (pp *Processor) GetSymbolInfo() *symbol_types.Symbol

func (*Processor) GetTargetBalance

func (pp *Processor) GetTargetBalance() items_types.QuantityType

func (*Processor) GetTargetSymbol

func (pp *Processor) GetTargetSymbol() symbol_types.BaseAsset

func (*Processor) GetTickSizeExp

func (pp *Processor) GetTickSizeExp() (res int)

Округлення ціни до TickSize знаків після коми

func (*Processor) GetUpAndLowBound

func (pp *Processor) GetUpAndLowBound() items_types.PricePercentType

func (*Processor) GetUpBound

func (pp *Processor) GetUpBound(price items_types.PriceType) items_types.PriceType

func (*Processor) NextPriceDown

func (pp *Processor) NextPriceDown(prices ...items_types.PriceType) items_types.PriceType

func (*Processor) NextPriceUp

func (pp *Processor) NextPriceUp(prices ...items_types.PriceType) items_types.PriceType

func (*Processor) NextQuantityDown

func (pp *Processor) NextQuantityDown(quantity items_types.QuantityType) items_types.QuantityType

func (*Processor) NextQuantityUp

func (pp *Processor) NextQuantityUp(quantity items_types.QuantityType) items_types.QuantityType

func (*Processor) PercentLiquidation

func (pp *Processor) PercentLiquidation(leverage int) (res items_types.PricePercentType)

func (*Processor) PossibleLoss

func (pp *Processor) PossibleLoss(
	quantity items_types.QuantityType,
	delta items_types.DeltaPriceType) (possibleLoss items_types.ValueType)

func (*Processor) PossibleQuantity

func (pp *Processor) PossibleQuantity(
	value items_types.ValueType,
	delta items_types.DeltaPriceType,
	round ...bool) (possibleQuantity items_types.QuantityType)

func (*Processor) RoundPrice

func (pp *Processor) RoundPrice(price items_types.PriceType) items_types.PriceType

func (*Processor) RoundQuantity

func (pp *Processor) RoundQuantity(quantity items_types.QuantityType) items_types.QuantityType

func (*Processor) RoundValue

func (pp *Processor) RoundValue(value items_types.ValueType) items_types.ValueType

func (*Processor) SetGetterBaseBalanceFunction

func (pp *Processor) SetGetterBaseBalanceFunction(function GetBaseBalanceFunction)

Налаштовуємо функції

func (*Processor) SetGetterCallbackRateFunction

func (pp *Processor) SetGetterCallbackRateFunction(function GetCallbackRateFunction)

func (*Processor) SetGetterCurrentPriceFunction

func (pp *Processor) SetGetterCurrentPriceFunction(function GetCurrentPriceFunction)

func (*Processor) SetGetterDeltaPriceFunction

func (pp *Processor) SetGetterDeltaPriceFunction(function GetDeltaPriceFunction)

func (*Processor) SetGetterDeltaQuantityFunction

func (pp *Processor) SetGetterDeltaQuantityFunction(function GetDeltaQuantityFunction)

func (*Processor) SetGetterFreeBalanceFunction

func (pp *Processor) SetGetterFreeBalanceFunction(function GetFreeBalanceFunction)

func (*Processor) SetGetterLeverageFunction

func (pp *Processor) SetGetterLeverageFunction(function GetLeverageFunction)

func (*Processor) SetGetterLimitOnPositionFunction

func (pp *Processor) SetGetterLimitOnPositionFunction(function GetLimitOnPositionFunction)

func (*Processor) SetGetterLimitOnTransactionFunction

func (pp *Processor) SetGetterLimitOnTransactionFunction(function GetLimitOnTransactionFunction)

func (*Processor) SetGetterLockedBalanceFunction

func (pp *Processor) SetGetterLockedBalanceFunction(function GetLockedBalanceFunction)

func (*Processor) SetGetterMarginTypeFunction

func (pp *Processor) SetGetterMarginTypeFunction(function GetMarginTypeFunction)

func (*Processor) SetGetterPositionRiskFunction

func (pp *Processor) SetGetterPositionRiskFunction(function func(*Processor) GetPositionRiskFunction)

func (*Processor) SetGetterTargetBalanceFunction

func (pp *Processor) SetGetterTargetBalanceFunction(function GetTargetBalanceFunction)

func (*Processor) SetGetterUpAndLowBoundFunction

func (pp *Processor) SetGetterUpAndLowBoundFunction(function GetUpAndLowBoundFunction)

func (*Processor) SetLeverage

func (pp *Processor) SetLeverage(leverage int) (Leverage int, MaxNotionalValue string, Symbol string, err error)

func (*Processor) SetMarginType

func (pp *Processor) SetMarginType(marginType types.MarginType) (err error)

MarginTypeIsolated MarginType = "ISOLATED" MarginTypeCrossed MarginType = "CROSSED"

func (*Processor) SetPositionMargin

func (pp *Processor) SetPositionMargin(amountMargin items_types.ValueType, typeMargin int) (err error)

func (*Processor) SetSetterLeverageFunction

func (pp *Processor) SetSetterLeverageFunction(function func(*Processor) SetLeverageFunction)

func (*Processor) SetSetterMarginTypeFunction

func (pp *Processor) SetSetterMarginTypeFunction(function func(*Processor) SetMarginTypeFunction)

func (*Processor) SetSetterPositionMarginFunction

func (pp *Processor) SetSetterPositionMarginFunction(function func(*Processor) SetPositionMarginFunction)

type SetLeverageFunction

type SetLeverageFunction func(leverage int) (Leverage int, MaxNotionalValue string, Symbol string, err error)

type SetMarginTypeFunction

type SetMarginTypeFunction func(types.MarginType) error

type SetPositionMarginFunction

type SetPositionMarginFunction func(items_types.ValueType, int) error

Jump to

Keyboard shortcuts

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