Documentation
¶
Index ¶
- Constants
- type AccountBalances
- type ActiveLoan
- type ActiveLoans
- type Addresses
- type AvailableAccountBalances
- type AvailableAccountBalancesTemp
- type Balance
- type Balances
- type Base
- type Buy
- type ChartData
- type ChartDataEntry
- type Currencies
- type Currency
- type DailyVolume
- type DailyVolumeEntry
- type DailyVolumeEntryTemp
- type DailyVolumeTemp
- type DepositsWithdrawals
- type FeeInfo
- type LoanOffer
- type LoanOrder
- type LoanOrders
- type MarginAccountSummary
- type MoveOrder
- type OpenLoanOffer
- type OpenLoanOffers
- type OpenOrder
- type OpenOrders
- type OpenOrdersAll
- type Order
- type OrderBook
- type OrderBookAll
- type OrderBookAllTemp
- type OrderBookTemp
- type OrderTemp
- type OrderTrade
- type OrderTrades
- type Poloniex
- func (p *Poloniex) AccountBalances() (balances AccountBalances, err error)
- func (p *Poloniex) ActiveLoans() (activeLoans ActiveLoans, err error)
- func (p *Poloniex) Addresses() (addresses Addresses, err error)
- func (p *Poloniex) AvailableAccountBalances() (aab AvailableAccountBalances, err error)
- func (p *Poloniex) Balances() (balances Balances, err error)
- func (p *Poloniex) Buy(pair string, rate, amount float64) (buy Buy, err error)
- func (p *Poloniex) BuyFillKill(pair string, rate, amount float64) (buy Buy, err error)
- func (p *Poloniex) BuyPostOnly(pair string, rate, amount float64) (buy Buy, err error)
- func (p *Poloniex) CancelLoanOffer(orderNumber int64) (success bool, err error)
- func (p *Poloniex) CancelOrder(orderNumber int64) (success bool, err error)
- func (p *Poloniex) ChartData(pair string) (chartData ChartData, err error)
- func (p *Poloniex) ChartDataCurrent(pair string) (chartData ChartData, err error)
- func (p *Poloniex) ChartDataPeriod(pair string, start, end time.Time, period ...int) (chartData ChartData, err error)
- func (p *Poloniex) Currencies() (currencies Currencies, err error)
- func (p *Poloniex) DailyVolume() (dailyVolume DailyVolume, err error)
- func (p *Poloniex) Debug()
- func (p *Poloniex) DepositsWithdrawals() (depositsWithdrawals DepositsWithdrawals, err error)
- func (p *Poloniex) Emit(event interface{}, arguments ...interface{}) *emission.Emitter
- func (p *Poloniex) FeeInfo() (fi FeeInfo, err error)
- func (p *Poloniex) GenerateNewAddress(currency string) (address string, err error)
- func (p *Poloniex) LoanOffer(currency string, amount float64, duration int, renew bool, lendingRate float64) (loanOffer LoanOffer, err error)
- func (p *Poloniex) LoanOrders(currency string) (loanOrders LoanOrders, err error)
- func (p *Poloniex) MarginAccountSummary() (mas MarginAccountSummary, err error)
- func (p *Poloniex) Move(orderNumber int64, rate float64) (moveOrder MoveOrder, err error)
- func (p *Poloniex) MovePostOnly(orderNumber int64, rate float64) (moveOrder MoveOrder, err error)
- func (p *Poloniex) Off(event interface{}, listener interface{}) *emission.Emitter
- func (p *Poloniex) On(event interface{}, listener interface{}) *emission.Emitter
- func (p *Poloniex) OpenLoanOffers() (openLoanOffers OpenLoanOffers, err error)
- func (p *Poloniex) OpenOrders(pair string) (openOrders OpenOrders, err error)
- func (p *Poloniex) OpenOrdersAll() (openOrders OpenOrdersAll, err error)
- func (p *Poloniex) OrderBook(pair string) (orderBook OrderBook, err error)
- func (p *Poloniex) OrderBookAll() (orderBook OrderBookAll, err error)
- func (p *Poloniex) OrderTrades(orderNumber int64) (ot OrderTrades, err error)
- func (p *Poloniex) PrivateTradeHistory(in ...interface{}) (history PrivateTradeHistory, err error)
- func (p *Poloniex) PrivateTradeHistoryAll(in ...interface{}) (history PrivateTradeHistoryAll, err error)
- func (p *Poloniex) Sell(pair string, rate, amount float64) (sell Sell, err error)
- func (p *Poloniex) SellFillKill(pair string, rate, amount float64) (sell Sell, err error)
- func (p *Poloniex) SellPostOnly(pair string, rate, amount float64) (sell Sell, err error)
- func (p *Poloniex) StartWS()
- func (p *Poloniex) Subscribe(chid string) error
- func (p *Poloniex) Ticker() (ticker Ticker, err error)
- func (p *Poloniex) ToggleAutoRenew(orderNumber int64) (success bool, err error)
- func (p *Poloniex) TradableBalances() (tb TradableBalances, err error)
- func (p *Poloniex) TradeHistory(pair string, start, end time.Time) (tradeHistory TradeHistory, err error)
- func (p *Poloniex) TransferBalance(currency string, amount float64, from string, to string) (tb TransferBalance, err error)
- func (p *Poloniex) Unsubscribe(chid string) error
- func (p *Poloniex) WSIdle(dur time.Duration, callbacks ...WSReportFunc)
- func (p *Poloniex) Withdraw(currency string, amount float64, address string) (w Withdraw, err error)
- type PoloniexError
- type PrivateTradeHistory
- type PrivateTradeHistoryAll
- type PrivateTradeHistoryEntry
- type ResultingTrade
- type Sell
- type Ticker
- type TickerEntry
- type TradableBalance
- type TradableBalanceTemp
- type TradableBalances
- type TradableBalancesTemp
- type TradeHistory
- type TradeHistoryEntry
- type TransferBalance
- type WSOrderbook
- type WSReportFunc
- type WSTicker
- type Withdraw
Examples ¶
Constants ¶
const ( // PUBLICURI is the address of the public API on Poloniex PUBLICURI = "https://poloniex.com/public" // PRIVATEURI is the address of the public API on Poloniex PRIVATEURI = "https://poloniex.com/tradingApi" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountBalances ¶
type AccountBalances struct {
Exchange map[string]float64
Margin map[string]float64
Lending map[string]float64
}
Account holds the balances in the various wallet accounts
type ActiveLoan ¶
type ActiveLoans ¶
type ActiveLoans struct {
Provided []ActiveLoan
}
type Balance ¶
type Balance struct {
Available float64 `json:",string"`
OnOrders float64 `json:"onOrders,string"`
BTCValue float64 `json:"btcValue,string"`
}
Balance is a single balance entry used in the Balances map
Example ¶
p := New("config.json")
balances, err := p.Balances()
if err != nil {
log.Fatalln(err)
}
fmt.Printf("%+v\n", balances)
type ChartData ¶
type ChartData []ChartDataEntry
type ChartDataEntry ¶
type Currencies ¶
type DailyVolume ¶
type DailyVolume map[string]DailyVolumeEntry
type DailyVolumeEntry ¶
type DailyVolumeEntryTemp ¶
type DailyVolumeEntryTemp map[string]interface{}
type DailyVolumeTemp ¶
type DailyVolumeTemp map[string]interface{}
type DepositsWithdrawals ¶
type DepositsWithdrawals struct {
Deposits []deposit
Withdrawals []withdrawal
}
DepositsWithdrawals holds the history of deposit and withdrawal
type LoanOrders ¶
type MarginAccountSummary ¶
type MarginAccountSummary struct {
TotalValue float64 `json:"totalValue,string"`
ProfitLoss float64 `json:"pl,string"`
LendingFees float64 `json:"lendingFees,string"`
NetValue float64 `json:"netValue,string"`
TotalBorrowedValue float64 `json:"totalBorrowedValue,string"`
CurrentMargin float64 `json:"currentMargin,string"`
}
type OpenLoanOffer ¶
type OpenLoanOffers ¶
type OpenLoanOffers map[string][]OpenLoanOffer
type OpenOrder ¶
type OpenOrder struct {
OrderNumber int64 `json:",string"`
Type string
Rate float64 `json:",string"`
Amount float64 `json:",string"`
Total float64 `json:",string"`
}
OpenOrder is a singular entry used in the OpenOrders type
type OpenOrders ¶
type OpenOrders []OpenOrder
OpenOrders is the list of open orders for the pair specified
type OrderBook ¶
Example ¶
p := NewPublicOnly()
ob, err := p.OrderBook("BTC_ETH")
if err != nil {
log.Fatalln(err)
}
pp.Println(ob.Asks[0], ob.Bids[0])
type OrderBookAll ¶
type OrderBookAllTemp ¶
type OrderBookAllTemp map[string]OrderBookTemp
type OrderBookTemp ¶
type OrderTrade ¶
type OrderTrade struct {
GlobalTradeID int64 `json:"globalTradeID"`
TradeID int64 `json:"tradeID"`
CurrencyPair string `json:"currencyPair"`
Type string `json:"type"`
Rate float64 `json:"rate,string"`
Amount float64 `json:"amount,string"`
Total float64 `json:"total,string"`
Fee float64 `json:"fee,string"`
Date string `json:"date"`
}
type OrderTrades ¶
type OrderTrades []OrderTrade
type Poloniex ¶
type Poloniex struct {
Key string
Secret string
ByID map[string]string
ByName map[string]string
// contains filtered or unexported fields
}
Poloniex describes the API
func NewPublicOnly ¶
func NewPublicOnly() *Poloniex
NewPublicOnly allows the use of the public and websocket api only
func NewWithConfig ¶
NewWithConfig is the replacement function for New, pass in a configfile to use
func NewWithCredentials ¶
NewWithCredentials allows to pass in the key and secret directly
func (*Poloniex) AccountBalances ¶
func (p *Poloniex) AccountBalances() (balances AccountBalances, err error)
func (*Poloniex) ActiveLoans ¶
func (p *Poloniex) ActiveLoans() (activeLoans ActiveLoans, err error)
func (*Poloniex) AvailableAccountBalances ¶
func (p *Poloniex) AvailableAccountBalances() (aab AvailableAccountBalances, err error)
func (*Poloniex) BuyFillKill ¶
func (*Poloniex) BuyPostOnly ¶
func (*Poloniex) CancelLoanOffer ¶
func (*Poloniex) CancelOrder ¶
func (*Poloniex) ChartDataCurrent ¶
func (*Poloniex) ChartDataPeriod ¶
func (*Poloniex) Currencies ¶
func (p *Poloniex) Currencies() (currencies Currencies, err error)
func (*Poloniex) DailyVolume ¶
func (p *Poloniex) DailyVolume() (dailyVolume DailyVolume, err error)
func (*Poloniex) Debug ¶
func (p *Poloniex) Debug()
Debug turns on debugmode, which basically dumps all responses from the poloniex API REST server
func (*Poloniex) DepositsWithdrawals ¶
func (p *Poloniex) DepositsWithdrawals() (depositsWithdrawals DepositsWithdrawals, err error)
func (*Poloniex) GenerateNewAddress ¶
func (*Poloniex) LoanOrders ¶
func (p *Poloniex) LoanOrders(currency string) (loanOrders LoanOrders, err error)
func (*Poloniex) MarginAccountSummary ¶
func (p *Poloniex) MarginAccountSummary() (mas MarginAccountSummary, err error)
func (*Poloniex) MovePostOnly ¶
func (*Poloniex) OpenLoanOffers ¶
func (p *Poloniex) OpenLoanOffers() (openLoanOffers OpenLoanOffers, err error)
func (*Poloniex) OpenOrders ¶
func (p *Poloniex) OpenOrders(pair string) (openOrders OpenOrders, err error)
func (*Poloniex) OpenOrdersAll ¶
func (p *Poloniex) OpenOrdersAll() (openOrders OpenOrdersAll, err error)
func (*Poloniex) OrderBookAll ¶
func (p *Poloniex) OrderBookAll() (orderBook OrderBookAll, err error)
func (*Poloniex) OrderTrades ¶
func (p *Poloniex) OrderTrades(orderNumber int64) (ot OrderTrades, err error)
func (*Poloniex) PrivateTradeHistory ¶
func (p *Poloniex) PrivateTradeHistory(in ...interface{}) (history PrivateTradeHistory, err error)
PrivateTradeHistory takes a string pair and 2 unix timestamps as the start and end date period for the request.
func (*Poloniex) PrivateTradeHistoryAll ¶
func (p *Poloniex) PrivateTradeHistoryAll(in ...interface{}) (history PrivateTradeHistoryAll, err error)
PrivateTradeHistoryAll takes 2 unix timestamps as the start and end date period for the request.
func (*Poloniex) SellFillKill ¶
func (*Poloniex) SellPostOnly ¶
func (*Poloniex) ToggleAutoRenew ¶
func (*Poloniex) TradableBalances ¶
func (p *Poloniex) TradableBalances() (tb TradableBalances, err error)
func (*Poloniex) TradeHistory ¶
func (*Poloniex) TransferBalance ¶
func (*Poloniex) Unsubscribe ¶
type PoloniexError ¶
type PoloniexError struct {
Error string `json:"error"`
}
type PrivateTradeHistory ¶
type PrivateTradeHistory []PrivateTradeHistoryEntry
type PrivateTradeHistoryAll ¶
type PrivateTradeHistoryAll map[string]PrivateTradeHistory
type ResultingTrade ¶
type Ticker ¶
type Ticker map[string]TickerEntry
type TickerEntry ¶
type TickerEntry struct {
Last float64 `json:",string"`
Ask float64 `json:"lowestAsk,string"`
Bid float64 `json:"highestBid,string"`
Change float64 `json:"percentChange,string"`
BaseVolume float64 `json:"baseVolume,string"`
QuoteVolume float64 `json:"quoteVolume,string"`
IsFrozen int64 `json:"isFrozen,string"`
ID int64 `json:"id"`
}
type TradableBalance ¶
type TradableBalanceTemp ¶
type TradableBalances ¶
type TradableBalances map[string]TradableBalance
type TradableBalancesTemp ¶
type TradableBalancesTemp map[string]TradableBalanceTemp
type TradeHistory ¶
type TradeHistory []TradeHistoryEntry