huobiapi

package
v0.0.0-...-d6a5068 Latest Latest
Warning

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

Go to latest
Published: May 7, 2020 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StatusOK StatusOK
	StatusOK = "ok"
)

Variables

This section is empty.

Functions

func Init

func Init(accessKeyValue, secretKeyValue, hostValue string)

Init Init

Types

type APIError

type APIError struct {
	API string
	Err error
}

APIError 火币API错误

func (*APIError) Error

func (e *APIError) Error() string

type AccountBalanceItem

type AccountBalanceItem struct {
	// ID 账户 ID
	ID int64 `json:"id,omitempty"`
	// State 账户状态
	//
	// working:正常 lock:账户被锁定
	State string `json:"state,omitempty"`
	// Type 账户类型
	//
	// spot:现货账户, margin:逐仓杠杆账户,otc:OTC 账户,point:点卡账户,super-margin:全仓杠杆账户
	Type string                      `json:"type,omitempty"`
	List []AccountBalanceItemDetails `json:"list,omitempty"`
}

AccountBalanceItem 账户余额项模型

type AccountBalanceItemDetails

type AccountBalanceItemDetails struct {
	// Balance 余额
	Balance string `json:"balance,omitempty"`
	// Currency 币种
	Currency string `json:"currency,omitempty"`
	// Type 类型	trade: 交易余额,frozen: 冻结余额
	Type string `json:"type,omitempty"`
}

AccountBalanceItemDetails 账户余额明细

type AccountBalanceResponse

type AccountBalanceResponse struct {
	BaseResponse
	Data AccountBalanceItem `json:"data,omitempty"`
}

AccountBalanceResponse 账户余额响应模型

func AccountBalance

func AccountBalance(accountID string) (AccountBalanceResponse, error)

AccountBalance 账户余额

查询指定账户的余额,支持以下账户

spot:现货账户, margin:逐仓杠杆账户,otc:OTC 账户,point:点卡账户,super-margin:全仓杠杆账户

type AccountInfoItem

type AccountInfoItem struct {
	// ID account-id
	ID int64 `json:"id,omitempty"`
	// State 账户状态
	State string `json:"state,omitempty"`
	// Type 账户类型
	//
	// spot:现货账户, margin:逐仓杠杆账户,otc:OTC 账户,point:点卡账户,super-margin:全仓杠杆账户
	Type string `json:"type,omitempty"`
	// SubType 子账户类型(仅对逐仓杠杆账户有效)
	SubType string `json:"sub_type,omitempty"`
}

AccountInfoItem 账户数据项模型

type AccountInfoResponse

type AccountInfoResponse struct {
	BaseResponse
	Data []AccountInfoItem `json:"data,omitempty"`
}

AccountInfoResponse 账户信息响应模型

func Accounts

func Accounts() (AccountInfoResponse, error)

Accounts 账户信息

查询当前用户的所有账户 ID account-id 及其相关信息

type BaseResponse

type BaseResponse struct {
	Status     string `json:"status,omitempty"`
	Timestamp  int64  `json:"ts,omitempty"`
	ErrCode    string `json:"err-code,omitempty"`
	ErrMessage string `json:"err-msg,omitempty"`
}

BaseResponse BaseResponse

func (*BaseResponse) IsOK

func (o *BaseResponse) IsOK() bool

IsOK 判断响应内容是否OK

type CurrencysResponse

type CurrencysResponse struct {
	BaseResponse
	Data []string `json:"data,omitempty"`
}

CurrencysResponse 币种响应模型

func Currencys

func Currencys() (CurrencysResponse, error)

Currencys 获取所有币种

此接口返回所有火币全球站支持的币种。

type KLineItem

type KLineItem struct {
	// Id 调整为新加坡时间的时间戳,单位秒,并以此作为此K线柱的id
	ID int64 `json:"id,omitempty"`
	// Amount 以基础币种计量的交易量
	Amount float32 `json:"amount,omitempty"`
	// Count 交易次数
	Count int `json:"count,omitempty"`
	// Open 本阶段开盘价
	Open float32 `json:"open,omitempty"`
	// Close 本阶段收盘价
	Close float32 `json:"close,omitempty"`
	// Low 本阶段最低价
	Low float32 `json:"low,omitempty"`
	// High 本阶段最高价
	High float32 `json:"high,omitempty"`
	// Vol 以报价币种计量的交易量
	Vol float32 `json:"vol,omitempty"`
}

