Repository: ccxt/ccxt
File: ts/src/pro/paradex.ts (TypeScript)

Code before:
        return await this.watch (url, messageHash, this.deepExtend (request, params), messageHash);
    }

    /**
     * @method
     * @name paradex#watchFundingRates
     * @description watch the funding rate for multiple markets
     * @see https://docs.paradex.trade/ws/web-socket-channels/markets-summary/markets-summary
     * @param {string[]} symbols list of unified market symbols
     * @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}
     */
    async watchFundingRates (symbols: string[], params = {}): Promise<FundingRates> {
        await this.loadMarkets ();
        symbols = this.marketSymbols (symbols);
        const channel = 'funding_data';
        const url = this.urls['api']['ws'];
        const request: Dict = {
            'jsonrpc': '2.0',
            'method': 'subscribe',
            'params': {
                'channel': channel,
            },
        };
        const messageHashes = [];
        if (Array.isArray (symbols)) {
            for (let i = 0; i < symbols.length; i++) {
                const messageHash = channel + '.' + symbols[i];
                messageHashes.push (messageHash);
            }
        } else {
            messageHashes.push (channel);
        }
        const newFundingRates = await this.watchMultiple (url, messageHashes, this.deepExtend (request, params), messageHashes);
        if (this.newUpdates) {
            const result: Dict = {};
            result[newFundingRates['symbol']] = newFundingRates;
            return result;
        }
        return this.filterByArray (this.fundingRates, 'symbol', symbols);
    }

    handleFundingRate (client: Client, message) {
        //
        //     {
        //         "jsonrpc": "2.0",
        //         "method": "subscription",
        //         "params": {
        //             "channel": "funding_data",
        //             "data": {
        //                 "market": "TRUMP-USD-PERP",

Review comment (suggestion):
if we want to make symbols optional, we might use `Symbols: = undefined`

then we should check if symbols is undefined or nto, but if it's not undefined we should assume it's an array

Code after:
        return await this.watch (url, messageHash, this.deepExtend (request, params), messageHash);
    }

    /**
     * @method
     * @name paradex#watchFundingRates
     * @description watch the funding rate for multiple markets
     * @see https://docs.paradex.trade/ws/web-socket-channels/markets-summary/markets-summary
     * @param {string[]} [symbols] a list of unified market symbols
     * @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}
     */
    async watchFundingRates (symbols: Strings = undefined, params = {}): Promise<FundingRates> {
        await this.loadMarkets ();
        symbols = this.marketSymbols (symbols);
        const channel = 'funding_data';
        const url = this.urls['api']['ws'];
        const request: Dict = {
            'jsonrpc': '2.0',
            'method': 'subscribe',
            'params': {
                'channel': channel,
            },
        };
        const messageHashes = [];
        if (symbols !== undefined) {
            const symbolsLength = symbols.length;
            if (symbolsLength > 0) {
                for (let i = 0; i < symbols.length; i++) {
                    const messageHash = channel + '.' + symbols[i];
                    messageHashes.push (messageHash);
                }
            } else {
                messageHashes.push (channel); // if an empty array is passed, subscribe to all funding rates
            }
        } else {
            messageHashes.push (channel);
        }
        const newFundingRates = await this.watchMultiple (url, messageHashes, this.deepExtend (request, params), messageHashes);
        if (this.newUpdates) {
            const result: Dict = {};
            result[newFundingRates['symbol']] = newFundingRates;
            return result;
        }
        return this.filterByArray (this.fundingRates, 'symbol', symbols);
    }

    handleFundingRate (client: Client, message) {
        //
        //     {
        //         "jsonrpc": "2.0",