http

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetRequestError

type GetRequestError struct {
	Code    int
	Content string
	Status  string
	Url     string
}

GetRequestError is a custom error type that makes for somewhat nicer logic with non-200 codes returned.

func (*GetRequestError) Error

func (e *GetRequestError) Error() string

type HttpClient

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

HttpClient implements the HTTP (REST) API endpoints.

func NewHttpClient

func NewHttpClient(options ...HttpOption) *HttpClient

func (*HttpClient) V1HourlyTicker

func (c *HttpClient) V1HourlyTicker() (response TickerResponse, err error)

GET https://www.bitstamp.net/api/ticker_hour/

func (*HttpClient) V1OrderBook

func (c *HttpClient) V1OrderBook(group int) (response V1OrderBookResponse, err error)

GET https://www.bitstamp.net/api/order_book?group=1

func (*HttpClient) V1Ticker

func (c *HttpClient) V1Ticker() (response TickerResponse, err error)

GET https://www.bitstamp.net/api/ticker/

func (*HttpClient) V2BuyInstantOrder

func (c *HttpClient) V2BuyInstantOrder(currencyPair string, amount decimal.Decimal, clOrdId string) (response V2InstantOrderResponse, err error)

func (*HttpClient) V2BuyLimitOrder

func (c *HttpClient) V2BuyLimitOrder(currencyPair string, price, amount, limitPrice decimal.Decimal, dailyOrder, iocOrder bool, clOrdId string) (response V2LimitOrderResponse, err error)

func (*HttpClient) V2BuyMarketOrder

func (c *HttpClient) V2BuyMarketOrder(currencyPair string, amount decimal.Decimal, clOrdId string) (response V2MarketOrderResponse, err error)

func (*HttpClient) V2CancelOrder

func (c *HttpClient) V2CancelOrder(orderId int64) (response V2CancelOrderResponse, err error)

func (*HttpClient) V2EurUsd

func (c *HttpClient) V2EurUsd() (response V2EurUsdResponse, err error)

GET https://www.bitstamp.net/api/v2/eur_usd/

func (*HttpClient) V2HourlyTicker

func (c *HttpClient) V2HourlyTicker(currencyPair string) (response TickerResponse, err error)

GET https://www.bitstamp.net/api/v2/ticker_hour/{currency_pair}/

func (*HttpClient) V2Ohlc

func (c *HttpClient) V2Ohlc(currencyPair string, step, limit int, start, end int64) (response V2OhlcResponse, err error)

GET https://www.bitstamp.net/api/v2/ohlc/{currency_pair}/?step=60&limit=5

  • start (Optional): Unix timestamp from when OHLC data will be started.
  • end (Optional): Unix timestamp to when OHLC data will be shown. If none from start or end timestamps are posted then endpoint returns OHLC data to current unixtime. If both start and end timestamps are posted, end timestamp will be used.
  • step: Timeframe in seconds. Possible options are 60, 180, 300, 900, 1800, 3600, 7200, 14400, 21600, 43200, 86400, 259200
  • limit: Limit OHLC results (minimum: 1; maximum: 1000)

func (*HttpClient) V2OrderBook

func (c *HttpClient) V2OrderBook(currencyPair string, group int) (response V2OrderBookResponse, err error)

GET https://www.bitstamp.net/api/v2/order_book/{currency_pair}?group=1 Possible values are for group parameter - 0 (orders are not grouped at same price) - 1 (orders are grouped at same price - default) - 2 (orders with their order ids are not grouped at same price)

func (*HttpClient) V2OrderStatus

func (c *HttpClient) V2OrderStatus(orderId int64, clOrdId string, omitTx bool) (response V2OrderStatusResponse, err error)

POST https://www.bitstamp.net/api/v2/order_status/

func (*HttpClient) V2SellInstantOrder

func (c *HttpClient) V2SellInstantOrder(currencyPair string, amount decimal.Decimal, clOrdId string) (response V2InstantOrderResponse, err error)

func (*HttpClient) V2SellLimitOrder

