poloniex

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2020 License: MIT Imports: 30 Imported by: 0

README

GoCryptoTrader package Poloniex

Build Status Software License GoDoc Coverage Status Go Report Card

This poloniex package is part of the GoCryptoTrader codebase.

This is still in active development

You can track ideas, planned features and what's in progress on this Trello board: https://trello.com/b/ZAhMhpOy/gocryptotrader.

Join our slack to discuss all things related to GoCryptoTrader! GoCryptoTrader Slack

Poloniex Exchange

Current Features
  • REST Support
  • Websocket Support
How to enable
  // Exchanges will be abstracted out in further updates and examples will be
  // supplied then
How to do REST public/private calls
  • If enabled via "configuration".json file the exchange will be added to the IBotExchange array in the go var bot Bot and you will only be able to use the wrapper interface functions for accessing exchange data. View routines.go for an example of integration usage with GoCryptoTrader. Rudimentary example below:

main.go

var p exchange.IBotExchange

for i := range bot.Exchanges {
  if bot.Exchanges[i].GetName() == "Poloniex" {
    y = bot.Exchanges[i]
  }
}

// Public calls - wrapper functions

// Fetches current ticker information
tick, err := p.FetchTicker()
if err != nil {
  // Handle error
}

// Fetches current orderbook information
ob, err := p.FetchOrderbook()
if err != nil {
  // Handle error
}

// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
// set and AuthenticatedAPISupport is set to true

// Fetches current account information
accountInfo, err := p.GetAccountInfo()
if err != nil {
  // Handle error
}
  • If enabled via individually importing package, rudimentary example below:
// Public calls

// Fetches current ticker information
ticker, err := p.GetTicker()
if err != nil {
  // Handle error
}

// Fetches current orderbook information
ob, err := p.GetOrderbook()
if err != nil {
  // Handle error
}

// Private calls - make sure your APIKEY and APISECRET are set and
// AuthenticatedAPISupport is set to true

// Cancels current account order
accountInfo, err := p.CancelOrder()
if err != nil {
  // Handle error
}

// Submits an order and the exchange and returns its tradeID
tradeID, err := p.PlaceOrder(...)
if err != nil {
  // Handle error
}
How to do Websocket public/private calls
  // Exchanges will be abstracted out in further updates and examples will be
  // supplied then
Please click GoDocs chevron above to view current GoDoc information for this package

Contribution

Please feel free to submit any pull requests or suggest any desired features to be added.

When submitting a PR, please abide by our coding guidelines:

  • Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
  • Code must be documented adhering to the official Go commentary guidelines.
  • Code must adhere to our coding style.
  • Pull requests need to be based on and opened against the master branch.

Donations

If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:

bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WithdrawalFees = map[currency.Code]float64{
	currency.ZRX:   5,
	currency.ARDR:  2,
	currency.REP:   0.1,
	currency.BTC:   0.0005,
	currency.BCH:   0.0001,
	currency.XBC:   0.0001,
	currency.BTCD:  0.01,
	currency.BTM:   0.01,
	currency.BTS:   5,
	currency.BURST: 1,
	currency.BCN:   1,
	currency.CVC:   1,
	currency.CLAM:  0.001,
	currency.XCP:   1,
	currency.DASH:  0.01,
	currency.DCR:   0.1,
	currency.DGB:   0.1,
	currency.DOGE:  5,
	currency.EMC2:  0.01,
	currency.EOS:   0,
	currency.ETH:   0.01,
	currency.ETC:   0.01,
	currency.EXP:   0.01,
	currency.FCT:   0.01,
	currency.GAME:  0.01,
	currency.GAS:   0,
	currency.GNO:   0.015,
	currency.GNT:   1,
	currency.GRC:   0.01,
	currency.HUC:   0.01,
	currency.LBC:   0.05,
	currency.LSK:   0.1,
	currency.LTC:   0.001,
	currency.MAID:  10,
	currency.XMR:   0.015,
	currency.NMC:   0.01,
	currency.NAV:   0.01,
	currency.XEM:   15,
	currency.NEOS:  0.0001,
	currency.NXT:   1,
	currency.OMG:   0.3,
	currency.OMNI:  0.1,
	currency.PASC:  0.01,
	currency.PPC:   0.01,
	currency.POT:   0.01,
	currency.XPM:   0.01,
	currency.XRP:   0.15,
	currency.SC:    10,
	currency.STEEM: 0.01,
	currency.SBD:   0.01,
	currency.XLM:   0.00001,
	currency.STORJ: 1,
	currency.STRAT: 0.01,
	currency.AMP:   5,
	currency.SYS:   0.01,
	currency.USDT:  10,
	currency.VRC:   0.01,
	currency.VTC:   0.001,
	currency.VIA:   0.01,
	currency.ZEC:   0.001,
}

