Documentation ¶
Index ¶
- func ConnectSQL(name, user, host, port, password string)
- func Engine() *xorm.Engine
- type Account
- type Coin
- func (self *Coin) ATR(pt conset.PLAT, symbol conset.SYMBOL, period conset.PERIOD, times conset.TIMES, ...) float32
- func (self *Coin) All(pt conset.PLAT, symbol conset.SYMBOL, period conset.PERIOD, times conset.TIMES, ...) ([]*Coin, error)
- func (self *Coin) Chanel(pt conset.PLAT, symbol conset.SYMBOL, period conset.PERIOD, times conset.TIMES, ...) (float32, float32)
- func (self *Coin) Create(pt conset.PLAT, symbol conset.SYMBOL, period conset.PERIOD, times conset.TIMES, ...) error
- func (self *Coin) EMA(pt conset.PLAT, symbol conset.SYMBOL, period conset.PERIOD, times conset.TIMES, ...) float32
- func (self *Coin) LastTime(pt conset.PLAT, symbol conset.SYMBOL, period conset.PERIOD, times conset.TIMES) (bool, time.Time)
- func (self *Coin) Lasts(pt conset.PLAT, symbol conset.SYMBOL, period conset.PERIOD, times conset.TIMES, ...) ([]Coin, error)
- func (self *Coin) MA(pt conset.PLAT, symbol conset.SYMBOL, period conset.PERIOD, times conset.TIMES, ...) float32
- type Record
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Account ¶
type Coin ¶
type Coin struct { Id int64 Plat string `xorm:"plat varchar(255) unique(pl-time) index(pl-sy-t)"` Symbol string `xorm:"symbol varchar(255) unique(pl-time) index(pl-sy-t)"` Times string `xorm:"times varchar(255) unique(pl-time) index(pl-sy-t)"` // 时间间隔 Period string `json:"period" xorm:"varchar(255) unique(pl-time) index(pl-sy-t)"` // 合约类型 spot,week Open float32 `xorm:"float"` Close float32 `xorm:"float"` High float32 `xorm:"float"` Low float32 `xorm:"float"` Volume float32 `xorm:"float"` Timestamp int64 `json:"time_stamp" xorm:"bigint time_stamp index unique(pl-time)"` // 毫秒 CreateTime time.Time `json:"create_time" xorm:"DATETIME create_time"` }
Coin K线数据
func (*Coin) ATR ¶
func (self *Coin) ATR(pt conset.PLAT, symbol conset.SYMBOL, period conset.PERIOD, times conset.TIMES, limit int, end time.Time) float32
平均波动幅度 1、当前交易日的最高价与最低价间的波幅 2、前一交易日收盘价与当个交易日最高价间的波幅 3、前一交易日收盘价与当个交易日最低价间的波幅
func (*Coin) Chanel ¶
func (self *Coin) Chanel(pt conset.PLAT, symbol conset.SYMBOL, period conset.PERIOD, times conset.TIMES, limit int, end time.Time) (float32, float32)
通道 N日移动平均线=N日收市价之和/N
func (*Coin) EMA ¶
func (self *Coin) EMA(pt conset.PLAT, symbol conset.SYMBOL, period conset.PERIOD, times conset.TIMES, limit int, end time.Time) float32
平滑移动平均线 EMA(12) = [2/(12+1)]*今日收盘价+[11/(12+1)]*作日EMA(12)
type Record ¶
type Record struct { Id int64 Plat string `xorm:"varchar(255) plat index(plat-symbol-period)"` // 平台名称 Symbol string `xorm:"varchar(255) symbol index(plat-symbol-period)"` // Token Period string `xorm:"varchar(255) period index(plat-symbol-period)"` // 周期 spot|week|quarter Operation int32 `xorm:"int"` // 1: 开多 2: 开空 3: 平仓 Position int32 `xorm:"int"` // 加仓层数 Price float32 `xorm:"float"` // 当前价格 AvgPrice float32 `xorm:"float"` // 均价 Used float32 `xorm:"float"` // 已开仓Token Size float32 `xorm:"float"` // 开仓张数 Total float32 `xorm:"float"` // 当前账户总值 Detail string `xorm:"detail text"` // 描述 usd->token | ust<-token Profit float32 `xorm:"float"` // 收益 ProfitRate float32 `xorm:"float"` // 收益率 TotalRate float32 `xorm:"float"` // 总收益率 CreateTime time.Time `json:"create_time" xorm:"create_time DateTime index"` // 时间 }
MarginRecord 交易记录
Click to show internal directories.
Click to hide internal directories.