client

package
v1.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Endpoint = "https://api.huobi.pro"

/ 全局API

View Source
const MarketEndpoint = "https://api.huobi.pro/market"

/ 行情API

View Source
const TradeEndpoint = "https://api.huobi.pro/v1"

/ 交易API

Variables

This section is empty.

Functions

func ComputeHmac256 added in v1.0.7

func ComputeHmac256(strMessage string, strSecret string) string

ComputeHmac256 HMAC SHA256加密 strMessage: 需要加密的信息 strSecret: 密钥 return: BASE64编码的密文

func Map2UrlQuery added in v1.0.7

func Map2UrlQuery(mapParams map[string]string) string

Map2UrlQuery 将map格式的请求参数转换为字符串格式的 mapParams: map格式的参数键值对 return: 查询字符串

func Map2UrlQueryBySort added in v1.0.7

func Map2UrlQueryBySort(mapParams map[string]string) string

Map2UrlQueryBySort 将map格式的请求参数转换为字符串格式的,并按照Map的key升序排列 mapParams: map格式的参数键值对 return: 查询字符串

func MapSortByKey added in v1.0.7

func MapSortByKey(mapValue map[string]string) map[string]string

MapSortByKey 对Map按着ASCII码进行排序 mapValue: 需要进行排序的map return: 排序后的map

func MapValueEncodeURI added in v1.0.7

func MapValueEncodeURI(mapValue map[string]string) map[string]string

MapValueEncodeURI 对Map的值进行URI编码 mapParams: 需要进行URI编码的map return: 编码后的map

func SendRequest

func SendRequest(sign *Sign, method, scheme, host, path string, data ParamData) (*simplejson.Json, error)

SendRequest 发送原始请求

Types

type Client

type Client struct {
	Sign *Sign
	// contains filtered or unexported fields
}

func NewClient

func NewClient(endpoint, accessKeyId, accessKeySecret string) (*Client, error)

/ 创建新客户端

func (*Client) Request

func (c *Client) Request(method, path string, data ParamData) (*simplejson.Json, error)

/ 发送请求

type ParamData

type ParamData = map[string]string

ParamData 请求参数

type Sign

type Sign struct {
	AccessKeyId      string
	AccessKeySecret  string
	SignatureMethod  string
	SignatureVersion string
}

func NewSign

func NewSign(accessKeyId, accessKeySecret string) *Sign

NewSign 创建签名参数

func (*Sign) Get

func (s *Sign) Get(method, host, path, timestamp string, params map[string]string) string

Get 获取签名

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL