Documentation ¶
Index ¶
Constants ¶
View Source
const ( USDT = "USDT" CNY = "CNY" USD = "USD" )
View Source
const ( BUY = Side("buy") SELL = Side("sell") )
View Source
const ( Taker = Role("taker") // 吃单: 你满足人家的挂单, 佣金稍低 Maker = Role("maker") // 挂单: 挂上去人家来满足你, 佣金稍高 )
View Source
const ( Success = 0 // success SuccessMsg = "SUCCESS" UnknownErr = 1 UnknownErrMsg = "unknown error message" UndefinedErr = 2 UndefinedErrMsg = "undefined error message" )
View Source
const ( ErrDbConnect = 102001 // connect error ErrDbConnectMsg = "mysql:connect error" ErrDbAdd = 102002 // add error ErrDbAddMsg = "mysql:add error" ErrDbDel = 102003 // delete error ErrDbDelMsg = "mysql:delete error" ErrDbQuery = 102004 // query error ErrDbQueryMsg = "mysql:query error" ErrDbUpdate = 102005 // update error ErrDbUpdateMsg = "mysql:update error" ErrDbRecordNotFound = 102006 // record not found ErrDbRecordNotFoundMsg = "mysql:record not found" )
102 db error
View Source
const ( ErrParameter = 104400 // 0: 参数格式错误 ErrParameterMsg = "invalid parameter" ErrNotFound = 104404 // 4: request path not found ErrNotSupportMethod = 104405 // 5: not support method )
104 parameter error
View Source
const ( ErrGateioApi = 105001 ErrGateioApiErrMsg = "gateio api error" )
105 collector error
View Source
const ( ErrRdsSet = 106001 ErrRdsSetMsg = "redis set error" ErrRdsGet = 106002 ErrRdsGetMsg = "redis get error" ErrRdsDel = 106003 ErrRdsDelMsg = "redis del error" )
106 redis error
View Source
const ( ErrMail = 107001 ErrMailMsg = "send mail error" ErrInvalidVerify = 107002 ErrInvalidVerifyMsg = "invalid verify code" ErrUserExists = 107003 ErrUserExistsMsg = "register: user exists" ErrGeneratePassword = 107004 ErrGeneratePasswordMsg = "generate password error" ErrTokenGenerate = 107005 ErrTokenGenerateMsg = "token generated error" ErrUserNotFound = 107006 ErrUserNotFoundMsg = "user account not found" ErrInvalidPwd = 107007 ErrInvalidPwdMsg = "invalid password" ErrTokenExpired = 107007 ErrTokenExpiredMsg = "token expired" )
107 business err
View Source
const (
SnowflakeMode = 1152921504606846976 // 雪花算法第一bit没用到, 此处去掉, 保留时间戳(41bit),node节点(10bit),序列号(12)
)
Variables ¶
View Source
var ( GOOS = runtime.GOOS GOARCH = runtime.GOARCH GoVersion = runtime.Version() BuildTimestamp string BuildTime time.Time BuildUser string Branch string Version string Commit string Author string Email string )
View Source
var (
Node *snowflake.Node
)
Functions ¶
Types ¶
type T ¶
type T struct { Price decimal.Decimal `json:"price" example:"41914.12"` Amount decimal.Decimal `json:"amount" example:"23.23"` }
T TODO 表示买N/卖N 的价格+量的合体
type Ticket ¶
type Ticket struct { TicketTopic string `json:"ticket_topic" example:"/gateio/BTC_USDT/ticket/"` OrderTopic string `json:"order_topic" example:"/gateio/BTC_USDT/order/"` Base string `json:"base" example:"BTC"` Quote string `json:"quote" example:"USDT"` Name string `json:"name" example:"南方航空"` Currency string `json:"currency" example:"BTC_USDT"` Latest decimal.Decimal `json:"latest" example:"41913.47"` Ask []T `json:"ask"` Bid []T `json:"bid"` Time int64 `json:"time" example:"1644822272084"` // 毫秒单位 Raw json.RawMessage `json:"raw"` }
Ticket x
// huobi ticket
{ "ch":"market.btcusdt.ticker", "ts":1630982370526, "tick":{ "open":51732, "high":52785.64, "low":51000, "close":52735.63, "amount":13259.24137056181, "vol":687640987.4125315, "count":448737, "bid":52732.88, "bidSize":0.036, "ask":52732.89, "askSize":0.583653, "lastPrice":52735.63, "lastSize":0.03 } }
// gateio ticket
{ "time":1644821166, "channel":"spot.tickers", "event":"update", "result":{ "currency_pair":"BTC_USDT", "last":"41913.47", "lowest_ask":"41914", "highest_bid":"41913.99", "change_percentage":"-1.0202", "base_volume":"861.5026739119", "quote_volume":"36375443.997132", "high_24h":"45816.6", "low_24h":"32944.17" } }
Directories ¶
Path | Synopsis |
---|---|
protobuf
|
|
go/protobuf
Package protobuf is a reverse proxy.
|
Package protobuf is a reverse proxy. |
Click to show internal directories.
Click to hide internal directories.