func (c *HttpClient) V2SellLimitOrder(currencyPair string, price, amount, limitPrice decimal.Decimal, dailyOrder, iocOrder bool, clOrdId string) (response V2LimitOrderResponse, err error)

func (*HttpClient) V2SellMarketOrder

func (c *HttpClient) V2SellMarketOrder(currencyPair string, amount decimal.Decimal, clOrdId string) (response V2MarketOrderResponse, err error)

func (*HttpClient) V2Ticker

func (c *HttpClient) V2Ticker(currencyPair string) (response TickerResponse, err error)

GET https://www.bitstamp.net/api/v2/ticker/{currency_pair}/

func (*HttpClient) V2TradingPairsInfo

func (c *HttpClient) V2TradingPairsInfo() (response []V2TradingPairsInfoResponse, err error)

func (*HttpClient) V2Transactions

func (c *HttpClient) V2Transactions(currencyPair string, timeParam string) (response []V2TransactionsResponse, err error)

GET https://www.bitstamp.net/api/v2/transactions/{currency_pair}/?time=day

func (*HttpClient) V2UserTransactions

func (c *HttpClient) V2UserTransactions(currencyPairOrAll string) (response []V2UserTransactionsResponse, err error)

TODO: add arguments!

func (*HttpClient) V2WebsocketsToken

func (c *HttpClient) V2WebsocketsToken() (response V2WebsocketsTokenResponse, err error)

V2WebsocketsToken generates an ephemeral token, which allows user to subscribe to private websocket events. These events include ClientOrderIds (and potentially additional private data)

type HttpOption

type HttpOption func(*httpClientConfig)

func AutoRoundingEnabled

func AutoRoundingEnabled() HttpOption

func Credentials

func Credentials(customerId string, apiKey string, apiSecret string) HttpOption

func NonceGenerator

func NonceGenerator(nonceGen func() string) HttpOption

func UrlDomain

func UrlDomain(rawDomain string) HttpOption

type Ohlc

type Ohlc struct {
	Open      decimal.Decimal `json:"open"`
	High      decimal.Decimal `json:"high"`
	Low       decimal.Decimal `json:"low"`
	Close     decimal.Decimal `json:"close"`
	Timestamp int64           `json:"timestamp"`
	Volume    decimal.Decimal `json:"volume"`
}

func (*Ohlc) UnmarshalJSON

func (e *Ohlc) UnmarshalJSON(bytes []byte) error

custom deserialization instructions necessary

type OrderBookEntry

type OrderBookEntry struct {
	Price  decimal.Decimal
	Amount decimal.Decimal
	Id     int64
}

func (*OrderBookEntry) UnmarshalJSON

func (obe *OrderBookEntry) UnmarshalJSON(bytes []byte) error

custom deserialization instructions necessary

type TickerResponse

type TickerResponse struct {
	Ask       decimal.Decimal `json:"ask"`
	Bid       decimal.Decimal `json:"bid"`
	High      decimal.Decimal `json:"high"`
	Last      decimal.Decimal `json:"last"`
	Low       decimal.Decimal `json:"low"`
	Open      decimal.Decimal `json:"open"`
	Timestamp int64           `json:"timestamp"`
	Volume    decimal.Decimal `json:"volume"`
	Vwap      decimal.Decimal `json:"vwap"`
}

func (*TickerResponse) UnmarshalJSON

func (t *TickerResponse) UnmarshalJSON(data []byte) error

custom deserialization instructions necessary

type V1OrderBookResponse

type V1OrderBookResponse struct {
	Timestamp string           `json:"timestamp"` // UNIX epoch in UTC in seconds
	Bids      []OrderBookEntry `json:"bids"`
	Asks      []OrderBookEntry `json:"asks"`
}

type V2BalanceResponse

