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 ¶
View Source
var ( EventTypes = map[string]reflect.Type{ EventCandle: reflect.TypeOf(Candle{}), EventOrder: reflect.TypeOf(TradeAction{}), EventTrade: reflect.TypeOf(Trade{}), EventPosition: reflect.TypeOf(Position{}), EventDepth: reflect.TypeOf(Depth{}), EventTradeMarket: reflect.TypeOf(Trade{}), EventBalance: reflect.TypeOf(Balance{}), EventBalanceInit: reflect.TypeOf(BalanceInfo{}), EventWatch: reflect.TypeOf(WatchParam{}), EventNotify: reflect.TypeOf(NotifyEvent{}), EventWatchCandle: reflect.TypeOf(CandleParam{}), } )
Functions ¶
This section is empty.
Types ¶
type CandleInfo ¶
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 ¶
UnmarshalJSON EventData can't be used as Embed
type NotifyEvent ¶
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
type RiskLimits ¶
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
Click to show internal directories.
Click to hide internal directories.