poloniex

package module
v0.0.0-...-ce8fafd Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2020 License: MIT Imports: 21 Imported by: 15

README

ARCHIVED

This repository is no longer maintained

Go Poloniex API wrapper

This API should be a complete wrapper for the Poloniex api, including the public, private and websocket APIs.

Install

go get -u github.com/pharrisee/poloniex-api

Usage

To use create a copy of config-example.json and fill in your API key and secret.

{
    "key":"put your key here",
    "secret":"put your secret here"
}

You can also pass your key/secret pair in code rather than creating a config.json.

Examples

Public API
package main

import (
    "log"

    "github.com/k0kubun/pp"
    "github.com/pharrisee/poloniex-api"
)

func main() {
    p := poloniex.NewPublicOnly()
    ob, err := p.OrderBook("BTC_ETH")
    if err != nil {
        log.Fatalln(err)
    }
    pp.Println(ob.Asks[0], ob.Bids[0])
}
Private API
package main

import (
    "fmt"
    "log"

    "github.com/pharrisee/poloniex-api"
)

func main() {
    p := poloniex.New("config.json")
    balances, err := p.Balances()
    if err != nil {
        log.Fatalln(err)
    }
    fmt.Printf("%+v\n", balances)
}
Websocket API
package main

import (
    "log"

    poloniex "github.com/pharrisee/poloniex-api"

    "github.com/k0kubun/pp"
)

func main() {
	p := poloniex.NewWithCredentials("Key goes here", "secret goes here")
	p.Subscribe("ticker")
	p.Subscribe("USDT_BTC")
	p.StartWS()

	p.On("ticker", func(m poloniex.WSTicker) {
		pp.Println(m)
	}).On("USDT_BTC-trade", func(m poloniex.WSOrderbook) {
		pp.Println(m)
	})

	for _ = range time.Tick(1 * time.Second) {

	}
}

Websocket Events

When subscribing to an event stream there are a few input types, and strangely more output types.

Ticker

event name: ticker

Sends ticker updates when any of currencyPair, last, lowestAsk, highestBid, percentChange, baseVolume, quoteVolume, isFrozen, 24hrHigh or 24hrLow changes for any market.

You are required to filter which markets you are interested in.

Market_Name

Subscribing to an orderbook change stream can be confusing (both to think about and describe), since a single subscription can lead to multiple event streams being created.

using USDT_BTC as an example market below, any valid market name could be used (e.g. BTC_NXT or ETH_ETC)

Subscribing to USDT_BTC will lead to these events being emitted.

Event Purpose
USDT_BTC all events, trade, modify and remove for a single market
trade trade events for all markets
modify modify events for all markets
remove remove events for all markets
USDT_BTC-trade trade events for single market
USDT_BTC-modify modify events for single market
USDT_BTC-remove remove event for single market

This gives flexibility when writing the event handlers, meaning that you could for example have one routing which sends all trades for all markets to a local database for later processing.

see https://poloniex.com/support/api/ for a fuller description of the event types.

Support Development

Coin Address
BTC 1M2quzgptKWAVSmDyD7vAQbxYb8BNJmjEf
BCH 1CcDLKYTy2pCLTYTYBbBPkK79JeJ4v3GmV
ZEC t1bC8TnYYh6k71QMTTpJZdmKKzqPiqhuBxU
DCR DsdK14zAJ7sKU2MYYozFtmuk9sAoxD7XCs9

Documentation

Index

Examples

Constants

View Source
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

View Source
var ErrAck = errors.New("cannot parse to ticker - ack")

ErrAck ::::

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances struct {
	Exchange map[string]float64
	Margin   map[string]float64
	Lending  map[string]float64
}

AccountBalances are all of your balances

type ActiveLoan

type ActiveLoan struct {
	ID        int64 `json:"id"`
	Currency  string
	Rate      float64 `json:",string"`
	Amount    float64 `json:",string"`
	Range     int64
	Renewable bool
	AutoRenew int64 `json:"autoRenew"`
	Date      string
	DateTaken time.Time
	Fees      float64 `json:",string"`
}