type V2BalanceResponse struct {
	// currencies
	AaveAvailable      decimal.Decimal `json:"aave_available"`
	AaveBalance        decimal.Decimal `json:"aave_balance"`
	AaveReserved       decimal.Decimal `json:"aave_reserved"`
	AaveWithdrawalFee  decimal.Decimal `json:"aave_withdrawal_fee"`
	AlgoAvailable      decimal.Decimal `json:"algo_available"`
	AlgoBalance        decimal.Decimal `json:"algo_balance"`
	AlgoReserved       decimal.Decimal `json:"algo_reserved"`
	AlgoWithdrawalFee  decimal.Decimal `json:"algo_withdrawal_fee"`
	AudioAvailable     decimal.Decimal `json:"audio_available"`
	AudioBalance       decimal.Decimal `json:"audio_balance"`
	AudioReserved      decimal.Decimal `json:"audio_reserved"`
	AudioWithdrawalFee decimal.Decimal `json:"audio_withdrawal_fee"`
	BatAvailable       decimal.Decimal `json:"bat_available"`
	BatBalance         decimal.Decimal `json:"bat_balance"`
	BatReserved        decimal.Decimal `json:"bat_reserved"`
	BatWithdrawalFee   decimal.Decimal `json:"bat_withdrawal_fee"`
	BchAvailable       decimal.Decimal `json:"bch_available"`
	BchBalance         decimal.Decimal `json:"bch_balance"`
	BchReserved        decimal.Decimal `json:"bch_reserved"`
	BchWithdrawalFee   decimal.Decimal `json:"bch_withdrawal_fee"`
	BtcAvailable       decimal.Decimal `json:"btc_available"`
	BtcBalance         decimal.Decimal `json:"btc_balance"`
	BtcReserved        decimal.Decimal `json:"btc_reserved"`
	BtcWithdrawalFee   decimal.Decimal `json:"btc_withdrawal_fee"`
	CompAvailable      decimal.Decimal `json:"comp_available"`
	CompBalance        decimal.Decimal `json:"comp_balance"`
	CompReserved       decimal.Decimal `json:"comp_reserved"`
	CompWithdrawalFee  decimal.Decimal `json:"comp_withdrawal_fee"`
	CrvAvailable       decimal.Decimal `json:"crv_available"`
	CrvBalance         decimal.Decimal `json:"crv_balance"`
	CrvReserved        decimal.Decimal `json:"crv_reserved"`
	CrvWithdrawalFee   decimal.Decimal `json:"crv_withdrawal_fee"`
	DaiAvailable       decimal.Decimal `json:"dai_available"`
	DaiBalance         decimal.Decimal `json:"dai_balance"`
	DaiReserved        decimal.Decimal `json:"dai_reserved"`
	DaiWithdrawalFee   decimal.Decimal `json:"dai_withdrawal_fee"`
	Eth2Available      decimal.Decimal `json:"eth2_available"`
	Eth2Balance        decimal.Decimal `json:"eth2_balance"`
	Eth2Reserved       decimal.Decimal `json:"eth2_reserved"`
	Eth2rAvailable     decimal.Decimal `json:"eth2r_available"`
	Eth2rBalance       decimal.Decimal `json:"eth2r_balance"`
	Eth2rReserved      decimal.Decimal `json:"eth2r_reserved"`
	EthAvailable       decimal.Decimal `json:"eth_available"`
	EthBalance         decimal.Decimal `json:"eth_balance"`
	EthReserved        decimal.Decimal `json:"eth_reserved"`
	EthWithdrawalFee   decimal.Decimal `json:"eth_withdrawal_fee"`
	EurAvailable       decimal.Decimal `json:"eur_available"`
	EurBalance         decimal.Decimal `json:"eur_balance"`
	EurReserved        decimal.Decimal `json:"eur_reserved"`
	EurWithdrawalFee   decimal.Decimal `json:"eur_withdrawal_fee"`
	GbpAvailable       decimal.Decimal `json:"gbp_available"`
	GbpBalance         decimal.Decimal `json:"gbp_balance"`
	GbpReserved        decimal.Decimal `json:"gbp_reserved"`
	GbpWithdrawalFee   decimal.Decimal `json:"gbp_withdrawal_fee"`
	GrtAvailable       decimal.Decimal `json:"grt_available"`
	GrtBalance         decimal.Decimal `json:"grt_balance"`
	GrtReserved        decimal.Decimal `json:"grt_reserved"`
	GrtWithdrawalFee   decimal.Decimal `json:"grt_withdrawal_fee"`
	GusdAvailable      decimal.Decimal `json:"gusd_available"`
	GusdBalance        decimal.Decimal `json:"gusd_balance"`
	GusdReserved       decimal.Decimal `json:"gusd_reserved"`
	GusdWithdrawalFee  decimal.Decimal `json:"gusd_withdrawal_fee"`
	KncAvailable       decimal.Decimal `json:"knc_available"`
	KncBalance         decimal.Decimal `json:"knc_balance"`
	KncReserved        decimal.Decimal `json:"knc_reserved"`
	KncWithdrawalFee   decimal.Decimal `json:"knc_withdrawal_fee"`
	LinkAvailable      decimal.Decimal `json:"link_available"`
	LinkBalance        decimal.Decimal `json:"link_balance"`
	LinkReserved       decimal.Decimal `json:"link_reserved"`
	LinkWithdrawalFee  decimal.Decimal `json:"link_withdrawal_fee"`
	LtcAvailable       decimal.Decimal `json:"ltc_available"`
	LtcBalance         decimal.Decimal `json:"ltc_balance"`
	LtcReserved        decimal.Decimal `json:"ltc_reserved"`
	LtcWithdrawalFee   decimal.Decimal `json:"ltc_withdrawal_fee"`
	MkrAvailable       decimal.Decimal `json:"mkr_available"`
	MkrBalance         decimal.Decimal `json:"mkr_balance"`
	MkrReserved        decimal.Decimal `json:"mkr_reserved"`
	MkrWithdrawalFee   decimal.Decimal `json:"mkr_withdrawal_fee"`
	OmgAvailable       decimal.Decimal `json:"omg_available"`
	OmgBalance         decimal.Decimal `json:"omg_balance"`
	OmgReserved        decimal.Decimal `json:"omg_reserved"`
	OmgWithdrawalFee   decimal.Decimal `json:"omg_withdrawal_fee"`
	PaxAvailable       decimal.Decimal `json:"pax_available"`
	PaxBalance         decimal.Decimal `json:"pax_balance"`
	PaxReserved        decimal.Decimal `json:"pax_reserved"`
	PaxWithdrawalFee   decimal.Decimal `json:"pax_withdrawal_fee"`
	SnxAvailable       decimal.Decimal `json:"snx_available"`
	SnxBalance         decimal.Decimal `json:"snx_balance"`
	SnxReserved        decimal.Decimal `json:"snx_reserved"`
	SnxWithdrawalFee   decimal.Decimal `json:"snx_withdrawal_fee"`
	UmaAvailable       decimal.Decimal `json:"uma_available"`
	UmaBalance         decimal.Decimal `json:"uma_balance"`
	UmaReserved        decimal.Decimal `json:"uma_reserved"`
	UmaWithdrawalFee   decimal.Decimal `json:"uma_withdrawal_fee"`
	UniAvailable       decimal.Decimal `json:"uni_available"`
	UniBalance         decimal.Decimal `json:"uni_balance"`
	UniReserved        decimal.Decimal `json:"uni_reserved"`
	UniWithdrawalFee   decimal.Decimal `json:"uni_withdrawal_fee"`
	UsdAvailable       decimal.Decimal `json:"usd_available"`
	UsdBalance         decimal.Decimal `json:"usd_balance"`
	UsdReserved        decimal.Decimal `json:"usd_reserved"`
	UsdWithdrawalFee   decimal.Decimal `json:"usd_withdrawal_fee"`
	UsdcAvailable      decimal.Decimal `json:"usdc_available"`
	UsdcBalance        decimal.Decimal `json:"usdc_balance"`
	UsdcReserved       decimal.Decimal `json:"usdc_reserved"`
	UsdcWithdrawalFee  decimal.Decimal `json:"usdc_withdrawal_fee"`
	UsdtAvailable      decimal.Decimal `json:"usdt_available"`
	UsdtBalance        decimal.Decimal `json:"usdt_balance"`
	UsdtReserved       decimal.Decimal `json:"usdt_reserved"`
	UsdtWithdrawalFee  decimal.Decimal `json:"usdt_withdrawal_fee"`
	XlmAvailable       decimal.Decimal `json:"xlm_available"`
	XlmBalance         decimal.Decimal `json:"xlm_balance"`
	XlmReserved        decimal.Decimal `json:"xlm_reserved"`
	XlmWithdrawalFee   decimal.Decimal `json:"xlm_withdrawal_fee"`
	XrpAvailable       decimal.Decimal `json:"xrp_available"`
	XrpBalance         decimal.Decimal `json:"xrp_balance"`
	XrpReserved        decimal.Decimal `json:"xrp_reserved"`
	XrpWithdrawalFee   decimal.Decimal `json:"xrp_withdrawal_fee"`
	YfiAvailable       decimal.Decimal `json:"yfi_available"`
	YfiBalance         decimal.Decimal `json:"yfi_balance"`
	YfiReserved        decimal.Decimal `json:"yfi_reserved"`
	YfiWithdrawalFee   decimal.Decimal `json:"yfi_withdrawal_fee"`
	ZrxAvailable       decimal.Decimal `json:"zrx_available"`
	ZrxBalance         decimal.Decimal `json:"zrx_balance"`
	ZrxReserved        decimal.Decimal `json:"zrx_reserved"`
	ZrxWithdrawalFee   decimal.Decimal `json:"zrx_withdrawal_fee"`

	// pairs
	AavebtcFee  decimal.Decimal `json:"aavebtc_fee"`
	AaveeurFee  decimal.Decimal `json:"aaveeur_fee"`
	AaveusdFee  decimal.Decimal `json:"aaveusd_fee"`
	AlgobtcFee  decimal.Decimal `json:"algobtc_fee"`
	AlgoeurFee  decimal.Decimal `json:"algoeur_fee"`
	AlgousdFee  decimal.Decimal `json:"algousd_fee"`
	AudiobtcFee decimal.Decimal `json:"audiobtc_fee"`
	AudioeurFee decimal.Decimal `json:"audioeur_fee"`
	AudiousdFee decimal.Decimal `json:"audiousd_fee"`
	BatbtcFee   decimal.Decimal `json:"batbtc_fee"`
	BateurFee   decimal.Decimal `json:"bateur_fee"`
	BatusdFee   decimal.Decimal `json:"batusd_fee"`
	BchbtcFee   decimal.Decimal `json:"bchbtc_fee"`
	BcheurFee   decimal.Decimal `json:"bcheur_fee"`
	BchgbpFee   decimal.Decimal `json:"bchgbp_fee"`
	BchusdFee   decimal.Decimal `json:"bchusd_fee"`
	BtceurFee   decimal.Decimal `json:"btceur_fee"`
	BtcgbpFee   decimal.Decimal `json:"btcgbp_fee"`
	BtcpaxFee   decimal.Decimal `json:"btcpax_fee"`
	BtcusdFee   decimal.Decimal `json:"btcusd_fee"`
	BtcusdcFee  decimal.Decimal `json:"btcusdc_fee"`
	BtcusdtFee  decimal.Decimal `json:"btcusdt_fee"`
	CompbtcFee  decimal.Decimal `json:"compbtc_fee"`
	CompeurFee  decimal.Decimal `json:"compeur_fee"`
	CompusdFee  decimal.Decimal `json:"compusd_fee"`
	CrvbtcFee   decimal.Decimal `json:"crvbtc_fee"`
	CrveurFee   decimal.Decimal `json:"crveur_fee"`
	CrvusdFee   decimal.Decimal `json:"crvusd_fee"`
	DaiusdFee   decimal.Decimal `json:"daiusd_fee"`
	Eth2ethFee  decimal.Decimal `json:"eth2eth_fee"`
	EthbtcFee   decimal.Decimal `json:"ethbtc_fee"`
	EtheurFee   decimal.Decimal `json:"etheur_fee"`
	EthgbpFee   decimal.Decimal `json:"ethgbp_fee"`
	EthpaxFee   decimal.Decimal `json:"ethpax_fee"`
	EthusdFee   decimal.Decimal `json:"ethusd_fee"`
	EthusdcFee  decimal.Decimal `json:"ethusdc_fee"`
	EthusdtFee  decimal.Decimal `json:"ethusdt_fee"`
	EurusdFee   decimal.Decimal `json:"eurusd_fee"`
	GbpeurFee   decimal.Decimal `json:"gbpeur_fee"`
	GbpusdFee   decimal.Decimal `json:"gbpusd_fee"`
	GusdusdFee  decimal.Decimal `json:"gusdusd_fee"`
	KncbtcFee   decimal.Decimal `json:"kncbtc_fee"`
	KnceurFee   decimal.Decimal `json:"knceur_fee"`
	KncusdFee   decimal.Decimal `json:"kncusd_fee"`
	LinkbtcFee  decimal.Decimal `json:"linkbtc_fee"`
	LinkethFee  decimal.Decimal `json:"linketh_fee"`
	LinkeurFee  decimal.Decimal `json:"linkeur_fee"`
	LinkgbpFee  decimal.Decimal `json:"linkgbp_fee"`
	LinkusdFee  decimal.Decimal `json:"linkusd_fee"`
	LtcbtcFee   decimal.Decimal `json:"ltcbtc_fee"`
	LtceurFee   decimal.Decimal `json:"ltceur_fee"`
	LtcgbpFee   decimal.Decimal `json:"ltcgbp_fee"`
	LtcusdFee   decimal.Decimal `json:"ltcusd_fee"`
	MkrbtcFee   decimal.Decimal `json:"mkrbtc_fee"`
	MkreurFee   decimal.Decimal `json:"mkreur_fee"`
	MkrusdFee   decimal.Decimal `json:"mkrusd_fee"`
	OmgbtcFee   decimal.Decimal `json:"omgbtc_fee"`
	OmgeurFee   decimal.Decimal `json:"omgeur_fee"`
	OmggbpFee   decimal.Decimal `json:"omggbp_fee"`
	OmgusdFee   decimal.Decimal `json:"omgusd_fee"`
	PaxeurFee   decimal.Decimal `json:"paxeur_fee"`
	PaxgbpFee   decimal.Decimal `json:"paxgbp_fee"`
	PaxusdFee   decimal.Decimal `json:"paxusd_fee"`
	SnxbtcFee   decimal.Decimal `json:"snxbtc_fee"`
	SnxeurFee   decimal.Decimal `json:"snxeur_fee"`
	SnxusdFee   decimal.Decimal `json:"snxusd_fee"`
	UmabtcFee   decimal.Decimal `json:"umabtc_fee"`
	UmaeurFee   decimal.Decimal `json:"umaeur_fee"`
	UmausdFee   decimal.Decimal `json:"umausd_fee"`
	UnibtcFee   decimal.Decimal `json:"unibtc_fee"`
	UnieurFee   decimal.Decimal `json:"unieur_fee"`
	UniusdFee   decimal.Decimal `json:"uniusd_fee"`
	UsdceurFee  decimal.Decimal `json:"usdceur_fee"`
	UsdcusdFee  decimal.Decimal `json:"usdcusd_fee"`
	UsdcusdtFee decimal.Decimal `json:"usdcusdt_fee"`
	UsdteurFee  decimal.Decimal `json:"usdteur_fee"`
	UsdtusdFee  decimal.Decimal `json:"usdtusd_fee"`
	XlmbtcFee   decimal.Decimal `json:"xlmbtc_fee"`
	XlmeurFee   decimal.Decimal `json:"xlmeur_fee"`
	XlmgbpFee   decimal.Decimal `json:"xlmgbp_fee"`
	XlmusdFee   decimal.Decimal `json:"xlmusd_fee"`
	XrpbtcFee   decimal.Decimal `json:"xrpbtc_fee"`
	XrpeurFee   decimal.Decimal `json:"xrpeur_fee"`
	XrpgbpFee   decimal.Decimal `json:"xrpgbp_fee"`
	XrppaxFee   decimal.Decimal `json:"xrppax_fee"`
	XrpusdFee   decimal.Decimal `json:"xrpusd_fee"`
	XrpusdtFee  decimal.Decimal `json:"xrpusdt_fee"`
	YfibtcFee   decimal.Decimal `json:"yfibtc_fee"`
	YfieurFee   decimal.Decimal `json:"yfieur_fee"`
	YfiusdFee   decimal.Decimal `json:"yfiusd_fee"`
	ZrxbtcFee   decimal.Decimal `json:"zrxbtc_fee"`
	ZrxeurFee   decimal.Decimal `json:"zrxeur_fee"`
	ZrxusdFee   decimal.Decimal `json:"zrxusd_fee"`

	// fee
	Fee decimal.Decimal `json:"fee"`
}

