huobi

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoltStorage

type BoltStorage struct {
	// contains filtered or unexported fields
}

BoltStorage strage object for using huobi including boltdb

func NewBoltStorage

func NewBoltStorage(path string) (*BoltStorage, error)

NewBoltStorage return new storage instance

func (*BoltStorage) GetIntermedatorTx

func (bs *BoltStorage) GetIntermedatorTx(id common.ActivityID) (common.TXEntry, error)

GetIntermedatorTx get intermediate transaction

func (*BoltStorage) GetPendingIntermediateTXs

func (bs *BoltStorage) GetPendingIntermediateTXs() (map[common.ActivityID]common.TXEntry, error)

GetPendingIntermediateTXs return pending transaction for first deposit phase

func (*BoltStorage) GetTradeHistory

func (bs *BoltStorage) GetTradeHistory(fromTime, toTime uint64) (common.ExchangeTradeHistory, error)

GetTradeHistory get trade history

func (*BoltStorage) StoreIntermediateTx

func (bs *BoltStorage) StoreIntermediateTx(id common.ActivityID, data common.TXEntry) error

StoreIntermediateTx store intermediate transaction and remove it from pending bucket

func (*BoltStorage) StorePendingIntermediateTx

func (bs *BoltStorage) StorePendingIntermediateTx(id common.ActivityID, data common.TXEntry) error

StorePendingIntermediateTx store pending transaction

func (*BoltStorage) StoreTradeHistory

func (bs *BoltStorage) StoreTradeHistory(data common.ExchangeTradeHistory) error

StoreTradeHistory store trade history

type Client added in v0.1.2

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

Client endpoint object

func NewHuobiClient added in v0.1.2

func NewHuobiClient(signer Signer, interf EndpointsInterface) *Client

NewHuobiClient return new endpoint instance

func (*Client) CancelOrder added in v0.1.2

func (ep *Client) CancelOrder(symbol string, id uint64) (exchange.HuobiCancel, error)

CancelOrder cancel open order on huobi

func (*Client) DepositHistory added in v0.1.2

func (ep *Client) DepositHistory(tokens []common.Token) (exchange.HuobiDeposits, error)

DepositHistory get deposit history from huobi

func (*Client) GetAccountTradeHistory added in v0.1.2

func (ep *Client) GetAccountTradeHistory(
	base, quote common.Token) (exchange.HuobiTradeHistory, error)

GetAccountTradeHistory return account trade history

func (*Client) GetAccounts added in v0.1.2

func (ep *Client) GetAccounts() (exchange.HuobiAccounts, error)

GetAccounts Get account list for later use

func (*Client) GetDepositAddress added in v0.1.2

func (ep *Client) GetDepositAddress(asset string) (exchange.HuobiDepositAddress, error)

GetDepositAddress get huobi deposit address

func (*Client) GetDepthOnePair added in v0.1.2

func (ep *Client) GetDepthOnePair(
	baseID, quoteID string) (exchange.HuobiDepth, error)

GetDepthOnePair get depth one pair on huobi

func (*Client) GetExchangeInfo added in v0.1.2

func (ep *Client) GetExchangeInfo() (exchange.HuobiExchangeInfo, error)

GetExchangeInfo get huobi exchange info

func (*Client) GetInfo added in v0.1.2

func (ep *Client) GetInfo() (exchange.HuobiInfo, error)

GetInfo return exchange info

func (*Client) GetResponse added in v0.1.2

func (ep *Client) GetResponse(
	method string, reqURL string,
	params map[string]string, signNeeded bool) ([]byte, error)

GetResponse from huobi api

func (*Client) OrderStatus added in v0.1.2

func (ep *Client) OrderStatus(symbol string, id uint64) (exchange.HuobiOrder, error)

OrderStatus check order status on huobi

func (*Client) Trade added in v0.1.2

func (ep *Client) Trade(tradeType string, base, quote common.Token, rate, amount float64, timepoint uint64) (exchange.HuobiTrade, error)

Trade create a new order on huobi

func (*Client) Withdraw added in v0.1.2

func (ep *Client) Withdraw(token common.Token, amount *big.Int, address ethereum.Address) (string, error)

Withdraw token from huobi

func (*Client) WithdrawHistory added in v0.1.2

func (ep *Client) WithdrawHistory(tokens []common.Token) (exchange.HuobiWithdraws, error)

WithdrawHistory return withdraw history from huobi

type Endpoints added in v0.1.2

type Endpoints struct {
	// contains filtered or unexported fields
}

func (*Endpoints) AuthenticatedEndpoint added in v0.1.2

func (r *Endpoints) AuthenticatedEndpoint() string

func (*Endpoints) PublicEndpoint added in v0.1.2

func (r *Endpoints) PublicEndpoint() string

type EndpointsInterface added in v0.1.2

type EndpointsInterface interface {
	// PublicEndpoint returns the endpoint that does not requires authentication.
	PublicEndpoint() string
	// AuthenticatedEndpoint returns the endpoint that requires authentication.
	// In simulation mode, authenticated endpoint is the Huobi mock server.
	AuthenticatedEndpoint() string
}

EndpointsInterface is Huobi exchange API endpoints interface.

func NewEndpoints added in v0.1.2

func NewEndpoints(baseURL string) EndpointsInterface

NewEndpoints ...

type Signer

type Signer struct {
	Key    string `json:"huobi_key"`
	Secret string `json:"huobi_secret"`
}

func NewSigner

func NewSigner(key, secret string) (*Signer, error)

func (Signer) GetKey

func (s Signer) GetKey() string

func (Signer) Sign

func (s Signer) Sign(msg string) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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