engine

package
v0.0.0-...-86952cd Latest Latest
Warning

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

Go to latest
Published: May 30, 2025 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(ext string, fn NewRunnerFn)

Types

type EngineImpl

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

func NewEngineImpl

func NewEngineImpl(proc *BaseProcesser, symbol string) *EngineImpl

func (*EngineImpl) AddIndicator

func (e *EngineImpl) AddIndicator(name string, params ...int) (ind indicator.CommonIndicator)

func (*EngineImpl) Balance

func (e *EngineImpl) Balance() (balance float64)

func (*EngineImpl) CancelAllOrder

func (e *EngineImpl) CancelAllOrder()

func (*EngineImpl) CancelOrder

func (e *EngineImpl) CancelOrder(id string)

func (*EngineImpl) Log

func (e *EngineImpl) Log(v ...interface{})

func (*EngineImpl) Merge

func (e *EngineImpl) Merge(vmID, src, dst string, fn common.CandleFn)

func (*EngineImpl) OnCandle

func (e *EngineImpl) OnCandle(candle *Candle)

func (*EngineImpl) Position

func (e *EngineImpl) Position() (float64, float64)

func (*EngineImpl) RemoveMerge

func (e *EngineImpl) RemoveMerge(vmID string)

func (*EngineImpl) SendNotify

func (e *EngineImpl) SendNotify(title, content, contentType string)

func (*EngineImpl) SetBalance

func (e *EngineImpl) SetBalance(balance float64)

func (*EngineImpl) UpdateBalance

func (e *EngineImpl) UpdateBalance(balance float64)

func (*EngineImpl) UpdatePosition

func (e *EngineImpl) UpdatePosition(pos, price float64)

func (*EngineImpl) UpdateStatus

func (e *EngineImpl) UpdateStatus(status int, msg string)

func (*EngineImpl) Watch

func (e *EngineImpl) Watch(watchType string)

type EngineWrapper

type EngineWrapper struct {
	*EngineImpl
	VmID string
	Cb   UpdateStatusFn
}

func NewEngineWrapper

func NewEngineWrapper(proc *BaseProcesser, cb UpdateStatusFn, symbol string, id string) *EngineWrapper

func (*EngineWrapper) CleanMerges

func (e *EngineWrapper) CleanMerges()

func (*EngineWrapper) CloseLong

func (e *EngineWrapper) CloseLong(price, amount float64) string

func (*EngineWrapper) CloseShort

func (e *EngineWrapper) CloseShort(price, amount float64) string

func (*EngineWrapper) DoOrder

func (e *EngineWrapper) DoOrder(typ TradeType, price, amount float64) string

func (*EngineWrapper) Merge

func (e *EngineWrapper) Merge(src, dst string, fn common.CandleFn)

func (*EngineWrapper) OpenLong

func (e *EngineWrapper) OpenLong(price, amount float64) string

func (*EngineWrapper) OpenShort

func (e *EngineWrapper) OpenShort(price, amount float64) string

func (*EngineWrapper) StopLong

func (e *EngineWrapper) StopLong(price, amount float64) string

func (*EngineWrapper) StopShort

func (e *EngineWrapper) StopShort(price, amount float64) string

func (*EngineWrapper) UpdateStatus

func (e *EngineWrapper) UpdateStatus(status int, msg string)

type KlinePlugin

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

func NewKlinePlugin

func NewKlinePlugin(src, dst string, fn common.CandleFn) (kp *KlinePlugin)

func (*KlinePlugin) Update

func (kp *KlinePlugin) Update(candle *Candle)

type NewRunnerFn

type NewRunnerFn func(file string) (r Runner, err error)

type Runner

type Runner interface {
	Param() (paramInfo []common.Param, err error)
	Init(engine engine.Engine, params common.ParamData) (err error)
	OnCandle(candle *Candle) (err error)
	OnPosition(pos, price float64) (err error)
	OnTrade(trade *Trade) (err error)
	OnTradeMarket(trade *Trade) (err error)
	OnDepth(depth *Depth) (err error)
	OnEvent(e *Event) (err error)
	GetName() string
}

func NewRunner

func NewRunner(file string) (r Runner, err error)

type UpdateStatusFn

type UpdateStatusFn func(vm string, status int, msg string)

Jump to

Keyboard shortcuts

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