Showing 497 of 497 total issues

Function decodeMsg_HISTORICAL_DATA has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  private decodeMsg_HISTORICAL_DATA(): void {
    let version = Number.MAX_SAFE_INTEGER;
    if (this.serverVersion < MIN_SERVER_VER.SYNT_REALTIME_BARS) {
      version = this.readInt();
    }
Severity: Major
Found in src/core/io/decoder.ts - About 2 hrs to fix

    Function decodeMsg_TICK_BY_TICK has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private decodeMsg_TICK_BY_TICK(): void {
        const reqId = this.readInt();
        const tickType = this.readInt();
        const time = this.readStr();
    
    
    Severity: Major
    Found in src/core/io/decoder.ts - About 2 hrs to fix

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

        calculateOptionPrice(
          reqId: number,
          contract: Contract,
          volatility: number,
          underPrice: number,
      Severity: Major
      Found in src/api/api.ts and 1 other location - About 2 hrs to fix
      src/api/api.ts on lines 169..184

      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 80.

      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

          const order: Order = {
            orderType: OrderType.LMT,
            action: OrderAction.BUY,
            lmtPrice: +this.cmdLineArgs.price,
            orderId: id,
      Severity: Major
      Found in src/tools/modify-order.ts and 1 other location - About 2 hrs to fix
      src/tools/place-order.ts on lines 59..67

      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 80.

      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

              const order: Order = {
                orderType: OrderType.LMT,
                action: OrderAction.BUY,
                lmtPrice: +this.cmdLineArgs.price,
                orderId: id,
      Severity: Major
      Found in src/tools/place-order.ts and 1 other location - About 2 hrs to fix
      src/tools/modify-order.ts on lines 45..53

      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 80.

      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

        calculateImpliedVolatility(
          reqId: number,
          contract: Contract,
          optionPrice: number,
          underPrice: number,
      Severity: Major
      Found in src/api/api.ts and 1 other location - About 2 hrs to fix
      src/api/api.ts on lines 197..212

      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 80.

      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

      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

        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 4 locations. Consider refactoring.
        Open

          readClearingParams(): void {
            if (this.version >= 19) {
              this.order.clearingAccount = this.decoder.readStr();
              this.order.clearingIntent = this.decoder.readStr();
            }
        Severity: Major
        Found in src/core/io/decoder.ts and 3 other locations - About 2 hrs to fix
        src/core/io/decoder.ts on lines 2934..2939
        src/core/io/decoder.ts on lines 3072..3077
        src/core/io/decoder.ts on lines 3273..3278

        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 4 locations. Consider refactoring.
        Open

          readBasisPoints(): void {
            if (this.version >= 14) {
              this.order.basisPoints = this.decoder.readDoubleOrUndefined();
              this.order.basisPointsType = this.decoder.readIntOrUndefined();
            }
        Severity: Major
        Found in src/core/io/decoder.ts and 3 other locations - About 2 hrs to fix
        src/core/io/decoder.ts on lines 2934..2939
        src/core/io/decoder.ts on lines 3184..3189
        src/core/io/decoder.ts on lines 3273..3278

        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 4 locations. Consider refactoring.
        Open

          readVolRandomizeFlags(): void {
            if (this.version >= 34) {
              this.order.randomizeSize = this.decoder.readBool();
              this.order.randomizePrice = this.decoder.readBool();
            }
        Severity: Major
        Found in src/core/io/decoder.ts and 3 other locations - About 2 hrs to fix
        src/core/io/decoder.ts on lines 2934..2939
        src/core/io/decoder.ts on lines 3072..3077
        src/core/io/decoder.ts on lines 3184..3189

        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 4 locations. Consider refactoring.
        Open

          readPegToStkOrVolOrderParams(): void {
            if (this.version >= 9) {
              this.order.stockRangeLower = this.decoder.readDoubleOrUndefined();
              this.order.stockRangeUpper = this.decoder.readDoubleOrUndefined();
            }
        Severity: Major
        Found in src/core/io/decoder.ts and 3 other locations - About 2 hrs to fix
        src/core/io/decoder.ts on lines 3072..3077
        src/core/io/decoder.ts on lines 3184..3189
        src/core/io/decoder.ts on lines 3273..3278

        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

        Controller has 21 functions (exceeds 20 allowed). Consider refactoring.
        Open

        export class Controller implements EncoderCallbacks, DecoderCallbacks {
          /**
           *
           * @param ib The [[IBApi]] object.
           * @param _options The [[IBApi]] creation options.
        Severity: Minor
        Found in src/core/io/controller.ts - About 2 hrs to fix

          Socket has 21 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export class Socket {
            /**
             * Create a new [[Socket]] object.
             *
             * @param controller The parent [[Controller]] object.
          Severity: Minor
          Found in src/core/io/socket.ts - About 2 hrs to fix

            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

            Severity
            Category
            Status
            Source
            Language