WithdrawalFees the large list of predefined withdrawal fees Prone to change, using highest value

Functions

This section is empty.

Types

type ActiveLoans

type ActiveLoans struct {
	Provided []LoanOffer `json:"provided"`
	Used     []LoanOffer `json:"used"`
}

ActiveLoans shows the full active loans on the exchange

type AuthenticatedTradeHistory

type AuthenticatedTradeHistory struct {
	GlobalTradeID int64   `json:"globalTradeID"`
	TradeID       int64   `json:"tradeID,string"`
	Date          string  `json:"date"`
	Rate          float64 `json:"rate,string"`
	Amount        float64 `json:"amount,string"`
	Total         float64 `json:"total,string"`
	Fee           float64 `json:"fee,string"`
	OrderNumber   int64   `json:"orderNumber,string"`
	Type          string  `json:"type"`
	Category      string  `json:"category"`
}

AuthenticatedTradeHistory holds client trade history information

type AuthenticatedTradeHistoryAll

type AuthenticatedTradeHistoryAll struct {
	Data map[string][]AuthenticatedTradeHistory
}

AuthenticatedTradeHistoryAll holds the full client trade history

type AuthenticatedTradeHistoryResponse

type AuthenticatedTradeHistoryResponse struct {
	Data []AuthenticatedTradeHistory
}

AuthenticatedTradeHistoryResponse is a response type for trade history

type Balance

type Balance struct {
	Currency map[string]float64
}

Balance holds data for a range of currencies

type ChartData

type ChartData struct {
	Date            int64   `json:"date"`
	High            float64 `json:"high"`
	Low             float64 `json:"low"`
	Open            float64 `json:"open"`
	Close           float64 `json:"close"`
	Volume          float64 `json:"volume"`
	QuoteVolume     float64 `json:"quoteVolume"`
	WeightedAverage float64 `json:"weightedAverage"`
	Error           string  `json:"error"`
}

ChartData holds kline data

type CompleteBalance

type CompleteBalance struct {
	Available float64
	OnOrders  float64
	BTCValue  float64
}

CompleteBalance contains the complete balance with a btcvalue

type CompleteBalances

type CompleteBalances struct {
	Currency map[string]CompleteBalance
}

CompleteBalances holds the full balance data

type Currencies

type Currencies struct {
	ID                 float64     `json:"id"`
	Name               string      `json:"name"`
	MaxDailyWithdrawal string      `json:"maxDailyWithdrawal"`
	TxFee              float64     `json:"txFee,string"`
	MinConfirmations   int64       `json:"minConf"`
	DepositAddresses   interface{} `json:"depositAddress"`
	Disabled           int64       `json:"disabled"`
	Delisted           int64       `json:"delisted"`
	Frozen             int64       `json:"frozen"`
}

Currencies contains currency information

type DepositAddresses

type DepositAddresses struct {
	Addresses map[string]string
}

DepositAddresses holds the full address per crypto-currency

type DepositsWithdrawals

