package ccxt type Digifinex struct { *digifinex Core *digifinex } func NewDigifinex(userConfig map[string]interface{}) Digifinex { p := &digifinex{} p.Init(userConfig) return Digifinex{ digifinex: 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 digifinex#fetchMarkets * @description retrieves data on all markets for digifinex * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object[]} an array of objects representing market data */ func (this *Digifinex) FetchMarkets(params ...interface{}) ([]MarketInterface, error) { res := <- this.Core.FetchMarkets(params...) if IsError(res) { return nil, CreateReturnError(res) } return NewMarketInterfaceArray(res), nil } func (this *Digifinex) FetchMarketsV2(params ...interface{}) ([]map[string]interface{}, error) { res := <- this.Core.FetchMarketsV2(params...) if IsError(res) { return nil, CreateReturnError(res) } return res.([]map[string]interface{}), nil } func (this *Digifinex) FetchMarketsV1(params ...interface{}) ([]map[string]interface{}, error) { res := <- this.Core.FetchMarketsV1(params...) if IsError(res) { return nil, CreateReturnError(res) } return res.([]map[string]interface{}), nil } /** * @method * @name digifinex#fetchBalance * @description query for balance and get the amount of funds available for trading or funds locked in orders * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#spot-account-assets * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#margin-assets * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#accountbalance * @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 *Digifinex) FetchBalance(params ...interface{}) (Balances, error) { res := <- this.Core.FetchBalance(params...) if IsError(res) { return Balances{}, CreateReturnError(res) } return NewBalances(res), nil } /** * @method * @name digifinex#fetchOrderBook * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#get-orderbook * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#orderbook * @param {string} symbol unified symbol of the market to fetch the order book for * @param {int} [limit] the maximum amount of order book entries to return * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols */ func (this *Digifinex) 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 digifinex#fetchTickers * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#ticker-price * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#tickers * @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 *Digifinex) 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 } /** * @method * @name digifinex#fetchTicker * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#ticker-price * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#ticker * @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 *Digifinex) 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 digifinex#fetchTime * @description fetches the current integer timestamp in milliseconds from the exchange server * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {int} the current integer timestamp in milliseconds from the exchange server */ func (this *Digifinex) FetchTime(params ...interface{}) ( int64, error) { res := <- this.Core.FetchTime(params...) if IsError(res) { return -1, CreateReturnError(res) } return (res).(int64), nil } /** * @method * @name digifinex#fetchStatus * @description the latest known information on the availability of the exchange API * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure} */ func (this *Digifinex) FetchStatus(params ...interface{}) (map[string]interface{}, error) { res := <- this.Core.FetchStatus(params...) if IsError(res) { return map[string]interface{}{}, CreateReturnError(res) } return res.(map[string]interface{}), nil } /** * @method * @name digifinex#fetchTrades * @description get the list of most recent trades for a particular symbol * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#get-recent-trades * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#recenttrades * @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 *Digifinex) 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 digifinex#fetchOHLCV * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#get-candles-data * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#recentcandle * @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 * @param {int} [params.until] timestamp in ms of the latest candle to fetch * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume */ func (this *Digifinex) 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 digifinex#createOrder * @description create a trade order * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#create-new-order * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#orderplace * @param {string} symbol unified symbol of the market to create an order in * @param {string} type 'market' or 'limit' * @param {string} side 'buy' or 'sell' * @param {float} amount how much you want to trade in units of the base currency, spot market orders use the quote currency, swap requires the number of contracts * @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 {string} [params.timeInForce] "GTC", "IOC", "FOK", or "PO" * @param {bool} [params.postOnly] true or false * @param {bool} [params.reduceOnly] true or false * @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading * @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure} */ func (this *Digifinex) 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 digifinex#createOrders * @description create a list of trade orders (all orders should be of the same symbol) * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#create-multiple-order * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#batchorder * @param {Array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params * @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 *Digifinex) CreateOrders(orders []OrderRequest, options ...CreateOrdersOptions) ([]Order, error) { opts := CreateOrdersOptionsStruct{} for _, opt := range options { opt(&opts) } var params interface{} = nil if opts.Params != nil { params = *opts.Params } res := <- this.Core.CreateOrders(orders, params) if IsError(res) { return nil, CreateReturnError(res) } return NewOrderArray(res), nil } /** * @method * @name digifinex#createMarketBuyOrderWithCost * @description create a market buy order by providing the symbol and cost * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#create-new-order * @param {string} symbol unified symbol of the market to create an order in * @param {float} cost how much you want to trade in units of the quote currency * @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 *Digifinex) CreateMarketBuyOrderWithCost(symbol string, cost float64, options ...CreateMarketBuyOrderWithCostOptions) (Order, error) { opts := CreateMarketBuyOrderWithCostOptionsStruct{} for _, opt := range options { opt(&opts) } var params interface{} = nil if opts.Params != nil { params = *opts.Params } res := <- this.Core.CreateMarketBuyOrderWithCost(symbol, cost, params) if IsError(res) { return Order{}, CreateReturnError(res) } return NewOrder(res), nil } /** * @method * @name digifinex#cancelOrder * @description cancels an open order * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#cancel-order * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#cancelorder * @param {string} id order id * @param {string} symbol not used by digifinex cancelOrder () * @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 *Digifinex) CancelOrder(id string, options ...CancelOrderOptions) (map[string]interface{}, 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 map[string]interface{}{}, CreateReturnError(res) } return res.(map[string]interface{}), nil } /** * @method * @name digifinex#cancelOrders * @description cancel multiple orders * @param {string[]} ids order ids * @param {string} symbol not used by digifinex cancelOrders () * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} */ func (this *Digifinex) CancelOrders(ids interface{}, options ...CancelOrdersOptions) ([]map[string]interface{}, error) { opts := CancelOrdersOptionsStruct{} 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.CancelOrders(ids, symbol, params) if IsError(res) { return nil, CreateReturnError(res) } return res.([]map[string]interface{}), nil } /** * @method * @name digifinex#fetchOpenOrders * @description fetch all unfilled currently open orders * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#current-active-orders * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#openorder * @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 * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} */ func (this *Digifinex) 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 digifinex#fetchOrders * @description fetches information on multiple orders made by the user * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#get-all-orders-including-history-orders * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#historyorder * @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 * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} */ func (this *Digifinex) FetchOrders(options ...FetchOrdersOptions) ([]Order, error) { opts := FetchOrdersOptionsStruct{} 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.FetchOrders(symbol, since, limit, params) if IsError(res) { return nil, CreateReturnError(res) } return NewOrderArray(res), nil } /** * @method * @name digifinex#fetchOrder * @description fetches information on an order made by the user * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#get-order-status * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#orderinfo * @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 *Digifinex) 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 digifinex#fetchMyTrades * @description fetch all trades made by the user * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#customer-39-s-trades * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#historytrade * @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 * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure} */ func (this *Digifinex) 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 digifinex#fetchLedger * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#spot-margin-otc-financial-logs * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#bills * @param {string} [code] unified currency code, default is undefined * @param {int} [since] timestamp in ms of the earliest ledger entry, default is undefined * @param {int} [limit] max number of ledger entries to return, default is undefined * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger} */ func (this *Digifinex) FetchLedger(options ...FetchLedgerOptions) ([]LedgerEntry, error) { opts := FetchLedgerOptionsStruct{} for _, opt := range options { opt(&opts) } var code interface{} = nil if opts.Code != nil { code = *opts.Code } 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.FetchLedger(code, since, limit, params) if IsError(res) { return nil, CreateReturnError(res) } return NewLedgerEntryArray(res), nil } /** * @method * @name digifinex#fetchDepositAddress * @description fetch the deposit address for a currency associated with this account * @param {string} code unified currency code * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure} */ func (this *Digifinex) FetchDepositAddress(code string, options ...FetchDepositAddressOptions) (DepositAddress, error) { opts := FetchDepositAddressOptionsStruct{} for _, opt := range options { opt(&opts) } var params interface{} = nil if opts.Params != nil { params = *opts.Params } res := <- this.Core.FetchDepositAddress(code, params) if IsError(res) { return DepositAddress{}, CreateReturnError(res) } return NewDepositAddress(res), nil } func (this *Digifinex) FetchTransactionsByType(typeVar interface{}, options ...FetchTransactionsByTypeOptions) ([]Transaction, error) { opts := FetchTransactionsByTypeOptionsStruct{} for _, opt := range options { opt(&opts) } var code interface{} = nil if opts.Code != nil { code = *opts.Code } 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.FetchTransactionsByType(typeVar, code, since, limit, params) if IsError(res) { return nil, CreateReturnError(res) } return NewTransactionArray(res), nil } /** * @method * @name digifinex#fetchDeposits * @description fetch all deposits made to an account * @param {string} code unified currency code * @param {int} [since] the earliest time in ms to fetch deposits for * @param {int} [limit] the maximum number of deposits structures to retrieve * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure} */ func (this *Digifinex) FetchDeposits(options ...FetchDepositsOptions) ([]Transaction, error) { opts := FetchDepositsOptionsStruct{} for _, opt := range options { opt(&opts) } var code interface{} = nil if opts.Code != nil { code = *opts.Code } 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.FetchDeposits(code, since, limit, params) if IsError(res) { return nil, CreateReturnError(res) } return NewTransactionArray(res), nil } /** * @method * @name digifinex#fetchWithdrawals * @description fetch all withdrawals made from an account * @param {string} code unified currency code * @param {int} [since] the earliest time in ms to fetch withdrawals for * @param {int} [limit] the maximum number of withdrawals structures to retrieve * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure} */ func (this *Digifinex) FetchWithdrawals(options ...FetchWithdrawalsOptions) ([]Transaction, error) { opts := FetchWithdrawalsOptionsStruct{} for _, opt := range options { opt(&opts) } var code interface{} = nil if opts.Code != nil { code = *opts.Code } 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.FetchWithdrawals(code, since, limit, params) if IsError(res) { return nil, CreateReturnError(res) } return NewTransactionArray(res), nil } /** * @method * @name digifinex#transfer * @description transfer currency internally between wallets on the same account * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#transfer-assets-among-accounts * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#accounttransfer * @param {string} code unified currency code * @param {float} amount amount to transfer * @param {string} fromAccount 'spot', 'swap', 'margin', 'OTC' - account to transfer from * @param {string} toAccount 'spot', 'swap', 'margin', 'OTC' - account to transfer to * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure} */ func (this *Digifinex) Transfer(code string, amount float64, fromAccount string, toAccount string, options ...TransferOptions) (TransferEntry, error) { opts := TransferOptionsStruct{} for _, opt := range options { opt(&opts) } var params interface{} = nil if opts.Params != nil { params = *opts.Params } res := <- this.Core.Transfer(code, amount, fromAccount, toAccount, params) if IsError(res) { return TransferEntry{}, CreateReturnError(res) } return NewTransferEntry(res), nil } /** * @method * @name digifinex#withdraw * @description make a withdrawal * @param {string} code unified currency code * @param {float} amount the amount to withdraw * @param {string} address the address to withdraw to * @param {string} tag * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure} */ func (this *Digifinex) Withdraw(code string, amount float64, address string, options ...WithdrawOptions) (Transaction, error) { opts := WithdrawOptionsStruct{} for _, opt := range options { opt(&opts) } var tag interface{} = nil if opts.Tag != nil { tag = *opts.Tag } var params interface{} = nil if opts.Params != nil { params = *opts.Params } res := <- this.Core.Withdraw(code, amount, address, tag, params) if IsError(res) { return Transaction{}, CreateReturnError(res) } return NewTransaction(res), nil } func (this *Digifinex) FetchBorrowInterest(options ...FetchBorrowInterestOptions) ([]BorrowInterest, error) { opts := FetchBorrowInterestOptionsStruct{} for _, opt := range options { opt(&opts) } var code interface{} = nil if opts.Code != nil { code = *opts.Code } 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.FetchBorrowInterest(code, symbol, since, limit, params) if IsError(res) { return nil, CreateReturnError(res) } return NewBorrowInterestArray(res), nil } /** * @method * @name digifinex#fetchCrossBorrowRate * @description fetch the rate of interest to borrow a currency for margin trading * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#margin-assets * @param {string} code unified currency code * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [borrow rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-rate-structure} */ func (this *Digifinex) FetchCrossBorrowRate(code string, options ...FetchCrossBorrowRateOptions) (CrossBorrowRate, error) { opts := FetchCrossBorrowRateOptionsStruct{} for _, opt := range options { opt(&opts) } var params interface{} = nil if opts.Params != nil { params = *opts.Params } res := <- this.Core.FetchCrossBorrowRate(code, params) if IsError(res) { return CrossBorrowRate{}, CreateReturnError(res) } return NewCrossBorrowRate(res), nil } /** * @method * @name digifinex#fetchCrossBorrowRates * @description fetch the borrow interest rates of all currencies * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#margin-assets * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a list of [borrow rate structures]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure} */ func (this *Digifinex) FetchCrossBorrowRates(params ...interface{}) (CrossBorrowRates, error) { res := <- this.Core.FetchCrossBorrowRates(params...) if IsError(res) { return CrossBorrowRates{}, CreateReturnError(res) } return NewCrossBorrowRates(res), nil } /** * @method * @name digifinex#fetchFundingRate * @description fetch the current funding rate * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#currentfundingrate * @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 *Digifinex) 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 digifinex#fetchFundingInterval * @description fetch the current funding rate interval * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#currentfundingrate * @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 *Digifinex) 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 digifinex#fetchFundingRateHistory * @description fetches historical funding rate prices * @param {string} symbol unified symbol of the market to fetch the funding rate history for * @param {int} [since] timestamp in ms of the earliest funding rate to fetch * @param {int} [limit] the maximum amount of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure} to fetch * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure} */ func (this *Digifinex) FetchFundingRateHistory(options ...FetchFundingRateHistoryOptions) ([]FundingRateHistory, error) { opts := FetchFundingRateHistoryOptionsStruct{} 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.FetchFundingRateHistory(symbol, since, limit, params) if IsError(res) { return nil, CreateReturnError(res) } return NewFundingRateHistoryArray(res), nil } /** * @method * @name digifinex#fetchTradingFee * @description fetch the trading fees for a market * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#tradingfee * @param {string} symbol unified market symbol * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure} */ func (this *Digifinex) FetchTradingFee(symbol string, options ...FetchTradingFeeOptions) (TradingFeeInterface, error) { opts := FetchTradingFeeOptionsStruct{} for _, opt := range options { opt(&opts) } var params interface{} = nil if opts.Params != nil { params = *opts.Params } res := <- this.Core.FetchTradingFee(symbol, params) if IsError(res) { return TradingFeeInterface{}, CreateReturnError(res) } return NewTradingFeeInterface(res), nil } /** * @method * @name digifinex#fetchPositions * @description fetch all open positions * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#margin-positions * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#positions * @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 structures]{@link https://docs.ccxt.com/#/?id=position-structure} */ func (this *Digifinex) 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 digifinex#fetchPosition * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#margin-positions * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#positions * @description fetch data on a single open contract trade position * @param {string} symbol unified market symbol of the market the position is held in * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure} */ func (this *Digifinex) FetchPosition(symbol string, options ...FetchPositionOptions) (Position, error) { opts := FetchPositionOptionsStruct{} for _, opt := range options { opt(&opts) } var params interface{} = nil if opts.Params != nil { params = *opts.Params } res := <- this.Core.FetchPosition(symbol, params) if IsError(res) { return Position{}, CreateReturnError(res) } return NewPosition(res), nil } /** * @method * @name digifinex#setLeverage * @description set the level of leverage for a market * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#setleverage * @param {float} leverage the rate of leverage * @param {string} symbol unified market symbol * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {string} [params.marginMode] either 'cross' or 'isolated', default is cross * @param {string} [params.side] either 'long' or 'short', required for isolated markets only * @returns {object} response from the exchange */ func (this *Digifinex) SetLeverage(leverage int64, options ...SetLeverageOptions) (map[string]interface{}, error) { opts := SetLeverageOptionsStruct{} 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.SetLeverage(leverage, symbol, params) if IsError(res) { return map[string]interface{}{}, CreateReturnError(res) } return res.(map[string]interface{}), nil } /** * @method * @name digifinex#fetchTransfers * @description fetch the transfer history, only transfers between spot and swap accounts are supported * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#transferrecord * @param {string} code unified currency code of the currency transferred * @param {int} [since] the earliest time in ms to fetch transfers for * @param {int} [limit] the maximum number of transfers to retrieve * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure} */ func (this *Digifinex) FetchTransfers(options ...FetchTransfersOptions) ([]TransferEntry, error) { opts := FetchTransfersOptionsStruct{} for _, opt := range options { opt(&opts) } var code interface{} = nil if opts.Code != nil { code = *opts.Code } 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.FetchTransfers(code, since, limit, params) if IsError(res) { return nil, CreateReturnError(res) } return NewTransferEntryArray(res), nil } /** * @method * @name digifinex#fetchLeverageTiers * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#instruments * @description retrieve information on the maximum leverage, for different trade sizes * @param {string[]|undefined} symbols a list of unified market symbols * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols */ func (this *Digifinex) FetchLeverageTiers(options ...FetchLeverageTiersOptions) (LeverageTiers, error) { opts := FetchLeverageTiersOptionsStruct{} 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.FetchLeverageTiers(symbols, params) if IsError(res) { return LeverageTiers{}, CreateReturnError(res) } return NewLeverageTiers(res), nil } /** * @method * @name digifinex#fetchMarketLeverageTiers * @description retrieve information on the maximum leverage, for different trade sizes for a single market * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#instrument * @param {string} symbol unified market symbol * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [leverage tiers structure]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure} */ func (this *Digifinex) FetchMarketLeverageTiers(symbol string, options ...FetchMarketLeverageTiersOptions) ([]LeverageTier, error) { opts := FetchMarketLeverageTiersOptionsStruct{} for _, opt := range options { opt(&opts) } var params interface{} = nil if opts.Params != nil { params = *opts.Params } res := <- this.Core.FetchMarketLeverageTiers(symbol, params) if IsError(res) { return nil, CreateReturnError(res) } return NewLeverageTierArray(res), nil } /** * @method * @name digifinex#fetchDepositWithdrawFees * @description fetch deposit and withdraw fees * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#get-currency-deposit-and-withdrawal-information * @param {string[]|undefined} codes not used by fetchDepositWithdrawFees () * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} */ func (this *Digifinex) FetchDepositWithdrawFees(options ...FetchDepositWithdrawFeesOptions) (map[string]interface{}, error) { opts := FetchDepositWithdrawFeesOptionsStruct{} for _, opt := range options { opt(&opts) } var codes interface{} = nil if opts.Codes != nil { codes = *opts.Codes } var params interface{} = nil if opts.Params != nil { params = *opts.Params } res := <- this.Core.FetchDepositWithdrawFees(codes, params) if IsError(res) { return map[string]interface{}{}, CreateReturnError(res) } return res.(map[string]interface{}), nil } /** * @method * @name digifinex#fetchFundingHistory * @description fetch the history of funding payments paid and received on this account * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#funding-fee * @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 * @param {int} [params.until] timestamp in ms of the latest funding payment * @returns {object} a [funding history structure]{@link https://docs.ccxt.com/#/?id=funding-history-structure} */ func (this *Digifinex) 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 digifinex#setMarginMode * @description set margin mode to 'cross' or 'isolated' * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#positionmode * @param {string} marginMode 'cross' or 'isolated' * @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 *Digifinex) 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 }