ActiveLoan holds your active single loan.

type ActiveLoans

type ActiveLoans struct {
	Provided []ActiveLoan
}

ActiveLoans holds your active loans.

type Addresses

type Addresses map[string]string

Addresses holds the various deposit addresses for each coin

type AvailableAccountBalances

type AvailableAccountBalances struct {
	Exchange map[string]float64
	Margin   map[string]float64
	Lending  map[string]float64
}

AvailableAccountBalances holds your balances sorted by account.

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)
Output:

type Balances

type Balances map[string]Balance

Balances are all of your balances available for trade after having deducted all open orders

type Base

type Base struct {
	Error    string
	Success  int64
	Response string
}

Base is the collection of common fields returned by a call to the poloniex API

type Buy

type Buy struct {
	OrderNumber     int64 `json:",string"`
	ResultingTrades []ResultingTrade
}

Buy orders

type ChartData

type ChartData []ChartDataEntry

ChartData holds OHLC data for a period of time at specific resolution

type ChartDataEntry

type ChartDataEntry struct {
	Date            int64
	High            float64
	Low             float64
	Open            float64
	Close           float64
	Volume          float64
	QuoteVolume     float64
	WeightedAverage float64
}

ChartDataEntry holds OHLC data for a specific period of time at a specific resolution

type Currencies

type Currencies map[string]Currency

Currencies holds information about the available currencies

type Currency

type Currency struct {
	Name           string
	TxFee          float64 `json:",string"`
	MinConf        float64
	DepositAddress string
	Disabled       int64
	Delisted       int64
	Frozen         int64
}

Currency holds information about a specific currency

type DailyVolume

type DailyVolume map[string]DailyVolumeEntry

DailyVolume is the 24-hour volume for all markets as well as totals for primary currencies

type DailyVolumeEntry

type DailyVolumeEntry map[string]float64

DailyVolumeEntry is the 24-hour volume for a market

type DailyVolumeEntryTemp

type DailyVolumeEntryTemp map[string]interface{}

DailyVolumeEntryTemp ::::

type DailyVolumeTemp

type DailyVolumeTemp map[string]interface{}

DailyVolumeTemp ::::

type DepositsWithdrawals

type DepositsWithdrawals struct {
	Deposits    []deposit
	Withdrawals []withdrawal
	Adjustments []adjustment
}

DepositsWithdrawals holds the history of deposit and withdrawal

type Error

type Error struct {
	Error string `json:"error"`
}

Error is a domain specific error

type FeeInfo

type FeeInfo struct {
	MakerFee        float64 `json:"makerFee,string"`
	TakerFee        float64 `json:"takerFee,string"`
	ThirtyDayVolume float64 `json:"thirtyDayVolume,string"`
	NextTier        float64 `json:"nextTier,string"`
}

FeeInfo is the maker-taker fee schedule, returns your current trading fees and trailing 30-day volume in BTC.

type LendingHistory

type LendingHistory []LendingHistoryEntry

LendingHistory holds the lending history for a time period

type LendingHistoryEntry

type LendingHistoryEntry struct {
	ID       int64 `json:"id"`
	Currency string
	Rate     float64 `json:",string"`
	Amount   float64 `json:",string"`
	Duration float64 `json:",string"`
	Interest float64 `json:",string"`
	Earned   float64 `json:",string"`
	Open     string
	Close    string
	Fee      float64 `json:",string"`
}

LendingHistoryEntry describes one lending history event

type LoanOffer

type LoanOffer struct {
	Base
	OrderID int64 `json:"orderID"`
}

LoanOffer holds status of a loan offer attempt

type LoanOrder

type LoanOrder struct {
	Rate     float64 `json:",string"`
	Amount   float64 `json:",string"`
	RangeMin float64
	RangeMax float64
}