type DepositsWithdrawals struct {
	Deposits []struct {
		Currency      string  `json:"currency"`
		Address       string  `json:"address"`
		Amount        float64 `json:"amount,string"`
		Confirmations int64   `json:"confirmations"`
		TransactionID string  `json:"txid"`
		Timestamp     int64   `json:"timestamp"`
		Status        string  `json:"status"`
	} `json:"deposits"`
	Withdrawals []struct {
		WithdrawalNumber int64   `json:"withdrawalNumber"`
		Currency         string  `json:"currency"`
		Address          string  `json:"address"`
		Amount           float64 `json:"amount,string"`
		Confirmations    int64   `json:"confirmations"`
		TransactionID    string  `json:"txid"`
		Timestamp        int64   `json:"timestamp"`
		Status           string  `json:"status"`
		IPAddress        string  `json:"ipAddress"`
	} `json:"withdrawals"`
}

DepositsWithdrawals holds withdrawal information

type Fee

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

Fee holds fees for specific trades

type GenericResponse

type GenericResponse struct {
	Success int64  `json:"success"`
	Error   string `json:"error"`
}

GenericResponse is a response type for exchange generic responses

type LendingHistory

type LendingHistory struct {
	ID       int64   `json:"id"`
	Currency string  `json:"currency"`
	Rate     float64 `json:"rate,string"`
	Amount   float64 `json:"amount,string"`
	Duration float64 `json:"duration,string"`
	Interest float64 `json:"interest,string"`
	Fee      float64 `json:"fee,string"`
	Earned   float64 `json:"earned,string"`
	Open     string  `json:"open"`
	Close    string  `json:"close"`
}

LendingHistory holds the full lending history data

type LoanOffer

type LoanOffer struct {
	ID        int64   `json:"id"`
	Rate      float64 `json:"rate,string"`
	Amount    float64 `json:"amount,string"`
	Duration  int64   `json:"duration"`
	AutoRenew bool    `json:"autoRenew"`
	Date      string  `json:"date"`
}

LoanOffer holds loan offer information

type LoanOrder

type LoanOrder struct {
	Rate     float64 `json:"rate,string"`
	Amount   float64 `json:"amount,string"`
	RangeMin int64   `json:"rangeMin"`
	RangeMax int64   `json:"rangeMax"`
}

LoanOrder holds loan order information

type LoanOrders

type LoanOrders struct {
	Offers  []LoanOrder `json:"offers"`
	Demands []LoanOrder `json:"demands"`
}

LoanOrders holds loan order information range

type Margin

type Margin struct {
	TotalValue    float64 `json:"totalValue,string"`
	ProfitLoss    float64 `json:"pl,string"`
	LendingFees   float64 `json:"lendingFees,string"`
	NetValue      float64 `json:"netValue,string"`
	BorrowedValue float64 `json:"totalBorrowedValue,string"`
	CurrentMargin float64 `json:"currentMargin,string"`
}

Margin holds margin information

type MarginPosition

type MarginPosition struct {
	Amount           float64 `json:"amount,string"`
	Total            float64 `json:"total,string"`
	BasePrice        float64 `json:"basePrice,string"`
	LiquidationPrice float64 `json:"liquidationPrice"`
	ProfitLoss       float64 `json:"pl,string"`
	LendingFees      float64 `json:"lendingFees,string"`
	Type             string  `json:"type"`
}

MarginPosition holds margin positional information

type MoveOrderResponse

type MoveOrderResponse struct {
	Success     int64                        `json:"success"`
	Error       string                       `json:"error"`
	OrderNumber int64                        `json:"orderNumber,string"`
	Trades      map[string][]ResultingTrades `json:"resultingTrades"`
}

MoveOrderResponse is a response type for move order trades

type OpenOrdersResponse

type OpenOrdersResponse struct {
	Data []Order
}

OpenOrdersResponse holds open response orders

type OpenOrdersResponseAll

type OpenOrdersResponseAll struct {
	Data map[string][]Order
}

OpenOrdersResponseAll holds all open order responses

type Order

