Documentation
¶
Index ¶
- Constants
- func Sym2duo(pair string) q.D
- type DepositsWithdrawals
- type GenericResponse
- type MarginPosition
- type Poloniex
- func (poloniex *Poloniex) AllTicker(SymPair map[string]q.D) (mdt *sync.Map, err error)
- func (poloniex *Poloniex) Balances() (availables, frozens *sync.Map, err error)
- func (poloniex *Poloniex) CancelOrder(orderId string, currency CurrencyPair) (bool, error)
- func (poloniex *Poloniex) CloseMarginPosition(currency CurrencyPair) (bool, error)
- func (poloniex *Poloniex) Fee() float64
- func (poloniex *Poloniex) GetAccount() (*Account, error)
- func (poloniex *Poloniex) GetAllCurrencies() (map[string]*PoloniexCurrency, error)
- func (poloniex *Poloniex) GetAttr() (a q.Attr)
- func (poloniex *Poloniex) GetDepositsWithdrawals(start, end string) (*DepositsWithdrawals, error)
- func (poloniex *Poloniex) GetDepth(size int, currency CurrencyPair) (*Depth, error)
- func (poloniex *Poloniex) GetKlineRecords(currency CurrencyPair, period KlinePeriod, size int, ...) ([]Kline, error)
- func (poloniex *Poloniex) GetMarginPosition(currency CurrencyPair) (*MarginPosition, error)
- func (poloniex *Poloniex) GetOneOrder(orderId string, currency CurrencyPair) (*Order, error)
- func (poloniex *Poloniex) GetOrderHistorys(currency CurrencyPair, opt ...OptionalParameter) ([]Order, error)
- func (poloniex *Poloniex) GetTicker(currency CurrencyPair) (*Ticker, error)
- func (poloniex *Poloniex) GetTrades(currencyPair CurrencyPair, since int64) ([]Trade, error)
- func (poloniex *Poloniex) GetUnfinishedOrders(currency CurrencyPair) ([]Order, error)
- func (poloniex *Poloniex) LimitBuy(amount, price string, currency CurrencyPair, ...) (*Order, error)
- func (poloniex *Poloniex) LimitSell(amount, price string, currency CurrencyPair, ...) (*Order, error)
- func (poloniex *Poloniex) MarginLimitBuy(amount, price string, currency CurrencyPair) (*Order, error)
- func (poloniex *Poloniex) MarginLimitSell(amount, price string, currency CurrencyPair) (*Order, error)
- func (poloniex *Poloniex) MarketBuy(amount, price string, currency CurrencyPair) (*Order, error)
- func (poloniex *Poloniex) MarketSell(amount, price string, currency CurrencyPair) (*Order, error)
- func (poloniex *Poloniex) OneTicker(d q.D) (ticker q.Bbo, err error)
- func (poloniex *Poloniex) PairArray() (map[string]q.D, map[q.D]q.P, error)
- func (poloniex *Poloniex) PlaceOrders(places [3]q.Order) (orders [3]q.Order, err error)
- func (poloniex *Poloniex) Post(params url.Values) (resp []byte, err error)
- func (poloniex *Poloniex) String() string
- func (poloniex *Poloniex) Test() bool
- func (poloniex *Poloniex) TradeFee() (map[string]q.TradeFee, error)
- func (poloniex *Poloniex) Withdraw(amount string, currency Currency, fees, receiveAddr, safePwd string) (string, error)
- func (poloniex *Poloniex) WithdrawFee() (sf []q.NetworkWithdraw, err error)
Constants ¶
View Source
const ( BASE_URL = "https://poloniex.com/" TRADE_API = BASE_URL + "tradingApi" PUBLIC_URL = BASE_URL + "public" TICKER_API = "?command=returnTicker" CURRENCIES_API = "?command=returnCurrencies" ORDER_BOOK_API = "?command=returnOrderBook¤cyPair=%s&depth=%d" )
View Source
const EXCHANGE_NAME = "poloniex.com"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DepositsWithdrawals ¶
type DepositsWithdrawals struct { Deposits []struct { Currency string `json:"currency"` Address string `json:"address"` Amount float64 `json:"amount,string"` Confirmations int `json:"confirmations"` TransactionID string `json:"txid"` Timestamp time.Time `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 int `json:"confirmations"` TransactionID string `json:"txid"` Timestamp time.Time `json:"timestamp"` Status string `json:"status"` IPAddress string `json:"ipAddress"` } `json:"withdrawals"` }
type GenericResponse ¶
type MarginPosition ¶
type MarginPosition struct { Amount float64 `json:"amount,string"` Total float64 `json:"total,string"` BasePrice float64 `json:"basePrice,string"` LiquidiationPrice float64 `json:"liquidiationPrice"` ProfitLoss float64 `json:"pl,string"` LendingFees float64 `json:"lendingFees,string"` Type string `json:"type"` }
type Poloniex ¶
type Poloniex struct {
// contains filtered or unexported fields
}
func (*Poloniex) CancelOrder ¶
func (*Poloniex) CloseMarginPosition ¶
func (*Poloniex) GetAccount ¶
func (*Poloniex) GetAllCurrencies ¶
func (*Poloniex) GetDepositsWithdrawals ¶
func (poloniex *Poloniex) GetDepositsWithdrawals(start, end string) (*DepositsWithdrawals, error)
func (*Poloniex) GetKlineRecords ¶
func (*Poloniex) GetMarginPosition ¶
func (poloniex *Poloniex) GetMarginPosition(currency CurrencyPair) (*MarginPosition, error)
func (*Poloniex) GetOneOrder ¶
func (*Poloniex) GetOrderHistorys ¶
func (*Poloniex) GetUnfinishedOrders ¶
func (*Poloniex) MarginLimitBuy ¶
func (*Poloniex) MarginLimitSell ¶
func (*Poloniex) MarketSell ¶
func (*Poloniex) PlaceOrders ¶
func (*Poloniex) Post ¶
func (polo *Poloniex) OrderBook() (mdt *sync.Map, err error) {
url := PUBLIC_URL + TICKER_API ret, err := HttpGet(polo.client, url) if err != nil { return nil, err } for pairrev, v := range ret { pair := Sym2duo(pairrev) tickermap, ok := v.(map[string]any) if !ok { return nil, errors.New("not found") } isFrozen, _ := strconv.ParseFloat(tickermap["isFrozen"].(string), 64) if isFrozen == 0 { var ticker BBO ticker.Pair = pairrev ticker.Bid, _ = strconv.ParseFloat(tickermap["highestBid"].(string), 64) ticker.Ask, _ = strconv.ParseFloat(tickermap["lowestAsk"].(string), 64) ticker.BidSize = 1e-12 ticker.AskSize = 1e-12 ticker.High, _ = strconv.ParseFloat(tickermap["high24hr"].(string), 64) ticker.Low, _ = strconv.ParseFloat(tickermap["low24hr"].(string), 64) ticker.Last, _ = strconv.ParseFloat(tickermap["last"].(string), 64) ticker.Vol, _ = strconv.ParseFloat(tickermap["quoteVolume"].(string), 64) if ticker.Valid() { mdt.Store(pair,ticker) } } else { logs.I(pair, "isFrozen") } } return }
func (*Poloniex) WithdrawFee ¶
func (poloniex *Poloniex) WithdrawFee() (sf []q.NetworkWithdraw, err error)
Click to show internal directories.
Click to hide internal directories.