type V2CancelOrderResponse

type V2CancelOrderResponse struct {
	Id     uint64          `json:"id"`
	Amount decimal.Decimal `json:"amount"`
	Price  decimal.Decimal `json:"price"`
	Type   uint8           `json:"type"`
	Error  string          `json:"error"`
}

type V2EurUsdResponse

type V2EurUsdResponse struct {
	Buy  decimal.Decimal `json:"buy"`
	Sell decimal.Decimal `json:"sell"`
}

type V2InstantOrderResponse

type V2InstantOrderResponse struct {
	Id       string          `json:"id"`
	Datetime string          `json:"datetime"`
	Type     string          `json:"type"`
	Price    decimal.Decimal `json:"price"`
	Amount   decimal.Decimal `json:"amount"`
	Error    string          `json:"error"`
	Status   string          `json:"status"`
	Reason   interface{}     `json:"reason"`
}

type V2LimitOrderResponse

type V2LimitOrderResponse struct {
	Id       string          `json:"id"`
	Datetime string          `json:"datetime"`
	Type     string          `json:"type"`
	Price    decimal.Decimal `json:"price"`
	Amount   decimal.Decimal `json:"amount"`
	Status   string          `json:"status"`
	Reason   interface{}     `json:"reason"`
}

{"status": "error", "reason": {"__all__": ["Price is more than 20% below market price."]}} {"status": "error", "reason": {"__all__": ["You need 158338.86 USD to open that order. You have only 99991.52 USD available. Check your account balance for details."]}}