LoanOrder holds the a loan offer/demand for a given currency

type LoanOrders

type LoanOrders struct {
	Offers  []LoanOrder
	Demands []LoanOrder
}

LoanOrders holds the list of loan offers and demands for a given currency

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"`
}

MarginAccountSummary holds a summary of your entire margin account.

type MarginPosition

type MarginPosition struct {
	Amount           float64 `json:",string"`
	Total            float64 `json:",string"`
	BasePrice        float64 `json:",string"`
	LiquidationPrice float64 `json:",string"`
	PL               float64 `json:",string"`
	LendingFees      float64 `json:",string"`
	Type             string
}

MarginPosition of a pair

type MoveOrder

type MoveOrder struct {
	Base
	OrderNumber     int64 `json:",string"`
	ResultingTrades []ResultingTrade
}

MoveOrder status

type OpenLoanOffer

type OpenLoanOffer struct {
	ID        int64   `json:"id"`
	Rate      float64 `json:",string"`
	Amount    float64 `json:",string"`
	Duration  int64
	Renewable bool
	AutoRenew int64 `json:"autoRenew"`
	Date      string
	DateTaken time.Time
}

OpenLoanOffer holds your open loan offers for a single currency.

type OpenLoanOffers

type OpenLoanOffers map[string][]OpenLoanOffer

OpenLoanOffers holds your open loan offers for each currency.

type OpenOrder

type OpenOrder struct {
	OrderNumber    int64 `json:",string"`
	Type           string
	Rate           float64 `json:",string"`
	StartingAmount float64 `json:",string"`
	Amount         float64 `json:",string"`
	Total          float64 `json:",string"`
	Date           string
	Margin         bool
}

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 OpenOrdersAll

type OpenOrdersAll map[string]OpenOrders

OpenOrdersAll is used for all pairs

type Order

type Order struct {
	Rate   float64
	Amount float64
}

Order for a given trade

type OrderBook

type OrderBook struct {
	Asks     []Order
	Bids     []Order
	IsFrozen bool
	Seq      int64 `json:"seq"`
}

OrderBook for a given market

Example
p := NewPublicOnly()
ob, err := p.OrderBook("BTC_ETH")
if err != nil {
	log.Fatalln(err)
}
pp.Println(ob.Asks[0], ob.Bids[0])
Output:

type OrderBookAll

type OrderBookAll map[string]OrderBook

OrderBookAll holds the OrderBooks for all markets

type OrderBookAllTemp

type OrderBookAllTemp map[string]OrderBookTemp

OrderBookAllTemp ::::

type OrderBookTemp

type OrderBookTemp struct {
	Asks     []OrderTemp
	Bids     []OrderTemp
	IsFrozen interface{}
}

OrderBookTemp ::::

type OrderStatus

type OrderStatus struct {
	Status         string
	Rate           float64 `json:",string"`
	Amount         float64 `json:",string"`
	Pair           string  `json:"currencyPair"`
	Date           string
	Total          float64 `json:",string"`
	Type           string
	StartingAmount float64 `json:"startingAmount,string"`
}

OrderStatus holds the status of a given order

type OrderTemp

type OrderTemp []interface{}

OrderTemp ::::

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"`
}

OrderTrade holds a singular trade involved in a given order

type OrderTrades

type OrderTrades []OrderTrade

OrderTrades holds all trades involving a given order,

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

Example
p := NewWithCredentials("Key goes here", "secret goes here")
p.Subscribe("ticker")
p.Subscribe("USDT_BTC")

p.On("ticker", func(m WSTicker) {
	pp.Println(m)
}).On("USDT_BTC-trade", func(m WSOrderbook) {
	pp.Println(m)
})

select {}
Output:

func New

func New(configfile string) *Poloniex

New is the legacy way to create a new client, here just to maintain api

func NewPublicOnly

func NewPublicOnly() *Poloniex

NewPublicOnly allows the use of the public and websocket api only

