poloniex

package
v0.0.0-...-db5ea55 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_ID           = 29
	DEFAULT_TAKER_FEE    = 0.0020
	DEFAULT_MAKER_FEE    = 0.0008
	DEFAULT_LOT_SIZE     = 0.00000001
	DEFAULT_PRICE_FILTER = 0.00000001
	DEFAULT_LISTED       = true
)
View Source
const (
	API_URL string = "https://poloniex.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CancelOrder

type CancelOrder struct {
	Success       int    `json:"success"`
	Amount        string `json:"amount"`
	ClientOrderID string `json:"clientOrderId"`
	Message       string `json:"message"`
}

type CoinsData

type CoinsData struct {
	ID             int         `json:"id"`
	Name           string      `json:"name"`
	HumanType      string      `json:"humanType"`
	CurrencyType   string      `json:"currencyType"`
	TxFee          string      `json:"txFee"`
	MinConf        int         `json:"minConf"`
	DepositAddress interface{} `json:"depositAddress"`
	Disabled       int         `json:"disabled"`
	Delisted       int         `json:"delisted"`
	Frozen         int         `json:"frozen"`
	IsGeofenced    int         `json:"isGeofenced"`
}

type Kline

type Kline []struct {
	Date            int     `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"`
}

type OrderBook

type OrderBook struct {
	Asks     [][]interface{} `json:"asks"`
	Bids     [][]interface{} `json:"bids"`
	IsFrozen string          `json:"isFrozen"`
	Seq      int64           `json:"seq"`
}

type OrderDetail

type OrderDetail struct {
	Status         string `json:"status"`
	Rate           string `json:"rate"`
	Amount         string `json:"amount"`
	CurrencyPair   string `json:"currencyPair"`
	Date           string `json:"date"`
	Total          string `json:"total"`
	Type           string `json:"type"`
	StartingAmount string `json:"startingAmount"`
}

type OrderStatus

type OrderStatus struct {
	Result  map[string]*OrderDetail `json:"result"`
	Success int                     `json:"success"`
}

type PairsData

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

type PlaceOrder

type PlaceOrder struct {
	OrderNumber     string `json:"orderNumber"`
	ResultingTrades []struct {
		Amount  string `json:"amount"`
		Date    string `json:"date"`
		Rate    string `json:"rate"`
		Total   string `json:"total"`
		TradeID string `json:"tradeID"`
		Type    string `json:"type"`
	} `json:"resultingTrades"`
}

type Poloniex

type Poloniex struct {
	ID      int
	Name    string `bson:"name"`
	Website string `bson:"website"`

	API_KEY    string
	API_SECRET string

	Source    exchange.DataSource // / exchange API / microservicve api 1 / PSQL
	SourceURI string
}

func CreatePoloniex

func CreatePoloniex(config *exchange.Config) *Poloniex

*************************************************

func (*Poloniex) ApiKeyGET

func (e *Poloniex) ApiKeyGET(strRequestPath string, mapParams map[string]string) string

func (*Poloniex) ApiKeyPost

func (e *Poloniex) ApiKeyPost(strRequestPath string, mapParams map[string]string) string

************** Signature Http Request ************** Method: API Request and Signature is required Step 1: Change Instance Name (e *<exchange Instance Name>) Step 2: Create mapParams Depend on API Signature request Step 3: Add HttpGetRequest below strUrl if API has different requests

func (*Poloniex) CanDeposit

func (e *Poloniex) CanDeposit(coin *coin.Coin) bool

func (*Poloniex) CanWithdraw

func (e *Poloniex) CanWithdraw(coin *coin.Coin) bool

func (*Poloniex) CancelAllOrder

func (e *Poloniex) CancelAllOrder() error

func (*Poloniex) CancelOrder

func (e *Poloniex) CancelOrder(order *exchange.Order) error

func (*Poloniex) DeleteCoin

func (e *Poloniex) DeleteCoin(coin *coin.Coin)

func (*Poloniex) DeletePair

func (e *Poloniex) DeletePair(pair *pair.Pair)

func (*Poloniex) DoAccountOperation

func (e *Poloniex) DoAccountOperation(operation *exchange.AccountOperation) error

************** Private API **************

func (*Poloniex) GetBalance

func (e *Poloniex) GetBalance(coin *coin.Coin) float64

func (*Poloniex) GetCoinBySymbol

func (e *Poloniex) GetCoinBySymbol(symbol string) *coin.Coin

func (*Poloniex) GetCoinConstraint

func (e *Poloniex) GetCoinConstraint(coin *coin.Coin) *exchange.CoinConstraint

************** Coins on the Exchanges **************

func (*Poloniex) GetCoins

func (e *Poloniex) GetCoins() []*coin.Coin

func (*Poloniex) GetCoinsData

func (e *Poloniex) GetCoinsData() error

************** Public API ************** Get Coins Information (If API provide) Step 1: Change Instance Name (e *<exchange Instance Name>) Step 2: Add Model of API Response Step 3: Modify API Path(strRequestUrl)

func (*Poloniex) GetConfirmation

func (e *Poloniex) GetConfirmation(coin *coin.Coin) int

func (*Poloniex) GetConstraintFetchMethod

func (e *Poloniex) GetConstraintFetchMethod(pair *pair.Pair) *exchange.ConstrainFetchMethod

*************** Exchange Constraint ***************

func (*Poloniex) GetFee

func (e *Poloniex) GetFee(pair *pair.Pair) float64

*************** Pair Constraint ***************

func (*Poloniex) GetID

func (e *Poloniex) GetID() int

*************** Exchange Information ***************

func (*Poloniex) GetIDByPair

func (e *Poloniex) GetIDByPair(pair *pair.Pair) string

func (*Poloniex) GetLotSize

func (e *Poloniex) GetLotSize(pair *pair.Pair) float64

func (*Poloniex) GetName

func (e *Poloniex) GetName() exchange.ExchangeName

func (*Poloniex) GetPairByID

func (e *Poloniex) GetPairByID(exID string) *pair.Pair

func (*Poloniex) GetPairBySymbol

func (e *Poloniex) GetPairBySymbol(symbol string) *pair.Pair

func (*Poloniex) GetPairConstraint

func (e *Poloniex) GetPairConstraint(pair *pair.Pair) *exchange.PairConstraint

************** Pairs on the Exchanges **************

func (*Poloniex) GetPairs

func (e *Poloniex) GetPairs() []*pair.Pair

func (*Poloniex) GetPairsData

func (e *Poloniex) GetPairsData() error
GetPairsData - Get Pairs Information (If API provide)

Step 1: Change Instance Name (e *<exchange Instance Name>) Step 2: Add Model of API Response Step 3: Modify API Path(strRequestUrl)

func (*Poloniex) GetPriceFilter

func (e *Poloniex) GetPriceFilter(pair *pair.Pair) float64

func (*Poloniex) GetSymbolByCoin

func (e *Poloniex) GetSymbolByCoin(coin *coin.Coin) string

func (*Poloniex) GetSymbolByPair

func (e *Poloniex) GetSymbolByPair(pair *pair.Pair) string

func (*Poloniex) GetTradingWebURL

func (e *Poloniex) GetTradingWebURL(pair *pair.Pair) string

func (*Poloniex) GetTxFee

func (e *Poloniex) GetTxFee(coin *coin.Coin) float64

*************** Coin Constraint ***************

func (*Poloniex) HasPair

func (e *Poloniex) HasPair(pair *pair.Pair) bool

func (*Poloniex) InitData

func (e *Poloniex) InitData() error

func (*Poloniex) LimitBuy

func (e *Poloniex) LimitBuy(pair *pair.Pair, quantity, rate float64) (*exchange.Order, error)

func (*Poloniex) LimitSell

func (e *Poloniex) LimitSell(pair *pair.Pair, quantity, rate float64) (*exchange.Order, error)

func (*Poloniex) ListOrders

func (e *Poloniex) ListOrders() ([]*exchange.Order, error)

func (*Poloniex) LoadPublicData

func (e *Poloniex) LoadPublicData(operation *exchange.PublicOperation) error

************** PUBLIC API **************

func (*Poloniex) OrderBook

func (e *Poloniex) OrderBook(pair *pair.Pair) (*exchange.Maker, error)

Get Pair Market Depth Step 1: Change Instance Name (e *<exchange Instance Name>) Step 2: Add Model of API Response Step 3: Get Exchange Pair Code ex. symbol := e.GetPairCode(p) Step 4: Modify API Path(strRequestUrl) Step 5: Add Params - Depend on API request Step 6: Convert the response to Standard Maker struct

func (*Poloniex) OrderStatus

func (e *Poloniex) OrderStatus(order *exchange.Order) error

func (*Poloniex) SetCoinConstraint

func (e *Poloniex) SetCoinConstraint(coinConstraint *exchange.CoinConstraint)

func (*Poloniex) SetPairConstraint

func (e *Poloniex) SetPairConstraint(pairConstraint *exchange.PairConstraint)

func (*Poloniex) UpdateAllBalances

func (e *Poloniex) UpdateAllBalances()

func (*Poloniex) UpdateConstraint

func (e *Poloniex) UpdateConstraint()

func (*Poloniex) Withdraw

func (e *Poloniex) Withdraw(coin *coin.Coin, quantity float64, addr, tag string) bool

type TradeHistory

type TradeHistory []struct {
	GlobalTradeID int    `json:"globalTradeID"`
	TradeID       int    `json:"tradeID"`
	Date          string `json:"date"`
	Type          string `json:"type"`
	Rate          string `json:"rate"`
	Amount        string `json:"amount"`
	Total         string `json:"total"`
	OrderNumber   int64  `json:"orderNumber"`
}

type Withdraw

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

Jump to

Keyboard shortcuts

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