poloniex

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

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

Go to latest
Published: Sep 28, 2016 License: ISC Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Period5Minutes  period = 300
	Period15Minutes period = 900
	Period30Minutes period = 1800
	Period2Hours    period = 7200
	Period4Hours    period = 14400
	Period24Hours   period = 86400
)
View Source
const (
	TradeTypeBuy  tradeType = "buy"
	TradeTypeSell tradeType = "sell"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Balance

type Balance struct {
	Available float64 `json:"available,string"`
	OnOrders  float64 `json:"onOrders,string"`
	BtcValue  float64 `json:"btcValue,string"`
}

type ChartData

type ChartData struct {
	Date            time.Time
	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"`
}

func (*ChartData) UnmarshalJSON

func (c *ChartData) UnmarshalJSON(b []byte) error

type Client

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

func NewClient

func NewClient(key, secret string) *Client

func (*Client) Balance

func (c *Client) Balance(currency string) (Balance, error)

Returns exchange account balances for a given currency.

func (*Client) Balances

func (c *Client) Balances() (map[string]Balance, error)

Returns all of your balances, including available balance, balance on orders, and the estimated BTC value of your balance. This call is limited to your exchange account.

func (*Client) Buy

func (c *Client) Buy(order OrderRequest) (OrderResult, error)

Places a limit buy order in a given market.

func (*Client) CancelOrder

func (c *Client) CancelOrder(orderNumber int) error

Cancels an order you have placed in a given market.

func (*Client) ChartData

func (c *Client) ChartData(market string, start, end time.Time, period period) ([]ChartData, error)

Returns candlestick chart data.

func (*Client) MoveOrder

func (c *Client) MoveOrder(req MoveOrderRequest) (MoveOrderResult, error)

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 (*Client) OpenOrders

func (c *Client) OpenOrders() (map[string][]OpenOrder, error)

Returns your open orders for all markets.

func (*Client) OpenOrdersFor

func (c *Client) OpenOrdersFor(market string) ([]OpenOrder, error)

Returns your open orders for a given market.

func (*Client) OrderBook

func (c *Client) OrderBook(market string, depth int) (OrderBook, error)

Returns the order book for a given market.

func (*Client) OrderBooks

func (c *Client) OrderBooks(depth int) (map[string]OrderBook, error)

Returns the order book for all markets.

func (*Client) Sell

func (c *Client) Sell(order OrderRequest) (OrderResult, error)

Places a sell order in a given market.

func (*Client) Ticker

func (c *Client) Ticker(market string) (Ticker, error)

Returns the ticker for a specific market.

func (*Client) Tickers

func (c *Client) Tickers() (map[string]Ticker, error)

Returns the ticker for all markets.

func (*Client) TradeHistory

func (c *Client) TradeHistory(market string) ([]Trade, error)

Returns the past 200 trades for a given market.

func (*Client) TradeHistoryBetween

func (c *Client) TradeHistoryBetween(market string, start, end time.Time) ([]Trade, error)

Returns up to 50,000 trades between a range specified.

type MoveOrderRequest

type MoveOrderRequest struct {
	OrderNumber int
	Rate        float64
	// You may optionally specify "amount" if you wish to change the amount of the new order.
	Amount float64
	// An immediate-or-cancel order can be partially or completely filled, but any portion of the order that cannot be filled immediately will be canceled rather than left on the order book. May be specified for exchange orders, but will have no effect on margin orders.
	ImmediateOrCancel bool
	// A post-only order will only be placed if no portion of it fills immediately; this guarantees you will never pay the taker fee on any part of the order that fills. May be specified for exchange orders, but will have no effect on margin orders.
	PostOnly bool
}

type MoveOrderResult

type MoveOrderResult struct {
	OrderNumber     int                         `json:"orderNumber,string"`
	ResultingTrades map[string][]ResultingTrade `json:"resultingTrades"`
	// contains filtered or unexported fields
}

type OpenOrder

type OpenOrder struct {
	OrderNumber int       `json:"orderNumber,string"`
	Type        tradeType `json:"type"`
	Rate        float64   `json:"rate,string"`
	Amount      float64   `json:"amount,string"`
	Total       float64   `json:"total,string"`
}

type Order

type Order struct {
	Price  float64
	Amount float64
}

func (*Order) UnmarshalJSON

func (o *Order) UnmarshalJSON(b []byte) error

type OrderBook

type OrderBook struct {
	Asks []Order
	Bids []Order
}

type OrderRequest

type OrderRequest struct {
	Market string
	Rate   float64
	Amount float64
	// A fill-or-kill order will either fill in its entirety or be completely aborted.
	FillOrKill bool
	// An immediate-or-cancel order can be partially or completely filled, but any portion of the order that cannot be filled immediately will be canceled rather than left on the order book.
	ImmediateOrCancel bool
	// A post-only order will only be placed if no portion of it fills immediately; this guarantees you will never pay the taker fee on any part of the order that fills.
	PostOnly bool
}

type OrderResult

type OrderResult struct {
	OrderNumber     int `json:"orderNumber,string"`
	ResultingTrades []ResultingTrade
}

type PoloniexError

type PoloniexError struct {
	Message string `json:"error"`
}

func (*PoloniexError) Error

func (e *PoloniexError) Error() string

type ResultingTrade

type ResultingTrade struct {
	TradeId int `json:"tradeID,string"`
	Trade
}

type Ticker

type Ticker struct {
	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"`
}

type Trade

type Trade struct {
	Date   time.Time
	Type   tradeType `json:"type"`
	Rate   float64   `json:"rate,string"`
	Amount float64   `json:"amount,string"`
	Total  float64   `json:"total,string"`
}

func (*Trade) UnmarshalJSON

func (t *Trade) UnmarshalJSON(b []byte) (err error)

Jump to

Keyboard shortcuts

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