func NewWithConfig

func NewWithConfig(configfile string) *Poloniex

NewWithConfig is the replacement function for New, pass in a configfile to use

func NewWithCredentials

func NewWithCredentials(key, secret string) *Poloniex

NewWithCredentials allows to pass in the key and secret directly

func (*Poloniex) AccountBalances

func (p *Poloniex) AccountBalances() (balances AccountBalances, err error)

AccountBalances beturns your balances sorted by account.

func (*Poloniex) ActiveLoans

func (p *Poloniex) ActiveLoans() (activeLoans ActiveLoans, err error)

ActiveLoans returns your active loans for each currency.

func (*Poloniex) Addresses

func (p *Poloniex) Addresses() (addresses Addresses, err error)

Addresses returns all of your deposit addresses

func (*Poloniex) AvailableAccountBalances

func (p *Poloniex) AvailableAccountBalances() (aab AvailableAccountBalances, err error)

AvailableAccountBalances returns your balances sorted by account.

func (*Poloniex) Balances

func (p *Poloniex) Balances() (balances Balances, err error)

Balances returns all of your balances available for trade after having deducted all open orders.

func (*Poloniex) Buy

func (p *Poloniex) Buy(pair string, rate, amount float64) (buy Buy, err error)

Buy places a limit buy order in a given market.

func (*Poloniex) BuyFillKill

func (p *Poloniex) BuyFillKill(pair string, rate, amount float64) (buy Buy, err error)

BuyFillKill places a limit buy order in a given market. If the order is not immediately entirely filled, the order is killed

func (*Poloniex) BuyImmediateOrCancel

func (p *Poloniex) BuyImmediateOrCancel(pair string, rate, amount float64) (buy Buy, err error)

BuyImmediateOrCancel places a limit buy order in a given market. This order can be partially or completely filled, but any portion of the order that cannot be filled immediately will be canceled

func (*Poloniex) BuyPostOnly

func (p *Poloniex) BuyPostOnly(pair string, rate, amount float64) (buy Buy, err error)

BuyPostOnly places a limit buy order in a given market the order is only placed if no portion of the order is filled immediately

func (*Poloniex) CancelLoanOffer

func (p *Poloniex) CancelLoanOffer(orderNumber int64) (success bool, err error)

CancelLoanOffer cancels the loan offer specified .

func (*Poloniex) CancelOrder

func (p *Poloniex) CancelOrder(orderNumber int64) (success bool, err error)

CancelOrder cancels an order you have placed in a given market

func (*Poloniex) ChartData

func (p *Poloniex) ChartData(pair string) (chartData ChartData, err error)

ChartData returns OHLC chart data for the last 24 hour period at 5 minute resolution.

func (*Poloniex) ChartDataCurrent

func (p *Poloniex) ChartDataCurrent(pair string) (chartData ChartData, err error)

ChartDataCurrent returns OHLC chart data for the last period at 5 minute resolution.

func (*Poloniex) ChartDataPeriod

func (p *Poloniex) ChartDataPeriod(pair string, start, end time.Time, period ...int) (chartData ChartData, err error)

ChartDataPeriod returns OHLC chart data for the specified period at a specified ersolution (default 5 minute resolution).

func (*Poloniex) CloseMarginPosition

func (p *Poloniex) CloseMarginPosition(pair string) (success bool, err error)

CloseMarginPosition closes a margin position

func (*Poloniex) Currencies

func (p *Poloniex) Currencies() (currencies Currencies, err error)

Currencies returns information about currencies.

func (*Poloniex) DailyVolume

func (p *Poloniex) DailyVolume() (dailyVolume DailyVolume, err error)

DailyVolume returns the 24-hour volume for all markets as well as totals for primary currencies

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)

DepositsWithdrawals returns your deposit and withdrawal history for the last 6 months,

func (*Poloniex) Emit

func (p *Poloniex) Emit(event interface{}, arguments ...interface{}) *emission.Emitter

