hitbtc

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: MIT Imports: 17 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

This section is empty.

Functions

func Sym2duo

func Sym2duo(pair string) q.D

Types

type Hitbtc

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

func New

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

func (*Hitbtc) AllTicker

func (hitbtc *Hitbtc) AllTicker(SymPair map[string]q.D) (mdt *sync.Map, err error)

func (*Hitbtc) Balances

func (hitbtc *Hitbtc) Balances() (availables, frozens *sync.Map, err error)

func (*Hitbtc) CancelOrder

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

func (*Hitbtc) Fee

func (hitbtc *Hitbtc) Fee() float64

func (*Hitbtc) GetAccount

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

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

func (*Hitbtc) GetAttr

func (hitbtc *Hitbtc) GetAttr() (a q.Attr)

func (*Hitbtc) GetDepth

func (hitbtc *Hitbtc) GetDepth(size int, currency cons.CurrencyPair) (*exws.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) GetKline

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

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

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 cons.CurrencyPair, period cons.KlinePeriod, size int, opt ...exws.OptionalParameter) ([]exws.Kline, error)

func (*Hitbtc) GetOneOrder

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

func (*Hitbtc) GetOrderHistorys

func (hitbtc *Hitbtc) GetOrderHistorys(currency cons.CurrencyPair, optional ...exws.OptionalParameter) ([]q.Order, error)

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

func (*Hitbtc) GetSymbols

func (hitbtc *Hitbtc) GetSymbols() ([]cons.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 cons.CurrencyPair) (*exws.Ticker, error)

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

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 cons.CurrencyPair, since int64) ([]q.Trade, error)

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

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) GetUnfinishedOrders

func (hitbtc *Hitbtc) GetUnfinishedOrders(currency cons.CurrencyPair) ([]q.Order, error)

func (*Hitbtc) LimitBuy

func (hitbtc *Hitbtc) LimitBuy(amount, price string, currency cons.CurrencyPair, opt ...cons.LimitOrderOptionalParameter) (*q.Order, error)

func (*Hitbtc) LimitSell

func (hitbtc *Hitbtc) LimitSell(amount, price string, currency cons.CurrencyPair, opt ...cons.LimitOrderOptionalParameter) (*q.Order, error)

func (*Hitbtc) MarketBuy

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

func (*Hitbtc) MarketSell

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

func (*Hitbtc) OneTicker

func (hitbtc *Hitbtc) OneTicker(d q.D) (ticker q.Bbo, err error)

func (*Hitbtc) PairArray

func (hitbtc *Hitbtc) PairArray() (sm map[string]q.D, prec map[q.D]q.P, err error)

func (*Hitbtc) PlaceOrders

func (hitbtc *Hitbtc) PlaceOrders(places [3]q.Order) (orders [3]q.Order, err error)

func (*Hitbtc) String

func (hitbtc *Hitbtc) String() string

func (*Hitbtc) Test

func (hitbtc *Hitbtc) Test() bool

func (*Hitbtc) TradeFee

func (hitbtc *Hitbtc) TradeFee() (map[string]q.TradeFee, error)

func (*Hitbtc) WithdrawFee

func (hitbtc *Hitbtc) WithdrawFee() (sf []q.NetworkWithdraw, err error)

Jump to

Keyboard shortcuts

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