142 lines
4.4 KiB
Go
142 lines
4.4 KiB
Go
package models
|
||
|
||
import "time"
|
||
|
||
// Ticker24 24小时统计
|
||
type Ticker24 struct {
|
||
ChangePercent string `json:"change"` //24小时价格变动百分比
|
||
LastPrice string `json:"last"` //最新价格
|
||
OpenPrice string `json:"open"` //24小时开盘价格
|
||
HighPrice string `json:"high"` //24小时最高价
|
||
LowPrice string `json:"low"` //24小时最低价
|
||
Volume string `json:"volume"` //24小时成数量
|
||
QuoteVolume string `json:"quote"` //24小时成交金额
|
||
Symbol string `json:"-"`
|
||
E int64 `json:"-"` //推送时间
|
||
}
|
||
|
||
type Kline struct {
|
||
Pair string
|
||
Timestamp int64
|
||
Open string
|
||
Close string
|
||
High string
|
||
Low string
|
||
Vol string
|
||
QuoteVolume string //成交金额
|
||
}
|
||
|
||
type DepthRecord struct {
|
||
Price float64
|
||
Amount float64
|
||
}
|
||
|
||
type DepthRecords []DepthRecord
|
||
|
||
func (dr DepthRecords) Len() int {
|
||
return len(dr)
|
||
}
|
||
|
||
func (dr DepthRecords) Swap(i, j int) {
|
||
dr[i], dr[j] = dr[j], dr[i]
|
||
}
|
||
|
||
func (dr DepthRecords) Less(i, j int) bool {
|
||
return dr[i].Price < dr[j].Price
|
||
}
|
||
|
||
type Depth struct {
|
||
ContractType string //for future
|
||
Pair string
|
||
UTime time.Time
|
||
AskList DepthRecords // Descending order 卖盘,[price(挂单价), vol(此价格挂单张数)], 按price升序
|
||
BidList DepthRecords // Descending order 买盘,[price(挂单价), vol(此价格挂单张数)], 按price降序
|
||
}
|
||
|
||
// DepthBin 币安深度
|
||
type DepthBin struct {
|
||
Symbol string `json:"s"`
|
||
Bids [][]string `json:"bids"`
|
||
Asks [][]string `json:"asks"`
|
||
}
|
||
|
||
type UFuturesDepthBin struct {
|
||
Symbol string `json:"s"`
|
||
Bids [][]string `json:"b"`
|
||
Asks [][]string `json:"a"`
|
||
}
|
||
|
||
// NewDealPush 最近成交记录
|
||
type NewDealPush struct {
|
||
Price float64 `json:"price"` //成交价格
|
||
Num float64 `json:"num"` //成交数量
|
||
Type int `json:"type"` //1买,2卖
|
||
DealId int64 `json:"dealid"` //交易id
|
||
CreateTime int64 `json:"createtime"` //交易时间
|
||
//Symbol string `json:"symbol"`
|
||
//ExchangeId int `json:"exchangeid"`
|
||
}
|
||
|
||
// ForceOrder 强平订单exc_forceorder
|
||
type ForceOrder struct {
|
||
ExchangeID int `db:"exchangeid"`
|
||
Symbol string `db:"symbol"`
|
||
Side string `db:"side"` //请买卖方向 SELL, BUY
|
||
Ordertype string `db:"ordertype"` //订单类型 LIMIT, MARKET, STOP, TAKE_PROFIT, STOP_MARKET, TAKE_PROFIT_MARKET, TRAILING_STOP_MARKET
|
||
TimeInForce string `db:"timeinforce"` //有效方式,GTC 1,IOC 2,FOK 3,GTX 4
|
||
Price float64 `db:"price"` //价格
|
||
Num float64 `db:"num"` //数量
|
||
AvgPrice float64 `db:"avgprice"` //平均价格
|
||
State string `db:"state"` //订单状态
|
||
CreateTime time.Time `db:"createtime"`
|
||
}
|
||
|
||
type FiveItem struct {
|
||
Buy [][]string `json:"buy"`
|
||
Sell [][]string `json:"sell"`
|
||
BuyNum float64 `json:"buynum"`
|
||
SellNum float64 `json:"sellnum"`
|
||
}
|
||
|
||
// AlertSet vts_alertset
|
||
type AlertSet struct {
|
||
Id int `db:"id"`
|
||
UserId int `db:"userid"`
|
||
CoinId int `db:"coinid"`
|
||
CurrencyId int `db:"currencyid"`
|
||
AlertType int `db:"alerttype"` //预警类型:1价格涨到,2价格跌到,3涨幅达到,4跌幅达到,5-24小时涨幅,6-24小时跌幅
|
||
Frequency int `db:"frequency"` //提醒频率:1仅提醒一次,2每日提醒一次,3持续提醒(每当价格达到该值,则提醒一次)
|
||
State int `db:"state"` //设置状态:1正常,2停止(比如频率是只提醒一次,提醒一次完就修改为2)
|
||
AlwaysState int `db:"alwaysstate"` //持续提醒状态:1已提醒,0可提醒
|
||
AlertValue float64 `db:"alertvalue"` //提醒值
|
||
SendTime time.Time `db:"sendtime"` //发送时间,每日提醒+持续提醒需要
|
||
|
||
}
|
||
|
||
type PriceMarket struct {
|
||
Price float64 //最新价格
|
||
Rate24h float64 //24小时涨幅
|
||
Symbol string //交易对
|
||
}
|
||
|
||
// AlertLog vts_alertlog提醒记录
|
||
type AlertLog struct {
|
||
Id int `db:"id"`
|
||
UserId int `db:"userid"`
|
||
AlertId int `db:"alertid"`
|
||
AlertValue float64 `db:"alertvalue"`
|
||
Coin string `db:"coin"`
|
||
Currency string `db:"currency"`
|
||
Msg string `db:"msg"`
|
||
CreateTime time.Time `db:"createtime"`
|
||
}
|
||
|
||
type AlertMq struct {
|
||
UserId int
|
||
AlertId int
|
||
AlertValue string
|
||
Symbol string //格式:BTC/USDT
|
||
Msg string
|
||
CreateTime int64
|
||
}
|