Emit emits an event

func (*Poloniex) FeeInfo

func (p *Poloniex) FeeInfo() (fi FeeInfo, err error)

FeeInfo returns your current trading fees and trailing 30-day volume in BTC

func (*Poloniex) GenerateNewAddress

func (p *Poloniex) GenerateNewAddress(currency string) (address string, err error)

GenerateNewAddress generates a new deposit address for the currency specified

func (*Poloniex) LendingHistory

func (p *Poloniex) LendingHistory(start, end int64, limit int64) (lh LendingHistory, err error)

LendingHistory returns the lending history for a specified date range

func (*Poloniex) LoanOffer

func (p *Poloniex) LoanOffer(currency string, amount float64, duration int, renew bool, lendingRate float64) (loanOffer LoanOffer, err error)

LoanOffer creates a loan offer for a given currency.

func (*Poloniex) LoanOrders

func (p *Poloniex) LoanOrders(currency string) (loanOrders LoanOrders, err error)

LoanOrders returns the list of loan offers and demands for a given currency,

func (*Poloniex) MarginAccountSummary

func (p *Poloniex) MarginAccountSummary() (mas MarginAccountSummary, err error)

MarginAccountSummary returns a summary of your entire margin account

func (*Poloniex) MarginBuy

func (p *Poloniex) MarginBuy(pair string, rate float64, lendingRate float64, amount float64, clientOrderIDs ...string) (buy Buy, err error)

MarginBuy enters a buy order into the margin markets

func (*Poloniex) MarginPosition

func (p *Poloniex) MarginPosition(pair string) (mp MarginPosition, err error)

MarginPosition returns margin position info for a pair

func (*Poloniex) MarginSell

func (p *Poloniex) MarginSell(pair string, rate float64, lendingRate float64, amount float64, clientOrderIDs ...string) (sell Sell, err error)

MarginSell enters a sell order into the margin markets

func (*Poloniex) Move

func (p *Poloniex) Move(orderNumber int64, rate float64) (moveOrder MoveOrder, err error)

Move cancels an order and places a new one of the same type in a single atomic transaction, meaning either both operations will succeed or both will fail.

func (*Poloniex) MoveImmediateOrCancel

func (p *Poloniex) MoveImmediateOrCancel(orderNumber int64, rate float64) (moveOrder MoveOrder, err error)

MoveImmediateOrCancel cancels an order and places a new one of the same type in a single atomic transaction, meaning either both operations will succeed or both will fail. This order can be partially or completely filled, but any portion of the order that cannot be filled immediately will be canceled

func (*Poloniex) MovePostOnly

func (p *Poloniex) MovePostOnly(orderNumber int64, rate float64) (moveOrder MoveOrder, err error)

MovePostOnly cancels an order and places a new one of the same type in a single atomic transaction, meaning either both operations will succeed or both will fail. the order is only placed if no portion of the order is filled immediately

func (*Poloniex) Off

func (p *Poloniex) Off(event interface{}, listener interface{}) *emission.Emitter

Off removes a listener for an event

func (*Poloniex) On

func (p *Poloniex) On(event interface{}, listener interface{}) *emission.Emitter

On adds a listener to a specific event

func (*Poloniex) OpenLoanOffers

func (p *Poloniex) OpenLoanOffers() (openLoanOffers OpenLoanOffers, err error)

OpenLoanOffers returns your open loan offers for each currency.

func (*Poloniex) OpenOrders

func (p *Poloniex) OpenOrders(pair string) (openOrders OpenOrders, err error)

OpenOrders returns your open orders for a given market

func (*Poloniex) OpenOrdersAll

func (p *Poloniex) OpenOrdersAll() (openOrders OpenOrdersAll, err error)

OpenOrdersAll returns your open orders for all markets

func (*Poloniex) OrderBook

func (p *Poloniex) OrderBook(pair string) (orderBook OrderBook, err error)

