Showing 497 of 497 total issues

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

  on(
    event: EventName.symbolSamples,
    listener: (
      reqId: number,
      contractDescriptions: ContractDescription[],
Severity: Major
Found in src/api/api.ts and 3 other locations - About 35 mins to fix
src/api/api.ts on lines 2180..2186
src/api/api.ts on lines 2228..2231
src/api/api.ts on lines 2950..2953

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

  on(
    event: EventName.historicalNews,
    listener: (
      reqId: number,
      time: string,
Severity: Minor
Found in src/api/api.ts and 1 other location - About 35 mins to fix
src/api/api.ts on lines 1800..1809

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

      console.error(
        colors.bold.red(
          `[${new Date().toLocaleTimeString()}] [ERROR] [${tag}]:`
        ),
        newArgs
Severity: Minor
Found in src/core/api-next/console-logger.ts and 1 other location - About 35 mins to fix
src/core/api-next/console-logger.ts on lines 49..54

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

      console.warn(
        colors.bold.yellow(
          `[${new Date().toLocaleTimeString()}] [WARN] [${tag}]: `
        ),
        newArgs
Severity: Minor
Found in src/core/api-next/console-logger.ts and 1 other location - About 35 mins to fix
src/core/api-next/console-logger.ts on lines 67..72

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

  on(
    event: EventName.accountSummary,
    listener: (
      reqId: number,
      account: string,
Severity: Minor
Found in src/api/api.ts and 1 other location - About 35 mins to fix
src/api/api.ts on lines 2309..2318

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

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

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

  send(tokens: unknown[]): void {
    // flatten arrays and convert boolean types to 0/1

    tokens = this.flattenDeep(tokens);
    tokens.forEach((value, i) => {
Severity: Minor
Found in src/core/io/socket.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

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

  private decodeMsg_MKT_DEPTH_EXCHANGES(): void {
    const nDepthMktDataDescriptions = this.readInt();
    const depthMktDataDescriptions: DepthMktDataDescription[] = new Array(
      nDepthMktDataDescriptions,
    );
Severity: Minor
Found in src/core/io/decoder.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

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

  private decodeMsg_PORTFOLIO_VALUE(): void {
    const version = this.readInt();

    const contract: Contract = {};
    if (version >= 6) {
Severity: Minor
Found in src/core/io/decoder.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

Function decodeMsg_HISTORICAL_DATA has a Cognitive Complexity of 7 (exceeds 5 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: Minor
Found in src/core/io/decoder.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

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

  private decodeMsg_ORDER_STATUS(): void {
    const version =
      this.serverVersion >= MIN_SERVER_VER.MARKET_CAP_PRICE
        ? Number.MAX_SAFE_INTEGER
        : this.readInt();
Severity: Minor
Found in src/core/io/decoder.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
              Severity
              Category
              Status
              Source
              Language