Documentation ¶
Index ¶
- Constants
- Variables
- func Error(msg string, args ...interface{}) error
- type Accounts
- type Balance
- type Book
- type Buy
- type CancelOrder
- type CandleStick
- type Currency
- type LoanOrder
- type LoanOrderSc
- type MarketUpdate
- type NewAddress
- type NewTrade
- type OpenOrder
- type OrderBook
- type OrderDepth
- type OrderStat
- type OrderStat1
- type OrderStat2
- type OrderTrade
- type Poloniex
- func (p *Poloniex) Buy(market string, price, amount float64) (buy Buy, err error)
- func (p *Poloniex) CancelOrder(orderNumber string) (cancelorder CancelOrder, err error)
- func (p *Poloniex) GenerateNewAddress(currency string) (newaddress NewAddress, err error)
- func (p *Poloniex) Get24hVolumes() (volumes Volume, err error)
- func (p *Poloniex) GetAccountBalances() (accounts Accounts, err error)
- func (p *Poloniex) GetAllOpenOrders() (openorders map[string][]OpenOrder, err error)
- func (p *Poloniex) GetBalances() (balances map[string]string, err error)
- func (p *Poloniex) GetChartData(market string, start, end time.Time, period string) (candles []CandleStick, err error)
- func (p *Poloniex) GetCompleteBalances() (completebalances map[string]Balance, err error)
- func (p *Poloniex) GetCurrencies() (currencies map[string]Currency, err error)
- func (p *Poloniex) GetDepositAddresses() (depositaddresses map[string]string, err error)
- func (p *Poloniex) GetLoanOrders(currency string) (loanorders LoanOrder, err error)
- func (p *Poloniex) GetOpenOrders(market string) (openorders []OpenOrder, err error)
- func (p *Poloniex) GetOrderBook(market string, depth int) (orderbook OrderBook, err error)
- func (p *Poloniex) GetOrderStat(orderNumber string) (orderstat OrderStat, err error)
- func (p *Poloniex) GetPublicTradeHistory(market string, args ...time.Time) (trades []PublicTrade, err error)
- func (p *Poloniex) GetTickers() (tickers map[string]Ticker, err error)
- func (p *Poloniex) GetTradeHistory(market string, start, end time.Time, limit int) (tradehistory []TradeHistory, err error)
- func (p *Poloniex) GetTradesByOrderID(orderNumber string) (ordertrades []OrderTrade, err error)
- func (p *Poloniex) Sell(market string, price, amount float64) (sell Sell, err error)
- type PublicTrade
- type ResultTrades
- type Sell
- type Ticker
- type TradeHistory
- type Volume
- type WSClient
- type WSOrderBook
- type WSOrderBookModify
- type WSOrderBookRemove
- type WSTicker
Constants ¶
View Source
const ( TICKER = 1002 // Ticker Channel Id SUBSBUFFER = 24 // Subscriptions Buffer )
Variables ¶
View Source
var ( ConnectError = "[ERROR] Connection could not be established!" RequestError = "[ERROR] NewRequest Error!" SetApiError = "[ERROR] Set the API KEY and API SECRET!" PeriodError = "[ERROR] Invalid Period!" TimePeriodError = "[ERROR] Time Period incompatibility!" TimeError = "[ERROR] Invalid Time!" StartTimeError = "[ERROR] Start Time Format Error!" EndTimeError = "[ERROR] End Time Format Error!" LimitError = "[ERROR] Limit Format Error!" ChannelError = "[ERROR] Unknown Channel Name: %s" SubscribeError = "[ERROR] Already Subscribed!" WSTickerError = "[ERROR] WSTicker Parsing %s" WSOrderBookError = "[ERROR] MarketUpdate OrderBook Parsing %s" NewTradeError = "[ERROR] MarketUpdate NewTrade Parsing %s" ServerError = "[SERVER ERROR] Response: %s" )
View Source
var ZeroTime = time.Time{}
Functions ¶
Types ¶
type Book ¶
func (*Book) UnmarshalJSON ¶
type Buy ¶
type Buy struct { OrderNumber string `json:"orderNumber"` ResultingTrades []ResultTrades }
type CancelOrder ¶
type CancelOrder struct {
Success int `json:"success"`
}
type CandleStick ¶
type LoanOrder ¶
type LoanOrder struct { Offers []LoanOrderSc `json:"offers"` Demands []LoanOrderSc `json:"demands"` }
type LoanOrderSc ¶
type MarketUpdate ¶
type MarketUpdate struct { Data interface{} TypeUpdate string `json:"type"` }
for market update.
type NewAddress ¶
type NewTrade ¶
type NewTrade struct { TradeId int64 `json:"tradeID,string"` Rate float64 `json:"rate,string"` Amount float64 `json:"amount,string"` Total float64 `json:"total,string"` TypeOrder string `json:"type"` }
"t" messages.
type OpenOrder ¶
type OpenOrder struct { OrderNumber string `json:"orderNumber"` Type string `json:"type"` Price decimal.Decimal `json:"rate, string"` StartingAmount decimal.Decimal `json:"startingAmount, string"` Amount decimal.Decimal `json:"amount, string"` Total decimal.Decimal `json:"total, string"` Date string `json:"date"` Margin int `json:"margin"` }
type OrderDepth ¶
type OrderDepth struct { Symbol string `json:"symbol"` OrderBook struct { Asks []Book `json:"asks"` Bids []Book `json:"bids"` } `json:"orderBook"` }
"i" messages.
type OrderStat ¶
type OrderStat struct { Status string `json:"status"` Rate decimal.Decimal `json:"rate"` Amount decimal.Decimal `json:"amount"` CurrencyPair string `json:"currencyPair"` Date string `json:"date"` Total decimal.Decimal `json:"total"` Type string `json:"type"` StartingAmount decimal.Decimal `json:"startingAmount"` }
type OrderStat1 ¶
type OrderStat1 struct { Success int `json:"success"` Result struct { Error string `json:"error"` } `json:"result"` }
error result
type OrderStat2 ¶
success result
type OrderTrade ¶
type OrderTrade struct { GlobalTradeID decimal.Decimal `json:"globalTradeId"` TradeID decimal.Decimal `json:"tradeId"` Market string `json:"currencyPair"` Type string `json:"type"` Price decimal.Decimal `json:"rate"` Amount decimal.Decimal `json:"amount"` Total decimal.Decimal `json:"total"` Fee decimal.Decimal `json:"fee"` Date string `json:"date"` }
type Poloniex ¶
type Poloniex struct {
// contains filtered or unexported fields
}
func (*Poloniex) CancelOrder ¶
func (p *Poloniex) CancelOrder(orderNumber string) (cancelorder CancelOrder, err error)
func (*Poloniex) GenerateNewAddress ¶
func (p *Poloniex) GenerateNewAddress(currency string) (newaddress NewAddress, err error)
func (*Poloniex) Get24hVolumes ¶
func (*Poloniex) GetAccountBalances ¶
func (*Poloniex) GetAllOpenOrders ¶
This method returns all open orders.
func (*Poloniex) GetBalances ¶
func (*Poloniex) GetChartData ¶
func (*Poloniex) GetCompleteBalances ¶
func (*Poloniex) GetCurrencies ¶
func (*Poloniex) GetDepositAddresses ¶
func (*Poloniex) GetLoanOrders ¶
func (*Poloniex) GetOpenOrders ¶
Send market to get open orders.
func (*Poloniex) GetOrderBook ¶
func (*Poloniex) GetOrderStat ¶
func (*Poloniex) GetPublicTradeHistory ¶
func (*Poloniex) GetTickers ¶
func (*Poloniex) GetTradeHistory ¶
func (*Poloniex) GetTradesByOrderID ¶
func (p *Poloniex) GetTradesByOrderID(orderNumber string) (ordertrades []OrderTrade, err error)
type PublicTrade ¶
type PublicTrade struct { GlobalTradeID uint64 `json:"globalTradeID"` TradeID uint64 `json:"tradeID"` Date string `json:"date, string"` Type string `json:"type, string"` Rate decimal.Decimal `json:"rate, string"` Amount decimal.Decimal `json:"amount, string"` Total decimal.Decimal `json:"total, string"` }
type ResultTrades ¶
type Ticker ¶
type Ticker struct { ID int `json:"id, int"` Last decimal.Decimal `json:"last, string"` LowestAsk decimal.Decimal `json:"lowestAsk, string"` HighestBid decimal.Decimal `json:"highestBid, string"` PercentChange decimal.Decimal `json:"percentChange, string"` BaseVolume decimal.Decimal `json:"baseVolume, string"` QuoteVolume decimal.Decimal `json:"quoteVolume, string"` IsFrozen int `json:"isFrozen ,string"` High24hr decimal.Decimal `json:"high24hr, string"` Low24hr decimal.Decimal `json:"low24hr, string"` }
type TradeHistory ¶
type TradeHistory struct { GlobalTradeID int `json:"globalTradeId"` TradeID string `json:"tradeId"` Date string `json:"date"` Price decimal.Decimal `json:"rate, string"` Amount decimal.Decimal `json:"amount, string"` Total decimal.Decimal `json:"total, string"` Fee decimal.Decimal `json:"fee,string"` OrderNumber decimal.Decimal `json:"orderNumber,string"` Type string `json:"type"` Category string `json:"category"` }
type Volume ¶
type Volume struct { Volumes map[string]map[string]decimal.Decimal TotalBTC float64 `json:"totalBTC, string"` TotalETH float64 `json:"totalETH, string"` TotalUSDC float64 `json:"totalUSDC, string"` TotalUSDT float64 `json:"totalUSDT, string"` TotalXMR float64 `json:"totalXMR, string"` TotalXUSD float64 `json:"totalXUSD, string"` }
func (*Volume) UnmarshalJSON ¶
type WSClient ¶
type WSClient struct { Subs map[string]chan interface{} // subscriptions map sync.Mutex // embedded mutex // contains filtered or unexported fields }
func NewWSClient ¶
Create new web socket client.
func (*WSClient) SubscribeMarket ¶
Subscribe to market channel. It returns nil if successful.
func (*WSClient) SubscribeTicker ¶
Subscribe to ticker channel. It returns nil if successful.
func (*WSClient) UnsubscribeMarket ¶
Unsubscribe from market channel. It returns nil if successful.
func (*WSClient) UnsubscribeTicker ¶
Unsubscribe from ticker channel. It returns nil if successful.
type WSOrderBook ¶
type WSOrderBook struct { Rate float64 `json:"rate,string"` TypeOrder string `json:"type"` Amount float64 `json:"amount,string"` }
"o" messages
type WSOrderBookRemove ¶
"o" messages.
type WSTicker ¶
type WSTicker struct { Symbol string `json:"symbol"` Last float64 `json:"last"` LowestAsk float64 `json:"lowestAsk"` HighestBid float64 `json:"hihgestBid"` PercentChange float64 `json:"percentChange"` BaseVolume float64 `json:"baseVolume"` QuoteVolume float64 `json:"quoteVolume"` IsFrozen bool `json:"isFrozen"` High24hr float64 `json:"high24hr"` Low24hr float64 `json:"low24hr"` }
for ticker update.
Click to show internal directories.
Click to hide internal directories.