OrderBook returns the order book for a given market, as well as a sequence number used by websockets for synchronization of book updates and an indicator specifying whether the market is frozen.

func (*Poloniex) OrderBookAll

func (p *Poloniex) OrderBookAll() (orderBook OrderBookAll, err error)

OrderBookAll returns the order book for all markets, as well as a sequence number used by websockets for synchronization of book updates and an indicator specifying whether the market is frozen.

func (*Poloniex) OrderStatus

func (p *Poloniex) OrderStatus(orderNumber int64) (os OrderStatus, err error)

OrderStatus returns the status of an individual order

func (*Poloniex) OrderTrades

func (p *Poloniex) OrderTrades(orderNumber int64) (ot OrderTrades, err error)

OrderTrades returns all trades involving a given order,

func (*Poloniex) PrivateTradeHistory

func (p *Poloniex) PrivateTradeHistory(pair string, dates ...int64) (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(dates ...int64) (history PrivateTradeHistoryAll, err error)

PrivateTradeHistoryAll takes 2 unix timestamps as the start and end date period for the request.

func (*Poloniex) Sell

func (p *Poloniex) Sell(pair string, rate, amount float64) (sell Sell, err error)

Sell places a limit sell order in a given market.

func (*Poloniex) SellFillKill

func (p *Poloniex) SellFillKill(pair string, rate, amount float64) (sell Sell, err error)

SellFillKill places a limit sell order in a given market. If the order is not immediately entirely filled, the order is killed

func (*Poloniex) SellImmediateOrCancel

func (p *Poloniex) SellImmediateOrCancel(pair string, rate, amount float64) (sell Sell, err error)

SellImmediateOrCancel places a limit sell order in a given market. This order can be partially or completely filled, but any portion of the order that cannot be filled immediately will be canceled

func (*Poloniex) SellPostOnly

func (p *Poloniex) SellPostOnly(pair string, rate, amount float64) (sell Sell, err error)

SellPostOnly places a limit sell order in a given market the order is only placed if no portion of the order is filled immediately

func (*Poloniex) StartWS

func (p *Poloniex) StartWS()

StartWS opens the websocket connection, and waits for message events

func (*Poloniex) Subscribe

func (p *Poloniex) Subscribe(chid string) error

Subscribe to a particular channel specified by channel id: 1000 Private Account Notifications (Beta) 1002 Public Ticker Data 1003 Public 24 Hour Exchange Volume 1010 Public Heartbeat <currency pair> Public Price Aggregated Book

func (*Poloniex) Ticker

func (p *Poloniex) Ticker() (ticker Ticker, err error)

Ticker retrieves summary information for each currency pair listed on the exchange.

func (*Poloniex) ToggleAutoRenew

func (p *Poloniex) ToggleAutoRenew(orderNumber int64) (success bool, err error)

ToggleAutoRenew toggles the autoRenew setting on an active loan,

func (*Poloniex) TradableBalances

func (p *Poloniex) TradableBalances() (tb TradableBalances, err error)

TradableBalances returns your current tradable balances for each currency in each market for which margin trading is enabled

func (*Poloniex) TradeHistory

func (p *Poloniex) TradeHistory(pair string, dates ...int64) (tradeHistory TradeHistory, err error)

TradeHistory returns the past 200 trades for a given market, or up to 50,000 trades between a range specified in UNIX timestamps by the "start" and "end" GET parameters.

If a single date is passed then that is used as the startdate, and current date is used for the enddate. A startdate and enddate may be passed to select a specific period.

func (*Poloniex) TransferBalance

func (p *Poloniex) TransferBalance(currency string, amount float64, from string, to string) (tb TransferBalance, err error)

TransferBalance transfers funds from one account to another (e.g. from your exchange account to your margin account).

func (*Poloniex) Unsubscribe

func (p *Poloniex) Unsubscribe(chid string) error

Unsubscribe from the specified channel: 1000 Private Account Notifications (Beta) 1002 Public Ticker Data 1003 Public 24 Hour Exchange Volume 1010 Public Heartbeat <currency pair> Public Price Aggregated Book

func (*Poloniex) WSIdle

func (p *Poloniex) WSIdle(dur time.Duration, callbacks ...WSReportFunc)

WSIdle idles whilst waiting for callbacks

func (*Poloniex) Withdraw

func (p *Poloniex) Withdraw(currency string, amount float64, address string) (w Withdraw, err error)

Withdraw immediately places a withdrawal for a given currency, with no email confirmation. In order to use this method, withdrawal privilege must be enabled for your API key.

type PrivateTradeHistory

type PrivateTradeHistory []PrivateTradeHistoryEntry

PrivateTradeHistory holds your trade history for a given market,

type PrivateTradeHistoryAll

type PrivateTradeHistoryAll map[string]PrivateTradeHistory

PrivateTradeHistoryAll holds the trade histories of all markets

type PrivateTradeHistoryEntry

type PrivateTradeHistoryEntry struct {
	Date          string
	Rate          float64 `json:",string"`
	Amount        float64 `json:",string"`
	Total         float64 `json:",string"`
	OrderNumber   int64   `json:",string"`
	Type          string
	GlobalTradeID int64   `json:"globalTradeID"`
	TradeID       int64   `json:"tradeID"`
	Fee           float64 `json:",string"`
	Category      string
}

PrivateTradeHistoryEntry holds a singular trade history event

type ResultingTrade

type ResultingTrade struct {
	Amount        float64 `json:",string"`
	Rate          float64 `json:",string"`
	Date          string
	Total         float64 `json:",string"`
	TradeID       string  `json:"tradeID"`
	Type          string
	Fee           float64 `json:",string"`
	Pair          string  `json:"currencyPair"`
	ClientOrderID string  `json:"clientOrderId"`
}

ResultingTrade which form part of an order

type Sell

type Sell struct {
	Buy
}

Sell order

type Ticker

type Ticker map[string]TickerEntry

Ticker is summary information for all currency pairs

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"`
	High        float64 `json:"high24hr,string"`
	Low         float64 `json:"low24hr,string"`
	ID          int64   `json:"id"`
}

