hitbtc

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EXCHANGE_NAME = "hitbtc.com"

	API_BASE_URL = "https://api.hitbtc.com/"
	API_V2       = "api/2/"
	SYMBOLS_URI  = "public/symbol"
	TICKER_URI   = "public/ticker/"
	BALANCE_URI  = "account/balance"
	ORDER_URI    = "order"
	DEPTH_URI    = "public/orderbook"
	TRADES_URI   = "public/trades"
	KLINE_URI    = "public/candles"
)

Variables

View Source
var (
	YCC     = goex.Currency{"YCC", "Yuan Chain New"}
	BTC     = goex.Currency{"BTC", "Bitcoin"}
	YCC_BTC = goex.CurrencyPair{YCC, BTC}
)

Functions

This section is empty.

Types

type Hitbtc

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

func New

func New(client *http.Client, accessKey, secretKey string) *Hitbtc

func (*Hitbtc) CancelOrder

func (hitbtc *Hitbtc) CancelOrder(orderId string, currency goex.CurrencyPair) (bool, error)

func (*Hitbtc) GetAccount

func (hitbtc *Hitbtc) GetAccount() (*goex.Account, error)

https://api.hitbtc.com/#account-balance

func (*Hitbtc) GetDepth

func (hitbtc *Hitbtc) GetDepth(size int, currency goex.CurrencyPair) (*goex.Depth, error)

https://api.hitbtc.com/#orderbook

{
  "ask": [
    {
      "price": "0.046002",
      "size": "0.088"
    },
    {
      "price": "0.046800",
      "size": "0.200"
    }
  ],
  "bid": [
    {
      "price": "0.046001",
      "size": "0.005"
    },
    {
      "price": "0.046000",
      "size": "0.200"
    }
  ]
}

func (*Hitbtc) GetExchangeName

func (hitbtc *Hitbtc) GetExchangeName() string

func (*Hitbtc) GetKline

func (hitbtc *Hitbtc) GetKline(currencyPair goex.CurrencyPair, period string, size, since int64) ([]goex.Kline, error)

curl "https://api.hitbtc.com/api/2/public/candles/ETHBTC?period=M30" [

{
  "timestamp": "2017-10-20T20:00:00.000Z",
  "open": "0.050459",
  "close": "0.050087",
  "min": "0.050000",
  "max": "0.050511",
  "volume": "1326.628",
  "volumeQuote": "66.555987736"
},
{
  "timestamp": "2017-10-20T20:30:00.000Z",
  "open": "0.050108",
  "close": "0.050139",
  "min": "0.050068",
  "max": "0.050223",
  "volume": "87.515",
  "volumeQuote": "4.386062831"
}

]

func (*Hitbtc) GetKlineRecords

func (hitbtc *Hitbtc) GetKlineRecords(currency goex.CurrencyPair, period, size, since int) ([]goex.Kline, error)

func (*Hitbtc) GetOneOrder

func (hitbtc *Hitbtc) GetOneOrder(orderId string, currency goex.CurrencyPair) (*goex.Order, error)

func (*Hitbtc) GetOrderHistorys

func (hitbtc *Hitbtc) GetOrderHistorys(currency goex.CurrencyPair, currentPage, pageSize int) ([]goex.Order, error)

TODO https://api.hitbtc.com/#orders-history

func (*Hitbtc) GetSymbols

func (hitbtc *Hitbtc) GetSymbols() ([]goex.CurrencyPair, error)

https://api.hitbtc.com/#symbols

curl "https://api.hitbtc.com/api/2/public/symbol" [

{
  "id": "ETHBTC",
  "baseCurrency": "ETH",
  "quoteCurrency": "BTC",
  "quantityIncrement": "0.001",
  "tickSize": "0.000001",
  "takeLiquidityRate": "0.001",
  "provideLiquidityRate": "-0.0001",
  "feeCurrency": "BTC"
}

]

func (*Hitbtc) GetTicker

func (hitbtc *Hitbtc) GetTicker(currency goex.CurrencyPair) (*goex.Ticker, error)

curl "https://api.hitbtc.com/api/2/public/ticker"

[

{
  "ask": "0.050043",
  "bid": "0.050042",
  "last": "0.050042",
  "open": "0.047800",
  "low": "0.047052",
  "high": "0.051679",
  "volume": "36456.720",
  "volumeQuote": "1782.625000",
  "timestamp": "2017-05-12T14:57:19.999Z",
  "symbol": "ETHBTC"
}

]

func (*Hitbtc) GetTrades

func (hitbtc *Hitbtc) GetTrades(currencyPair goex.CurrencyPair, since int64) ([]goex.Trade, error)

curl "https://api.hitbtc.com/api/2/public/trades/ETHBTC?from=2018-05-22T07:22:00&limit=2" [

{
   "id" : 297604734,
   "timestamp" : "2018-05-22T07:23:06.556Z",
   "quantity" : "6.551",
   "side" : "sell",
   "price" : "0.083421"
},
{
   "side" : "sell",
   "price" : "0.083401",
   "quantity" : "0.021",
   "timestamp" : "2018-05-22T07:23:05.908Z",
   "id" : 297604724
},

]

func (*Hitbtc) GetUnfinishOrders

func (hitbtc *Hitbtc) GetUnfinishOrders(currency goex.CurrencyPair) ([]goex.Order, error)

func (*Hitbtc) LimitBuy

func (hitbtc *Hitbtc) LimitBuy(amount, price string, currency goex.CurrencyPair) (*goex.Order, error)

func (*Hitbtc) LimitSell

func (hitbtc *Hitbtc) LimitSell(amount, price string, currency goex.CurrencyPair) (*goex.Order, error)

func (*Hitbtc) MarketBuy

func (hitbtc *Hitbtc) MarketBuy(amount, price string, currency goex.CurrencyPair) (*goex.Order, error)

func (*Hitbtc) MarketSell

func (hitbtc *Hitbtc) MarketSell(amount, price string, currency goex.CurrencyPair) (*goex.Order, error)

Jump to

Keyboard shortcuts

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