KLineItem K线数据项模型

type KLineOptionalParam

type KLineOptionalParam struct {
	Size int
}

KLineOptionalParam K 线数据(蜡烛图)可选参数

type KLineResponse

type KLineResponse struct {
	BaseResponse
	Data []KLineItem `json:"data,omitempty"`
}

KLineResponse K线数据响应模型

func KLine

func KLine(symbol string, period PeriodOption, opt KLineOptionalParam) (KLineResponse, error)

KLine K 线数据(蜡烛图)

此接口返回历史K线数据。

symbol 交易对

period 返回数据时间粒度,也就是每根蜡烛的时间区间

size 返回 K 线数据条数

type PeriodOption

type PeriodOption string

PeriodOption 数据时间粒度

const (
	// Period1min 1min
	Period1min PeriodOption = "1min"
	// Period5min 5min
	Period5min PeriodOption = "5min"
	// Period15min 15min
	Period15min PeriodOption = "15min"
	// Period30min 30min
	Period30min PeriodOption = "30min"
	// Period60min 60min
	Period60min PeriodOption = "60min"
	// Period4hour 4hour
	Period4hour PeriodOption = "4hour"
	// Period1day 1day
	Period1day PeriodOption = "1day"
	// Period1mon 1mon
	Period1mon PeriodOption = "1mon"
	// Period1week 1week
	Period1week PeriodOption = "1week"
	// Period1year 1year
	Period1year PeriodOption = "1year"
)

type SymbolItem

type SymbolItem struct {
	// BaseCurrency 交易对中的基础币种
	BaseCurrency string `json:"base-currency,omitempty"`
	// QuoteCurrency 交易对中的报价币种
	QuoteCurrency string `json:"quote-currency,omitempty"`
	// PricePrecision 交易对报价的精度(小数点后位数)
	PricePrecision int `json:"price-precision,omitempty"`
	// AmountPrecision 交易对基础币种计数精度(小数点后位数)
	AmountPrecision int `json:"amount-precision,omitempty"`
	// SymbolPartition 交易区
	//
	// 可能值: [main,innovation]
	SymbolPartition string `json:"symbol-partition,omitempty"`
	// Symbol 交易对
	Symbol string `json:"symbol,omitempty"`
	// State 交易对状态
	//
	// 可能值: [online,offline,suspend] online - 已上线;offline - 交易对已下线,不可交易;suspend -- 交易暂停
	State string `json:"state,omitempty"`
	// ValuePrecision 交易对交易金额的精度(小数点后位数)
	ValuePrecision int `json:"value-precision,omitempty"`
	// MinOrderAmt 交易对最小下单量
	//
	// 下单量指当订单类型为限价单或sell-market时,下单接口传的'amount'
	MinOrderAmt float32 `json:"min-order-amt,omitempty"`
	// MaxOrderAmt 交易对最大下单量
	MaxOrderAmt float32 `json:"max-order-amt,omitempty"`
	// MinOrderValue 最小下单金额
	//
	// 下单金额指当订单类型为限价单时,下单接口传入的(amount * price)。当订单类型为buy-market时,下单接口传的'amount'
	MinOrderValue float32 `json:"min-order-value,omitempty"`
	// LeverageRatio 交易对杠杆最大倍数
	LeverageRatio float32 `json:"leverage-ratio,omitempty"`
}

SymbolItem 交易对数据项模型

type SymbolResponse

type SymbolResponse struct {
	BaseResponse
	Data []SymbolItem `json:"data,omitempty"`
}

SymbolResponse 交易对响应模型

func Symbols

func Symbols() (SymbolResponse, error)

Symbols 获取所有交易对

此接口返回所有火币全球站支持的交易对。

type TimestampResponse

type TimestampResponse struct {
	BaseResponse
	Data int64 `json:"data,omitempty"`
}

TimestampResponse 时间戳响应模型

func Timestamp

func Timestamp() (TimestampResponse, error)

Timestamp 获取当前系统时间戳

此接口返回当前的系统时间戳,即从 UTC 1970年1月1日0时0分0秒0毫秒到现在的总毫秒数。

func (TimestampResponse) Time

func (o TimestampResponse) Time() time.Time

Time 获取响应中的时间

Jump to

Keyboard shortcuts

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