TickerEntry is summary information for a currency pair

type TradableBalance

type TradableBalance map[string]float64

TradableBalance holds your current tradable balances for the two currencies in a single market for which margin trading is enabled.

type TradableBalances

type TradableBalances map[string]TradableBalance

TradableBalances holds your current tradable balances for each currency in each market for which margin trading is enabled.

type TradeHistory

type TradeHistory []TradeHistoryEntry

TradeHistory holds the historical trades for a given market

type TradeHistoryEntry

type TradeHistoryEntry struct {
	ID      int64 `json:"globalTradeID"`
	TradeID int64 `json:"tradeID"`
	Date    string
	Type    string
	Rate    float64 `json:",string"`
	Amount  float64 `json:",string"`
	Total   float64 `json:",string"`
}

TradeHistoryEntry holds an individual historical order

type TransferBalance

type TransferBalance struct {
	Base
	Message string `json:"message"`
}

TransferBalance holds status of a balance transfer.

type WSOrderbook

type WSOrderbook struct {
	Pair    string
	Event   string
	TradeID int64
	Type    string
	Rate    float64
	Amount  float64
	Total   float64
	TS      time.Time
}

WSOrderbook ::::

type WSReportFunc

type WSReportFunc = func(time.Time)

WSReportFunc is used whilst idling

type WSTicker

type WSTicker struct {
	Pair          string
	Last          float64
	Ask           float64
	Bid           float64
	PercentChange float64
	BaseVolume    float64
	QuoteVolume   float64
	IsFrozen      bool
	DailyHigh     float64
	DailyLow      float64
	PairID        int64
}

WSTicker describes a ticker item

type Withdraw

type Withdraw struct {
	Base
}

Withdraw status

Jump to

Keyboard shortcuts

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