core

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventCandle = "candle"
	EventOrder  = "order"
	// own trades
	EventTrade       = "trade"
	EventPosition    = "position"
	EventCurPosition = "cur_position" // position of current script
	EventRiskLimit   = "risk_limit"
	EventDepth       = "depth"
	// all trades in the markets
	EventTradeMarket = "trade_market"

	EventBalance     = "balance"
	EventBalanceInit = "balance_init"

	EventWatch       = "watch"
	EventWatchCandle = "watch_candle"

	EventNotify = "notify"

	EventError = "error"
)

Events

Variables

Functions

This section is empty.

Types

type BalanceInfo

type BalanceInfo struct {
	Balance float64
	Fee     float64
}

BalanceInfo balance

type CandleInfo

type CandleInfo struct {
	Exchange string
	Symbol   string
	BinSize  string
	Data     interface{}
}

CandleInfo candle data with symbol info

type CandleParam

type CandleParam struct {
	Start    time.Time
	End      time.Time
	Exchange string
	BinSize  string
	Symbol   string
}

CandleParam get candle param

type EventData

type EventData struct {
	Type  string      `json:"type"`
	Data  interface{} `json:"data"`
	Extra interface{} `json:"extra"`
}

func (*EventData) UnmarshalJSON

func (d *EventData) UnmarshalJSON(buf []byte) (err error)

UnmarshalJSON EventData can't be used as Embed

type NotifyEvent

type NotifyEvent struct {
	Type    string // text,markdown
	Title   string
	Content string
}

NotifyEvent event to send notify

type RiskLimit

type RiskLimit struct {
	Code         string  // symbol info, empty = global
	Lever        float64 // lever
	MaxLostRatio float64 // max lose ratio
}

RiskLimit risk limit

func (RiskLimit) Key

func (r RiskLimit) Key() string

Key key of r

type RiskLimits

type RiskLimits map[string]RiskLimit

RiskLimits risk limits

func NewRiskLimits

func NewRiskLimits() (rl RiskLimits)

func (RiskLimits) GetLimitRatio

func (rl RiskLimits) GetLimitRatio(limit RiskLimit) (ret float64)

func (RiskLimits) Update

func (rl RiskLimits) Update(limit RiskLimit)

type SymbolInfo

type SymbolInfo struct {
	ID          int64  `xorm:"pk autoincr null 'id'"`
	Exchange    string `xorm:"notnull unique(esr)  'exchange'"`
	Symbol      string `xorm:"notnull unique(esr) 'symbol'"`
	Resolutions string `xorm:"notnull unique(esr) 'resolutions'"`
	Pricescale  int    `xorm:"notnull 'pricescale'"`
}

SymbolInfo symbol infos

func (*SymbolInfo) GetResolutions

func (si *SymbolInfo) GetResolutions() []string

type WatchParam

type WatchParam = EventData

WatchParam add watch event param

func NewWatchCandle

func NewWatchCandle(cp *CandleParam) *WatchParam

Jump to

Keyboard shortcuts

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