wex

package
v0.0.0-...-cf2d4bb Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountInfo

type AccountInfo struct {
	Funds      map[string]float64 `json:"funds"`
	OpenOrders int                `json:"open_orders"`
	Rights     struct {
		Info     int `json:"info"`
		Trade    int `json:"trade"`
		Withdraw int `json:"withdraw"`
	} `json:"rights"`
	ServerTime       float64 `json:"server_time"`
	TransactionCount int     `json:"transaction_count"`
}

AccountInfo stores the account information for a user

type ActiveOrders

type ActiveOrders struct {
	Pair             string  `json:"pair"`
	Type             string  `json:"sell"`
	Amount           float64 `json:"amount"`
	Rate             float64 `json:"rate"`
	TimestampCreated float64 `json:"time_created"`
	Status           int     `json:"status"`
}

ActiveOrders stores active order information

type CancelOrder

type CancelOrder struct {
	OrderID float64            `json:"order_id"`
	Funds   map[string]float64 `json:"funds"`
}

CancelOrder is used for the CancelOrder API request response

type CoinDepositAddress

type CoinDepositAddress struct {
	Address string `json:"address"`
}

CoinDepositAddress stores a curency deposit address

type CreateCoupon

type CreateCoupon struct {
	Coupon  string             `json:"coupon"`
	TransID int64              `json:"transID"`
	Funds   map[string]float64 `json:"funds"`
}

CreateCoupon stores information coupon information

type Info

type Info struct {
	ServerTime int64           `json:"server_time"`
	Pairs      map[string]Pair `json:"pairs"`
}

Info holds server time and pair information

type OrderInfo

type OrderInfo struct {
	Pair             string  `json:"pair"`
	Type             string  `json:"sell"`
	StartAmount      float64 `json:"start_amount"`
	Amount           float64 `json:"amount"`
	Rate             float64 `json:"rate"`
	TimestampCreated float64 `json:"time_created"`
	Status           int     `json:"status"`
}

OrderInfo stores order information

type Orderbook

type Orderbook struct {
	Asks [][]float64 `json:"asks"`
	Bids [][]float64 `json:"bids"`
}

Orderbook stores the asks and bids orderbook information

type Pair

type Pair struct {
	DecimalPlaces int     `json:"decimal_places"`
	MinPrice      float64 `json:"min_price"`
	MaxPrice      float64 `json:"max_price"`
	MinAmount     float64 `json:"min_amount"`
	Hidden        int     `json:"hidden"`
	Fee           float64 `json:"fee"`
}

Pair holds pair information

type RedeemCoupon

type RedeemCoupon struct {
	CouponAmount   float64 `json:"couponAmount,string"`
	CouponCurrency string  `json:"couponCurrency"`
	TransID        int64   `json:"transID"`
}

RedeemCoupon stores redeem coupon information

type Response

type Response struct {
	Return  interface{} `json:"return"`
	Success int         `json:"success"`
	Error   string      `json:"error"`
}

Response is a generic struct used for exchange API request result

type Ticker

type Ticker struct {
	High          float64
	Low           float64
	Avg           float64
	Vol           float64
	VolumeCurrent float64 `json:"vol_cur"`
	Last          float64
	Buy           float64
	Sell          float64
	Updated       int64
}

Ticker stores the ticker information

type Trade

type Trade struct {
	Received float64            `json:"received"`
	Remains  float64            `json:"remains"`
	OrderID  float64            `json:"order_id"`
	Funds    map[string]float64 `json:"funds"`
}

Trade stores the trade information

type TradeHistory

type TradeHistory struct {
	Pair      string  `json:"pair"`
	Type      string  `json:"type"`
	Amount    float64 `json:"amount"`
	Rate      float64 `json:"rate"`
	OrderID   float64 `json:"order_id"`
	MyOrder   int     `json:"is_your_order"`
	Timestamp float64 `json:"timestamp"`
}

TradeHistory stores trade history

type Trades

type Trades struct {
	Type      string  `json:"type"`
	Price     float64 `json:"bid"`
	Amount    float64 `json:"amount"`
	TID       int64   `json:"tid"`
	Timestamp int64   `json:"timestamp"`
}

Trades stores trade information

type TransHistory

type TransHistory struct {
	Type        int     `json:"type"`
	Amount      float64 `json:"amount"`
	Currency    string  `json:"currency"`
	Description string  `json:"desc"`
	Status      int     `json:"status"`
	Timestamp   float64 `json:"timestamp"`
}

TransHistory stores transaction history

type WEX

type WEX struct {
	exchange.Base
	Ticker map[string]Ticker
}

WEX is the overarching type across the wex package

