Documentation ¶
Index ¶
- func ConnectSQL(name, user, host, port, password string)
- func Engine() *xorm.Engine
- func StringToSymbol(s string) conset.SYMBOL
- func SymbolToString(symbol conset.SYMBOL) string
- type Account
- type AccountDay
- type Coin
- func (self *Coin) ATR(pt conset.PLAT, symbol conset.SYMBOL, times conset.TIMES, limit int, ...) float32
- func (self *Coin) All(pt conset.PLAT, symbol conset.SYMBOL, times conset.TIMES, start time.Time) ([]*Coin, error)
- func (self *Coin) Chanel(pt conset.PLAT, symbol conset.SYMBOL, times conset.TIMES, limit int, ...) (float32, float32)
- func (self *Coin) Create(pt conset.PLAT, symbol conset.SYMBOL, times conset.TIMES, ...) error
- func (self *Coin) EMA(pt conset.PLAT, symbol conset.SYMBOL, times conset.TIMES, limit int, ...) float32
- func (self *Coin) EMAStart(pt conset.PLAT, symbol conset.SYMBOL, times conset.TIMES, limit int, ...) float32
- func (self *Coin) LastTime(pt conset.PLAT, symbol conset.SYMBOL, times conset.TIMES) (bool, time.Time)
- func (self *Coin) Lasts(pt conset.PLAT, symbol conset.SYMBOL, times conset.TIMES, limit int, ...) ([]Coin, error)
- func (self *Coin) MA(pt conset.PLAT, symbol conset.SYMBOL, times conset.TIMES, limit int, ...) float32
- type Indexs
- type Record
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StringToSymbol ¶
func SymbolToString ¶
Types ¶
type Account ¶
type Account struct { Id int64 Name string `xorm:"varchar(255) unique(n-p-s)"` // 名称 Plat string `xorm:"varchar(255) unique(n-p-s)"` // 平台名称 Symbol string `xorm:"varchar(255) unique(n-p-s)"` // Token Used float32 `xorm:"float"` // 总值 Total float32 `xorm:"float"` // 总值 CreatedAt time.Time `xorm:"created"` UpdatedAt time.Time `xorm:"updated"` }
type AccountDay ¶
type AccountDay struct { Id int64 Name string `xorm:"varchar(255)"` // 名称 Plat string `xorm:"varchar(255)"` // 平台名称 Symbol string `xorm:"varchar(255)"` // Token Used float32 `xorm:"float"` // 总值 Total float32 `xorm:"float"` // 总值 CreateTime time.Time `json:"create_time" xorm:"create_time DateTime"` // 时间 CreatedAt time.Time `xorm:"created"` UpdatedAt time.Time `xorm:"updated"` }
type Coin ¶
type Coin struct { Id int64 Plat string `xorm:"plat varchar(255) unique(pl-time) index(pl-sy-t) index(p-s-t-c)"` Symbol string `xorm:"symbol varchar(255) unique(pl-time) index(pl-sy-t) index(p-s-t-c)"` Times string `xorm:"times varchar(255) unique(pl-time) index(pl-sy-t) index(p-s-t-c)"` // 时间间隔 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 index(p-s-t-c)"` CreatedAt time.Time `xorm:"created"` UpdatedAt time.Time `xorm:"updated"` }
Coin K线数据
func (*Coin) ATR ¶
func (self *Coin) ATR(pt conset.PLAT, symbol conset.SYMBOL, 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, 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, times conset.TIMES, limit int, end time.Time) float32
平滑移动平均线 EMA(12) = [2/(12+1)]*今日收盘价+[11/(12+1)]*作日EMA(12)
type Indexs ¶
type Indexs struct { Id int64 Plat string `xorm:"varchar(255) unique(p-n-s-d)"` // 平台名称 Name string `xorm:"varchar(255) unique(p-n-s-d)"` // 指标名称 Symbol string `xorm:"varchar(255) unique(p-n-s-d)"` // 币种 Date string `xorm:"varchar(255) unique(p-n-s-d)"` // 格式化时间 P1 float32 `xorm:"p_1"` P2 float32 `xorm:"p_2"` P3 float32 `xorm:"p_3"` P4 float32 `xorm:"p_4"` P5 float32 `xorm:"p_5"` CreatedAt time.Time `xorm:"created"` UpdatedAt time.Time `xorm:"updated"` }
type Record ¶
type Record struct { Id int64 Name string `xorm:"name index(name-symbol-period) index(n-s-s) index(n-s-o-p)"` // 策略 Plat string `xorm:"plat"` // 平台名称 Symbol string `xorm:"symbol index(name-symbol-period) index(n-s-s) index(n-s-o-p)"` // Token Period string `xorm:"period index(name-symbol-period)"` // 周期 spot|week|quarter Operation int32 `xorm:"int index(n-s-o-p)"` // 1: 开多 2: 开空 3: 平仓 Position int32 `xorm:"int index(n-s-o-p)"` // 加仓层数 Price float32 `xorm:"float"` // 当前价格 AvgPrice float32 `xorm:"float"` // 均价 Used float32 `xorm:"float"` // 已开仓Token Size float32 `xorm:"float"` // 开仓张数 Total float32 `xorm:"float"` // 当前账户总值 LossPrice float32 `xorm:"float"` // 止损价 EstimatedLoss float32 `xorm:"float"` // 预计亏损 Detail string `xorm:"detail text"` // 描述 usd->token | ust<-token Profit float32 `xorm:"float"` // 收益 ProfitRate float32 `xorm:"float"` // 收益率(百分比 %) TotalRate float32 `xorm:"float"` // 总收益率(百分比 %) Status int32 `xorm:"status index(n-s-s)"` // 状态 CreateTime time.Time `json:"create_time" xorm:"create_time DateTime index"` // 时间 CreatedAt time.Time `xorm:"created"` UpdatedAt time.Time `xorm:"updated"` }
Record 交易记录
Click to show internal directories.
Click to hide internal directories.