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

Code before:
     * @see https://bybit-exchange.github.io/docs/v5/websocket/private/fast-execution
     * @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 {boolean} [params.unifiedMargin] use unified margin account
     * @param {boolean} [params.fast] use fast execution
     * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
     */
    async watchMyTrades (symbol: Str = undefined, since: Int = undefined, limit: Int = undefined, params = {}): Promise<Trade[]> {
        const method = 'watchMyTrades';
        let messageHash = 'myTrades';
        await this.loadMarkets ();
        if (symbol !== undefined) {
            symbol = this.symbol (symbol);
            messageHash += ':' + symbol;
        }
        const url = await this.getUrlByMarketType (symbol, true, method, params);
        await this.authenticate (url);
        const topicByMarket: Dict = {
            'spot': 'ticketInfo',
            'unified': 'execution',
            'usdc': 'user.openapi.perp.trade',
        };
        let topic = this.safeValue (topicByMarket, this.getPrivateType (url));
        const fast = this.safeBool (params, 'fast', false);
        if (fast) {
            topic = 'execution.fast';
        }
        params = this.omit (params, 'fast');
        const trades = await this.watchTopics (url, [ messageHash ], [ topic ], params);
        if (this.newUpdates) {
            limit = trades.getLimit (symbol, limit);
        }
        return this.filterBySymbolSinceLimit (trades, symbol, since, limit, true);
    }

    /**
     * @method
     * @name bybit#unWatchMyTrades
     * @description unWatches information on multiple trades made by the user
     * @see https://bybit-exchange.github.io/docs/v5/websocket/private/execution
     * @see https://bybit-exchange.github.io/docs/v5/websocket/private/fast-execution
     * @param {string} symbol unified market symbol of the market orders were made in
     * @param {object} [params] extra parameters specific to the exchange API endpoint
     * @param {boolean} [params.unifiedMargin] use unified margin account
     * @param {boolean} [params.fast] use fast execution
     * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
     */
    async unWatchMyTrades (symbol: Str = undefined, params = {}): Promise<any> {
        const method = 'watchMyTrades';

Review comment (suggestion):
@Dan-krm here we should use `handleOptionAndParams` so the user can set it in options

Code after:
     * @see https://bybit-exchange.github.io/docs/v5/websocket/private/fast-execution
     * @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 {boolean} [params.unifiedMargin] use unified margin account
     * @param {boolean} [params.executionFast] use fast execution
     * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
     */
    async watchMyTrades (symbol: Str = undefined, since: Int = undefined, limit: Int = undefined, params = {}): Promise<Trade[]> {
        const method = 'watchMyTrades';
        let messageHash = 'myTrades';
        await this.loadMarkets ();
        if (symbol !== undefined) {
            symbol = this.symbol (symbol);
            messageHash += ':' + symbol;
        }
        const url = await this.getUrlByMarketType (symbol, true, method, params);
        await this.authenticate (url);
        const topicByMarket: Dict = {
            'spot': 'ticketInfo',
            'unified': 'execution',
            'usdc': 'user.openapi.perp.trade',
        };
        let topic = this.safeValue (topicByMarket, this.getPrivateType (url));
        let executionFast = false;
        [ executionFast, params ] = this.handleOptionAndParams (params, 'watchMyTrades', 'executionFast', false);
        if (executionFast) {
            topic = 'execution.fast';
        }
        const trades = await this.watchTopics (url, [ messageHash ], [ topic ], params);
        if (this.newUpdates) {
            limit = trades.getLimit (symbol, limit);
        }
        return this.filterBySymbolSinceLimit (trades, symbol, since, limit, true);
    }

    /**
     * @method
     * @name bybit#unWatchMyTrades
     * @description unWatches information on multiple trades made by the user
     * @see https://bybit-exchange.github.io/docs/v5/websocket/private/execution
     * @see https://bybit-exchange.github.io/docs/v5/websocket/private/fast-execution
     * @param {string} symbol unified market symbol of the market orders were made in
     * @param {object} [params] extra parameters specific to the exchange API endpoint
     * @param {boolean} [params.unifiedMargin] use unified margin account
     * @param {boolean} [params.executionFast] use fast execution
     * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
     */
    async unWatchMyTrades (symbol: Str = undefined, params = {}): Promise<any> {
        const method = 'watchMyTrades';