type Order struct {
	OrderNumber int64   `json:"orderNumber,string"`
	Type        string  `json:"type"`
	Rate        float64 `json:"rate,string"`
	Amount      float64 `json:"amount,string"`
	Total       float64 `json:"total,string"`
	Date        string  `json:"date"`
	Margin      float64 `json:"margin"`
}

Order hold order information

type OrderResponse

type OrderResponse struct {
	OrderNumber int64             `json:"orderNumber,string"`
	Trades      []ResultingTrades `json:"resultingTrades"`
}

OrderResponse is a response type of trades

type Orderbook

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

Orderbook is a generic type golding orderbook information

type OrderbookAll

type OrderbookAll struct {
	Data map[string]Orderbook
}

OrderbookAll contains the full range of orderbooks

type OrderbookItem

type OrderbookItem struct {
	Price  float64
	Amount float64
}

OrderbookItem holds data on an individual item

type OrderbookResponse

type OrderbookResponse struct {
	Asks     [][]interface{} `json:"asks"`
	Bids     [][]interface{} `json:"bids"`
	IsFrozen string          `json:"isFrozen"`
	Error    string          `json:"error"`
}

OrderbookResponse is a sub-type for orderbooks

type OrderbookResponseAll

type OrderbookResponseAll struct {
	Data map[string]OrderbookResponse
}

OrderbookResponseAll holds the full response type orderbook

type Poloniex

type Poloniex struct {
	exchange.Base
}

Poloniex is the overarching type across the poloniex package

func (*Poloniex) CancelAllOrders

func (p *Poloniex) CancelAllOrders(_ *order.Cancel) (order.CancelAllResponse, error)

CancelAllOrders cancels all orders associated with a currency pair

func (*Poloniex) CancelExistingOrder

func (p *Poloniex) CancelExistingOrder(orderID int64) error

CancelExistingOrder cancels and order by orderID

func (*Poloniex) CancelLoanOffer

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

CancelLoanOffer cancels a loan offer order

func (*Poloniex) CancelOrder

func (p *Poloniex) CancelOrder(order *order.Cancel) error

CancelOrder cancels an order by its corresponding ID number

func (*Poloniex) CloseMarginPosition

func (p *Poloniex) CloseMarginPosition(currency string) (bool, error)

CloseMarginPosition closes a current margin position

func (*Poloniex) CreateLoanOffer

func (p *Poloniex) CreateLoanOffer(currency string, amount, rate float64, duration int, autoRenew bool) (int64, error)

CreateLoanOffer places a loan offer on the exchange

func (*Poloniex) FetchAccountInfo

func (p *Poloniex) FetchAccountInfo() (account.Holdings, error)

FetchAccountInfo retrieves balances for all enabled currencies

func (*Poloniex) FetchOrderbook

func (p *Poloniex) FetchOrderbook(currencyPair currency.Pair, assetType asset.Item) (*orderbook.Base, error)

FetchOrderbook returns orderbook base on the currency pair

func (*Poloniex) FetchTicker

func (p *Poloniex) FetchTicker(currencyPair currency.Pair, assetType asset.Item) (*ticker.Price, error)

FetchTicker returns the ticker for a currency pair

func (*Poloniex) FetchTradablePairs

func (p *Poloniex) FetchTradablePairs(asset asset.Item) ([]string, error)

FetchTradablePairs returns a list of the exchanges tradable pairs

func (*Poloniex) GenerateDefaultSubscriptions

func (p *Poloniex) GenerateDefaultSubscriptions() ([]stream.ChannelSubscription, error)

GenerateDefaultSubscriptions Adds default subscriptions to websocket to be handled by ManageSubscriptions()

func (*Poloniex) GenerateNewAddress

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

GenerateNewAddress generates a new address for a currency

func (*Poloniex) GetActiveLoans

func (p *Poloniex) GetActiveLoans() (ActiveLoans, error)

GetActiveLoans returns active loans

func (*Poloniex) GetActiveOrders

func (p *Poloniex) GetActiveOrders(req *order.GetOrdersRequest) ([]order.Detail, error)

