Showing 497 of 497 total issues

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

Function register has 71 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  register<T>(
    requestFunction: (reqId: number) => void,
    cancelFunction: (reqId: number) => void | null | undefined,
    eventHandler: [
      EventName,
Severity: Major
Found in src/core/api-next/subscription-registry.ts - About 2 hrs to fix

    Function decodeMsg_TICK_OPTION_COMPUTATION has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private decodeMsg_TICK_OPTION_COMPUTATION(): void {
        let version;
        if (this.serverVersion >= MIN_SERVER_VER.PRICE_BASED_VOLATILITY)
          version = Number.MAX_VALUE;
        else version = this.readInt();
    Severity: Major
    Found in src/core/io/decoder.ts - About 2 hrs to fix

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

      export class Index implements Contract {
        constructor(
          public symbol: string,
          public currency?: string,
          public exchange?: string,
      Severity: Major
      Found in src/api/contract/ind.ts and 3 other locations - About 2 hrs to fix
      src/api/contract/cfd.ts on lines 7..18
      src/api/contract/crypto.ts on lines 7..18
      src/api/contract/stock.ts on lines 7..18

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

      export class CFD implements Contract {
        constructor(
          public symbol: string,
          public currency?: string,
          public exchange?: string
      Severity: Major
      Found in src/api/contract/cfd.ts and 3 other locations - About 2 hrs to fix
      src/api/contract/crypto.ts on lines 7..18
      src/api/contract/ind.ts on lines 7..18
      src/api/contract/stock.ts on lines 7..18

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

      export class Crypto implements Contract {
        constructor(
          public symbol: string,
          public exchange?: string,
          public currency?: string,
      Severity: Major
      Found in src/api/contract/crypto.ts and 3 other locations - About 2 hrs to fix
      src/api/contract/cfd.ts on lines 7..18
      src/api/contract/ind.ts on lines 7..18
      src/api/contract/stock.ts on lines 7..18

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

      export class Stock implements Contract {
        constructor(
          public symbol: string,
          public exchange?: string,
          public currency?: string
      Severity: Major
      Found in src/api/contract/stock.ts and 3 other locations - About 2 hrs to fix
      src/api/contract/cfd.ts on lines 7..18
      src/api/contract/crypto.ts on lines 7..18
      src/api/contract/ind.ts on lines 7..18

      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

          this.subscription$ = this.api
            .getAutoOpenOrders(this.cmdLineArgs.bind ? true : false)
            .subscribe({
              next: (data) => {
                this.printObject(data);
      Severity: Major
      Found in src/tools/open-orders-auto.ts and 1 other location - About 2 hrs to fix
      src/tools/open-orders.ts on lines 37..47

      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_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

          this.subscription$ = this.api.getOpenOrders().subscribe({
            next: (data) => {
              this.printObject(data);
            },
            error: (err: IBApiNextError) => {
      Severity: Major
      Found in src/tools/open-orders.ts and 1 other location - About 2 hrs to fix
      src/tools/open-orders-auto.ts on lines 37..49

      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

      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

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

        private decodeMsg_TICK_GENERIC(): void {
          this.readInt(); // version
          const tickerId = this.readInt();
          const tickType = this.readInt();
          const value = this.readDouble();
      Severity: Major
      Found in src/core/io/decoder.ts and 2 other locations - About 2 hrs to fix
      src/core/io/decoder.ts on lines 629..636
      src/core/io/decoder.ts on lines 1675..1682

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

      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

        private decodeMsg_TICK_SIZE(): void {
          this.readInt(); // version
          const tickerId = this.readInt();
          const tickType = this.readInt();
          const size = this.readDecimal();
      Severity: Major
      Found in src/core/io/decoder.ts and 2 other locations - About 2 hrs to fix
      src/core/io/decoder.ts on lines 1663..1670
      src/core/io/decoder.ts on lines 1675..1682

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

      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

        private decodeMsg_TICK_STRING(): void {
          this.readInt(); // version
          const tickerId = this.readInt();
          const tickType = this.readInt();
          const value = this.readStr();
      Severity: Major
      Found in src/core/io/decoder.ts and 2 other locations - About 2 hrs to fix
      src/core/io/decoder.ts on lines 629..636
      src/core/io/decoder.ts on lines 1663..1670

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

      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.decoder.readBool()) {
              const conId = this.decoder.readInt();
              const delta = this.decoder.readDouble();
              const price = this.decoder.readDouble();
              this.contract.deltaNeutralContract = {
      Severity: Major
      Found in src/core/io/decoder.ts and 1 other location - About 2 hrs to fix
      src/core/io/decoder.ts on lines 3431..3440

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

      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.SOFT_DOLLAR_TIER) {
            const name = this.decoder.readStr();
            const value = this.decoder.readStr();
            const displayName = this.decoder.readStr();
            this.order.softDollarTier = {
      Severity: Major
      Found in src/core/io/decoder.ts and 1 other location - About 2 hrs to fix
      src/core/io/decoder.ts on lines 3199..3208

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

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

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

        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 decodeMsg_TICK_OPTION_COMPUTATION has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

            private decodeMsg_TICK_OPTION_COMPUTATION(): void {
              let version;
              if (this.serverVersion >= MIN_SERVER_VER.PRICE_BASED_VOLATILITY)
                version = Number.MAX_VALUE;
              else version = this.readInt();
          Severity: Minor
          Found in src/core/io/decoder.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

          Severity
          Category
          Status
          Source
          Language