Documentation
¶
Index ¶
- Constants
- func ApiKeyGet(mapParams map[string]string, strRequestPath string, params *ApiParameter) (string, error)
- func ComputeHmac256(strMessage string, strSecret string) string
- func CreatePrivateSignByJWT(sign string, PrivateKeyPrime256 string) (string, error)
- func CreateSign(mapParams map[string]string, ...) string
- func HttpGetRequest(strUrl string, mapParams map[string]string) (string, error)
- func HttpPostRequest(strUrl string, mapParams map[string]string) string
- func HttpPostRequestBatchorder(strUrl string, mapParams map[string]interface{}) string
- func Map2UrlQuery(mapParams map[string]string) string
- func Map2UrlQueryBySort(mapParams map[string]string) string
- func MapSortByKey(mapValue map[string]string) map[string]string
- func MapValueEncodeURI(mapValue map[string]string) map[string]string
- type ApiParameter
- type Data
- type DepthRequestDepth
- type DepthResponse
- type DepthStep
- type Error
- type FutureSymbolType
- type Handler
- func (handler *Handler) GetFutureMarketDepth(symbol string, cycle FutureSymbolType, depthType DepthStep) (*DepthResponse, error)
- func (handler *Handler) GetSpotDepth(symbol string, depth DepthRequestDepth, depthType DepthStep) (*DepthResponse, error)
- func (handler *Handler) GetSpotDepths(symbols []string, depth DepthRequestDepth, depthType DepthStep) ([]*DepthResponse, error)
- func (handler *Handler) Listen() <-chan interface{}
- func (handler *Handler) SubscribeFutureContractIndex(symbols []string)
- func (handler *Handler) SubscribeFutureMarketDepth(symbols []string, depthType DepthStep)
- func (handler *Handler) SubscribeFutureMarketTrade(symbols []string)
- func (handler *Handler) SubscribeSpotDepth(symbols []string, depth DepthRequestDepth, depthType DepthStep)
- func (handler *Handler) SubscribeSpotTrade(symbols []string)
- type Index
- type IndexResponse
- type Tick
- type Trade
- type TradeResponse
Constants ¶
const ( HTTP_OK = "ok" HTTP_ERROR = "error" )
Variables ¶
This section is empty.
Functions ¶
func ApiKeyGet ¶
func ApiKeyGet(mapParams map[string]string, strRequestPath string, params *ApiParameter) (string, error)
进行签名后的HTTP GET请求, 参考官方Python Demo写的 mapParams: map类型的请求参数, key:value strRequest: API路由路径 return: 请求结果
func ComputeHmac256 ¶
HMAC SHA256加密 strMessage: 需要加密的信息 strSecret: 密钥 return: BASE64编码的密文
func CreatePrivateSignByJWT ¶
func CreateSign ¶
func CreateSign(mapParams map[string]string, strMethod, strHostUrl, strRequestPath, strSecretKey string) string
构造签名 mapParams: 送进来参与签名的参数, Map类型 strMethod: 请求的方法 GET, POST...... strHostUrl: 请求的主机 strRequestPath: 请求的路由路径 strSecretKey: 进行签名的密钥
func HttpGetRequest ¶
Http Get请求基础函数, 通过封装Go语言Http请求, 支持火币网REST API的HTTP Get请求 strUrl: 请求的URL strParams: string类型的请求参数, user=lxz&pwd=lxz return: 请求结果
func HttpPostRequest ¶
Http POST请求基础函数, 通过封装Go语言Http请求, 支持火币网REST API的HTTP POST请求 strUrl: 请求的URL mapParams: map类型的请求参数 return: 请求结果
func Map2UrlQuery ¶
将map格式的请求参数转换为字符串格式的 mapParams: map格式的参数键值对 return: 查询字符串
func Map2UrlQueryBySort ¶
将map格式的请求参数转换为字符串格式的,并按照Map的key升序排列 mapParams: map格式的参数键值对 return: 查询字符串
func MapSortByKey ¶
对Map按着ASCII码进行排序 mapValue: 需要进行排序的map return: 排序后的map
Types ¶
type ApiParameter ¶
type ApiParameter struct { AccessKey string HostName string SecretKey string EnablePrivateSign bool Url string PrivateKeyPrime256 string }
func CreateDefaultFutureApiParameter ¶
func CreateDefaultFutureApiParameter() *ApiParameter
func CreateDefaultSpotApiParameter ¶
func CreateDefaultSpotApiParameter() *ApiParameter
type DepthRequestDepth ¶
type DepthRequestDepth int32
const ( DEPTH_FIVE DepthRequestDepth = 5 DEPTH_TEN DepthRequestDepth = 10 DEPTH_TWENTY DepthRequestDepth = 20 DEPTH_DEFAULT DepthRequestDepth = 150 )
type DepthResponse ¶
type FutureSymbolType ¶
type FutureSymbolType string
const ( CW FutureSymbolType = "_CW" CQ FutureSymbolType = "_CQ" NW FutureSymbolType = "_NW" )
type Handler ¶
type Handler struct { Params *ApiParameter // contains filtered or unexported fields }
func NewDefaultFutureRestHandler ¶
func NewDefaultFutureRestHandler() *Handler
func NewDefaultSpotRestHandler ¶
func NewDefaultSpotRestHandler() *Handler
func NewRestHandler ¶
func NewRestHandler(apiParams *ApiParameter) *Handler
func (*Handler) GetFutureMarketDepth ¶
func (handler *Handler) GetFutureMarketDepth(symbol string, cycle FutureSymbolType, depthType DepthStep) (*DepthResponse, error)
func (*Handler) GetSpotDepth ¶
func (handler *Handler) GetSpotDepth(symbol string, depth DepthRequestDepth, depthType DepthStep) (*DepthResponse, error)
func (*Handler) GetSpotDepths ¶
func (handler *Handler) GetSpotDepths(symbols []string, depth DepthRequestDepth, depthType DepthStep) ([]*DepthResponse, error)
func (*Handler) SubscribeFutureMarketDepth ¶
func (*Handler) SubscribeFutureMarketTrade ¶
func (*Handler) SubscribeSpotDepth ¶
func (handler *Handler) SubscribeSpotDepth(symbols []string, depth DepthRequestDepth, depthType DepthStep)