GetActiveOrders retrieves any orders that are active/open

func (*Poloniex) GetAuthenticatedTradeHistory

func (p *Poloniex) GetAuthenticatedTradeHistory(start, end, limit int64) (AuthenticatedTradeHistoryAll, error)

GetAuthenticatedTradeHistory returns account trade history

func (*Poloniex) GetAuthenticatedTradeHistoryForCurrency

func (p *Poloniex) GetAuthenticatedTradeHistoryForCurrency(currency string, start, end, limit int64) (AuthenticatedTradeHistoryResponse, error)

GetAuthenticatedTradeHistoryForCurrency returns account trade history

func (*Poloniex) GetBalances

func (p *Poloniex) GetBalances() (Balance, error)

GetBalances returns balances for your account.

func (*Poloniex) GetChartData

func (p *Poloniex) GetChartData(currencyPair string, start, end time.Time, period string) ([]ChartData, error)

GetChartData returns chart data for a specific currency pair

func (*Poloniex) GetCompleteBalances

func (p *Poloniex) GetCompleteBalances() (CompleteBalances, error)

GetCompleteBalances returns complete balances from your account.

func (*Poloniex) GetCurrencies

func (p *Poloniex) GetCurrencies() (map[string]Currencies, error)

GetCurrencies returns information about currencies

func (*Poloniex) GetDefaultConfig

func (p *Poloniex) GetDefaultConfig() (*config.ExchangeConfig, error)

GetDefaultConfig returns a default exchange config

func (*Poloniex) GetDepositAddress

func (p *Poloniex) GetDepositAddress(cryptocurrency currency.Code, _ string) (string, error)

GetDepositAddress returns a deposit address for a specified currency

func (*Poloniex) GetDepositAddresses

func (p *Poloniex) GetDepositAddresses() (DepositAddresses, error)

GetDepositAddresses returns deposit addresses for all enabled cryptos.

func (*Poloniex) GetDepositsWithdrawals

func (p *Poloniex) GetDepositsWithdrawals(start, end string) (DepositsWithdrawals, error)

GetDepositsWithdrawals returns a list of deposits and withdrawals

func (*Poloniex) GetExchangeHistory

func (p *Poloniex) GetExchangeHistory(currencyPair currency.Pair, assetType asset.Item, timestampStart, timestampEnd time.Time) ([]exchange.TradeHistory, error)

GetExchangeHistory returns historic trade data within the timeframe provided.

func (*Poloniex) GetFee

func (p *Poloniex) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error)

GetFee returns an estimate of fee based on type of transaction

func (*Poloniex) GetFeeByType

func (p *Poloniex) GetFeeByType(feeBuilder *exchange.FeeBuilder) (float64, error)

GetFeeByType returns an estimate of fee based on type of transaction

func (*Poloniex) GetFeeInfo

func (p *Poloniex) GetFeeInfo() (Fee, error)

GetFeeInfo returns fee information

func (*Poloniex) GetFundingHistory

func (p *Poloniex) GetFundingHistory() ([]exchange.FundHistory, error)

GetFundingHistory returns funding history, deposits and withdrawals

func (*Poloniex) GetHistoricCandles

func (p *Poloniex) GetHistoricCandles(pair currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error)

GetHistoricCandles returns candles between a time period for a set time interval

func (*Poloniex) GetHistoricCandlesExtended

func (p *Poloniex) GetHistoricCandlesExtended(pair currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error)

GetHistoricCandlesExtended returns candles between a time period for a set time interval

func (*Poloniex) GetLendingHistory

func (p *Poloniex) GetLendingHistory(start, end string) ([]LendingHistory, error)

GetLendingHistory returns lending history for the account

func (*Poloniex) GetLoanOrders

func (p *Poloniex) GetLoanOrders(currency string) (LoanOrders, error)

GetLoanOrders returns the list of loan offers and demands for a given currency, specified by the "currency" GET parameter.

