Documentation
¶
Index ¶
- Constants
- func EpochTime() string
- func HmacSha256Base64Signer(message string, secretKey string) (string, error)
- func IsoTime() string
- func NewJSON(data []byte) (j *simplejson.Json, err error)
- func PreHashString(timestamp string, method RequestMethod, requestPath string, body string) string
- type BaseURL
- type InstType
- type Operate
- type OrderType
- type PosSide
- type PriceLevel
- type RequestMethod
- type SideType
- type TdMode
Constants ¶
View Source
const ( SideTypeBuy SideType = "buy" SideTypeSell SideType = "sell" RequestMethodGET RequestMethod = "GET" RequestMethodPOST RequestMethod = "POST" SpotInstType InstType = "SPOT" // 币币 MarginInstType InstType = "MARGIN" // 币币杠杆 SwapInstType InstType = "SWAP" // 永续合约 FuturesInstType InstType = "FUTURES" // 交割合约 OptionInstType InstType = "OPTION" // 期权 AnyInstType InstType = "ANY" // 全部 Isolated TdMode = "isolated" // 逐仓 Cross TdMode = "cross" // 全仓 Cash TdMode = "cash" // 现金 Market OrderType = "market" // 市价单 Limit OrderType = "limit" // 限价单 PostOnl OrderType = "post_onl" // 只做maker单 Fok OrderType = "fok" // 全部成交或立即取消 Ioc OrderType = "ioc" // 立即成交并取消剩余 OptimalLimitIoc OrderType = "optimal_limit_ioc" // 市价委托立即成交并取消剩余(仅适用交割、永续) Net PosSide = "net" // 在单向持仓模式下,默认 net Long PosSide = "long" // 在双向持仓模式下必填,仅适用于交割/永续 多 Short PosSide = "short" // 在双向持仓模式下必填,仅适用于交割/永续 空 OrderOp Operate = "order" // 创建订单 BatchOrderOp Operate = "batch-orders" // 批量创建订单 )
Variables ¶
This section is empty.
Functions ¶
func HmacSha256Base64Signer ¶
HmacSha256Base64Signer signing a message using: hmac sha256 + base64 eg:
message = Pre_hash function comment secretKey = E65791902180E9EF4510DB6A77F6EBAE
return signed string = TO6uwdqz+31SIPkd4I+9NiZGmVH74dXi+Fd5X0EzzSQ=
func PreHashString ¶
func PreHashString(timestamp string, method RequestMethod, requestPath string, body string) string
PreHashString the pre hash string eg:
timestamp = 2018-03-08T10:59:25.789Z method = POST request_path = /orders?before=2&limit=30 body = {"product_id":"BTC-USD-0309","order_id":"377454671037440"}
return pre hash string = 2018-03-08T10:59:25.789ZPOST/orders?before=2&limit=30{"product_id":"BTC-USD-0309","order_id":"377454671037440"}
Types ¶
type PriceLevel ¶
PriceLevel 价格信息
Click to show internal directories.
Click to hide internal directories.