type V2MarketOrderResponse

type V2MarketOrderResponse struct {
	Id       string          `json:"id"`
	Datetime string          `json:"datetime"`
	Type     string          `json:"type"`
	Price    decimal.Decimal `json:"price"`
	Amount   decimal.Decimal `json:"amount"`
	Error    string          `json:"error"`
	Status   string          `json:"status"`
	Reason   interface{}     `json:"reason"`
}

type V2OhlcResponse

type V2OhlcResponse struct {
	Data struct {
		Pair    string `json:"pair"`
		Candles []Ohlc `json:"ohlc"`
	} `json:"data"`
}

type V2OpenOrdersResponse

type V2OpenOrdersResponse struct {
	Id           string          `json:"id"`
	Datetime     string          `json:"datetime"`
	Type         string          `json:"type"`
	Price        decimal.Decimal `json:"price"`
	Amount       decimal.Decimal `json:"amount"`
	CurrencyPair string          `json:"currency_pair"`
	Status       string          `json:"status"`
	Reason       interface{}     `json:"reason"`
}

Open orders

type V2OrderBookResponse

type V2OrderBookResponse struct {
	V1OrderBookResponse
	Microtimestamp string `json:"microtimestamp"`
}

type V2OrderStatusResponse

type V2OrderStatusResponse struct {
	Id              int64                      `json:"id"`
	Status          string                     `json:"status"`
	Transactions    []V2OrderStatusTransaction `json:"transactions"`
	AmountRemaining decimal.Decimal            `json:"amount_remaining"`
	ClientOrderId   string                     `json:"client_order_id"`

	Reason interface{} `json:"reason"`
}