func (*Poloniex) GetMarginAccountSummary

func (p *Poloniex) GetMarginAccountSummary() (Margin, error)

GetMarginAccountSummary returns a summary on your margin accounts

func (*Poloniex) GetMarginPosition

func (p *Poloniex) GetMarginPosition(currency string) (interface{}, error)

GetMarginPosition returns a position on a margin order

func (*Poloniex) GetOpenLoanOffers

func (p *Poloniex) GetOpenLoanOffers() (map[string][]LoanOffer, error)

GetOpenLoanOffers returns all open loan offers

func (*Poloniex) GetOpenOrders

func (p *Poloniex) GetOpenOrders(currency string) (OpenOrdersResponse, error)

GetOpenOrders returns current unfilled opened orders

func (*Poloniex) GetOpenOrdersForAllCurrencies

func (p *Poloniex) GetOpenOrdersForAllCurrencies() (OpenOrdersResponseAll, error)

GetOpenOrdersForAllCurrencies returns all open orders

func (*Poloniex) GetOrderHistory

func (p *Poloniex) GetOrderHistory(req *order.GetOrdersRequest) ([]order.Detail, error)

GetOrderHistory retrieves account order information Can Limit response to specific order status

func (*Poloniex) GetOrderHistoryById

func (o *Poloniex) GetOrderHistoryById(getOrdersRequest string) ([]order.Detail, error)

GetOrderHistoryById retrieves specified closed order information Can Limit response to specific order status

func (*Poloniex) GetOrderInfo

func (p *Poloniex) GetOrderInfo(orderID string) (order.Detail, error)

GetOrderInfo returns information on a current open order

func (*Poloniex) GetOrderbook

func (p *Poloniex) GetOrderbook(currencyPair string, depth int) (OrderbookAll, error)

GetOrderbook returns the full orderbook from poloniex

func (*Poloniex) GetTicker

func (p *Poloniex) GetTicker() (map[string]Ticker, error)

GetTicker returns current ticker information

func (*Poloniex) GetTradableBalances

func (p *Poloniex) GetTradableBalances() (map[string]map[string]float64, error)

GetTradableBalances returns tradable balances

func (*Poloniex) GetTradeHistory

func (p *Poloniex) GetTradeHistory(currencyPair, start, end string) ([]TradeHistory, error)

GetTradeHistory returns trades history from poloniex

func (*Poloniex) GetVolume

func (p *Poloniex) GetVolume() (interface{}, error)

GetVolume returns a list of currencies with associated volume

func (*Poloniex) ModifyOrder

func (p *Poloniex) ModifyOrder(action *order.Modify) (string, error)

ModifyOrder will allow of changing orderbook placement and limit to market conversion

func (*Poloniex) MoveOrder

func (p *Poloniex) MoveOrder(orderID int64, rate, amount float64, postOnly, immediateOrCancel bool) (MoveOrderResponse, error)

MoveOrder moves an order

func (*Poloniex) PlaceMarginOrder

func (p *Poloniex) PlaceMarginOrder(currency string, rate, amount, lendingRate float64, buy bool) (OrderResponse, error)

PlaceMarginOrder places a margin order

func (*Poloniex) PlaceOrder

func (p *Poloniex) PlaceOrder(currency string, rate, amount float64, immediate, fillOrKill, buy bool) (OrderResponse, error)

PlaceOrder places a new order on the exchange

func (*Poloniex) Run

func (p *Poloniex) Run()

Run implements the Poloniex wrapper

func (*Poloniex) SendAuthenticatedHTTPRequest

func (p *Poloniex) SendAuthenticatedHTTPRequest(method, endpoint string, values url.Values, result interface{}) error

SendAuthenticatedHTTPRequest sends an authenticated HTTP request

func (*Poloniex) SendHTTPRequest

func (p *Poloniex) SendHTTPRequest(path string, result interface{}) error

SendHTTPRequest sends an unauthenticated HTTP request

func (*Poloniex) SetDefaults

