sonntagsgesicht/dcf

View on GitHub

Showing 148 of 148 total issues

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

    def __init__(self, valuation_date=None, forward_curve=None,
                 volatility_curve=None, day_count=None, bump_greeks=None,
                 displacement=0.0):
        super().__init__(valuation_date, forward_curve, volatility_curve,
                         day_count, bump_greeks)
Severity: Major
Found in dcf/models/displaced.py and 1 other location - About 1 hr to fix
dcf/models/displaced.py on lines 104..109

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

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 __init__ has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self, payment_date_list, amount_list=DEFAULT_AMOUNT,
Severity: Major
Found in dcf/cashflows/contingent.py - About 1 hr to fix

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

        def __init__(self, valuation_date=None, forward_curve=None,
                     volatility_curve=None, day_count=None, bump_greeks=None,
                     displacement=0.0):
            super().__init__(valuation_date, forward_curve, volatility_curve,
                             day_count, bump_greeks)
    Severity: Major
    Found in dcf/models/displaced.py and 1 other location - About 1 hr to fix
    dcf/models/displaced.py on lines 58..63

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

    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

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

            if stop is None:
                stop = start + self.forward_tenor if step is None else start + step
    Severity: Major
    Found in dcf/curves/interestratecurve.py and 1 other location - About 1 hr to fix
    dcf/curves/interestratecurve.py on lines 437..438

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

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

        def _call_gamma(self, time, strike, forward, volatility):
            return super()._call_gamma(time,
                                       strike + self.displacement,
                                       forward + self.displacement,
                                       volatility)
    Severity: Major
    Found in dcf/models/displaced.py and 4 other locations - About 1 hr to fix
    dcf/models/displaced.py on lines 65..69
    dcf/models/displaced.py on lines 71..75
    dcf/models/displaced.py on lines 83..87
    dcf/models/displaced.py on lines 111..115

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

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

        def _call_price(self, time, strike, forward, volatility):
            return super()._call_price(time,
                                       strike + self.displacement,
                                       forward + self.displacement,
                                       volatility)
    Severity: Major
    Found in dcf/models/displaced.py and 4 other locations - About 1 hr to fix
    dcf/models/displaced.py on lines 71..75
    dcf/models/displaced.py on lines 77..81
    dcf/models/displaced.py on lines 83..87
    dcf/models/displaced.py on lines 111..115

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

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

        def _call_price(self, time, strike, forward, volatility):
            return super()._call_price(time,
                                       strike + self.displacement,
                                       forward + self.displacement,
                                       volatility)
    Severity: Major
    Found in dcf/models/displaced.py and 4 other locations - About 1 hr to fix
    dcf/models/displaced.py on lines 65..69
    dcf/models/displaced.py on lines 71..75
    dcf/models/displaced.py on lines 77..81
    dcf/models/displaced.py on lines 83..87

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

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

        def _call_vega(self, time, strike, forward, volatility):
            return super()._call_vega(time,
                                      strike + self.displacement,
                                      forward + self.displacement,
                                      volatility)
    Severity: Major
    Found in dcf/models/displaced.py and 4 other locations - About 1 hr to fix
    dcf/models/displaced.py on lines 65..69
    dcf/models/displaced.py on lines 71..75
    dcf/models/displaced.py on lines 77..81
    dcf/models/displaced.py on lines 111..115

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

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

        def _call_delta(self, time, strike, forward, volatility):
            return super()._call_delta(time,
                                       strike + self.displacement,
                                       forward + self.displacement,
                                       volatility)
    Severity: Major
    Found in dcf/models/displaced.py and 4 other locations - About 1 hr to fix
    dcf/models/displaced.py on lines 65..69
    dcf/models/displaced.py on lines 77..81
    dcf/models/displaced.py on lines 83..87
    dcf/models/displaced.py on lines 111..115

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

    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 __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, payment_date_list,
    Severity: Major
    Found in dcf/cashflows/contingent.py - About 1 hr to fix

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

                      elif curve.domain[-1] < today + '2y':
                          x = BusinessRange(today - '6m', curve.domain[-1] + '6m',
                                            step='1w', rolling=curve.origin)
      Severity: Major
      Found in dev2.py and 2 other locations - About 1 hr to fix
      dev2.py on lines 120..122
      dev2.py on lines 123..128

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

      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

                      if curve.domain[-1] < today + '1y':
                          x = BusinessRange(today - '3m', curve.domain[-1] + '3m',
                                            step='1d', rolling=curve.origin)
      Severity: Major
      Found in dev2.py and 2 other locations - About 1 hr to fix
      dev2.py on lines 123..125
      dev2.py on lines 123..128

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

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

          def table(self):
              """ cashflow details as list of tuples """
              # print(tabulate(cf.table, headers='firstrow'))  # for pretty print
      
              header, table = list(), list()
      Severity: Minor
      Found in dcf/cashflows/cashflow.py - 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 get_curve_fit has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def get_curve_fit(cashflow_list, discount_curve, valuation_date=None,
      Severity: Major
      Found in dcf/pricer.py - About 1 hr to fix

        Function __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, payment_date_list, amount_list=DEFAULT_AMOUNT,
        Severity: Major
        Found in dcf/cashflows/contingent.py - About 1 hr to fix

          Function __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(self, start, end, amount=DEFAULT_AMOUNT,
          Severity: Major
          Found in dcf/cashflows/payoffs.py - About 1 hr to fix

            Function __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(self, payment_date_list, amount_list=DEFAULT_AMOUNT,
            Severity: Major
            Found in dcf/cashflows/cashflow.py - About 1 hr to fix

              Function add has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def add(self, foreign_currency, foreign_curve=None, fx_spot=1.0):
                      """
                      adds contents to FxShelf.
                      If curve is FxCurve or FxDict,
                      spot should turn curve.currency into self.currency,
              Severity: Minor
              Found in dcf/curves/fx.py - About 55 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 __setitem__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def __setitem__(self, key, value):
                      if isinstance(key, tuple) and len(key) == 2:
                          d, f = key
                          if not (isinstance(d, type(self.currency))
                                  and isinstance(f, type(self.currency))
              Severity: Minor
              Found in dcf/curves/fx.py - About 55 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

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

                      if start == stop:
                          return 1. if 2 * float_info.min <= self(start) else 0.
              Severity: Minor
              Found in dcf/curves/creditcurve.py and 1 other location - About 55 mins to fix
              dcf/curves/creditcurve.py on lines 286..287

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

              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