type V2OrderStatusTransaction

type V2OrderStatusTransaction struct {
	Btc      decimal.Decimal `json:"btc"`
	Datetime string          `json:"datetime"`
	Fee      decimal.Decimal `json:"fee"`
	Price    decimal.Decimal `json:"price"`
	Tid      int64           `json:"tid"`
	Type     int             `json:"type"`
	Usd      decimal.Decimal `json:"usd"`
}

type V2TradingPairsInfoResponse

type V2TradingPairsInfoResponse struct {
	BaseDecimals           int    `json:"base_decimals"`
	CounterDecimals        int    `json:"counter_decimals"`
	Description            string `json:"description"`
	InstantAndMarketOrders string `json:"instant_and_market_orders"` // TODO: make this a boolean flag
	MinimumOrder           string `json:"minimum_order"`
	Name                   string `json:"name"`
	Trading                string `json:"trading"` // TODO: make this a boolean flag
	UrlSymbol              string `json:"url_symbol"`
}

type V2TransactionsResponse

type V2TransactionsResponse struct {
	Amount decimal.Decimal `json:"amount"` // Amount in base (?)
	Date   int64           `json:"date"`   // Unix timestamp date and time.
	Price  decimal.Decimal `json:"price"`
	Tid    int64           `json:"tid"`  // Transaction ID.
	Type   int8            `json:"type"` // 0 (buy) or 1 (sell).
}

