Showing 497 of 497 total issues

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

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

  private decodeMsg_SCANNER_DATA(): void {
    const version = this.readInt();
    const reqId = this.readInt();
    let numberOfElements = this.readInt();

Severity: Minor
Found in src/core/io/decoder.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

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

          reqContractDetails(reqId: number, contract: Contract): IBApi {
            this.controller.schedule(() =>
              this.controller.encoder.reqContractDetails(reqId, contract),
            );
            return this;
        Severity: Major
        Found in src/api/api.ts and 1 other location - About 1 hr to fix
        src/api/api.ts on lines 811..816

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

        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

          reqExecutions(reqId: number, filter: ExecutionFilter): IBApi {
            this.controller.schedule(() =>
              this.controller.encoder.reqExecutions(reqId, filter),
            );
            return this;
        Severity: Major
        Found in src/api/api.ts and 1 other location - About 1 hr to fix
        src/api/api.ts on lines 786..791

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

        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 readVolOrderParams has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          readVolOrderParams(readOpenOrderAttribs: boolean): void {
            if (this.version >= 11) {
              this.order.volatility = this.decoder.readDoubleOrUndefined();
              this.order.volatilityType = this.decoder.readInt();
              if (this.version == 11) {
        Severity: Minor
        Found in src/core/io/decoder.ts - About 1 hr to fix

          Function onData has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private onData(data: Buffer): void {
              if (this.useV100Plus) {
                let dataToParse = data;
                if (this._v100MessageBuffer.length > 0) {
                  dataToParse = Buffer.concat([this._v100MessageBuffer, data]);
          Severity: Minor
          Found in src/core/io/socket.ts - About 1 hr to fix

            Function decodeMsg_TICK_PRICE has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              private decodeMsg_TICK_PRICE(): void {
                // read from input queue
            
                const version = this.readInt();
                const tickerId = this.readInt();
            Severity: Minor
            Found in src/core/io/decoder.ts - About 1 hr to fix

              Function readComboLegs has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                readComboLegs(): void {
                  if (this.version >= 14) {
                    this.contract.comboLegsDescription = this.decoder.readStr();
                  }
              
              
              Severity: Minor
              Found in src/core/io/decoder.ts - About 1 hr to fix

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

                  reqSmartComponents(reqId: number, bboExchange: string): IBApi {
                    this.controller.schedule(() =>
                      this.controller.encoder.reqSmartComponents(reqId, bboExchange),
                    );
                    return this;
                Severity: Major
                Found in src/api/api.ts and 3 other locations - About 1 hr to fix
                src/api/api.ts on lines 379..384
                src/api/api.ts on lines 1172..1177
                src/api/api.ts on lines 1581..1586

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

                  reqMatchingSymbols(reqId: number, pattern: string): IBApi {
                    this.controller.schedule(() =>
                      this.controller.encoder.reqMatchingSymbols(reqId, pattern),
                    );
                    return this;
                Severity: Major
                Found in src/api/api.ts and 3 other locations - About 1 hr to fix
                src/api/api.ts on lines 379..384
                src/api/api.ts on lines 1484..1489
                src/api/api.ts on lines 1581..1586

                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

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

                  warn(tag: string, args: unknown[] | string): void {
                    if (this._logLevel >= LogLevel.WARN) {
                      this.logger.warn(tag, args);
                    }
                  }
                Severity: Major
                Found in src/core/api-next/logger.ts and 2 other locations - About 1 hr to fix
                src/core/api-next/logger.ts on lines 26..30
                src/core/api-next/logger.ts on lines 33..37

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

                  info(tag: string, args: unknown[] | string): void {
                    if (this._logLevel >= LogLevel.INFO) {
                      this.logger.info(tag, args);
                    }
                  }
                Severity: Major
                Found in src/core/api-next/logger.ts and 2 other locations - About 1 hr to fix
                src/core/api-next/logger.ts on lines 26..30
                src/core/api-next/logger.ts on lines 40..44

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

                  cancelOrder(orderId: number, manualOrderCancelTime?: string): IBApi {
                    this.controller.schedule(() =>
                      this.controller.encoder.cancelOrder(orderId, manualOrderCancelTime),
                    );
                    return this;
                Severity: Major
                Found in src/api/api.ts and 3 other locations - About 1 hr to fix
                src/api/api.ts on lines 1172..1177
                src/api/api.ts on lines 1484..1489
                src/api/api.ts on lines 1581..1586

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

                  debug(tag: string, args: unknown[] | string): void {
                    if (this._logLevel >= LogLevel.DETAIL) {
                      this.logger.debug(tag, args);
                    }
                  }
                Severity: Major
                Found in src/core/api-next/logger.ts and 2 other locations - About 1 hr to fix
                src/core/api-next/logger.ts on lines 33..37
                src/core/api-next/logger.ts on lines 40..44

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

                  updateDisplayGroup(reqId: number, contractInfo: string): IBApi {
                    this.controller.schedule(() =>
                      this.controller.encoder.updateDisplayGroup(reqId, contractInfo),
                    );
                    return this;
                Severity: Major
                Found in src/api/api.ts and 3 other locations - About 1 hr to fix
                src/api/api.ts on lines 379..384
                src/api/api.ts on lines 1172..1177
                src/api/api.ts on lines 1484..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 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

                Severity
                Category
                Status
                Source
                Language