func (*WEX) CancelOrder

func (w *WEX) CancelOrder(OrderID int64) (bool, error)

CancelOrder cancels an order for a specific order ID

func (*WEX) CoinDepositAddress

func (w *WEX) CoinDepositAddress(coin string) (string, error)

CoinDepositAddress returns the deposit address for a specific currency

func (*WEX) CreateCoupon

func (w *WEX) CreateCoupon(currency string, amount float64) (CreateCoupon, error)

CreateCoupon creates an exchange coupon for a sepcific currency

func (*WEX) GetAccountInfo

func (w *WEX) GetAccountInfo() (AccountInfo, error)

GetAccountInfo returns a users account info

func (*WEX) GetActiveOrders

func (w *WEX) GetActiveOrders(pair string) (map[string]ActiveOrders, error)

GetActiveOrders returns the active orders for a specific currency

func (*WEX) GetDepth

func (w *WEX) GetDepth(symbol string) (Orderbook, error)

GetDepth returns the depth for a specific currency

func (*WEX) GetExchangeAccountInfo

func (w *WEX) GetExchangeAccountInfo() (exchange.AccountInfo, error)

GetExchangeAccountInfo retrieves balances for all enabled currencies for the WEX exchange

func (*WEX) GetFee

func (w *WEX) GetFee() float64

GetFee returns the exchange fee

func (*WEX) GetInfo

func (w *WEX) GetInfo() (Info, error)

GetInfo returns the WEX info

func (*WEX) GetOrderInfo

func (w *WEX) GetOrderInfo(OrderID int64) (map[string]OrderInfo, error)

GetOrderInfo returns the order info for a specific order ID

func (*WEX) GetOrderbookEx

func (w *WEX) GetOrderbookEx(p pair.CurrencyPair, assetType string) (orderbook.Base, error)

GetOrderbookEx returns the orderbook for a currency pair

func (*WEX) GetTicker

func (w *WEX) GetTicker(symbol string) (map[string]Ticker, error)

GetTicker returns a ticker for a specific currency

func (*WEX) GetTickerPrice

func (w *WEX) GetTickerPrice(p pair.CurrencyPair, assetType string) (ticker.Price, error)

GetTickerPrice returns the ticker for a currency pair

func (*WEX) GetTradeHistory

func (w *WEX) GetTradeHistory(TIDFrom, Count, TIDEnd int64, order, since, end, pair string) (map[string]TradeHistory, error)

GetTradeHistory returns the trade history

func (*WEX) GetTrades

func (w *WEX) GetTrades(symbol string) ([]Trades, error)

GetTrades returns the trades for a specific currency

func (*WEX) GetTransactionHistory

func (w *WEX) GetTransactionHistory(TIDFrom, Count, TIDEnd int64, order, since, end string) (map[string]TransHistory, error)

GetTransactionHistory returns the transaction history

func (*WEX) RedeemCoupon

func (w *WEX) RedeemCoupon(coupon string) (RedeemCoupon, error)

RedeemCoupon redeems an exchange coupon

func (*WEX) Run

func (w *WEX) Run()

Run implements the WEX wrapper

func (*WEX) SendAuthenticatedHTTPRequest

func (w *WEX) SendAuthenticatedHTTPRequest(method string, values url.Values, result interface{}) (err error)

SendAuthenticatedHTTPRequest sends an authenticated HTTP request to WEX

func (*WEX) SetDefaults

func (w *WEX) SetDefaults()

SetDefaults sets current default value for WEX

func (*WEX) Setup

func (w *WEX) Setup(exch config.ExchangeConfig)

Setup sets exchange configuration parameters for WEX

func (*WEX) Start

func (w *WEX) Start()

Start starts the WEX go routine

func (*WEX) Trade

func (w *WEX) Trade(pair, orderType string, amount, price float64) (int64, error)

Trade places an order and returns the order ID if successful or an error

func (*WEX) UpdateOrderbook

func (w *WEX) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderbook.Base, error)

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*WEX) UpdateTicker

func (w *WEX) UpdateTicker(p pair.CurrencyPair, assetType string) (ticker.Price, error)

UpdateTicker updates and returns the ticker for a currency pair

func (*WEX) WithdrawCoins

func (w *WEX) WithdrawCoins(coin string, amount float64, address string) (WithdrawCoins, error)

WithdrawCoins withdraws coins for a specific coin

type WithdrawCoins

type WithdrawCoins struct {
	TID        int64              `json:"tId"`
	AmountSent float64            `json:"amountSent"`
	Funds      map[string]float64 `json:"funds"`
}

WithdrawCoins stores information for a withdrawcoins request

Jump to

Keyboard shortcuts

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