Documentation ¶
Index ¶
- Constants
- func UnmarshalErrorOnType(err error, t string) bool
- type API
- func (a *API) Balances(address string) (bs map[string]string, err error)
- func (a *API) CompleteBalances(address string) (bs map[string]*Balance, err error)
- func (a *API) ContractAddress() (address string, err error)
- func (a *API) Currencies() (cs map[string]*Currency, err error)
- func (a *API) DepositsWithdrawals(address string, start, end int) (ds []*Deposit, ws []*Withdrawal, err error)
- func (a *API) NextNonce(address string) (nonce int, err error)
- func (a *API) OpenOrders(market, address string) (os []*OpenOrder, err error)
- func (a *API) OrderBook(market string) (ob *OrderBook, err error)
- func (a *API) OrderTrades(hash string) (ts []*Trade, err error)
- func (a *API) Post(endpoint, payload string) ([]byte, error)
- func (a *API) Ticker(market string) (t *Ticker, err error)
- func (a *API) Tickers() (t map[string]*Ticker, err error)
- func (a *API) TradeHistoryMarket(market, address string, start, end int) (ts []*Trade, err error)
- func (a *API) TradeHistoryUser(address string, start, end int) (ts map[string][]*Trade, err error)
- func (a *API) Volume24() (v *Volume, err error)
- type Balance
- type Currency
- type Deposit
- type Idex
- type Method
- type OpenOrder
- type Order
- type OrderBook
- type OrderInserted
- type Params
- type PushCancel
- type Socket
- type SocketResponse
- type Ticker
- type Trade
- type TradeInserted
- type Volume
- type Withdrawal
Constants ¶
const ( APIURL = "https://api.idex.market" WSURL = "wss://v1.idex.market" )
IDEX rest and websocket urls
Variables ¶
This section is empty.
Functions ¶
func UnmarshalErrorOnType ¶
UnmarshalErrorOnType is true when the error was a json.UnmarshalTypeError on type t
Types ¶
type API ¶
type API struct {
URL string
}
API for requests
func (*API) CompleteBalances ¶
CompleteBalances returns available balances with balance in orders
func (*API) ContractAddress ¶
ContractAddress returns the IDEX contract address
func (*API) Currencies ¶
Currencies returns all supported currencies
func (*API) DepositsWithdrawals ¶
func (a *API) DepositsWithdrawals(address string, start, end int) (ds []*Deposit, ws []*Withdrawal, err error)
DepositsWithdrawals returns the user's deposits and withdrawals
func (*API) OpenOrders ¶
OpenOrders all open orders for market and/or user address
func (*API) OrderTrades ¶
OrderTrades returns all trades involved in the order hash
func (*API) TradeHistoryMarket ¶
TradeHistoryMarket trade history for a market, filterable by user and timestamps API limited to 200 trades
func (*API) TradeHistoryUser ¶
TradeHistoryUser trade history for a user across all markets, filterable by timestamps API limited to 200 trades
type Currency ¶
type Currency struct { Name string `json:"name"` Decimals int `json:"decimals"` Address string `json:"address"` }
Currency holds details about supported currencies
type Deposit ¶
type Deposit struct { DepositNumber int `json:"depositNumber"` Currency string `json:"currency"` Amount string `json:"amount"` Timestamp int `json:"timestamp"` TransactionHash string `json:"transactionHash"` }
Deposit holds information about a user's deposits
type OpenOrder ¶
type OpenOrder struct { Timestamp int `json:"timestamp"` Price string `json:"price"` Amount string `json:"amount"` Total string `json:"total"` OrderHash string `json:"orderHash"` Market string `json:"market"` Type string `json:"type"` OrderNumber int `json:"orderNumber"` Params *Params `json:"params"` }
OpenOrder for a market or user
type Order ¶
type Order struct { Price string `json:"price"` Amount string `json:"amount"` Total string `json:"total"` OrderHash string `json:"orderHash"` Params *Params `json:"params"` }
Order held in OrderBook
type OrderInserted ¶
type OrderInserted struct { Complete bool `json:"complete"` ID int `json:"id"` TokenBuy string `json:"tokenBuy"` AmountBuy string `json:"amountBuy"` TokenSell string `json:"tokenSell"` AmountSell string `json:"amountSell"` Expires int `json:"expires"` Nonce int `json:"nonce"` User string `json:"user"` V int `json:"v"` R string `json:"r"` S string `json:"s"` Hash string `json:"hash"` FeeDiscount string `json:"feeDiscount"` RewardsMultiple string `json:"rewardsMultiple"` UpdatedAt string `json:"updatedAt"` CreatedAt string `json:"createdAt"` }
OrderInserted event
func (*OrderInserted) UnmarshalJSON ¶
func (oi *OrderInserted) UnmarshalJSON(b []byte) error
UnmarshalJSON custom for OrderInserted to handle V as string or int
type Params ¶
type Params struct { TokenBuy string `json:"tokenBuy"` BuySymbol string `json:"buySymbol"` BuyPrecision int `json:"buyPrecision"` AmountBuy string `json:"amountBuy"` TokenSell string `json:"tokenSell"` SellSymbol string `json:"sellSymbol"` SellPrecision int `json:"sellPrecision"` AmountSell string `json:"amountSell"` Expires int `json:"expires"` Nonce int `json:"nonce"` User string `json:"user"` }
Params of an Order
type PushCancel ¶
type PushCancel struct { ID int `json:"id"` Hash string `json:"hash"` User string `json:"user"` V int `json:"v"` R string `json:"r"` S string `json:"s"` UpdatedAt string `json:"updatedAt"` CreatedAt string `json:"createdAt"` }
PushCancel event
func (*PushCancel) UnmarshalJSON ¶
func (pc *PushCancel) UnmarshalJSON(b []byte) error
UnmarshalJSON custom for PushCancel to handle V as string or int
type Socket ¶
Socket wraps the websocket connection
func (*Socket) Monitor ¶
func (s *Socket) Monitor(resp chan SocketResponse)
Monitor the websocket for messages
type SocketResponse ¶
type SocketResponse struct { OrderInserted *OrderInserted TradeInserted *TradeInserted PushCancel *PushCancel Error error }
SocketResponse holds messages to pass back from the websocket
type Ticker ¶
type Ticker struct { Last string `json:"last"` High string `json:"high"` Low string `json:"low"` LowestAsk string `json:"lowestAsk"` HighestBid string `json:"highestBid"` PercentChange string `json:"percentChange"` BaseVolume string `json:"baseVolume"` QuoteVolume string `json:"quoteVolume"` }
Ticker data
type Trade ¶
type Trade struct { Date string `json:"date"` Amount string `json:"amount"` Type string `json:"type"` Total string `json:"total"` Price string `json:"price"` OrderHash string `json:"orderHash"` UUID string `json:"uuid"` BuyerFee string `json:"buyerFee"` SellerFee string `json:"sellerFee"` GasFee string `json:"gasFee"` Timestamp int `json:"timestamp"` Maker string `json:"maker"` Taker string `json:"taker"` TransactionHash string `json:"transactionHash"` USDValue string `json:"usdValue"` }
Trade holds details about a trade
type TradeInserted ¶
type TradeInserted struct { ID int `json:"id"` Price string `json:"price"` AmountPrecision string `json:"amountPrecision"` TotalPrecision string `json:"totalPrecision"` Date string `json:"date"` Timestamp int `json:"timestamp"` SellerFee string `json:"sellerFee"` BuyerFee string `json:"buyerFee"` Type string `json:"type"` TokenBuy string `json:"tokenBuy"` AmountBuy string `json:"amountBuy"` TokenSell string `json:"tokenSell"` AmountSell string `json:"amountSell"` FeeMake string `json:"feeMake"` FeeTake string `json:"feeTake"` GasFee string `json:"gasFee"` Buy string `json:"buy"` V int `json:"v"` R string `json:"r"` S string `json:"s"` User string `json:"user"` Sell string `json:"sell"` Hash string `json:"hash"` Nonce int `json:"nonce"` Amount string `json:"amount"` USDValue string `json:"usdValue"` GasFeeAdjusted string `json:"gasFeeAdjusted"` UUID string `json:"uuid"` UpdatedAt string `json:"updatedAt"` CreatedAt string `json:"createdAt"` }
TradeInserted event
func (*TradeInserted) UnmarshalJSON ¶
func (ti *TradeInserted) UnmarshalJSON(b []byte) error
UnmarshalJSON custom for TradeInserted to handle V as string or int
type Volume ¶
Volume maps markets to ETH and TOKEN amounts, with total eth volume
func (*Volume) UnmarshalJSON ¶
UnmarshalJSON custom for Volume
type Withdrawal ¶
type Withdrawal struct { WithdrawalNumber int `json:"depositNumber"` Currency string `json:"currency"` Amount string `json:"amount"` Timestamp int `json:"timestamp"` TransactionHash string `json:"transactionHash"` Status string `json:"status"` }
Withdrawal holds information about a user's withdrawals