func (*V2TransactionsResponse) UnmarshalJSON

func (tx *V2TransactionsResponse) UnmarshalJSON(bytes []byte) error

custom deserialization instructions necessary

type V2UserTransactionsResponse

type V2UserTransactionsResponse struct {
	Datetime string          `json:"datetime"`
	Fee      decimal.Decimal `json:"fee"`
	Id       int64           `json:"id"`
	OrderId  int64           `json:"order_id"`
	Type     string          `json:"type"`

	Status string      `json:"status"`
	Reason interface{} `json:"reason"`

	// amounts
	Aave   decimal.Decimal `json:"aave"`
	Algo   decimal.Decimal `json:"algo"`
	Audio  decimal.Decimal `json:"audio"`
	Bat    decimal.Decimal `json:"bat"`
	Bch    decimal.Decimal `json:"bch"`
	Btc    decimal.Decimal `json:"btc"`
	Comp   decimal.Decimal `json:"comp"`
	Crv    decimal.Decimal `json:"crv"`
	Dai    decimal.Decimal `json:"dai"`
	Eth    decimal.Decimal `json:"eth"`
	Eth2   decimal.Decimal `json:"eth2"`
	Eth2r  decimal.Decimal `json:"eth2r"`
	Eur    decimal.Decimal `json:"eur"`
	Gbp    decimal.Decimal `json:"gbp"`
	Grt    decimal.Decimal `json:"grt"`
	Gusd   decimal.Decimal `json:"gusd"`
	Knc    decimal.Decimal `json:"knc"`
	Link   decimal.Decimal `json:"link"`
	Ltc    decimal.Decimal `json:"ltc"`
	Mkr    decimal.Decimal `json:"mkr"`
	Omg    decimal.Decimal `json:"omg"`
	Pax    decimal.Decimal `json:"pax"`
	Snx    decimal.Decimal `json:"snx"`
	Uma    decimal.Decimal `json:"uma"`
	Uni    decimal.Decimal `json:"uni"`
	Usd    decimal.Decimal `json:"usd"`
	Usdc   decimal.Decimal `json:"usdc"`
	Usdt   decimal.Decimal `json:"usdt"`
	Xlm    decimal.Decimal `json:"xlm"`
	Xrp    decimal.Decimal `json:"xrp"`
	Yfi    decimal.Decimal `json:"yfi"`
	Zrx    decimal.Decimal `json:"zrx"`
	BtcUsd decimal.Decimal `json:"btc_usd"`
}

User transactions

type V2WebsocketsTokenResponse

type V2WebsocketsTokenResponse struct {
	Token    string `json:"token"`
	ValidSec uint32 `json:"valid_sec"`
	UserId   uint32 `json:"user_id"`
}

Jump to

Keyboard shortcuts

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