767 lines
26 KiB
Go
767 lines
26 KiB
Go
![]() |
package ccxt
|
||
|
|
||
|
type Poloniexfutures struct {
|
||
|
*poloniexfutures
|
||
|
Core *poloniexfutures
|
||
|
}
|
||
|
|
||
|
func NewPoloniexfutures(userConfig map[string]interface{}) Poloniexfutures {
|
||
|
p := &poloniexfutures{}
|
||
|
p.Init(userConfig)
|
||
|
return Poloniexfutures{
|
||
|
poloniexfutures: p,
|
||
|
Core: p,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
|
||
|
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
|
||
|
|
||
|
|
||
|
/**
|
||
|
* @method
|
||
|
* @name poloniexfutures#fetchMarkets
|
||
|
* @description retrieves data on all markets for poloniexfutures
|
||
|
* @see https://api-docs.poloniex.com/futures/api/symbol
|
||
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
||
|
* @returns {object[]} an array of objects representing market data
|
||
|
*/
|
||
|
func (this *Poloniexfutures) FetchMarkets(params ...interface{}) ([]MarketInterface, error) {
|
||
|
res := <- this.Core.FetchMarkets(params...)
|
||
|
if IsError(res) {
|
||
|
return nil, CreateReturnError(res)
|
||
|
}
|
||
|
return NewMarketInterfaceArray(res), nil
|
||
|
}
|
||
|
/**
|
||
|
* @method
|
||
|
* @name poloniexfutures#fetchTicker
|
||
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
||
|
* @see https://api-docs.poloniex.com/futures/api/ticker#get-real-time-ticker-20
|
||
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
||
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
||
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
||
|
*/
|
||
|
func (this *Poloniexfutures) FetchTicker(symbol string, options ...FetchTickerOptions) (Ticker, error) {
|
||
|
|
||
|
opts := FetchTickerOptionsStruct{}
|
||
|
|
||
|
for _, opt := range options {
|
||
|
opt(&opts)
|
||
|
}
|
||
|
|
||
|
var params interface{} = nil
|
||
|
if opts.Params != nil {
|
||
|
params = *opts.Params
|
||
|
}
|
||
|
res := <- this.Core.FetchTicker(symbol, params)
|
||
|
if IsError(res) {
|
||
|
return Ticker{}, CreateReturnError(res)
|
||
|
}
|
||
|
return NewTicker(res), nil
|
||
|
}
|
||
|
/**
|
||
|
* @method
|
||
|
* @name poloniexfutures#fetchTickers
|
||
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
||
|
* @see https://api-docs.poloniex.com/futures/api/ticker#get-real-time-ticker-of-all-symbols
|
||
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
||
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
||
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
||
|
*/
|
||
|
func (this *Poloniexfutures) FetchTickers(options ...FetchTickersOptions) (Tickers, error) {
|
||
|
|
||
|
opts := FetchTickersOptionsStruct{}
|
||
|
|
||
|
for _, opt := range options {
|
||
|
opt(&opts)
|
||
|
}
|
||
|
|
||
|
var symbols interface{} = nil
|
||
|
if opts.Symbols != nil {
|
||
|
symbols = *opts.Symbols
|
||
|
}
|
||
|
|
||
|
var params interface{} = nil
|
||
|
if opts.Params != nil {
|
||
|
params = *opts.Params
|
||
|
}
|
||
|
res := <- this.Core.FetchTickers(symbols, params)
|
||
|
if IsError(res) {
|
||
|
return Tickers{}, CreateReturnError(res)
|
||
|
}
|
||
|
return NewTickers(res), nil
|
||
|
}
|
||
|
func (this *Poloniexfutures) FetchOrderBook(symbol string, options ...FetchOrderBookOptions) (OrderBook, error) {
|
||
|
|
||
|
opts := FetchOrderBookOptionsStruct{}
|
||
|
|
||
|
for _, opt := range options {
|
||
|
opt(&opts)
|
||
|
}
|
||
|
|
||
|
var limit interface{} = nil
|
||
|
if opts.Limit != nil {
|
||
|
limit = *opts.Limit
|
||
|
}
|
||
|
|
||
|
var params interface{} = nil
|
||
|
if opts.Params != nil {
|
||
|
params = *opts.Params
|
||
|
}
|
||
|
res := <- this.Core.FetchOrderBook(symbol, limit, params)
|
||
|
if IsError(res) {
|
||
|
return OrderBook{}, CreateReturnError(res)
|
||
|
}
|
||
|
return NewOrderBook(res), nil
|
||
|
}
|
||
|
/**
|
||
|
* @method
|
||
|
* @name poloniexfutures#fetchL3OrderBook
|
||
|
* @description fetches level 3 information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
||
|
* @see https://api-docs.poloniex.com/futures/api/orderbook#get-full-order-book--level-3
|
||
|
* @param {string} symbol unified market symbol
|
||
|
* @param {int} [limit] max number of orders to return, default is undefined
|
||
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
||
|
* @returns {object} an [order book structure]{@link https://docs.ccxt.com/#/?id=order-book-structure}
|
||
|
*/
|
||
|
func (this *Poloniexfutures) FetchL3OrderBook(symbol string, options ...FetchL3OrderBookOptions) (OrderBook, error) {
|
||
|
|
||
|
opts := FetchL3OrderBookOptionsStruct{}
|
||
|
|
||
|
for _, opt := range options {
|
||
|
opt(&opts)
|
||
|
}
|
||
|
|
||
|
var limit interface{} = nil
|
||
|
if opts.Limit != nil {
|
||
|
limit = *opts.Limit
|
||
|
}
|
||
|
|
||
|
var params interface{} = nil
|
||
|
if opts.Params != nil {
|
||
|
params = *opts.Params
|
||
|
}
|
||
|
res := <- this.Core.FetchL3OrderBook(symbol, limit, params)
|
||
|
if IsError(res) {
|
||
|
return OrderBook{}, CreateReturnError(res)
|
||
|
}
|
||
|
return NewOrderBook(res), nil
|
||
|
}
|
||
|
/**
|
||
|
* @method
|
||
|
* @name poloniexfutures#fetchTrades
|
||
|
* @description get the list of most recent trades for a particular symbol
|
||
|
* @see https://api-docs.poloniex.com/futures/api/historical#transaction-history
|
||
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
||
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
||
|
* @param {int} [limit] the maximum amount of trades to fetch
|
||
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
||
|
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
|
||
|
*/
|
||
|
func (this *Poloniexfutures) FetchTrades(symbol string, options ...FetchTradesOptions) ([]Trade, error) {
|
||
|
|
||
|
opts := FetchTradesOptionsStruct{}
|
||
|
|
||
|
for _, opt := range options {
|
||
|
opt(&opts)
|
||
|
}
|
||
|
|
||
|
var since interface{} = nil
|
||
|
if opts.Since != nil {
|
||
|
since = *opts.Since
|
||
|
}
|
||
|
|
||
|
var limit interface{} = nil
|
||
|
if opts.Limit != nil {
|
||
|
limit = *opts.Limit
|
||
|
}
|
||
|
|
||
|
var params interface{} = nil
|
||
|
if opts.Params != nil {
|
||
|
params = *opts.Params
|
||
|
}
|
||
|
res := <- this.Core.FetchTrades(symbol, since, limit, params)
|
||
|
if IsError(res) {
|
||
|
return nil, CreateReturnError(res)
|
||
|
}
|
||
|
return NewTradeArray(res), nil
|
||
|
}
|
||
|
/**
|
||
|
* @method
|
||
|
* @name poloniexfutures#fetchTime
|
||
|
* @description fetches the current integer timestamp in milliseconds from the poloniexfutures server
|
||
|
* @see https://api-docs.poloniex.com/futures/api/time#server-time
|
||
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
||
|
* @returns {int} the current integer timestamp in milliseconds from the poloniexfutures server
|
||
|
*/
|
||
|
func (this *Poloniexfutures) FetchTime(params ...interface{}) ( int64, error) {
|
||
|
res := <- this.Core.FetchTime(params...)
|
||
|
if IsError(res) {
|
||
|
return -1, CreateReturnError(res)
|
||
|
}
|
||
|
return (res).(int64), nil
|
||
|
}
|
||
|
/**
|
||
|
* @method
|
||
|
* @name poloniexfutures#fetchOHLCV
|
||
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
||
|
* @see https://api-docs.poloniex.com/futures/api/kline#get-k-line-data-of-contract
|
||
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
||
|
* @param {string} timeframe the length of time each candle represents
|
||
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
||
|
* @param {int} [limit] the maximum amount of candles to fetch
|
||
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
||
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
||
|
*/
|
||
|
func (this *Poloniexfutures) FetchOHLCV(symbol string, options ...FetchOHLCVOptions) ([]OHLCV, error) {
|
||
|
|
||
|
opts := FetchOHLCVOptionsStruct{}
|
||
|
|
||
|
for _, opt := range options {
|
||
|
opt(&opts)
|
||
|
}
|
||
|
|
||
|
var timeframe interface{} = nil
|
||
|
if opts.Timeframe != nil {
|
||
|
timeframe = *opts.Timeframe
|
||
|
}
|
||
|
|
||
|
var since interface{} = nil
|
||
|
if opts.Since != nil {
|
||
|
since = *opts.Since
|
||
|
}
|
||
|
|
||
|
var limit interface{} = nil
|
||
|
if opts.Limit != nil {
|
||
|
limit = *opts.Limit
|
||
|
}
|
||
|
|
||
|
var params interface{} = nil
|
||
|
if opts.Params != nil {
|
||
|
params = *opts.Params
|
||
|
}
|
||
|
res := <- this.Core.FetchOHLCV(symbol, timeframe, since, limit, params)
|
||
|
if IsError(res) {
|
||
|
return nil, CreateReturnError(res)
|
||
|
}
|
||
|
return NewOHLCVArray(res), nil
|
||
|
}
|
||
|
/**
|
||
|
* @method
|
||
|
* @name poloniexfutures#fetchBalance
|
||
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
||
|
* @see https://api-docs.poloniex.com/futures/api/account#get-account-overview
|
||
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
||
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
||
|
*/
|
||
|
func (this *Poloniexfutures) FetchBalance(params ...interface{}) (Balances, error) {
|
||
|
res := <- this.Core.FetchBalance(params...)
|
||
|
if IsError(res) {
|
||
|
return Balances{}, CreateReturnError(res)
|
||
|
}
|
||
|
return NewBalances(res), nil
|
||
|
}
|
||
|
/**
|
||
|
* @method
|
||
|
* @name poloniexfutures#createOrder
|
||
|
* @description Create an order on the exchange
|
||
|
* @see https://api-docs.poloniex.com/futures/api/orders#place-an-order
|
||
|
* @param {string} symbol Unified CCXT market symbol
|
||
|
* @param {string} type 'limit' or 'market'
|
||
|
* @param {string} side 'buy' or 'sell'
|
||
|
* @param {float} amount the amount of currency to trade
|
||
|
* @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
||
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
||
|
* @param {float} [params.leverage] Leverage size of the order
|
||
|
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
||
|
* @param {bool} [params.reduceOnly] A mark to reduce the position size only. Set to false by default. Need to set the position size when reduceOnly is true.
|
||
|
* @param {string} [params.timeInForce] GTC, GTT, IOC, or FOK, default is GTC, limit orders only
|
||
|
* @param {string} [params.postOnly] Post only flag, invalid when timeInForce is IOC or FOK
|
||
|
* @param {string} [params.clientOid] client order id, defaults to uuid if not passed
|
||
|
* @param {string} [params.remark] remark for the order, length cannot exceed 100 utf8 characters
|
||
|
* @param {string} [params.stop] 'up' or 'down', defaults to 'up' if side is sell and 'down' if side is buy, requires stopPrice
|
||
|
* @param {string} [params.stopPriceType] TP, IP or MP, defaults to TP
|
||
|
* @param {bool} [params.closeOrder] set to true to close position
|
||
|
* @param {bool} [params.forceHold] A mark to forcely hold the funds for an order, even though it's an order to reduce the position size. This helps the order stay on the order book and not get canceled when the position size changes. Set to false by default.
|
||
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
||
|
*/
|
||
|
func (this *Poloniexfutures) CreateOrder(symbol string, typeVar string, side string, amount float64, options ...CreateOrderOptions) (Order, error) {
|
||
|
|
||
|
opts := CreateOrderOptionsStruct{}
|
||
|
|
||
|
for _, opt := range options {
|
||
|
opt(&opts)
|
||
|
}
|
||
|
|
||
|
var price interface{} = nil
|
||
|
if opts.Price != nil {
|
||
|
price = *opts.Price
|
||
|
}
|
||
|
|
||
|
var params interface{} = nil
|
||
|
if opts.Params != nil {
|
||
|
params = *opts.Params
|
||
|
}
|
||
|
res := <- this.Core.CreateOrder(symbol, typeVar, side, amount, price, params)
|
||
|
if IsError(res) {
|
||
|
return Order{}, CreateReturnError(res)
|
||
|
}
|
||
|
return NewOrder(res), nil
|
||
|
}
|
||
|
/**
|
||
|
* @method
|
||
|
* @name poloniexfutures#cancelOrder
|
||
|
* @description cancels an open order
|
||
|
* @see https://api-docs.poloniex.com/futures/api/orders#cancel-an-order
|
||
|
* @param {string} id order id
|
||
|
* @param {string} symbol unified symbol of the market the order was made in
|
||
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
||
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
||
|
*/
|
||
|
func (this *Poloniexfutures) CancelOrder(id string, options ...CancelOrderOptions) (Order, error) {
|
||
|
|
||
|
opts := CancelOrderOptionsStruct{}
|
||
|
|
||
|
for _, opt := range options {
|
||
|
opt(&opts)
|
||
|
}
|
||
|
|
||
|
var symbol interface{} = nil
|
||
|
if opts.Symbol != nil {
|
||
|
symbol = *opts.Symbol
|
||
|
}
|
||
|
|
||
|
var params interface{} = nil
|
||
|
if opts.Params != nil {
|
||
|
params = *opts.Params
|
||
|
}
|
||
|
res := <- this.Core.CancelOrder(id, symbol, params)
|
||
|
if IsError(res) {
|
||
|
return Order{}, CreateReturnError(res)
|
||
|
}
|
||
|
return NewOrder(res), nil
|
||
|
}
|
||
|
/**
|
||
|
* @method
|
||
|
* @name poloniexfutures#fetchPositions
|
||
|
* @description fetch all open positions
|
||
|
* @see https://api-docs.poloniex.com/futures/api/positions#get-position-list
|
||
|
* @param {string[]|undefined} symbols list of unified market symbols
|
||
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
||
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
|
||
|
*/
|
||
|
func (this *Poloniexfutures) FetchPositions(options ...FetchPositionsOptions) ([]Position, error) {
|
||
|
|
||
|
opts := FetchPositionsOptionsStruct{}
|
||
|
|
||
|
for _, opt := range options {
|
||
|
opt(&opts)
|
||
|
}
|
||
|
|
||
|
var symbols interface{} = nil
|
||
|
if opts.Symbols != nil {
|
||
|
symbols = *opts.Symbols
|
||
|
}
|
||
|
|
||
|
var params interface{} = nil
|
||
|
if opts.Params != nil {
|
||
|
params = *opts.Params
|
||
|
}
|
||
|
res := <- this.Core.FetchPositions(symbols, params)
|
||
|
if IsError(res) {
|
||
|
return nil, CreateReturnError(res)
|
||
|
}
|
||
|
return NewPositionArray(res), nil
|
||
|
}
|
||
|
/**
|
||
|
* @method
|
||
|
* @name poloniexfutures#fetchFundingHistory
|
||
|
* @description fetch the history of funding payments paid and received on this account
|
||
|
* @see https://api-docs.poloniex.com/futures/api/funding-fees#get-funding-history
|
||
|
* @param {string} symbol unified market symbol
|
||
|
* @param {int} [since] the earliest time in ms to fetch funding history for
|
||
|
* @param {int} [limit] the maximum number of funding history structures to retrieve
|
||
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
||
|
* @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure}
|
||
|
*/
|
||
|
func (this *Poloniexfutures) FetchFundingHistory(options ...FetchFundingHistoryOptions) ([]FundingHistory, error) {
|
||
|
|
||
|
opts := FetchFundingHistoryOptionsStruct{}
|
||
|
|
||
|
for _, opt := range options {
|
||
|
opt(&opts)
|
||
|
}
|
||
|
|
||
|
var symbol interface{} = nil
|
||
|
if opts.Symbol != nil {
|
||
|
symbol = *opts.Symbol
|
||
|
}
|
||
|
|
||
|
var since interface{} = nil
|
||
|
if opts.Since != nil {
|
||
|
since = *opts.Since
|
||
|
}
|
||
|
|
||
|
var limit interface{} = nil
|
||
|
if opts.Limit != nil {
|
||
|
limit = *opts.Limit
|
||
|
}
|
||
|
|
||
|
var params interface{} = nil
|
||
|
if opts.Params != nil {
|
||
|
params = *opts.Params
|
||
|
}
|
||
|
res := <- this.Core.FetchFundingHistory(symbol, since, limit, params)
|
||
|
if IsError(res) {
|
||
|
return nil, CreateReturnError(res)
|
||
|
}
|
||
|
return NewFundingHistoryArray(res), nil
|
||
|
}
|
||
|
/**
|
||
|
* @method
|
||
|
* @name poloniexfutures#cancelAllOrders
|
||
|
* @description cancel all open orders
|
||
|
* @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
|
||
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
||
|
* @param {object} [params.trigger] When true, all the trigger orders will be cancelled
|
||
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
||
|
*/
|
||
|
func (this *Poloniexfutures) CancelAllOrders(options ...CancelAllOrdersOptions) ([]map[string]interface{}, error) {
|
||
|
|
||
|
opts := CancelAllOrdersOptionsStruct{}
|
||
|
|
||
|
for _, opt := range options {
|
||
|
opt(&opts)
|
||
|
}
|
||
|
|
||
|
var symbol interface{} = nil
|
||
|
if opts.Symbol != nil {
|
||
|
symbol = *opts.Symbol
|
||
|
}
|
||
|
|
||
|
var params interface{} = nil
|
||
|
if opts.Params != nil {
|
||
|
params = *opts.Params
|
||
|
}
|
||
|
res := <- this.Core.CancelAllOrders(symbol, params)
|
||
|
if IsError(res) {
|
||
|
return nil, CreateReturnError(res)
|
||
|
}
|
||
|
return res.([]map[string]interface{}), nil
|
||
|
}
|
||
|
/**
|
||
|
* @method
|
||
|
* @name poloniexfutures#fetchOrdersByStatus
|
||
|
* @description fetches a list of orders placed on the exchange
|
||
|
* @see https://api-docs.poloniex.com/futures/api/orders#get-order-listdeprecated
|
||
|
* @see https://api-docs.poloniex.com/futures/api/orders#get-untriggered-stop-order-list
|
||
|
* @param {string} status 'active' or 'closed', only 'active' is valid for stop orders
|
||
|
* @param {string} symbol unified symbol for the market to retrieve orders from
|
||
|
* @param {int} [since] timestamp in ms of the earliest order to retrieve
|
||
|
* @param {int} [limit] The maximum number of orders to retrieve
|
||
|
* @param {object} [params] exchange specific parameters
|
||
|
* @param {bool} [params.stop] set to true to retrieve untriggered stop orders
|
||
|
* @param {int} [params.until] End time in ms
|
||
|
* @param {string} [params.side] buy or sell
|
||
|
* @param {string} [params.type] limit or market
|
||
|
* @returns An [array of order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
||
|
*/
|
||
|
func (this *Poloniexfutures) FetchOrdersByStatus(status interface{}, options ...FetchOrdersByStatusOptions) ([]Order, error) {
|
||
|
|
||
|
opts := FetchOrdersByStatusOptionsStruct{}
|
||
|
|
||
|
for _, opt := range options {
|
||
|
opt(&opts)
|
||
|
}
|
||
|
|
||
|
var symbol interface{} = nil
|
||
|
if opts.Symbol != nil {
|
||
|
symbol = *opts.Symbol
|
||
|
}
|
||
|
|
||
|
var since interface{} = nil
|
||
|
if opts.Since != nil {
|
||
|
since = *opts.Since
|
||
|
}
|
||
|
|
||
|
var limit interface{} = nil
|
||
|
if opts.Limit != nil {
|
||
|
limit = *opts.Limit
|
||
|
}
|
||
|
|
||
|
var params interface{} = nil
|
||
|
if opts.Params != nil {
|
||
|
params = *opts.Params
|
||
|
}
|
||
|
res := <- this.Core.FetchOrdersByStatus(status, symbol, since, limit, params)
|
||
|
if IsError(res) {
|
||
|
return nil, CreateReturnError(res)
|
||
|
}
|
||
|
return NewOrderArray(res), nil
|
||
|
}
|
||
|
/**
|
||
|
* @method
|
||
|
* @name poloniexfutures#fetchOpenOrders
|
||
|
* @description fetch all unfilled currently open orders
|
||
|
* @see https://api-docs.poloniex.com/futures/api/orders#get-order-listdeprecated
|
||
|
* @see https://api-docs.poloniex.com/futures/api/orders#get-untriggered-stop-order-list
|
||
|
* @param {string} symbol unified market symbol
|
||
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
||
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
||
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
||
|
* @param {int} [params.until] end time in ms
|
||
|
* @param {string} [params.side] buy or sell
|
||
|
* @param {string} [params.type] limit, or market
|
||
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
||
|
*/
|
||
|
func (this *Poloniexfutures) FetchOpenOrders(options ...FetchOpenOrdersOptions) ([]Order, error) {
|
||
|
|
||
|
opts := FetchOpenOrdersOptionsStruct{}
|
||
|
|
||
|
for _, opt := range options {
|
||
|
opt(&opts)
|
||
|
}
|
||
|
|
||
|
var symbol interface{} = nil
|
||
|
if opts.Symbol != nil {
|
||
|
symbol = *opts.Symbol
|
||
|
}
|
||
|
|
||
|
var since interface{} = nil
|
||
|
if opts.Since != nil {
|
||
|
since = *opts.Since
|
||
|
}
|
||
|
|
||
|
var limit interface{} = nil
|
||
|
if opts.Limit != nil {
|
||
|
limit = *opts.Limit
|
||
|
}
|
||
|
|
||
|
var params interface{} = nil
|
||
|
if opts.Params != nil {
|
||
|
params = *opts.Params
|
||
|
}
|
||
|
res := <- this.Core.FetchOpenOrders(symbol, since, limit, params)
|
||
|
if IsError(res) {
|
||
|
return nil, CreateReturnError(res)
|
||
|
}
|
||
|
return NewOrderArray(res), nil
|
||
|
}
|
||
|
/**
|
||
|
* @method
|
||
|
* @name poloniexfutures#fetchClosedOrders
|
||
|
* @description fetches information on multiple closed orders made by the user
|
||
|
* @see https://api-docs.poloniex.com/futures/api/orders#get-order-listdeprecated
|
||
|
* @see https://api-docs.poloniex.com/futures/api/orders#get-untriggered-stop-order-list
|
||
|
* @param {string} symbol unified market symbol of the market orders were made in
|
||
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
||
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
||
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
||
|
* @param {int} [params.until] end time in ms
|
||
|
* @param {string} [params.side] buy or sell
|
||
|
* @param {string} [params.type] limit, or market
|
||
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
||
|
*/
|
||
|
func (this *Poloniexfutures) FetchClosedOrders(options ...FetchClosedOrdersOptions) ([]Order, error) {
|
||
|
|
||
|
opts := FetchClosedOrdersOptionsStruct{}
|
||
|
|
||
|
for _, opt := range options {
|
||
|
opt(&opts)
|
||
|
}
|
||
|
|
||
|
var symbol interface{} = nil
|
||
|
if opts.Symbol != nil {
|
||
|
symbol = *opts.Symbol
|
||
|
}
|
||
|
|
||
|
var since interface{} = nil
|
||
|
if opts.Since != nil {
|
||
|
since = *opts.Since
|
||
|
}
|
||
|
|
||
|
var limit interface{} = nil
|
||
|
if opts.Limit != nil {
|
||
|
limit = *opts.Limit
|
||
|
}
|
||
|
|
||
|
var params interface{} = nil
|
||
|
if opts.Params != nil {
|
||
|
params = *opts.Params
|
||
|
}
|
||
|
res := <- this.Core.FetchClosedOrders(symbol, since, limit, params)
|
||
|
if IsError(res) {
|
||
|
return nil, CreateReturnError(res)
|
||
|
}
|
||
|
return NewOrderArray(res), nil
|
||
|
}
|
||
|
/**
|
||
|
* @method
|
||
|
* @name poloniexfutures#fetchOrder
|
||
|
* @description fetches information on an order made by the user
|
||
|
* @see https://api-docs.poloniex.com/futures/api/orders#get-details-of-a-single-order
|
||
|
* @see https://api-docs.poloniex.com/futures/api/orders#get-single-order-by-clientoid
|
||
|
* @param {string} id the order id
|
||
|
* @param {string} symbol unified symbol of the market the order was made in
|
||
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
||
|
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
||
|
*/
|
||
|
func (this *Poloniexfutures) FetchOrder(id string, options ...FetchOrderOptions) (Order, error) {
|
||
|
|
||
|
opts := FetchOrderOptionsStruct{}
|
||
|
|
||
|
for _, opt := range options {
|
||
|
opt(&opts)
|
||
|
}
|
||
|
|
||
|
var symbol interface{} = nil
|
||
|
if opts.Symbol != nil {
|
||
|
symbol = *opts.Symbol
|
||
|
}
|
||
|
|
||
|
var params interface{} = nil
|
||
|
if opts.Params != nil {
|
||
|
params = *opts.Params
|
||
|
}
|
||
|
res := <- this.Core.FetchOrder(id, symbol, params)
|
||
|
if IsError(res) {
|
||
|
return Order{}, CreateReturnError(res)
|
||
|
}
|
||
|
return NewOrder(res), nil
|
||
|
}
|
||
|
/**
|
||
|
* @method
|
||
|
* @name poloniexfutures#fetchFundingRate
|
||
|
* @description fetch the current funding rate
|
||
|
* @see https://api-docs.poloniex.com/futures/api/futures-index#get-premium-index
|
||
|
* @param {string} symbol unified market symbol
|
||
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
||
|
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
||
|
*/
|
||
|
func (this *Poloniexfutures) FetchFundingRate(symbol string, options ...FetchFundingRateOptions) (FundingRate, error) {
|
||
|
|
||
|
opts := FetchFundingRateOptionsStruct{}
|
||
|
|
||
|
for _, opt := range options {
|
||
|
opt(&opts)
|
||
|
}
|
||
|
|
||
|
var params interface{} = nil
|
||
|
if opts.Params != nil {
|
||
|
params = *opts.Params
|
||
|
}
|
||
|
res := <- this.Core.FetchFundingRate(symbol, params)
|
||
|
if IsError(res) {
|
||
|
return FundingRate{}, CreateReturnError(res)
|
||
|
}
|
||
|
return NewFundingRate(res), nil
|
||
|
}
|
||
|
/**
|
||
|
* @method
|
||
|
* @name poloniexfutures#fetchFundingInterval
|
||
|
* @description fetch the current funding rate interval
|
||
|
* @see https://api-docs.poloniex.com/futures/api/futures-index#get-premium-index
|
||
|
* @param {string} symbol unified market symbol
|
||
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
||
|
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
||
|
*/
|
||
|
func (this *Poloniexfutures) FetchFundingInterval(symbol string, options ...FetchFundingIntervalOptions) (FundingRate, error) {
|
||
|
|
||
|
opts := FetchFundingIntervalOptionsStruct{}
|
||
|
|
||
|
for _, opt := range options {
|
||
|
opt(&opts)
|
||
|
}
|
||
|
|
||
|
var params interface{} = nil
|
||
|
if opts.Params != nil {
|
||
|
params = *opts.Params
|
||
|
}
|
||
|
res := <- this.Core.FetchFundingInterval(symbol, params)
|
||
|
if IsError(res) {
|
||
|
return FundingRate{}, CreateReturnError(res)
|
||
|
}
|
||
|
return NewFundingRate(res), nil
|
||
|
}
|
||
|
/**
|
||
|
* @method
|
||
|
* @name poloniexfutures#fetchMyTrades
|
||
|
* @description fetch all trades made by the user
|
||
|
* @see https://api-docs.poloniex.com/futures/api/fills#get-fillsdeprecated
|
||
|
* @param {string} symbol unified market symbol
|
||
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
||
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
||
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
||
|
* @param {string} [params.orderIdFills] filles for a specific order (other parameters can be ignored if specified)
|
||
|
* @param {string} [params.side] buy or sell
|
||
|
* @param {string} [params.type] limit, market, limit_stop or market_stop
|
||
|
* @param {int} [params.endAt] end time (milisecond)
|
||
|
* @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
||
|
*/
|
||
|
func (this *Poloniexfutures) FetchMyTrades(options ...FetchMyTradesOptions) ([]Trade, error) {
|
||
|
|
||
|
opts := FetchMyTradesOptionsStruct{}
|
||
|
|
||
|
for _, opt := range options {
|
||
|
opt(&opts)
|
||
|
}
|
||
|
|
||
|
var symbol interface{} = nil
|
||
|
if opts.Symbol != nil {
|
||
|
symbol = *opts.Symbol
|
||
|
}
|
||
|
|
||
|
var since interface{} = nil
|
||
|
if opts.Since != nil {
|
||
|
since = *opts.Since
|
||
|
}
|
||
|
|
||
|
var limit interface{} = nil
|
||
|
if opts.Limit != nil {
|
||
|
limit = *opts.Limit
|
||
|
}
|
||
|
|
||
|
var params interface{} = nil
|
||
|
if opts.Params != nil {
|
||
|
params = *opts.Params
|
||
|
}
|
||
|
res := <- this.Core.FetchMyTrades(symbol, since, limit, params)
|
||
|
if IsError(res) {
|
||
|
return nil, CreateReturnError(res)
|
||
|
}
|
||
|
return NewTradeArray(res), nil
|
||
|
}
|
||
|
/**
|
||
|
* @method
|
||
|
* @name poloniexfutures#setMarginMode
|
||
|
* @description set margin mode to 'cross' or 'isolated'
|
||
|
* @see https://api-docs.poloniex.com/futures/api/margin-mode#change-margin-mode
|
||
|
* @param {string} marginMode "0" (isolated) or "1" (cross)
|
||
|
* @param {string} symbol unified market symbol
|
||
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
||
|
* @returns {object} response from the exchange
|
||
|
*/
|
||
|
func (this *Poloniexfutures) SetMarginMode(marginMode string, options ...SetMarginModeOptions) (map[string]interface{}, error) {
|
||
|
|
||
|
opts := SetMarginModeOptionsStruct{}
|
||
|
|
||
|
for _, opt := range options {
|
||
|
opt(&opts)
|
||
|
}
|
||
|
|
||
|
var symbol interface{} = nil
|
||
|
if opts.Symbol != nil {
|
||
|
symbol = *opts.Symbol
|
||
|
}
|
||
|
|
||
|
var params interface{} = nil
|
||
|
if opts.Params != nil {
|
||
|
params = *opts.Params
|
||
|
}
|
||
|
res := <- this.Core.SetMarginMode(marginMode, symbol, params)
|
||
|
if IsError(res) {
|
||
|
return map[string]interface{}{}, CreateReturnError(res)
|
||
|
}
|
||
|
return res.(map[string]interface{}), nil
|
||
|
}
|