spot

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DirectNone Direct = ""
	DirectPrev Direct = "forward"
	DirectNext Direct = "next"

	MatchResutEndPoint = "/v1/order/matchresults"

	MatchRoleMaker = "maker"
	MatchRoleTaker = "taker"
)
View Source
const (
	SpotHost = "api.huobi.pro"
)
View Source
const (
	TransactFeeRateEndPoint = "/v2/reference/transact-fee-rate"
)

Variables

This section is empty.

Functions

func Init added in v0.3.0

func Init(ctx context.Context) error

func ParseSymbol added in v0.3.0

func ParseSymbol(symbol string) (exchange.SpotSymbol, error)

Types

type Direct added in v0.3.0

type Direct string

type MatchResult added in v0.3.0

type MatchResult struct {
	ID                int64           `json:"id"`
	MatchID           int64           `json:"match-id"`
	OrderID           int64           `json:"order-id"`
	TradeID           int64           `json:"trade-id"`
	CreatedAt         int64           `json:"created-at"`
	FilledAmount      decimal.Decimal `json:"filled-amount"`
	FilledFees        decimal.Decimal `json:"filled-fees"`
	FilledPoints      decimal.Decimal `json:"filled-points"`
	FeeCurrency       string          `json:"fee-currency"`
	Price             decimal.Decimal `json:"price"`
	Source            string          `json:"source"`
	Symbol            string          `json:"symbol"`
	Type              string          `json:"type"`
	Role              string          `json:"role"`
	FeeDeductCurrency string          `json:"fee-deduct-currency"`
	FeeDeductState    string          `json:"fee-deduct-state"`
}

func (*MatchResult) Parse added in v0.3.0

func (mr *MatchResult) Parse() (*exchange.Trade, error)

type RestClient

type RestClient struct {
	*huobi.RestClient
}

func NewRestClient

func NewRestClient(key, secret string) *RestClient

func (*RestClient) FeeRate

func (rc *RestClient) FeeRate(ctx context.Context, symbols []exchange.Symbol) ([]*exchange.TradeFee, error)

func (*RestClient) FetchSymbols added in v0.3.0

func (rc *RestClient) FetchSymbols(ctx context.Context) ([]Symbol, error)

func (*RestClient) MatchResults added in v0.3.0

func (rc *RestClient) MatchResults(ctx context.Context, symbol string, types []string, st int64, et int64, from string, d Direct, size int) ([]MatchResult, error)

func (*RestClient) Symbols added in v0.3.0

func (rc *RestClient) Symbols(ctx context.Context) ([]exchange.SpotSymbol, error)

func (*RestClient) Trades added in v0.3.0

func (rc *RestClient) Trades(ctx context.Context, req *exchange.TradeReqParam) ([]exchange.Trade, error)

func (*RestClient) TransactFeeRate added in v0.3.0

func (rc *RestClient) TransactFeeRate(ctx context.Context, symbols []string) ([]TransactFeeRate, error)

type SpotSymbol

type SpotSymbol struct {
	*exchange.BaseSpotSymbol
	Symbol string
}

func (*SpotSymbol) String

func (ss *SpotSymbol) String() string

type Symbol

type Symbol struct {
	BaseCurrency string `json:"base-currency"`
	QuoteCurreny string `json:"quote-currency"`
	Symbol       string `json:"symbol"`
}

TODO add precision

func (*Symbol) Parse added in v0.3.0

func (s *Symbol) Parse() (exchange.SpotSymbol, error)

type SymbolResp

type SymbolResp struct {
	Status string   `json:"status"`
	Data   []Symbol `json:"data"`
}

type TransactFeeRate

type TransactFeeRate struct {
	Symbol          string
	MakerFeeRate    decimal.Decimal `json:"makerFeeRate"`
	TakerFeeRate    decimal.Decimal `json:"takerFeeRate"`
	ActualMakerRate decimal.Decimal `json:"actualMakerRate"`
	ActualTakerRate decimal.Decimal `json:"actualTakerRate"`
}

func (*TransactFeeRate) Parse added in v0.3.0

func (tfr *TransactFeeRate) Parse() (*exchange.TradeFee, error)

Jump to

Keyboard shortcuts

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