package ccxt type Blofin struct { *blofin Core *blofin } func NewBlofin(userConfig map[string]interface{}) Blofin { p := &blofin{} p.Init(userConfig) return Blofin{ blofin: 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 blofin#fetchMarkets * @description retrieves data on all markets for blofin * @see https://blofin.com/docs#get-instruments * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object[]} an array of objects representing market data */ func (this *Blofin) FetchMarkets(params ...interface{}) ([]MarketInterface, error) { res := <- this.Core.FetchMarkets(params...) if IsError(res) { return nil, CreateReturnError(res) } return NewMarketInterfaceArray(res), nil } /** * @method * @name blofin#fetchOrderBook * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data * @see https://blofin.com/docs#get-order-book * @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 *Blofin) 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 blofin#fetchTicker * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market * @see https://blofin.com/docs#get-tickers * @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 *Blofin) 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 blofin#fetchMarkPrice * @description fetches mark price for the market * @see https://docs.blofin.com/index.html#get-mark-price * @param {string} symbol unified market symbol * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {string} [params.subType] "linear" or "inverse" * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure} */ func (this *Blofin) FetchMarkPrice(symbol string, options ...FetchMarkPriceOptions) (Ticker, error) { opts := FetchMarkPriceOptionsStruct{} for _, opt := range options { opt(&opts) } var params interface{} = nil if opts.Params != nil { params = *opts.Params } res := <- this.Core.FetchMarkPrice(symbol, params) if IsError(res) { return Ticker{}, CreateReturnError(res) } return NewTicker(res), nil } /** * @method * @name blofin#fetchTickers * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market * @see https://blofin.com/docs#get-tickers * @param {string[]} [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 *Blofin) 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 blofin#fetchTrades * @description get the list of most recent trades for a particular symbol * @see https://blofin.com/docs#get-trades * @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 * @param {boolean} [params.paginate] *only applies to publicGetMarketHistoryTrades* default false, when true will automatically paginate by calling this endpoint multiple times * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades} */ func (this *Blofin) 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 blofin#fetchOHLCV * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market * @see https://blofin.com/docs#get-candlesticks * @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 * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume */ func (this *Blofin) 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 blofin#fetchFundingRateHistory * @description fetches historical funding rate prices * @see https://blofin.com/docs#get-funding-rate-history * @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 * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) * @returns {object[]} a list of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-history-structure} */ func (this *Blofin) 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 blofin#fetchFundingRate * @description fetch the current funding rate * @see https://blofin.com/docs#get-funding-rate * @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 *Blofin) 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 blofin#fetchBalance * @description query for balance and get the amount of funds available for trading or funds locked in orders * @see https://blofin.com/docs#get-balance * @see https://blofin.com/docs#get-futures-account-balance * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {string} [params.accountType] the type of account to fetch the balance for, either 'funding' or 'futures' or 'copy_trading' or 'earn' * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure} */ func (this *Blofin) FetchBalance(params ...interface{}) (Balances, error) { res := <- this.Core.FetchBalance(params...) if IsError(res) { return Balances{}, CreateReturnError(res) } return NewBalances(res), nil } /** * @method * @name blofin#createOrder * @description create a trade order * @see https://blofin.com/docs#place-order * @see https://blofin.com/docs#place-tpsl-order * @param {string} symbol unified symbol of the market to create an order in * @param {string} type 'market' or 'limit' or 'post_only' or 'ioc' or 'fok' * @param {string} side 'buy' or 'sell' * @param {float} amount how much of currency you want to trade in units of base currency * @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 {bool} [params.reduceOnly] a mark to reduce the position size for margin, swap and future orders * @param {bool} [params.postOnly] true to place a post only order * @param {string} [params.marginMode] 'cross' or 'isolated', default is 'cross' * @param {float} [params.stopLossPrice] stop loss trigger price (will use privatePostTradeOrderTpsl) * @param {float} [params.takeProfitPrice] take profit trigger price (will use privatePostTradeOrderTpsl) * @param {string} [params.positionSide] *stopLossPrice/takeProfitPrice orders only* 'long' or 'short' or 'net' default is 'net' * @param {string} [params.clientOrderId] a unique id for the order * @param {object} [params.takeProfit] *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered * @param {float} [params.takeProfit.triggerPrice] take profit trigger price * @param {float} [params.takeProfit.price] take profit order price (if not provided the order will be a market order) * @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered * @param {float} [params.stopLoss.triggerPrice] stop loss trigger price * @param {float} [params.stopLoss.price] stop loss order price (if not provided the order will be a market order) * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure} */ func (this *Blofin) 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 blofin#cancelOrder * @description cancels an open order * @see https://blofin.com/docs#cancel-order * @see https://blofin.com/docs#cancel-tpsl-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 * @param {boolean} [params.trigger] True if cancelling a trigger/conditional order/tp sl orders * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure} */ func (this *Blofin) 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 blofin#createOrders * @description create a list of trade orders * @see https://blofin.com/docs#place-multiple-orders * @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 *Blofin) 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 blofin#fetchOpenOrders * @description Fetch orders that are still open * @see https://blofin.com/docs#get-active-orders * @see https://blofin.com/docs#get-active-tpsl-orders * @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 {bool} [params.trigger] True if fetching trigger or conditional orders * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} */ func (this *Blofin) 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 blofin#fetchMyTrades * @description fetch all trades made by the user * @see https://blofin.com/docs#get-trade-history * @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 {int} [params.until] Timestamp in ms of the latest time to retrieve trades for * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure} */ func (this *Blofin) 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 blofin#fetchDeposits * @description fetch all deposits made to an account * @see https://blofin.com/docs#get-deposite-history * @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 * @param {int} [params.until] the latest time in ms to fetch entries for * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure} */ func (this *Blofin) 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 blofin#fetchWithdrawals * @description fetch all withdrawals made from an account * @see https://blofin.com/docs#get-withdraw-history * @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 * @param {int} [params.until] the latest time in ms to fetch entries for * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) * @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure} */ func (this *Blofin) 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 blofin#fetchLedger * @description fetch the history of changes, actions done by the user or operations that altered the balance of the user * @see https://blofin.com/docs#get-funds-transfer-history * @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 * @param {string} [params.marginMode] 'cross' or 'isolated' * @param {int} [params.until] the latest time in ms to fetch entries for * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) * @returns {object} a [ledger structure]{@link https://docs.ccxt.com/#/?id=ledger} */ func (this *Blofin) 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 blofin#cancelOrders * @description cancel multiple orders * @see https://blofin.com/docs#cancel-multiple-orders * @param {string[]} ids order ids * @param {string} symbol unified market symbol * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {boolean} [params.trigger] whether the order is a stop/trigger order * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} */ func (this *Blofin) CancelOrders(ids interface{}, options ...CancelOrdersOptions) ([]Order, 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 NewOrderArray(res), nil } /** * @method * @name blofin#transfer * @description transfer currency internally between wallets on the same account * @see https://blofin.com/docs#funds-transfer * @param {string} code unified currency code * @param {float} amount amount to transfer * @param {string} fromAccount account to transfer from (funding, swap, copy_trading, earn) * @param {string} toAccount account to transfer to (funding, swap, copy_trading, earn) * @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 *Blofin) 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 blofin#fetchPosition * @description fetch data on a single open contract trade position * @see https://blofin.com/docs#get-positions * @param {string} symbol unified market symbol of the market the position is held in, default is undefined * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {string} [params.instType] MARGIN, SWAP, FUTURES, OPTION * @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure} */ func (this *Blofin) 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 blofin#fetchPositions * @description fetch data on a single open contract trade position * @see https://blofin.com/docs#get-positions * @param {string[]} [symbols] list of unified market symbols * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {string} [params.instType] MARGIN, SWAP, FUTURES, OPTION * @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure} */ func (this *Blofin) 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 blofin#fetchLeverages * @description fetch the set leverage for all contract markets * @see https://docs.blofin.com/index.html#get-multiple-leverage * @param {string[]} symbols a list of unified market symbols, required on blofin * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {string} [params.marginMode] 'cross' or 'isolated' * @returns {object} a list of [leverage structures]{@link https://docs.ccxt.com/#/?id=leverage-structure} */ func (this *Blofin) FetchLeverages(options ...FetchLeveragesOptions) (Leverages, error) { opts := FetchLeveragesOptionsStruct{} 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.FetchLeverages(symbols, params) if IsError(res) { return Leverages{}, CreateReturnError(res) } return NewLeverages(res), nil } /** * @method * @name blofin#fetchLeverage * @description fetch the set leverage for a market * @see https://docs.blofin.com/index.html#get-leverage * @param {string} symbol unified market symbol * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {string} [params.marginMode] 'cross' or 'isolated' * @returns {object} a [leverage structure]{@link https://docs.ccxt.com/#/?id=leverage-structure} */ func (this *Blofin) FetchLeverage(symbol string, options ...FetchLeverageOptions) (Leverage, error) { opts := FetchLeverageOptionsStruct{} for _, opt := range options { opt(&opts) } var params interface{} = nil if opts.Params != nil { params = *opts.Params } res := <- this.Core.FetchLeverage(symbol, params) if IsError(res) { return Leverage{}, CreateReturnError(res) } return NewLeverage(res), nil } /** * @method * @name blofin#setLeverage * @description set the level of leverage for a market * @see https://blofin.com/docs#set-leverage * @param {int} 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] 'cross' or 'isolated' * @returns {object} response from the exchange */ func (this *Blofin) 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 blofin#fetchClosedOrders * @description fetches information on multiple closed orders made by the user * @see https://blofin.com/docs#get-order-history * @see https://blofin.com/docs#get-tpsl-order-history * @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 orde structures to retrieve * @param {object} [params] extra parameters specific to the exchange API endpoint * @param {bool} [params.trigger] True if fetching trigger or conditional orders * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure} */ func (this *Blofin) 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 blofin#fetchMarginMode * @description fetches the margin mode of a trading pair * @see https://docs.blofin.com/index.html#get-margin-mode * @param {string} symbol unified symbol of the market to fetch the margin mode for * @param {object} [params] extra parameters specific to the exchange API endpoint * @returns {object} a [margin mode structure]{@link https://docs.ccxt.com/#/?id=margin-mode-structure} */ func (this *Blofin) FetchMarginMode(symbol string, options ...FetchMarginModeOptions) (MarginMode, error) { opts := FetchMarginModeOptionsStruct{} for _, opt := range options { opt(&opts) } var params interface{} = nil if opts.Params != nil { params = *opts.Params } res := <- this.Core.FetchMarginMode(symbol, params) if IsError(res) { return MarginMode{}, CreateReturnError(res) } return NewMarginMode(res), nil }