src/core/io/encoder.ts

Summary

Maintainability
F
1 mo
Test Coverage

File encoder.ts has 2569 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { MarketDataType, WhatToShow } from "../..";
import { ScanCode } from "../../api-next/market-scanner/market-scanner";
import { Contract } from "../../api/contract/contract";
import WshEventData from "../../api/contract/wsh";
import TagValue from "../../api/data/container/tag-value";
Severity: Major
Found in src/core/io/encoder.ts - About 1 wk to fix

    Function placeOrder has a Cognitive Complexity of 248 (exceeds 5 allowed). Consider refactoring.
    Open

      placeOrder(id: number, contract: Contract, order: Order): void {
        if (this.serverVersion < MIN_SERVER_VER.SCALE_ORDERS) {
          if (
            order.scaleInitLevelSize !== undefined ||
            order.scalePriceIncrement !== undefined
    Severity: Minor
    Found in src/core/io/encoder.ts - About 5 days to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function placeOrder has 884 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      placeOrder(id: number, contract: Contract, order: Order): void {
        if (this.serverVersion < MIN_SERVER_VER.SCALE_ORDERS) {
          if (
            order.scaleInitLevelSize !== undefined ||
            order.scalePriceIncrement !== undefined
    Severity: Major
    Found in src/core/io/encoder.ts - About 4 days to fix

      Encoder has 82 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export class Encoder {
        /**
         * Create an [[Encoder]] object for encoding messages to token data.
         *
         * @param callback A [[EncoderCallbacks]] implementation.
      Severity: Major
      Found in src/core/io/encoder.ts - About 1 day to fix

        Function reqContractDetails has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

          reqContractDetails(reqId: number, contract: Contract): void {
            if (this.serverVersion < 4) {
              return this.emitError(
                "This feature is only available for versions of TWS >=4",
                ErrorCode.UPDATE_TWS,
        Severity: Minor
        Found in src/core/io/encoder.ts - About 4 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function reqMktData has 93 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          reqMktData(
            tickerId: number,
            contract: Contract,
            genericTickList: string,
            snapshot: boolean,
        Severity: Major
        Found in src/core/io/encoder.ts - About 3 hrs to fix

          Function reqContractDetails has 87 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            reqContractDetails(reqId: number, contract: Contract): void {
              if (this.serverVersion < 4) {
                return this.emitError(
                  "This feature is only available for versions of TWS >=4",
                  ErrorCode.UPDATE_TWS,
          Severity: Major
          Found in src/core/io/encoder.ts - About 3 hrs to fix

            Function reqMktData has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

              reqMktData(
                tickerId: number,
                contract: Contract,
                genericTickList: string,
                snapshot: boolean,
            Severity: Minor
            Found in src/core/io/encoder.ts - About 3 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function reqHistoricalData has 83 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              reqHistoricalData(
                tickerId: number,
                contract: Contract,
                endDateTime: string,
                durationStr: string,
            Severity: Major
            Found in src/core/io/encoder.ts - About 3 hrs to fix

              Function exerciseOptions has 77 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                exerciseOptions(
                  tickerId: number,
                  contract: Contract,
                  exerciseAction: OptionExerciseAction,
                  exerciseQuantity: number,
              Severity: Major
              Found in src/core/io/encoder.ts - About 3 hrs to fix

                Function reqHistoricalData has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                  reqHistoricalData(
                    tickerId: number,
                    contract: Contract,
                    endDateTime: string,
                    durationStr: string,
                Severity: Minor
                Found in src/core/io/encoder.ts - About 2 hrs to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function reqMktDepth has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  reqMktDepth(
                    tickerId: number,
                    contract: Contract,
                    numRows: number,
                    isSmartDepth: boolean,
                Severity: Major
                Found in src/core/io/encoder.ts - About 2 hrs to fix

                  Function exerciseOptions has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                    exerciseOptions(
                      tickerId: number,
                      contract: Contract,
                      exerciseAction: OptionExerciseAction,
                      exerciseQuantity: number,
                  Severity: Minor
                  Found in src/core/io/encoder.ts - About 2 hrs to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function reqScannerSubscription has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    reqScannerSubscription(
                      reqId: number,
                      subscription: ScannerSubscription,
                      scannerSubscriptionOptions: TagValue[],
                      scannerSubscriptionFilterOptions?: TagValue[],
                  Severity: Major
                  Found in src/core/io/encoder.ts - About 2 hrs to fix

                    Function reqWshEventData has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      reqWshEventData(reqId: number, wshEventData: WshEventData): void {
                        if (this.serverVersion < MIN_SERVER_VER.WSHE_CALENDAR) {
                          return this.emitError(
                            "It does not support WSHE Calendar API.",
                            ErrorCode.UPDATE_TWS,
                    Severity: Minor
                    Found in src/core/io/encoder.ts - About 1 hr to fix

                      Function reqMktDepth has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                        reqMktDepth(
                          tickerId: number,
                          contract: Contract,
                          numRows: number,
                          isSmartDepth: boolean,
                      Severity: Minor
                      Found in src/core/io/encoder.ts - About 1 hr to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function reqRealTimeBars has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        reqRealTimeBars(
                          tickerId: number,
                          contract: Contract,
                          barSize: number,
                          whatToShow: WhatToShow,
                      Severity: Minor
                      Found in src/core/io/encoder.ts - About 1 hr to fix

                        Function calculateOptionPrice has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          calculateOptionPrice(
                            reqId: number,
                            contract: Contract,
                            volatility: number,
                            underPrice: number,
                        Severity: Minor
                        Found in src/core/io/encoder.ts - About 1 hr to fix

                          Function calculateImpliedVolatility has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            calculateImpliedVolatility(
                              reqId: number,
                              contract: Contract,
                              optionPrice: number,
                              underPrice: number,
                          Severity: Minor
                          Found in src/core/io/encoder.ts - About 1 hr to fix

                            Function reqFundamentalData has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              reqFundamentalData(
                                reqId: number,
                                contract: Contract,
                                reportType: string,
                                fundamentalDataOptions: TagValue[],
                            Severity: Minor
                            Found in src/core/io/encoder.ts - About 1 hr to fix

                              Consider simplifying this complex logical expression.
                              Open

                                      if (
                                        order.scalePriceAdjustValue !== undefined ||
                                        order.scalePriceAdjustInterval !== undefined ||
                                        order.scaleProfitOffset !== undefined ||
                                        order.scaleAutoReset ||
                              Severity: Major
                              Found in src/core/io/encoder.ts - About 1 hr to fix

                                Function reqRealTimeBars has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  reqRealTimeBars(
                                    tickerId: number,
                                    contract: Contract,
                                    barSize: number,
                                    whatToShow: WhatToShow,
                                Severity: Minor
                                Found in src/core/io/encoder.ts - About 45 mins to fix

                                Cognitive Complexity

                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                A method's cognitive complexity is based on a few simple rules:

                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                • Code is considered more complex for each "break in the linear flow of the code"
                                • Code is considered more complex when "flow breaking structures are nested"

                                Further reading

                                Function reqScannerSubscription has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  reqScannerSubscription(
                                    reqId: number,
                                    subscription: ScannerSubscription,
                                    scannerSubscriptionOptions: TagValue[],
                                    scannerSubscriptionFilterOptions?: TagValue[],
                                Severity: Minor
                                Found in src/core/io/encoder.ts - About 45 mins to fix

                                Cognitive Complexity

                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                A method's cognitive complexity is based on a few simple rules:

                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                • Code is considered more complex for each "break in the linear flow of the code"
                                • Code is considered more complex when "flow breaking structures are nested"

                                Further reading

                                Function reqWshEventData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  reqWshEventData(reqId: number, wshEventData: WshEventData): void {
                                    if (this.serverVersion < MIN_SERVER_VER.WSHE_CALENDAR) {
                                      return this.emitError(
                                        "It does not support WSHE Calendar API.",
                                        ErrorCode.UPDATE_TWS,
                                Severity: Minor
                                Found in src/core/io/encoder.ts - About 45 mins to fix

                                Cognitive Complexity

                                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                A method's cognitive complexity is based on a few simple rules:

                                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                • Code is considered more complex for each "break in the linear flow of the code"
                                • Code is considered more complex when "flow breaking structures are nested"

                                Further reading

                                Consider simplifying this complex logical expression.
                                Open

                                    if (
                                      this.serverVersion < MIN_SERVER_VER.PEGBEST_PEGMID_OFFSETS &&
                                      (order.minTradeQty !== undefined ||
                                        order.minCompeteSize !== undefined ||
                                        order.competeAgainstBestOffset !== undefined ||
                                Severity: Major
                                Found in src/core/io/encoder.ts - About 40 mins to fix

                                  Function calculateImpliedVolatility has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    calculateImpliedVolatility(
                                      reqId: number,
                                      contract: Contract,
                                      optionPrice: number,
                                      underPrice: number,
                                  Severity: Minor
                                  Found in src/core/io/encoder.ts - About 35 mins to fix

                                  Cognitive Complexity

                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                  A method's cognitive complexity is based on a few simple rules:

                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                  • Code is considered more complex for each "break in the linear flow of the code"
                                  • Code is considered more complex when "flow breaking structures are nested"

                                  Further reading

                                  Avoid too many return statements within this function.
                                  Open

                                          return this.emitError(
                                            "It does not support secIdType and secId parameters.",
                                            ErrorCode.UPDATE_TWS,
                                            id,
                                          );
                                  Severity: Major
                                  Found in src/core/io/encoder.ts - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                              return this.emitError(
                                                "It does not support Scale order parameters: PriceAdjustValue, PriceAdjustInterval, ProfitOffset, AutoReset, InitPosition, InitFillQty and RandomPercent",
                                                ErrorCode.UPDATE_TWS,
                                                id,
                                              );
                                    Severity: Major
                                    Found in src/core/io/encoder.ts - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                              return this.emitError(
                                                "It does not support tradingClass parameters in placeOrder.",
                                                ErrorCode.UPDATE_TWS,
                                                id,
                                              );
                                      Severity: Major
                                      Found in src/core/io/encoder.ts - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                              return this.emitError(
                                                "It does not support algoId parameter",
                                                ErrorCode.UPDATE_TWS,
                                                id,
                                              );
                                        Severity: Major
                                        Found in src/core/io/encoder.ts - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                  return this.emitError(
                                                    "It does not support scaleTable, activeStartTime and activeStopTime parameters.",
                                                    ErrorCode.UPDATE_TWS,
                                                    id,
                                                  );
                                          Severity: Major
                                          Found in src/core/io/encoder.ts - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                  return this.emitError(
                                                    "It does not support oms container parameter.",
                                                    ErrorCode.UPDATE_TWS,
                                                    id,
                                                  );
                                            Severity: Major
                                            Found in src/core/io/encoder.ts - About 30 mins to fix

                                              Avoid too many return statements within this function.
                                              Open

                                                    return this.emitError(
                                                      "It does not support D-Peg orders.",
                                                      ErrorCode.UPDATE_TWS,
                                                      id,
                                                    );
                                              Severity: Major
                                              Found in src/core/io/encoder.ts - About 30 mins to fix

                                                Avoid too many return statements within this function.
                                                Open

                                                      return this.emitError(
                                                        "It does not support advanced error override attribute",
                                                        ErrorCode.UPDATE_TWS,
                                                        id,
                                                      );
                                                Severity: Major
                                                Found in src/core/io/encoder.ts - About 30 mins to fix

                                                  Avoid too many return statements within this function.
                                                  Open

                                                          return this.emitError(
                                                            "It does not support professional customer parameter",
                                                            ErrorCode.UPDATE_TWS,
                                                            id,
                                                          );
                                                  Severity: Major
                                                  Found in src/core/io/encoder.ts - About 30 mins to fix

                                                    Avoid too many return statements within this function.
                                                    Open

                                                            return this.emitError(
                                                              "It does not support issuerId parameter in reqContractDetails.",
                                                              ErrorCode.UPDATE_TWS,
                                                              reqId,
                                                            );
                                                    Severity: Major
                                                    Found in src/core/io/encoder.ts - About 30 mins to fix

                                                      Avoid too many return statements within this function.
                                                      Open

                                                              return this.emitError(
                                                                "It does not support notHeld parameter.",
                                                                ErrorCode.UPDATE_TWS,
                                                                id,
                                                              );
                                                      Severity: Major
                                                      Found in src/core/io/encoder.ts - About 30 mins to fix

                                                        Avoid too many return statements within this function.
                                                        Open

                                                                return this.emitError(
                                                                  "It does not support conId parameter.",
                                                                  ErrorCode.UPDATE_TWS,
                                                                  id,
                                                                );
                                                        Severity: Major
                                                        Found in src/core/io/encoder.ts - About 30 mins to fix

                                                          Avoid too many return statements within this function.
                                                          Open

                                                                  return this.emitError(
                                                                    "It does not support hedge orders.",
                                                                    ErrorCode.UPDATE_TWS,
                                                                    id,
                                                                  );
                                                          Severity: Major
                                                          Found in src/core/io/encoder.ts - About 30 mins to fix

                                                            Avoid too many return statements within this function.
                                                            Open

                                                                  return this.emitError(
                                                                    "It does not support duration attribute",
                                                                    ErrorCode.UPDATE_TWS,
                                                                    id,
                                                                  );
                                                            Severity: Major
                                                            Found in src/core/io/encoder.ts - About 30 mins to fix

                                                              Avoid too many return statements within this function.
                                                              Open

                                                                    return this.emitError(
                                                                      "It does not support ext operator",
                                                                      ErrorCode.UPDATE_TWS,
                                                                      id,
                                                                    );
                                                              Severity: Major
                                                              Found in src/core/io/encoder.ts - About 30 mins to fix

                                                                Avoid too many return statements within this function.
                                                                Open

                                                                      return this.emitError(
                                                                        "It does not support don't use auto price for hedge parameter.",
                                                                        ErrorCode.UPDATE_TWS,
                                                                        id,
                                                                      );
                                                                Severity: Major
                                                                Found in src/core/io/encoder.ts - About 30 mins to fix

                                                                  Avoid too many return statements within this function.
                                                                  Open

                                                                          return this.emitError(
                                                                            "It does not support model code parameter.",
                                                                            ErrorCode.UPDATE_TWS,
                                                                            id,
                                                                          );
                                                                  Severity: Major
                                                                  Found in src/core/io/encoder.ts - About 30 mins to fix

                                                                    Avoid too many return statements within this function.
                                                                    Open

                                                                          return this.emitError(
                                                                            "It does not support soft dollar tier",
                                                                            ErrorCode.UPDATE_TWS,
                                                                            id,
                                                                          );
                                                                    Severity: Major
                                                                    Found in src/core/io/encoder.ts - About 30 mins to fix

                                                                      Avoid too many return statements within this function.
                                                                      Open

                                                                              return this.emitError(
                                                                                "It does not support deltaNeutral parameters: ConId, SettlingFirm, ClearingAccount, ClearingIntent.",
                                                                                ErrorCode.UPDATE_TWS,
                                                                                id,
                                                                              );
                                                                      Severity: Major
                                                                      Found in src/core/io/encoder.ts - About 30 mins to fix

                                                                        Avoid too many return statements within this function.
                                                                        Open

                                                                              return this.emitError(
                                                                                "It does not support MIFID II execution parameters",
                                                                                ErrorCode.UPDATE_TWS,
                                                                                id,
                                                                              );
                                                                        Severity: Major
                                                                        Found in src/core/io/encoder.ts - About 30 mins to fix

                                                                          Avoid too many return statements within this function.
                                                                          Open

                                                                                  return this.emitError(
                                                                                    "It does not support optOutSmartRouting parameter.",
                                                                                    ErrorCode.UPDATE_TWS,
                                                                                    id,
                                                                                  );
                                                                          Severity: Major
                                                                          Found in src/core/io/encoder.ts - About 30 mins to fix

                                                                            Avoid too many return statements within this function.
                                                                            Open

                                                                                  return this.emitError(
                                                                                    "It does not support PEG BEST / PEG MID order parameters: minTradeQty, minCompeteSize, competeAgainstBestOffset, midOffsetAtWhole and midOffsetAtHalf",
                                                                                    ErrorCode.UPDATE_TWS,
                                                                                    id,
                                                                                  );
                                                                            Severity: Major
                                                                            Found in src/core/io/encoder.ts - About 30 mins to fix

                                                                              Avoid too many return statements within this function.
                                                                              Open

                                                                                      return this.emitError(
                                                                                        "It does not support order solicited parameter.",
                                                                                        ErrorCode.UPDATE_TWS,
                                                                                        id,
                                                                                      );
                                                                              Severity: Major
                                                                              Found in src/core/io/encoder.ts - About 30 mins to fix

                                                                                Avoid too many return statements within this function.
                                                                                Open

                                                                                      return this.emitError(
                                                                                        "It does not support MIFID II decision maker parameters",
                                                                                        ErrorCode.UPDATE_TWS,
                                                                                        id,
                                                                                      );
                                                                                Severity: Major
                                                                                Found in src/core/io/encoder.ts - About 30 mins to fix

                                                                                  Avoid too many return statements within this function.
                                                                                  Open

                                                                                          return this.emitError(
                                                                                            "It does not support deltaNeutral parameters: OpenClose, ShortSale, ShortSaleSlot, DesignatedLocation.",
                                                                                            ErrorCode.UPDATE_TWS,
                                                                                            id,
                                                                                          );
                                                                                  Severity: Major
                                                                                  Found in src/core/io/encoder.ts - About 30 mins to fix

                                                                                    Avoid too many return statements within this function.
                                                                                    Open

                                                                                            return this.emitError(
                                                                                              "It does not support trailing percent parameter.",
                                                                                              ErrorCode.UPDATE_TWS,
                                                                                              id,
                                                                                            );
                                                                                    Severity: Major
                                                                                    Found in src/core/io/encoder.ts - About 30 mins to fix

                                                                                      Avoid too many return statements within this function.
                                                                                      Open

                                                                                              return this.emitError(
                                                                                                "It does not support professional customer parameter in exerciseOptions.",
                                                                                                ErrorCode.UPDATE_TWS,
                                                                                                tickerId,
                                                                                              );
                                                                                      Severity: Major
                                                                                      Found in src/core/io/encoder.ts - About 30 mins to fix

                                                                                        Avoid too many return statements within this function.
                                                                                        Open

                                                                                                return this.emitError(
                                                                                                  "It does not support algo orders.",
                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                  id,
                                                                                                );
                                                                                        Severity: Major
                                                                                        Found in src/core/io/encoder.ts - About 30 mins to fix

                                                                                          Avoid too many return statements within this function.
                                                                                          Open

                                                                                                  return this.emitError(
                                                                                                    "It does not support cash quantity parameter",
                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                    id,
                                                                                                  );
                                                                                          Severity: Major
                                                                                          Found in src/core/io/encoder.ts - About 30 mins to fix

                                                                                            Avoid too many return statements within this function.
                                                                                            Open

                                                                                                  return this.emitError(
                                                                                                    "It does not support autoCancelParent attribute",
                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                    id,
                                                                                                  );
                                                                                            Severity: Major
                                                                                            Found in src/core/io/encoder.ts - About 30 mins to fix

                                                                                              Avoid too many return statements within this function.
                                                                                              Open

                                                                                                      return this.emitError(
                                                                                                        "It does not support scaleTable, activeStartTime and activeStopTime parameters.",
                                                                                                        ErrorCode.UPDATE_TWS,
                                                                                                        id,
                                                                                                      );
                                                                                              Severity: Major
                                                                                              Found in src/core/io/encoder.ts - About 30 mins to fix

                                                                                                Avoid too many return statements within this function.
                                                                                                Open

                                                                                                      return this.emitError(
                                                                                                        "It does not support price management algo parameter",
                                                                                                        ErrorCode.UPDATE_TWS,
                                                                                                        id,
                                                                                                      );
                                                                                                Severity: Major
                                                                                                Found in src/core/io/encoder.ts - About 30 mins to fix

                                                                                                  Avoid too many return statements within this function.
                                                                                                  Open

                                                                                                          return this.emitError(
                                                                                                            "It does not support exemptCode parameter.",
                                                                                                            ErrorCode.UPDATE_TWS,
                                                                                                            id,
                                                                                                          );
                                                                                                  Severity: Major
                                                                                                  Found in src/core/io/encoder.ts - About 30 mins to fix

                                                                                                    Avoid too many return statements within this function.
                                                                                                    Open

                                                                                                          return this.emitError(
                                                                                                            "It does not support postToAts attribute",
                                                                                                            ErrorCode.UPDATE_TWS,
                                                                                                            id,
                                                                                                          );
                                                                                                    Severity: Major
                                                                                                    Found in src/core/io/encoder.ts - About 30 mins to fix

                                                                                                      Avoid too many return statements within this function.
                                                                                                      Open

                                                                                                            return this.emitError(
                                                                                                              "It does not support manual order time attribute",
                                                                                                              ErrorCode.UPDATE_TWS,
                                                                                                              id,
                                                                                                            );
                                                                                                      Severity: Major
                                                                                                      Found in src/core/io/encoder.ts - About 30 mins to fix

                                                                                                        Avoid too many return statements within this function.
                                                                                                        Open

                                                                                                                return this.emitError(
                                                                                                                  "It does not support customer account parameter",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                                  id,
                                                                                                                );
                                                                                                        Severity: Major
                                                                                                        Found in src/core/io/encoder.ts - About 30 mins to fix

                                                                                                          Function calculateOptionPrice has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                          Open

                                                                                                            calculateOptionPrice(
                                                                                                              reqId: number,
                                                                                                              contract: Contract,
                                                                                                              volatility: number,
                                                                                                              underPrice: number,
                                                                                                          Severity: Minor
                                                                                                          Found in src/core/io/encoder.ts - About 25 mins to fix

                                                                                                          Cognitive Complexity

                                                                                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                          A method's cognitive complexity is based on a few simple rules:

                                                                                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                          • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                          • Code is considered more complex when "flow breaking structures are nested"

                                                                                                          Further reading

                                                                                                          Function reqFundamentalData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                          Open

                                                                                                            reqFundamentalData(
                                                                                                              reqId: number,
                                                                                                              contract: Contract,
                                                                                                              reportType: string,
                                                                                                              fundamentalDataOptions: TagValue[],
                                                                                                          Severity: Minor
                                                                                                          Found in src/core/io/encoder.ts - About 25 mins to fix

                                                                                                          Cognitive Complexity

                                                                                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                          A method's cognitive complexity is based on a few simple rules:

                                                                                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                          • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                          • Code is considered more complex when "flow breaking structures are nested"

                                                                                                          Further reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (
                                                                                                                this.serverVersion >= 8 &&
                                                                                                                SecType.BAG === contract.secType?.toUpperCase()
                                                                                                              ) {
                                                                                                                if (!contract.comboLegs) {
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 4 hrs to fix
                                                                                                          src/core/io/encoder.ts on lines 2254..2266

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 132.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (SecType.BAG === contract.secType?.toUpperCase()) {
                                                                                                                if (!contract.comboLegs) {
                                                                                                                  tokens.push(0);
                                                                                                                } else {
                                                                                                                  tokens.push(contract.comboLegs.length);
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 4 hrs to fix
                                                                                                          src/core/io/encoder.ts on lines 2513..2528

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 132.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion >= MIN_SERVER_VER.DELTA_NEUTRAL) {
                                                                                                                if (contract.deltaNeutralContract) {
                                                                                                                  args.push(true);
                                                                                                                  args.push(contract.deltaNeutralContract.conId);
                                                                                                                  args.push(contract.deltaNeutralContract.delta);
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 3 hrs to fix
                                                                                                          src/core/io/encoder.ts on lines 1511..1520

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 113.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion >= MIN_SERVER_VER.DELTA_NEUTRAL) {
                                                                                                                if (contract.deltaNeutralContract) {
                                                                                                                  tokens.push(true);
                                                                                                                  tokens.push(contract.deltaNeutralContract.conId);
                                                                                                                  tokens.push(contract.deltaNeutralContract.delta);
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 3 hrs to fix
                                                                                                          src/core/io/encoder.ts on lines 2530..2539

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 113.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                                      case OrderConditionType.Volume: {
                                                                                                                        const timeConditionCond = cond as VolumeCondition;
                                                                                                                        // OperatorCondition
                                                                                                                        tokens.push(timeConditionCond.isMore);
                                                                                                                        tokens.push(timeConditionCond.strValue);
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 2 hrs to fix
                                                                                                          src/core/io/encoder.ts on lines 1594..1603

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 93.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                                      case OrderConditionType.PercentChange: {
                                                                                                                        const percentChangeCond = cond as PercentChangeCondition;
                                                                                                                        // OperatorCondition
                                                                                                                        tokens.push(percentChangeCond.isMore);
                                                                                                                        tokens.push(percentChangeCond.strValue);
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 2 hrs to fix
                                                                                                          src/core/io/encoder.ts on lines 1626..1635

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 93.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                                  if (
                                                                                                                    this.serverVersion >= MIN_SERVER_VER.DELTA_NEUTRAL_OPEN_CLOSE &&
                                                                                                                    !!order.deltaNeutralOrderType
                                                                                                                  ) {
                                                                                                                    tokens.push(order.deltaNeutralOpenClose);
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 2 hrs to fix
                                                                                                          src/core/io/encoder.ts on lines 1414..1422

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 91.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                                  if (
                                                                                                                    this.serverVersion >= MIN_SERVER_VER.DELTA_NEUTRAL_CONID &&
                                                                                                                    !!order.deltaNeutralOrderType
                                                                                                                  ) {
                                                                                                                    tokens.push(order.deltaNeutralConId);
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 2 hrs to fix
                                                                                                          src/core/io/encoder.ts on lines 1424..1432

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 91.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 6 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            cancelRealTimeBars(tickerId: number): void {
                                                                                                              if (this.serverVersion < MIN_SERVER_VER.REAL_TIME_BARS) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support realtime bar data query cancellation.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 5 other locations - About 2 hrs to fix
                                                                                                          src/core/io/encoder.ts on lines 386..398
                                                                                                          src/core/io/encoder.ts on lines 412..424
                                                                                                          src/core/io/encoder.ts on lines 429..441
                                                                                                          src/core/io/encoder.ts on lines 446..458
                                                                                                          src/core/io/encoder.ts on lines 2727..2739

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 81.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 6 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            cancelPositionsMulti(reqId: number): void {
                                                                                                              if (this.serverVersion < MIN_SERVER_VER.MODELS_SUPPORT) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support positions multi cancellation.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 5 other locations - About 2 hrs to fix
                                                                                                          src/core/io/encoder.ts on lines 386..398
                                                                                                          src/core/io/encoder.ts on lines 412..424
                                                                                                          src/core/io/encoder.ts on lines 429..441
                                                                                                          src/core/io/encoder.ts on lines 446..458
                                                                                                          src/core/io/encoder.ts on lines 571..583

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 81.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 6 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            cancelAccountSummary(reqId: number): void {
                                                                                                              if (this.serverVersion < MIN_SERVER_VER.ACCT_SUMMARY) {
                                                                                                                return this.emitError(
                                                                                                                  "It not support account summary cancellation.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 5 other locations - About 2 hrs to fix
                                                                                                          src/core/io/encoder.ts on lines 412..424
                                                                                                          src/core/io/encoder.ts on lines 429..441
                                                                                                          src/core/io/encoder.ts on lines 446..458
                                                                                                          src/core/io/encoder.ts on lines 571..583
                                                                                                          src/core/io/encoder.ts on lines 2727..2739

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 81.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 6 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            cancelCalculateImpliedVolatility(reqId: number): void {
                                                                                                              if (this.serverVersion < MIN_SERVER_VER.CANCEL_CALC_IMPLIED_VOLAT) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support calculate implied volatility cancellation.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 5 other locations - About 2 hrs to fix
                                                                                                          src/core/io/encoder.ts on lines 386..398
                                                                                                          src/core/io/encoder.ts on lines 429..441
                                                                                                          src/core/io/encoder.ts on lines 446..458
                                                                                                          src/core/io/encoder.ts on lines 571..583
                                                                                                          src/core/io/encoder.ts on lines 2727..2739

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 81.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 6 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            cancelCalculateOptionPrice(reqId: number): void {
                                                                                                              if (this.serverVersion < MIN_SERVER_VER.CANCEL_CALC_OPTION_PRICE) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support calculate option price cancellation.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 5 other locations - About 2 hrs to fix
                                                                                                          src/core/io/encoder.ts on lines 386..398
                                                                                                          src/core/io/encoder.ts on lines 412..424
                                                                                                          src/core/io/encoder.ts on lines 446..458
                                                                                                          src/core/io/encoder.ts on lines 571..583
                                                                                                          src/core/io/encoder.ts on lines 2727..2739

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 81.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 6 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            cancelFundamentalData(reqId: number): void {
                                                                                                              if (this.serverVersion < MIN_SERVER_VER.FUNDAMENTAL_DATA) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support fundamental data requests.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 5 other locations - About 2 hrs to fix
                                                                                                          src/core/io/encoder.ts on lines 386..398
                                                                                                          src/core/io/encoder.ts on lines 412..424
                                                                                                          src/core/io/encoder.ts on lines 429..441
                                                                                                          src/core/io/encoder.ts on lines 571..583
                                                                                                          src/core/io/encoder.ts on lines 2727..2739

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 81.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            reqSmartComponents(reqId: number, bboExchange: string): void {
                                                                                                              if (this.serverVersion < MIN_SERVER_VER.REQ_SMART_COMPONENTS) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support smart components request.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 2 hrs to fix
                                                                                                          src/core/io/encoder.ts on lines 3031..3041

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 79.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            reqMatchingSymbols(reqId: number, pattern: string): void {
                                                                                                              if (this.serverVersion < MIN_SERVER_VER.REQ_MATCHING_SYMBOLS) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support matching symbols request.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 2 hrs to fix
                                                                                                          src/core/io/encoder.ts on lines 3061..3071

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 79.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            cancelHistoricalData(tickerId: number): void {
                                                                                                              if (this.serverVersion < 24) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support historical data query cancellation.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 2 hrs to fix
                                                                                                          src/core/io/encoder.ts on lines 588..600

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 77.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            cancelScannerSubscription(tickerId: number): void {
                                                                                                              if (this.serverVersion < 24) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support API scanner subscription.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 2 hrs to fix
                                                                                                          src/core/io/encoder.ts on lines 463..475

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 77.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            cancelPositions(): void {
                                                                                                              if (this.serverVersion < MIN_SERVER_VER.ACCT_SUMMARY) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support position cancellation.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 2 other locations - About 2 hrs to fix
                                                                                                          src/core/io/encoder.ts on lines 2147..2159
                                                                                                          src/core/io/encoder.ts on lines 2683..2695

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 77.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            reqPositions(): void {
                                                                                                              if (this.serverVersion < MIN_SERVER_VER.ACCT_SUMMARY) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support position requests.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 2 other locations - About 2 hrs to fix
                                                                                                          src/core/io/encoder.ts on lines 554..566
                                                                                                          src/core/io/encoder.ts on lines 2147..2159

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 77.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            reqGlobalCancel(): void {
                                                                                                              if (this.serverVersion < MIN_SERVER_VER.REQ_GLOBAL_CANCEL) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support globalCancel requests.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 2 other locations - About 2 hrs to fix
                                                                                                          src/core/io/encoder.ts on lines 554..566
                                                                                                          src/core/io/encoder.ts on lines 2683..2695

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 77.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 7 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            cancelTickByTickData(reqId: number): void {
                                                                                                              if (this.serverVersion < MIN_SERVER_VER.TICK_BY_TICK) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support tick-by-tick data cancels.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 6 other locations - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 1801..1811
                                                                                                          src/core/io/encoder.ts on lines 1836..1846
                                                                                                          src/core/io/encoder.ts on lines 3001..3011
                                                                                                          src/core/io/encoder.ts on lines 3187..3197
                                                                                                          src/core/io/encoder.ts on lines 3202..3212
                                                                                                          src/core/io/encoder.ts on lines 3217..3227

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 73.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 7 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            cancelHeadTimestamp(tickerId: number): void {
                                                                                                              if (this.serverVersion < MIN_SERVER_VER.CANCEL_HEADTIMESTAMP) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support head time stamp requests canceling.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 6 other locations - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 1801..1811
                                                                                                          src/core/io/encoder.ts on lines 1836..1846
                                                                                                          src/core/io/encoder.ts on lines 2388..2398
                                                                                                          src/core/io/encoder.ts on lines 3001..3011
                                                                                                          src/core/io/encoder.ts on lines 3187..3197
                                                                                                          src/core/io/encoder.ts on lines 3217..3227

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 73.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 7 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            cancelPnL(reqId: number): void {
                                                                                                              if (this.serverVersion < MIN_SERVER_VER.PNL) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support pnl requests.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 6 other locations - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 1836..1846
                                                                                                          src/core/io/encoder.ts on lines 2388..2398
                                                                                                          src/core/io/encoder.ts on lines 3001..3011
                                                                                                          src/core/io/encoder.ts on lines 3187..3197
                                                                                                          src/core/io/encoder.ts on lines 3202..3212
                                                                                                          src/core/io/encoder.ts on lines 3217..3227

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 73.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 7 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            reqMarketRule(marketRuleId: number): void {
                                                                                                              if (this.serverVersion < MIN_SERVER_VER.MARKET_RULES) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support market rule requests.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 6 other locations - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 1801..1811
                                                                                                          src/core/io/encoder.ts on lines 1836..1846
                                                                                                          src/core/io/encoder.ts on lines 2388..2398
                                                                                                          src/core/io/encoder.ts on lines 3001..3011
                                                                                                          src/core/io/encoder.ts on lines 3187..3197
                                                                                                          src/core/io/encoder.ts on lines 3202..3212

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 73.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            reqCurrentTime(): void {
                                                                                                              if (this.serverVersion < 33) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support current time requests.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 2814..2826

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 73.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 7 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            cancelPnLSingle(reqId: number): void {
                                                                                                              if (this.serverVersion < MIN_SERVER_VER.PNL) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support pnl requests.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 6 other locations - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 1801..1811
                                                                                                          src/core/io/encoder.ts on lines 2388..2398
                                                                                                          src/core/io/encoder.ts on lines 3001..3011
                                                                                                          src/core/io/encoder.ts on lines 3187..3197
                                                                                                          src/core/io/encoder.ts on lines 3202..3212
                                                                                                          src/core/io/encoder.ts on lines 3217..3227

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 73.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            reqScannerParameters(): void {
                                                                                                              if (this.serverVersion < 24) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support API scanner subscription.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 2046..2058

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 73.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 7 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            reqSoftDollarTiers(reqId: number): void {
                                                                                                              if (this.serverVersion < MIN_SERVER_VER.SOFT_DOLLAR_TIER) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support soft dollar tier requests.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 6 other locations - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 1801..1811
                                                                                                          src/core/io/encoder.ts on lines 1836..1846
                                                                                                          src/core/io/encoder.ts on lines 2388..2398
                                                                                                          src/core/io/encoder.ts on lines 3187..3197
                                                                                                          src/core/io/encoder.ts on lines 3202..3212
                                                                                                          src/core/io/encoder.ts on lines 3217..3227

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 73.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 7 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            cancelHistogramData(tickerId: number): void {
                                                                                                              if (this.serverVersion < MIN_SERVER_VER.REQ_HISTOGRAM) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support head time stamp requests.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 6 other locations - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 1801..1811
                                                                                                          src/core/io/encoder.ts on lines 1836..1846
                                                                                                          src/core/io/encoder.ts on lines 2388..2398
                                                                                                          src/core/io/encoder.ts on lines 3001..3011
                                                                                                          src/core/io/encoder.ts on lines 3202..3212
                                                                                                          src/core/io/encoder.ts on lines 3217..3227

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 73.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            reqWshMetaData(reqId: number): void {
                                                                                                              if (this.serverVersion < MIN_SERVER_VER.WSHE_CALENDAR) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support WSHE Calendar API.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 3 other locations - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 3256..3266
                                                                                                          src/core/io/encoder.ts on lines 3324..3334
                                                                                                          src/core/io/encoder.ts on lines 3336..3346

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 71.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            reqUserInfo(reqId: number): void {
                                                                                                              if (this.serverVersion < MIN_SERVER_VER.USER_INFO) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support user info requests.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 3 other locations - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 3244..3254
                                                                                                          src/core/io/encoder.ts on lines 3256..3266
                                                                                                          src/core/io/encoder.ts on lines 3324..3334

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 71.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            reqCancelWshEventData(reqId: number): void {
                                                                                                              if (this.serverVersion < MIN_SERVER_VER.WSHE_CALENDAR) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support WSHE Calendar API.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 3 other locations - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 3244..3254
                                                                                                          src/core/io/encoder.ts on lines 3256..3266
                                                                                                          src/core/io/encoder.ts on lines 3336..3346

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 71.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            reqCancelWshMetaData(reqId: number): void {
                                                                                                              if (this.serverVersion < MIN_SERVER_VER.WSHE_CALENDAR) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support WSHE Calendar API.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 3 other locations - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 3244..3254
                                                                                                          src/core/io/encoder.ts on lines 3324..3334
                                                                                                          src/core/io/encoder.ts on lines 3336..3346

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 71.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            reqFamilyCodes(): void {
                                                                                                              if (this.serverVersion < MIN_SERVER_VER.REQ_FAMILY_CODES) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support family codes request.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 2 other locations - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 3046..3056
                                                                                                          src/core/io/encoder.ts on lines 3107..3117

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 69.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            reqNewsProviders(): void {
                                                                                                              if (this.serverVersion < MIN_SERVER_VER.REQ_SMART_COMPONENTS) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support smart components request.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 2 other locations - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 3016..3026
                                                                                                          src/core/io/encoder.ts on lines 3046..3056

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 69.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            reqMktDepthExchanges(): void {
                                                                                                              if (this.serverVersion < MIN_SERVER_VER.REQ_MKT_DEPTH_EXCHANGES) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support market depth exchanges request.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 2 other locations - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 3016..3026
                                                                                                          src/core/io/encoder.ts on lines 3107..3117

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 69.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            reqAccountSummary(reqId: number, group: string, tags: string): void {
                                                                                                              if (this.serverVersion < MIN_SERVER_VER.ACCT_SUMMARY) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support account summary requests.",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 2700..2722

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 66.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            reqPositionsMulti(
                                                                                                              reqId: number,
                                                                                                              account: string,
                                                                                                              modelCode: string | null,
                                                                                                            ): void {
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 1769..1781

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 66.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion >= MIN_SERVER_VER.WSH_EVENT_DATA_FILTERS_DATE) {
                                                                                                                tokens.push(wshEventData.startDate);
                                                                                                                tokens.push(wshEventData.endDate);
                                                                                                                tokens.push(wshEventData.totalLimit);
                                                                                                              }
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 1485..1489

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 64.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion >= MIN_SERVER_VER.SCALE_TABLE) {
                                                                                                                tokens.push(order.scaleTable);
                                                                                                                tokens.push(order.activeStartTime);
                                                                                                                tokens.push(order.activeStopTime);
                                                                                                              }
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 3315..3319

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 64.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.TRADING_CLASS) {
                                                                                                                if (!!contract.tradingClass || contract.conId != undefined) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support conId and tradingClass parameters in reqHistoricalData.",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 3 other locations - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 626..634
                                                                                                          src/core/io/encoder.ts on lines 2585..2593
                                                                                                          src/core/io/encoder.ts on lines 2760..2768

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 63.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.TRADING_CLASS) {
                                                                                                                if (!!contract.tradingClass || contract.conId != undefined) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support conId and tradingClass parameters in reqRealTimeBars.",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 3 other locations - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 626..634
                                                                                                          src/core/io/encoder.ts on lines 2186..2194
                                                                                                          src/core/io/encoder.ts on lines 2585..2593

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 63.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.TRADING_CLASS) {
                                                                                                                if (!!contract.tradingClass || contract.conId != undefined) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support conId and tradingClass parameters in reqMktDepth.",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 3 other locations - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 626..634
                                                                                                          src/core/io/encoder.ts on lines 2186..2194
                                                                                                          src/core/io/encoder.ts on lines 2760..2768

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 63.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.TRADING_CLASS) {
                                                                                                                if (!!contract.tradingClass || contract.conId != undefined) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support conId and tradingClass parameters in exerciseOptions.",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 3 other locations - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 2186..2194
                                                                                                          src/core/io/encoder.ts on lines 2585..2593
                                                                                                          src/core/io/encoder.ts on lines 2760..2768

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 63.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.SEC_ID_TYPE) {
                                                                                                                if (!!contract.secIdType || !!contract.secId) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support secIdType and secId parameters.",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 1943..1951

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 63.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.SEC_ID_TYPE) {
                                                                                                                if (!!contract.secIdType || !!contract.secId) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support secIdType and secId parameters.",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 786..794

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 63.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                                if (smartComboRoutingParamsCount > 0) {
                                                                                                                  order.smartComboRoutingParams?.forEach((param) => {
                                                                                                                    tokens.push(param.tag);
                                                                                                                    tokens.push(param.value);
                                                                                                                  });
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 1529..1534

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 62.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                                  if (algoParamsCount > 0) {
                                                                                                                    order.algoParams?.forEach((param) => {
                                                                                                                      tokens.push(param.tag);
                                                                                                                      tokens.push(param.value);
                                                                                                                    });
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 1319..1324

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 62.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (
                                                                                                                this.serverVersion < MIN_SERVER_VER.DECISION_MAKER &&
                                                                                                                (!!order.mifid2DecisionMaker || !!order.mifid2DecisionAlgo)
                                                                                                              ) {
                                                                                                                return this.emitError(
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 1035..1044

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 60.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (
                                                                                                                this.serverVersion < MIN_SERVER_VER.MIFID_EXECUTION &&
                                                                                                                (!!order.mifid2ExecutionTrader || !!order.mifid2ExecutionAlgo)
                                                                                                              ) {
                                                                                                                return this.emitError(
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 1024..1033

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 60.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                                      case OrderConditionType.Margin: {
                                                                                                                        const marginCond = cond as MarginCondition;
                                                                                                                        // OperatorCondition
                                                                                                                        tokens.push(marginCond.isMore);
                                                                                                                        tokens.push(marginCond.strValue);
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 1618..1624

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 59.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                                      case OrderConditionType.Time: {
                                                                                                                        const timeConditionCond = cond as TimeCondition;
                                                                                                                        // OperatorCondition
                                                                                                                        tokens.push(timeConditionCond.isMore);
                                                                                                                        tokens.push(timeConditionCond.strValue);
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 1 hr to fix
                                                                                                          src/core/io/encoder.ts on lines 1586..1592

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 59.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 8 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.LINKING) {
                                                                                                                if (!!contract.primaryExch) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support primaryExchange parameter in reqContractDetails.",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 7 other locations - About 50 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 338..346
                                                                                                          src/core/io/encoder.ts on lines 766..774
                                                                                                          src/core/io/encoder.ts on lines 828..836
                                                                                                          src/core/io/encoder.ts on lines 926..934
                                                                                                          src/core/io/encoder.ts on lines 982..990
                                                                                                          src/core/io/encoder.ts on lines 1953..1961
                                                                                                          src/core/io/encoder.ts on lines 2469..2477

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 51.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 5 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.CASH_QTY) {
                                                                                                                if (order.cashQty !== undefined) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support cash quantity parameter",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 4 other locations - About 50 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 756..764
                                                                                                          src/core/io/encoder.ts on lines 796..804
                                                                                                          src/core/io/encoder.ts on lines 916..924
                                                                                                          src/core/io/encoder.ts on lines 2108..2116

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 51.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 5 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.SCALE_ORDERS2) {
                                                                                                                if (order.scaleSubsLevelSize !== undefined) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support Subsequent Level Size for Scale orders.",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 4 other locations - About 50 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 796..804
                                                                                                          src/core/io/encoder.ts on lines 916..924
                                                                                                          src/core/io/encoder.ts on lines 1014..1022
                                                                                                          src/core/io/encoder.ts on lines 2108..2116

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 51.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 5 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.TRAILING_PERCENT) {
                                                                                                                if (order.trailingPercent !== undefined) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support trailing percent parameter.",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 4 other locations - About 50 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 756..764
                                                                                                          src/core/io/encoder.ts on lines 796..804
                                                                                                          src/core/io/encoder.ts on lines 1014..1022
                                                                                                          src/core/io/encoder.ts on lines 2108..2116

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 51.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 8 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.TRADING_CLASS) {
                                                                                                                if (!!contract.tradingClass) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support tradingClass parameter in calculateOptionPrice.",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 7 other locations - About 50 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 766..774
                                                                                                          src/core/io/encoder.ts on lines 828..836
                                                                                                          src/core/io/encoder.ts on lines 926..934
                                                                                                          src/core/io/encoder.ts on lines 982..990
                                                                                                          src/core/io/encoder.ts on lines 1953..1961
                                                                                                          src/core/io/encoder.ts on lines 1963..1971
                                                                                                          src/core/io/encoder.ts on lines 2469..2477

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 51.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 8 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.TRADING_CLASS) {
                                                                                                                if (!!contract.tradingClass) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support tradingClass parameter in reqContractDetails.",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 7 other locations - About 50 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 338..346
                                                                                                          src/core/io/encoder.ts on lines 766..774
                                                                                                          src/core/io/encoder.ts on lines 828..836
                                                                                                          src/core/io/encoder.ts on lines 926..934
                                                                                                          src/core/io/encoder.ts on lines 982..990
                                                                                                          src/core/io/encoder.ts on lines 1963..1971
                                                                                                          src/core/io/encoder.ts on lines 2469..2477

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 51.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 8 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.HEDGE_ORDERS) {
                                                                                                                if (!!order.hedgeType) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support hedge orders.",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 7 other locations - About 50 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 338..346
                                                                                                          src/core/io/encoder.ts on lines 766..774
                                                                                                          src/core/io/encoder.ts on lines 926..934
                                                                                                          src/core/io/encoder.ts on lines 982..990
                                                                                                          src/core/io/encoder.ts on lines 1953..1961
                                                                                                          src/core/io/encoder.ts on lines 1963..1971
                                                                                                          src/core/io/encoder.ts on lines 2469..2477

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 51.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 8 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.TRADING_CLASS) {
                                                                                                                if (!!contract.tradingClass) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support tradingClass parameters in placeOrder.",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 7 other locations - About 50 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 338..346
                                                                                                          src/core/io/encoder.ts on lines 766..774
                                                                                                          src/core/io/encoder.ts on lines 828..836
                                                                                                          src/core/io/encoder.ts on lines 982..990
                                                                                                          src/core/io/encoder.ts on lines 1953..1961
                                                                                                          src/core/io/encoder.ts on lines 1963..1971
                                                                                                          src/core/io/encoder.ts on lines 2469..2477

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 51.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 5 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.PLACE_ORDER_CONID) {
                                                                                                                if (contract.conId != undefined) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support conId parameter.",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 4 other locations - About 50 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 756..764
                                                                                                          src/core/io/encoder.ts on lines 916..924
                                                                                                          src/core/io/encoder.ts on lines 1014..1022
                                                                                                          src/core/io/encoder.ts on lines 2108..2116

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 51.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 8 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.MODELS_SUPPORT) {
                                                                                                                if (!!order.modelCode) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support model code parameter.",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 7 other locations - About 50 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 338..346
                                                                                                          src/core/io/encoder.ts on lines 766..774
                                                                                                          src/core/io/encoder.ts on lines 828..836
                                                                                                          src/core/io/encoder.ts on lines 926..934
                                                                                                          src/core/io/encoder.ts on lines 1953..1961
                                                                                                          src/core/io/encoder.ts on lines 1963..1971
                                                                                                          src/core/io/encoder.ts on lines 2469..2477

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 51.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 8 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.TRADING_CLASS) {
                                                                                                                if (!!contract.tradingClass) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support tradingClass parameter in reqMarketData.",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 7 other locations - About 50 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 338..346
                                                                                                          src/core/io/encoder.ts on lines 766..774
                                                                                                          src/core/io/encoder.ts on lines 828..836
                                                                                                          src/core/io/encoder.ts on lines 926..934
                                                                                                          src/core/io/encoder.ts on lines 982..990
                                                                                                          src/core/io/encoder.ts on lines 1953..1961
                                                                                                          src/core/io/encoder.ts on lines 1963..1971

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 51.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 8 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.ALGO_ORDERS) {
                                                                                                                if (!!order.algoStrategy) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support algo orders.",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 7 other locations - About 50 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 338..346
                                                                                                          src/core/io/encoder.ts on lines 828..836
                                                                                                          src/core/io/encoder.ts on lines 926..934
                                                                                                          src/core/io/encoder.ts on lines 982..990
                                                                                                          src/core/io/encoder.ts on lines 1953..1961
                                                                                                          src/core/io/encoder.ts on lines 1963..1971
                                                                                                          src/core/io/encoder.ts on lines 2469..2477

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 51.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 5 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.TRADING_CLASS) {
                                                                                                                if (contract.conId != undefined) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support conId parameter in reqFundamentalData.",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 4 other locations - About 50 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 756..764
                                                                                                          src/core/io/encoder.ts on lines 796..804
                                                                                                          src/core/io/encoder.ts on lines 916..924
                                                                                                          src/core/io/encoder.ts on lines 1014..1022

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 51.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 6 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion >= MIN_SERVER_VER.PTA_ORDERS) {
                                                                                                                tokens.push(order.clearingAccount);
                                                                                                                tokens.push(order.clearingIntent);
                                                                                                              }
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 5 other locations - About 40 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 1285..1288
                                                                                                          src/core/io/encoder.ts on lines 1555..1558
                                                                                                          src/core/io/encoder.ts on lines 1667..1670
                                                                                                          src/core/io/encoder.ts on lines 1672..1675
                                                                                                          src/core/io/encoder.ts on lines 2032..2035

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 49.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 6 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion >= MIN_SERVER_VER.DECISION_MAKER) {
                                                                                                                tokens.push(order.mifid2DecisionMaker);
                                                                                                                tokens.push(order.mifid2DecisionAlgo);
                                                                                                              }
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 5 other locations - About 40 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 1285..1288
                                                                                                          src/core/io/encoder.ts on lines 1502..1505
                                                                                                          src/core/io/encoder.ts on lines 1555..1558
                                                                                                          src/core/io/encoder.ts on lines 1672..1675
                                                                                                          src/core/io/encoder.ts on lines 2032..2035

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 49.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 6 locations. Consider refactoring.
                                                                                                          Open

                                                                                                                    if (this.serverVersion >= MIN_SERVER_VER.SSHORT_COMBO_LEGS) {
                                                                                                                      tokens.push(comboLeg.shortSaleSlot);
                                                                                                                      tokens.push(comboLeg.designatedLocation);
                                                                                                                    }
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 5 other locations - About 40 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 1502..1505
                                                                                                          src/core/io/encoder.ts on lines 1555..1558
                                                                                                          src/core/io/encoder.ts on lines 1667..1670
                                                                                                          src/core/io/encoder.ts on lines 1672..1675
                                                                                                          src/core/io/encoder.ts on lines 2032..2035

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 49.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 6 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion >= MIN_SERVER_VER.MIFID_EXECUTION) {
                                                                                                                tokens.push(order.mifid2ExecutionTrader);
                                                                                                                tokens.push(order.mifid2ExecutionAlgo);
                                                                                                              }
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 5 other locations - About 40 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 1285..1288
                                                                                                          src/core/io/encoder.ts on lines 1502..1505
                                                                                                          src/core/io/encoder.ts on lines 1555..1558
                                                                                                          src/core/io/encoder.ts on lines 1667..1670
                                                                                                          src/core/io/encoder.ts on lines 2032..2035

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 49.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 6 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion >= MIN_SERVER_VER.SEC_ID_TYPE) {
                                                                                                                args.push(contract.secIdType);
                                                                                                                args.push(contract.secId);
                                                                                                              }
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 5 other locations - About 40 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 1285..1288
                                                                                                          src/core/io/encoder.ts on lines 1502..1505
                                                                                                          src/core/io/encoder.ts on lines 1555..1558
                                                                                                          src/core/io/encoder.ts on lines 1667..1670
                                                                                                          src/core/io/encoder.ts on lines 1672..1675

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 49.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 6 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion >= MIN_SERVER_VER.RANDOMIZE_SIZE_AND_PRICE) {
                                                                                                                tokens.push(order.randomizeSize);
                                                                                                                tokens.push(order.randomizePrice);
                                                                                                              }
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 5 other locations - About 40 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 1285..1288
                                                                                                          src/core/io/encoder.ts on lines 1502..1505
                                                                                                          src/core/io/encoder.ts on lines 1667..1670
                                                                                                          src/core/io/encoder.ts on lines 1672..1675
                                                                                                          src/core/io/encoder.ts on lines 2032..2035

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 49.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (
                                                                                                                this.serverVersion < MIN_SERVER_VER.POST_TO_ATS &&
                                                                                                                order.postToAts != undefined
                                                                                                              ) {
                                                                                                                return this.emitError(
                                                                                                          Severity: Minor
                                                                                                          Found in src/core/io/encoder.ts and 2 other locations - About 40 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 1090..1099
                                                                                                          src/core/io/encoder.ts on lines 1123..1132

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 48.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.ALGO_ID && !!order.algoId) {
                                                                                                                return this.emitError(
                                                                                                                  "It does not support algoId parameter",
                                                                                                                  ErrorCode.UPDATE_TWS,
                                                                                                                  id,
                                                                                                          Severity: Minor
                                                                                                          Found in src/core/io/encoder.ts and 2 other locations - About 40 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 992..1001
                                                                                                          src/core/io/encoder.ts on lines 2603..2612

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 48.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (
                                                                                                                this.serverVersion < MIN_SERVER_VER.ADVANCED_ORDER_REJECT &&
                                                                                                                order.advancedErrorOverride != undefined
                                                                                                              ) {
                                                                                                                return this.emitError(
                                                                                                          Severity: Minor
                                                                                                          Found in src/core/io/encoder.ts and 2 other locations - About 40 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 1090..1099
                                                                                                          src/core/io/encoder.ts on lines 1101..1110

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 48.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (
                                                                                                                this.serverVersion < MIN_SERVER_VER.MKT_DEPTH_PRIM_EXCHANGE &&
                                                                                                                !!contract.primaryExch
                                                                                                              ) {
                                                                                                                return this.emitError(
                                                                                                          Severity: Minor
                                                                                                          Found in src/core/io/encoder.ts and 2 other locations - About 40 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 950..956
                                                                                                          src/core/io/encoder.ts on lines 992..1001

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 48.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (
                                                                                                                this.serverVersion < MIN_SERVER_VER.DURATION &&
                                                                                                                order.duration != undefined
                                                                                                              ) {
                                                                                                                return this.emitError(
                                                                                                          Severity: Minor
                                                                                                          Found in src/core/io/encoder.ts and 2 other locations - About 40 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 1101..1110
                                                                                                          src/core/io/encoder.ts on lines 1123..1132

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 48.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 3 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (
                                                                                                                this.serverVersion < MIN_SERVER_VER.EXT_OPERATOR &&
                                                                                                                !!order.extOperator
                                                                                                              ) {
                                                                                                                return this.emitError(
                                                                                                          Severity: Minor
                                                                                                          Found in src/core/io/encoder.ts and 2 other locations - About 40 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 950..956
                                                                                                          src/core/io/encoder.ts on lines 2603..2612

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 48.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (
                                                                                                                this.serverVersion < MIN_SERVER_VER.PRICE_MGMT_ALGO &&
                                                                                                                order.usePriceMgmtAlgo != null
                                                                                                              ) {
                                                                                                                return this.emitError(
                                                                                                          Severity: Minor
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 40 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 1112..1121

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 48.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (
                                                                                                                this.serverVersion < MIN_SERVER_VER.AUTO_CANCEL_PARENT &&
                                                                                                                order.autoCancelParent != null
                                                                                                              ) {
                                                                                                                return this.emitError(
                                                                                                          Severity: Minor
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 40 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 1079..1088

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 48.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 8 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.WHAT_IF_ORDERS) {
                                                                                                                if (order.whatIf) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support what-if orders.",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 7 other locations - About 35 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 746..754
                                                                                                          src/core/io/encoder.ts on lines 776..784
                                                                                                          src/core/io/encoder.ts on lines 838..846
                                                                                                          src/core/io/encoder.ts on lines 972..980
                                                                                                          src/core/io/encoder.ts on lines 1160..1168
                                                                                                          src/core/io/encoder.ts on lines 1170..1178
                                                                                                          src/core/io/encoder.ts on lines 1973..1981

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 47.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 8 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.NOT_HELD) {
                                                                                                                if (order.notHeld) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support notHeld parameter.",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 7 other locations - About 35 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 736..744
                                                                                                          src/core/io/encoder.ts on lines 746..754
                                                                                                          src/core/io/encoder.ts on lines 838..846
                                                                                                          src/core/io/encoder.ts on lines 972..980
                                                                                                          src/core/io/encoder.ts on lines 1160..1168
                                                                                                          src/core/io/encoder.ts on lines 1170..1178
                                                                                                          src/core/io/encoder.ts on lines 1973..1981

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 47.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 8 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.CUSTOMER_ACCOUNT) {
                                                                                                                if (order.customerAccount) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support customer account parameter",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 7 other locations - About 35 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 736..744
                                                                                                          src/core/io/encoder.ts on lines 746..754
                                                                                                          src/core/io/encoder.ts on lines 776..784
                                                                                                          src/core/io/encoder.ts on lines 838..846
                                                                                                          src/core/io/encoder.ts on lines 972..980
                                                                                                          src/core/io/encoder.ts on lines 1170..1178
                                                                                                          src/core/io/encoder.ts on lines 1973..1981

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 47.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 8 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.PROFESSIONAL_CUSTOMER) {
                                                                                                                if (order.professionalCustomer) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support professional customer parameter",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 7 other locations - About 35 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 736..744
                                                                                                          src/core/io/encoder.ts on lines 746..754
                                                                                                          src/core/io/encoder.ts on lines 776..784
                                                                                                          src/core/io/encoder.ts on lines 838..846
                                                                                                          src/core/io/encoder.ts on lines 972..980
                                                                                                          src/core/io/encoder.ts on lines 1160..1168
                                                                                                          src/core/io/encoder.ts on lines 1973..1981

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 47.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 8 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.ORDER_SOLICITED) {
                                                                                                                if (order.solicited) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support order solicited parameter.",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 7 other locations - About 35 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 736..744
                                                                                                          src/core/io/encoder.ts on lines 746..754
                                                                                                          src/core/io/encoder.ts on lines 776..784
                                                                                                          src/core/io/encoder.ts on lines 838..846
                                                                                                          src/core/io/encoder.ts on lines 1160..1168
                                                                                                          src/core/io/encoder.ts on lines 1170..1178
                                                                                                          src/core/io/encoder.ts on lines 1973..1981

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 47.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 8 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.DELTA_NEUTRAL) {
                                                                                                                if (contract.deltaNeutralContract) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support delta-neutral orders.",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 7 other locations - About 35 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 736..744
                                                                                                          src/core/io/encoder.ts on lines 776..784
                                                                                                          src/core/io/encoder.ts on lines 838..846
                                                                                                          src/core/io/encoder.ts on lines 972..980
                                                                                                          src/core/io/encoder.ts on lines 1160..1168
                                                                                                          src/core/io/encoder.ts on lines 1170..1178
                                                                                                          src/core/io/encoder.ts on lines 1973..1981

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 47.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 8 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.OPT_OUT_SMART_ROUTING) {
                                                                                                                if (order.optOutSmartRouting) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support optOutSmartRouting parameter.",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 7 other locations - About 35 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 736..744
                                                                                                          src/core/io/encoder.ts on lines 746..754
                                                                                                          src/core/io/encoder.ts on lines 776..784
                                                                                                          src/core/io/encoder.ts on lines 972..980
                                                                                                          src/core/io/encoder.ts on lines 1160..1168
                                                                                                          src/core/io/encoder.ts on lines 1170..1178
                                                                                                          src/core/io/encoder.ts on lines 1973..1981

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 47.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 8 locations. Consider refactoring.
                                                                                                          Open

                                                                                                              if (this.serverVersion < MIN_SERVER_VER.BOND_ISSUERID) {
                                                                                                                if (contract.issuerId) {
                                                                                                                  return this.emitError(
                                                                                                                    "It does not support issuerId parameter in reqContractDetails.",
                                                                                                                    ErrorCode.UPDATE_TWS,
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 7 other locations - About 35 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 736..744
                                                                                                          src/core/io/encoder.ts on lines 746..754
                                                                                                          src/core/io/encoder.ts on lines 776..784
                                                                                                          src/core/io/encoder.ts on lines 838..846
                                                                                                          src/core/io/encoder.ts on lines 972..980
                                                                                                          src/core/io/encoder.ts on lines 1160..1168
                                                                                                          src/core/io/encoder.ts on lines 1170..1178

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 47.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 5 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            cancelMktData(tickerId: number): void {
                                                                                                              const version = 1;
                                                                                                          
                                                                                                              this.sendMsg(OUT_MSG_ID.CANCEL_MKT_DATA, version, tickerId);
                                                                                                            }
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 4 other locations - About 30 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 403..407
                                                                                                          src/core/io/encoder.ts on lines 2403..2407
                                                                                                          src/core/io/encoder.ts on lines 2937..2941
                                                                                                          src/core/io/encoder.ts on lines 2964..2968

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 45.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 5 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            unsubscribeToGroupEvents(reqId: number): void {
                                                                                                              const version = 1;
                                                                                                          
                                                                                                              this.sendMsg(OUT_MSG_ID.UNSUBSCRIBE_FROM_GROUP_EVENTS, version, reqId);
                                                                                                            }
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 4 other locations - About 30 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 403..407
                                                                                                          src/core/io/encoder.ts on lines 480..484
                                                                                                          src/core/io/encoder.ts on lines 2403..2407
                                                                                                          src/core/io/encoder.ts on lines 2937..2941

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 45.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 5 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            cancelAccountUpdatesMulti(reqId: number): void {
                                                                                                              const version = 2;
                                                                                                          
                                                                                                              this.sendMsg(OUT_MSG_ID.CANCEL_ACCOUNT_UPDATES_MULTI, version, reqId);
                                                                                                            }
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 4 other locations - About 30 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 480..484
                                                                                                          src/core/io/encoder.ts on lines 2403..2407
                                                                                                          src/core/io/encoder.ts on lines 2937..2941
                                                                                                          src/core/io/encoder.ts on lines 2964..2968

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 45.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 5 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            reqIds(numIds: number): void {
                                                                                                              const version = 1;
                                                                                                          
                                                                                                              this.sendMsg(OUT_MSG_ID.REQ_IDS, version, numIds);
                                                                                                            }
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 4 other locations - About 30 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 403..407
                                                                                                          src/core/io/encoder.ts on lines 480..484
                                                                                                          src/core/io/encoder.ts on lines 2937..2941
                                                                                                          src/core/io/encoder.ts on lines 2964..2968

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 45.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 5 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            queryDisplayGroups(reqId: number): void {
                                                                                                              const version = 1;
                                                                                                          
                                                                                                              this.sendMsg(OUT_MSG_ID.QUERY_DISPLAY_GROUPS, version, reqId);
                                                                                                            }
                                                                                                          Severity: Major
                                                                                                          Found in src/core/io/encoder.ts and 4 other locations - About 30 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 403..407
                                                                                                          src/core/io/encoder.ts on lines 480..484
                                                                                                          src/core/io/encoder.ts on lines 2403..2407
                                                                                                          src/core/io/encoder.ts on lines 2964..2968

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 45.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            reqNewsBulletins(allMsgs: boolean): void {
                                                                                                              const version = 1;
                                                                                                          
                                                                                                              this.sendMsg(OUT_MSG_ID.REQ_NEWS_BULLETINS, version, allMsgs);
                                                                                                            }
                                                                                                          Severity: Minor
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 30 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 1897..1901

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 45.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                          Open

                                                                                                            reqAutoOpenOrders(bAutoBind: boolean): void {
                                                                                                              const version = 1;
                                                                                                          
                                                                                                              this.sendMsg(OUT_MSG_ID.REQ_AUTO_OPEN_ORDERS, version, bAutoBind);
                                                                                                            }
                                                                                                          Severity: Minor
                                                                                                          Found in src/core/io/encoder.ts and 1 other location - About 30 mins to fix
                                                                                                          src/core/io/encoder.ts on lines 2665..2669

                                                                                                          Duplicated Code

                                                                                                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                          Tuning

                                                                                                          This issue has a mass of 45.

                                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                          Refactorings

                                                                                                          Further Reading

                                                                                                          There are no issues that match your filters.

                                                                                                          Category
                                                                                                          Status