func (p *Poloniex) SetDefaults()

SetDefaults sets default settings for poloniex

func (*Poloniex) Setup

func (p *Poloniex) Setup(exch *config.ExchangeConfig) error

Setup sets user exchange configuration settings

func (*Poloniex) Start

func (p *Poloniex) Start(wg *sync.WaitGroup)

Start starts the Poloniex go routine

func (*Poloniex) SubmitOrder

func (p *Poloniex) SubmitOrder(s *order.Submit) (order.SubmitResponse, error)

SubmitOrder submits a new order

func (*Poloniex) Subscribe

func (p *Poloniex) Subscribe(sub []stream.ChannelSubscription) error

Subscribe sends a websocket message to receive data from the channel

func (*Poloniex) ToggleAutoRenew

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

ToggleAutoRenew allows for the autorenew of a contract

func (*Poloniex) TransferBalance

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

TransferBalance transfers balances between your accounts

func (*Poloniex) Unsubscribe

func (p *Poloniex) Unsubscribe(unsub []stream.ChannelSubscription) error

Unsubscribe sends a websocket message to stop receiving data from the channel

func (*Poloniex) UpdateAccountInfo

func (p *Poloniex) UpdateAccountInfo() (account.Holdings, error)

UpdateAccountInfo retrieves balances for all enabled currencies for the Poloniex exchange

func (*Poloniex) UpdateOrderbook

func (p *Poloniex) UpdateOrderbook(currencyPair currency.Pair, assetType asset.Item) (*orderbook.Base, error)

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*Poloniex) UpdateTicker

func (p *Poloniex) UpdateTicker(currencyPair currency.Pair, assetType asset.Item) (*ticker.Price, error)

UpdateTicker updates and returns the ticker for a currency pair

func (*Poloniex) UpdateTradablePairs

func (p *Poloniex) UpdateTradablePairs(forceUpgrade bool) error

UpdateTradablePairs updates the exchanges available pairs and stores them in the exchanges config

func (*Poloniex) ValidateCredentials

func (p *Poloniex) ValidateCredentials() error

ValidateCredentials validates current credentials used for wrapper functionality

func (*Poloniex) Withdraw

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

Withdraw withdraws a currency to a specific delegated address

func (*Poloniex) WithdrawCryptocurrencyFunds

func (p *Poloniex) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted

func (*Poloniex) WithdrawFiatFunds

