engine

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 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 added in v0.0.2

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

func NewEngineImpl added in v0.0.6

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

func (*EngineImpl) AddIndicator added in v0.0.2

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

func (*EngineImpl) Balance added in v0.0.2

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

func (*EngineImpl) CancelAllOrder added in v0.0.2

func (e *EngineImpl) CancelAllOrder()

func (*EngineImpl) CancelOrder added in v0.0.6

func (e *EngineImpl) CancelOrder(id string)

func (*EngineImpl) CloseLong added in v0.0.2

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

func (*EngineImpl) CloseShort added in v0.0.2

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

func (*EngineImpl) DoOrder added in v0.0.6

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

func (*EngineImpl) Log added in v0.0.2

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

func (*EngineImpl) Merge added in v0.0.2

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

func (*EngineImpl) OnCandle added in v0.0.2

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

func (*EngineImpl) OpenLong added in v0.0.2

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

func (*EngineImpl) OpenShort added in v0.0.2

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

func (*EngineImpl) Position added in v0.0.2

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

func (*EngineImpl) RemoveMerge added in v0.1.0

func (e *EngineImpl) RemoveMerge(vmID string)

func (*EngineImpl) SendNotify added in v0.0.2

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

func (*EngineImpl) SetBalance added in v0.0.2

func (e *EngineImpl) SetBalance(balance float64)

func (*EngineImpl) StopLong added in v0.0.2

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

func (*EngineImpl) StopShort added in v0.0.2

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

func (*EngineImpl) UpdateBalance added in v0.0.2

func (e *EngineImpl) UpdateBalance(balance float64)

func (*EngineImpl) UpdatePosition added in v0.0.2

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

func (*EngineImpl) UpdateStatus added in v0.0.6

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

func (*EngineImpl) Watch added in v0.0.2

func (e *EngineImpl) Watch(watchType string)

type EngineWrapper added in v0.0.6

type EngineWrapper struct {
	*EngineImpl
	VmID string
	Cb   UpdateStatusFn
}

func NewEngineWrapper added in v0.0.6

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

func (*EngineWrapper) CleanMerges added in v0.1.0

func (e *EngineWrapper) CleanMerges()

func (*EngineWrapper) Merge added in v0.1.0

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

func (*EngineWrapper) UpdateStatus added in v0.0.6

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 added in v0.0.6

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