plx

package
v0.0.0-...-41ec502 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const LIVE_CREDENTIALS_PATH = "./.creds.json"
View Source
const LIVE_URL = "https://poloniex.com"

Variables

This section is empty.

Functions

This section is empty.

Types

type ChartDataParams

type ChartDataParams struct {
	CurrencyPair string
	Start        int64
	End          int64
	Period       int64
}

func (*ChartDataParams) ToQueryString

func (p *ChartDataParams) ToQueryString() string

type Client

type Client struct {
	BaseUrl         string
	CredentialsPath string
}

func NewClient

func NewClient(baseUrl, credentialsPath string) *Client

func NewLiveClient

func NewLiveClient() *Client

func (*Client) AllOpenOrders

func (client *Client) AllOpenOrders() (marketOrders map[string][]OpenOrder, err error)

func (*Client) Buy

func (client *Client) Buy(currencyPair string, rate, amount float64) (plxOrder *PlxOrder, err error)

func (*Client) CompleteBalances

func (client *Client) CompleteBalances() ([]CompleteBalance, error)

func (*Client) GetBalance

func (client *Client) GetBalance(currency string) (balance *CompleteBalance, err error)

func (*Client) GetChartData

func (client *Client) GetChartData(params *ChartDataParams) ([]data.ChartData, error)

func (*Client) GetOpenOrders

func (client *Client) GetOpenOrders(currencyPair string) (openOrders []*OpenOrder, err error)

func (*Client) GetTicker

func (client *Client) GetTicker() (ticker []TickerEntry, err error)

func (*Client) GetTickerMap

func (client *Client) GetTickerMap() (ticker map[string]TickerEntry, err error)

func (*Client) GetTradeHistory

func (client *Client) GetTradeHistory(params *TradeHistoryParams) (trades []Trade, err error)

func (*Client) MyTradeHistory

func (client *Client) MyTradeHistory(marketName string, startTime, endTime int64) (trades map[string][]*PlxPrivateTrade, err error)

func (*Client) PlaceMarketOrder

func (client *Client) PlaceMarketOrder(apiCommand, currencyPair string, rate, amount float64) (plxOrder *PlxOrder, err error)

func (*Client) PublicApiUrl

func (client *Client) PublicApiUrl() string

func (*Client) ReadTradingApiCredentials

func (client *Client) ReadTradingApiCredentials() (key, secret string, err error)

func (*Client) Sell

func (client *Client) Sell(currencyPair string, rate, amount float64) (plxOrder *PlxOrder, err error)

func (*Client) SignFormData

func (client *Client) SignFormData(apiSecret string, formData *url.Values) (reqBody, signature string)

func (*Client) TradingApiRequest

func (client *Client) TradingApiRequest(formData *url.Values) (*http.Response, error)

func (*Client) TradingApiUrl

func (client *Client) TradingApiUrl() string

type CompleteBalance

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

type OpenOrder

type OpenOrder struct {
	Number int64 `json:"orderNumber,string"`
	Type   string
	Rate   float64 `json:",string"`
	Amount float64 `json:",string"`
	Total  float64 `json:",string"`
}

type PlxOrder

type PlxOrder struct {
	OrderNumber     int64 `json:",string"`
	Type            string
	CurrencyPair    string
	Rate            float64 `json:",string"`
	Amount          float64 `json:",string"`
	ResultingTrades []*PlxPrivateTrade
}

type PlxPrivateTrade

type PlxPrivateTrade struct {
	GlobalTradeId int64
	TradeId       string
	OrderNumber   string
	Date          string
	Rate          float64 `json:",string"`
	Amount        float64 `json:",string"`
	Total         float64 `json:",string"`
	Fee           float64 `json:",string"`
	Type          string
	Category      string
}

type PlxPublicTrade

type PlxPublicTrade struct {
	Date   string
	Type   string
	Rate   string
	Amount string
	Total  string
}

type TickerEntry

type TickerEntry struct {
	Market        string
	Last          float64 `json:",string"`
	LowestAsk     float64 `json:",string"`
	HighestBid    float64 `json:",string"`
	PercentChange float64 `json:",string"`
	BaseVolume    float64 `json:",string"`
	QuoteVolume   float64 `json:",string"`
}

type Trade

type Trade struct {
	Date   time.Time
	Type   string
	Rate   float64
	Amount float64
	Total  float64
}

type TradeHistoryParams

type TradeHistoryParams struct {
	Market    string
	StartTime int64
	EndTime   int64
}

func (*TradeHistoryParams) ToQueryString

func (p *TradeHistoryParams) ToQueryString() string

Jump to

Keyboard shortcuts

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