func (p *Poloniex) WithdrawFiatFunds(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted

func (*Poloniex) WithdrawFiatFundsToInternationalBank

func (p *Poloniex) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted

func (*Poloniex) WsConnect

func (p *Poloniex) WsConnect() error

WsConnect initiates a websocket connection

func (*Poloniex) WsProcessOrderbookSnapshot

func (p *Poloniex) WsProcessOrderbookSnapshot(ob []interface{}, symbol string) error

WsProcessOrderbookSnapshot processes a new orderbook snapshot into a local of orderbooks

func (*Poloniex) WsProcessOrderbookUpdate

func (p *Poloniex) WsProcessOrderbookUpdate(sequenceNumber int64, target []interface{}, symbol string) error

WsProcessOrderbookUpdate processes new orderbook updates

type RateLimit

type RateLimit struct {
	Auth   *rate.Limiter
	UnAuth *rate.Limiter
}

RateLimit implements the request.Limiter interface

func SetRateLimit

func SetRateLimit() *RateLimit

SetRateLimit returns the rate limit for the exchange If your account's volume is over $5 million in 30 day volume, you may be eligible for an API rate limit increase. Please email poloniex@circle.com. As per https://docs.poloniex.com/#http-api

func (*RateLimit) Limit

func (r *RateLimit) Limit(f request.EndpointLimit) error

Limit limits outbound calls

type ResultingTrades

type ResultingTrades struct {
	Amount  float64 `json:"amount,string"`
	Date    string  `json:"date"`
	Rate    float64 `json:"rate,string"`
	Total   float64 `json:"total,string"`
	TradeID int64   `json:"tradeID,string"`
	Type    string  `json:"type"`
}

ResultingTrades holds resultant trade information

type Ticker

type Ticker struct {
	ID            float64 `json:"id"`
	Last          float64 `json:"last,string"`
	LowestAsk     float64 `json:"lowestAsk,string"`
	HighestBid    float64 `json:"highestBid,string"`
	PercentChange float64 `json:"percentChange,string"`
	BaseVolume    float64 `json:"baseVolume,string"`
	QuoteVolume   float64 `json:"quoteVolume,string"`
	IsFrozen      int64   `json:"isFrozen,string"`
	High24Hr      float64 `json:"high24hr,string"`
	Low24Hr       float64 `json:"low24hr,string"`
}

Ticker holds ticker data

type TradeHistory

type TradeHistory struct {
	GlobalTradeID int64   `json:"globalTradeID"`
	TradeID       int64   `json:"tradeID"`
	Date          string  `json:"date"`
	Type          string  `json:"type"`
	Rate          float64 `json:"rate,string"`
	Amount        float64 `json:"amount,string"`
	Total         float64 `json:"total,string"`
}

TradeHistory holds trade history data

type WebsocketTicker

type WebsocketTicker struct {
	CurrencyPair  string
	Last          float64
	LowestAsk     float64
	HighestBid    float64
	PercentChange float64
	BaseVolume    float64
	QuoteVolume   float64
	IsFrozen      bool
	High          float64
	Low           float64
}

WebsocketTicker holds ticker data for the websocket

type WebsocketTrollboxMessage

type WebsocketTrollboxMessage struct {
	MessageNumber float64
	Username      string
	Message       string
	Reputation    float64
}

WebsocketTrollboxMessage holds trollbox messages and information for websocket

type Withdraw

type Withdraw struct {
	Response string `json:"response"`
	Error    string `json:"error"`
}

Withdraw holds withdraw information

type WsAccountBalanceUpdateResponse

type WsAccountBalanceUpdateResponse struct {
	// contains filtered or unexported fields
}

WsAccountBalanceUpdateResponse Authenticated Ws Account data

type WsAuthorisationRequest

type WsAuthorisationRequest struct {
	Command string `json:"command"`
	Channel int64  `json:"channel"`
	Sign    string `json:"sign"`
	Key     string `json:"key"`
	Payload string `json:"payload"`
}

WsAuthorisationRequest Authenticated Ws Account data request

type WsCommand

type WsCommand struct {
	Command string      `json:"command"`
	Channel interface{} `json:"channel"`
	APIKey  string      `json:"key,omitempty"`
	Payload string      `json:"payload,omitempty"`
	Sign    string      `json:"sign,omitempty"`
}

WsCommand defines the request params after a websocket connection has been established

type WsOrderUpdateResponse

type WsOrderUpdateResponse struct {
	OrderNumber float64
	NewAmount   string
}

WsOrderUpdateResponse Authenticated Ws Account data

type WsTicker

type WsTicker struct {
	LastPrice              float64
	LowestAsk              float64
	HighestBid             float64
	PercentageChange       float64
	BaseCurrencyVolume24H  float64
	QuoteCurrencyVolume24H float64
	IsFrozen               bool
	HighestTradeIn24H      float64
	LowestTradePrice24H    float64
}

WsTicker defines the websocket ticker response

type WsTrade

type WsTrade struct {
	Symbol    string
	TradeID   int64
	Side      string
	Volume    float64
	Price     float64
	Timestamp int64
}

WsTrade defines the websocket trade response

type WsTradeNotificationResponse

type WsTradeNotificationResponse struct {
	TradeID       float64
	Rate          float64
	Amount        float64
	FeeMultiplier float64
	FundingType   float64
	OrderNumber   float64
	TotalFee      float64
	Date          time.Time
}

WsTradeNotificationResponse Authenticated Ws Account data

Jump to

Keyboard shortcuts

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