SockTrader/SockTrader

View on GitHub

Showing 12 of 12 total issues

Function continuousDrawdown has a Cognitive Complexity of 22 (exceeds 7 allowed). Consider refactoring.
Open

export function continuousDrawdown(x: number[]): number[] {
  const cdd = [];
  let tmp = 0;
  let t = 0;

Severity: Minor
Found in packages/indicators/src/lib/risk/continuousDrawdown.ts - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Function mdietz has a Cognitive Complexity of 15 (exceeds 7 allowed). Consider refactoring.
Open

function mdietz(
  ev: number,
  bv: number,
  cf: number | number[],
  cfd: number | number[],
Severity: Minor
Found in packages/indicators/src/lib/performance/mdietz.ts - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

Function interp1 has a Cognitive Complexity of 13 (exceeds 7 allowed). Consider refactoring.
Open

function interp1(
  x: number[],
  y: number[],
  xnew: number | number[]
): number | number[] {
Severity: Minor
Found in packages/indicators/src/lib/math/interp1.ts - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

Function drawdown has a Cognitive Complexity of 13 (exceeds 7 allowed). Consider refactoring.
Open

export function drawdown(x: number[], mode = Mode.return) {
  let _a;
  if (mode === Mode.return) {
    _a = cumprod(plus(x, 1));
  } else if (mode === Mode.geometric) {
Severity: Minor
Found in packages/indicators/src/lib/risk/drawdown.ts - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

Function monteCarloValueAtRisk has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  x: number[],
  p = 0.95,
  t = 1,
  fr = 0,
  v = 1,
Severity: Minor
Found in packages/indicators/src/lib/risk/monteCarloValueAtRisk.ts - About 45 mins to fix

    Function m2sortino has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      x: number[],
      y: number[],
      frisk = 0,
      mar = 0,
      t: Frequency = Frequency.daily
    Severity: Minor
    Found in packages/indicators/src/lib/risk/m2sortino.ts - About 35 mins to fix

      Function parametricConditionalValueAtRisk has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        mu: number | number[],
        sigma: number | number[],
        p = 0.95,
        amount = 1,
        period = 1
      Severity: Minor
      Found in packages/indicators/src/lib/risk/parametricConditionalValueAtRisk.ts - About 35 mins to fix

        Function parametricValueAtRisk has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          mu: number | number[],
          sigma: number | number[],
          p = 0.95,
          amount = 1,
          period = 1
        Severity: Minor
        Found in packages/indicators/src/lib/risk/parametricValueAtRisk.ts - About 35 mins to fix

          Function mdietz has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            ev: number,
            bv: number,
            cf: number | number[],
            cfd: number | number[],
            cd: number
          Severity: Minor
          Found in packages/indicators/src/lib/performance/mdietz.ts - About 35 mins to fix

            Function internalRateOfReturn has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
            Open

            export const internalRateOfReturn = function (
              cf: number[],
              cfd?: number[],
              cd = 1,
              guess = 0.1
            Severity: Minor
            Found in packages/indicators/src/lib/performance/internalRateOfReturn.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

            TODO found
            Open

              // @TODO bug? const "dd" is not used!

            TODO found
            Open

              // @TODO bug? const "dd" is not used!
            Severity
            Category
            Status
            Source
            Language