unageanu/jiji2

View on GitHub

Showing 292 of 840 total issues

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

    positions.update_price(Jiji::Model::Trading::Tick.new({
      EURJPY: new_tick_value(130.8, 0.03),
      EURUSD: new_tick_value(1.0925, 0.00005),
      USDJPY: new_tick_value(0.9, 0.2)
    }, Time.new(2015, 12, 14)), pairs)
Severity: Major
Found in sample_agents/spec/trailing_stop_manager_spec.rb and 19 other locations - About 15 mins to fix
sample_agents/spec/trailing_stop_manager_spec.rb on lines 46..50
sample_agents/spec/trailing_stop_manager_spec.rb on lines 53..57
sample_agents/spec/trailing_stop_manager_spec.rb on lines 60..64
sample_agents/spec/trailing_stop_manager_spec.rb on lines 94..98
sample_agents/spec/trailing_stop_manager_spec.rb on lines 101..105
sample_agents/spec/trailing_stop_manager_spec.rb on lines 108..112
sample_agents/spec/trailing_stop_manager_spec.rb on lines 115..119
sample_agents/spec/trailing_stop_manager_spec.rb on lines 122..126
sample_agents/spec/trailing_stop_manager_spec.rb on lines 146..150
sample_agents/spec/trailing_stop_manager_spec.rb on lines 153..157
sample_agents/spec/trailing_stop_manager_spec.rb on lines 164..168
sample_agents/spec/trailing_stop_manager_spec.rb on lines 211..215
sample_agents/spec/trailing_stop_manager_spec.rb on lines 218..222
sample_agents/spec/trailing_stop_manager_spec.rb on lines 225..229
sample_agents/spec/trailing_stop_manager_spec.rb on lines 232..236
sample_agents/spec/trailing_stop_manager_spec.rb on lines 241..245
sample_agents/spec/trailing_stop_manager_spec.rb on lines 248..252
sample_agents/spec/trailing_stop_manager_spec.rb on lines 261..265
sample_agents/spec/trailing_stop_manager_spec.rb on lines 272..276

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

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

    positions.update_price(Jiji::Model::Trading::Tick.new({
      EURJPY: new_tick_value(130.94, 0.03),
      EURUSD: new_tick_value(1.0930, 0.00005),
      USDJPY: new_tick_value(0.9, 0.2)
    }, Time.new(2015, 12, 11)), pairs)
Severity: Major
Found in sample_agents/spec/trailing_stop_manager_spec.rb and 19 other locations - About 15 mins to fix
sample_agents/spec/trailing_stop_manager_spec.rb on lines 46..50
sample_agents/spec/trailing_stop_manager_spec.rb on lines 53..57
sample_agents/spec/trailing_stop_manager_spec.rb on lines 60..64
sample_agents/spec/trailing_stop_manager_spec.rb on lines 94..98
sample_agents/spec/trailing_stop_manager_spec.rb on lines 101..105
sample_agents/spec/trailing_stop_manager_spec.rb on lines 108..112
sample_agents/spec/trailing_stop_manager_spec.rb on lines 115..119
sample_agents/spec/trailing_stop_manager_spec.rb on lines 122..126
sample_agents/spec/trailing_stop_manager_spec.rb on lines 146..150
sample_agents/spec/trailing_stop_manager_spec.rb on lines 153..157
sample_agents/spec/trailing_stop_manager_spec.rb on lines 164..168
sample_agents/spec/trailing_stop_manager_spec.rb on lines 175..179
sample_agents/spec/trailing_stop_manager_spec.rb on lines 218..222
sample_agents/spec/trailing_stop_manager_spec.rb on lines 225..229
sample_agents/spec/trailing_stop_manager_spec.rb on lines 232..236
sample_agents/spec/trailing_stop_manager_spec.rb on lines 241..245
sample_agents/spec/trailing_stop_manager_spec.rb on lines 248..252
sample_agents/spec/trailing_stop_manager_spec.rb on lines 261..265
sample_agents/spec/trailing_stop_manager_spec.rb on lines 272..276

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

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

    positions.update_price(Jiji::Model::Trading::Tick.new({
      EURJPY: new_tick_value(131.03, 0.03),
      EURUSD: new_tick_value(1.0940, 0.00005),
      USDJPY: new_tick_value(0.9, 0.2)
    }, Time.new(2015, 12, 12)), pairs)
Severity: Major
Found in sample_agents/spec/trailing_stop_manager_spec.rb and 19 other locations - About 15 mins to fix
sample_agents/spec/trailing_stop_manager_spec.rb on lines 46..50
sample_agents/spec/trailing_stop_manager_spec.rb on lines 53..57
sample_agents/spec/trailing_stop_manager_spec.rb on lines 60..64
sample_agents/spec/trailing_stop_manager_spec.rb on lines 94..98
sample_agents/spec/trailing_stop_manager_spec.rb on lines 108..112
sample_agents/spec/trailing_stop_manager_spec.rb on lines 115..119
sample_agents/spec/trailing_stop_manager_spec.rb on lines 122..126
sample_agents/spec/trailing_stop_manager_spec.rb on lines 146..150
sample_agents/spec/trailing_stop_manager_spec.rb on lines 153..157
sample_agents/spec/trailing_stop_manager_spec.rb on lines 164..168
sample_agents/spec/trailing_stop_manager_spec.rb on lines 175..179
sample_agents/spec/trailing_stop_manager_spec.rb on lines 211..215
sample_agents/spec/trailing_stop_manager_spec.rb on lines 218..222
sample_agents/spec/trailing_stop_manager_spec.rb on lines 225..229
sample_agents/spec/trailing_stop_manager_spec.rb on lines 232..236
sample_agents/spec/trailing_stop_manager_spec.rb on lines 241..245
sample_agents/spec/trailing_stop_manager_spec.rb on lines 248..252
sample_agents/spec/trailing_stop_manager_spec.rb on lines 261..265
sample_agents/spec/trailing_stop_manager_spec.rb on lines 272..276

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

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

    positions.update_price(Jiji::Model::Trading::Tick.new({
      EURJPY: new_tick_value(131.03, 0.03),
      EURUSD: new_tick_value(1.0935, 0.00005),
      USDJPY: new_tick_value(0.9, 0.2)
    }, Time.new(2015, 12, 13)), pairs)
Severity: Major
Found in sample_agents/spec/trailing_stop_manager_spec.rb and 19 other locations - About 15 mins to fix
sample_agents/spec/trailing_stop_manager_spec.rb on lines 46..50
sample_agents/spec/trailing_stop_manager_spec.rb on lines 53..57
sample_agents/spec/trailing_stop_manager_spec.rb on lines 94..98
sample_agents/spec/trailing_stop_manager_spec.rb on lines 101..105
sample_agents/spec/trailing_stop_manager_spec.rb on lines 108..112
sample_agents/spec/trailing_stop_manager_spec.rb on lines 115..119
sample_agents/spec/trailing_stop_manager_spec.rb on lines 122..126
sample_agents/spec/trailing_stop_manager_spec.rb on lines 146..150
sample_agents/spec/trailing_stop_manager_spec.rb on lines 153..157
sample_agents/spec/trailing_stop_manager_spec.rb on lines 164..168
sample_agents/spec/trailing_stop_manager_spec.rb on lines 175..179
sample_agents/spec/trailing_stop_manager_spec.rb on lines 211..215
sample_agents/spec/trailing_stop_manager_spec.rb on lines 218..222
sample_agents/spec/trailing_stop_manager_spec.rb on lines 225..229
sample_agents/spec/trailing_stop_manager_spec.rb on lines 232..236
sample_agents/spec/trailing_stop_manager_spec.rb on lines 241..245
sample_agents/spec/trailing_stop_manager_spec.rb on lines 248..252
sample_agents/spec/trailing_stop_manager_spec.rb on lines 261..265
sample_agents/spec/trailing_stop_manager_spec.rb on lines 272..276

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

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

    positions.update_price(Jiji::Model::Trading::Tick.new({
      EURJPY: new_tick_value(131.03, 0.03),
      EURUSD: new_tick_value(1.0940, 0.00005),
      USDJPY: new_tick_value(0.9, 0.2)
    }, Time.new(2015, 12, 12)), pairs)
Severity: Major
Found in sample_agents/spec/trailing_stop_manager_spec.rb and 19 other locations - About 15 mins to fix
sample_agents/spec/trailing_stop_manager_spec.rb on lines 46..50
sample_agents/spec/trailing_stop_manager_spec.rb on lines 60..64
sample_agents/spec/trailing_stop_manager_spec.rb on lines 94..98
sample_agents/spec/trailing_stop_manager_spec.rb on lines 101..105
sample_agents/spec/trailing_stop_manager_spec.rb on lines 108..112
sample_agents/spec/trailing_stop_manager_spec.rb on lines 115..119
sample_agents/spec/trailing_stop_manager_spec.rb on lines 122..126
sample_agents/spec/trailing_stop_manager_spec.rb on lines 146..150
sample_agents/spec/trailing_stop_manager_spec.rb on lines 153..157
sample_agents/spec/trailing_stop_manager_spec.rb on lines 164..168
sample_agents/spec/trailing_stop_manager_spec.rb on lines 175..179
sample_agents/spec/trailing_stop_manager_spec.rb on lines 211..215
sample_agents/spec/trailing_stop_manager_spec.rb on lines 218..222
sample_agents/spec/trailing_stop_manager_spec.rb on lines 225..229
sample_agents/spec/trailing_stop_manager_spec.rb on lines 232..236
sample_agents/spec/trailing_stop_manager_spec.rb on lines 241..245
sample_agents/spec/trailing_stop_manager_spec.rb on lines 248..252
sample_agents/spec/trailing_stop_manager_spec.rb on lines 261..265
sample_agents/spec/trailing_stop_manager_spec.rb on lines 272..276

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

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

    positions.update_price(Jiji::Model::Trading::Tick.new({
      EURJPY: new_tick_value(131.05, 0.03),
      EURUSD: new_tick_value(1.09301, 0.00005),
      USDJPY: new_tick_value(0.9, 0.2)
    }, Time.new(2015, 12, 13)), pairs)
Severity: Major
Found in sample_agents/spec/trailing_stop_manager_spec.rb and 19 other locations - About 15 mins to fix
sample_agents/spec/trailing_stop_manager_spec.rb on lines 46..50
sample_agents/spec/trailing_stop_manager_spec.rb on lines 53..57
sample_agents/spec/trailing_stop_manager_spec.rb on lines 60..64
sample_agents/spec/trailing_stop_manager_spec.rb on lines 94..98
sample_agents/spec/trailing_stop_manager_spec.rb on lines 101..105
sample_agents/spec/trailing_stop_manager_spec.rb on lines 108..112
sample_agents/spec/trailing_stop_manager_spec.rb on lines 115..119
sample_agents/spec/trailing_stop_manager_spec.rb on lines 122..126
sample_agents/spec/trailing_stop_manager_spec.rb on lines 146..150
sample_agents/spec/trailing_stop_manager_spec.rb on lines 153..157
sample_agents/spec/trailing_stop_manager_spec.rb on lines 164..168
sample_agents/spec/trailing_stop_manager_spec.rb on lines 175..179
sample_agents/spec/trailing_stop_manager_spec.rb on lines 211..215
sample_agents/spec/trailing_stop_manager_spec.rb on lines 218..222
sample_agents/spec/trailing_stop_manager_spec.rb on lines 232..236
sample_agents/spec/trailing_stop_manager_spec.rb on lines 241..245
sample_agents/spec/trailing_stop_manager_spec.rb on lines 248..252
sample_agents/spec/trailing_stop_manager_spec.rb on lines 261..265
sample_agents/spec/trailing_stop_manager_spec.rb on lines 272..276

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

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

    positions.update_price(Jiji::Model::Trading::Tick.new({
      EURJPY: new_tick_value(130.999, 0.03),
      EURUSD: new_tick_value(1.0940,  0.00005),
      USDJPY: new_tick_value(0.9, 0.2)
    }, Time.new(2015, 12, 13)), pairs)
Severity: Major
Found in sample_agents/spec/trailing_stop_manager_spec.rb and 19 other locations - About 15 mins to fix
sample_agents/spec/trailing_stop_manager_spec.rb on lines 46..50
sample_agents/spec/trailing_stop_manager_spec.rb on lines 53..57
sample_agents/spec/trailing_stop_manager_spec.rb on lines 60..64
sample_agents/spec/trailing_stop_manager_spec.rb on lines 94..98
sample_agents/spec/trailing_stop_manager_spec.rb on lines 101..105
sample_agents/spec/trailing_stop_manager_spec.rb on lines 108..112
sample_agents/spec/trailing_stop_manager_spec.rb on lines 115..119
sample_agents/spec/trailing_stop_manager_spec.rb on lines 122..126
sample_agents/spec/trailing_stop_manager_spec.rb on lines 146..150
sample_agents/spec/trailing_stop_manager_spec.rb on lines 153..157
sample_agents/spec/trailing_stop_manager_spec.rb on lines 175..179
sample_agents/spec/trailing_stop_manager_spec.rb on lines 211..215
sample_agents/spec/trailing_stop_manager_spec.rb on lines 218..222
sample_agents/spec/trailing_stop_manager_spec.rb on lines 225..229
sample_agents/spec/trailing_stop_manager_spec.rb on lines 232..236
sample_agents/spec/trailing_stop_manager_spec.rb on lines 241..245
sample_agents/spec/trailing_stop_manager_spec.rb on lines 248..252
sample_agents/spec/trailing_stop_manager_spec.rb on lines 261..265
sample_agents/spec/trailing_stop_manager_spec.rb on lines 272..276

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

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

    positions.update_price(Jiji::Model::Trading::Tick.new({
      EURJPY: new_tick_value(131.03, 0.03),
      EURUSD: new_tick_value(1.0940, 0.00005),
      USDJPY: new_tick_value(0.9, 0.2)
    }, Time.new(2015, 12, 12)), pairs)
Severity: Major
Found in sample_agents/spec/trailing_stop_manager_spec.rb and 19 other locations - About 15 mins to fix
sample_agents/spec/trailing_stop_manager_spec.rb on lines 46..50
sample_agents/spec/trailing_stop_manager_spec.rb on lines 53..57
sample_agents/spec/trailing_stop_manager_spec.rb on lines 60..64
sample_agents/spec/trailing_stop_manager_spec.rb on lines 94..98
sample_agents/spec/trailing_stop_manager_spec.rb on lines 101..105
sample_agents/spec/trailing_stop_manager_spec.rb on lines 108..112
sample_agents/spec/trailing_stop_manager_spec.rb on lines 115..119
sample_agents/spec/trailing_stop_manager_spec.rb on lines 122..126
sample_agents/spec/trailing_stop_manager_spec.rb on lines 146..150
sample_agents/spec/trailing_stop_manager_spec.rb on lines 153..157
sample_agents/spec/trailing_stop_manager_spec.rb on lines 164..168
sample_agents/spec/trailing_stop_manager_spec.rb on lines 175..179
sample_agents/spec/trailing_stop_manager_spec.rb on lines 211..215
sample_agents/spec/trailing_stop_manager_spec.rb on lines 225..229
sample_agents/spec/trailing_stop_manager_spec.rb on lines 232..236
sample_agents/spec/trailing_stop_manager_spec.rb on lines 241..245
sample_agents/spec/trailing_stop_manager_spec.rb on lines 248..252
sample_agents/spec/trailing_stop_manager_spec.rb on lines 261..265
sample_agents/spec/trailing_stop_manager_spec.rb on lines 272..276

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

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

    positions.update_price(Jiji::Model::Trading::Tick.new({
      EURJPY: new_tick_value(131.06, 0.03),
      EURUSD: new_tick_value(1.0930, 0.00005),
      USDJPY: new_tick_value(0.9, 0.2)
    }, Time.new(2015, 12, 14)), pairs)
Severity: Major
Found in sample_agents/spec/trailing_stop_manager_spec.rb and 19 other locations - About 15 mins to fix
sample_agents/spec/trailing_stop_manager_spec.rb on lines 46..50
sample_agents/spec/trailing_stop_manager_spec.rb on lines 53..57
sample_agents/spec/trailing_stop_manager_spec.rb on lines 60..64
sample_agents/spec/trailing_stop_manager_spec.rb on lines 94..98
sample_agents/spec/trailing_stop_manager_spec.rb on lines 101..105
sample_agents/spec/trailing_stop_manager_spec.rb on lines 108..112
sample_agents/spec/trailing_stop_manager_spec.rb on lines 122..126
sample_agents/spec/trailing_stop_manager_spec.rb on lines 146..150
sample_agents/spec/trailing_stop_manager_spec.rb on lines 153..157
sample_agents/spec/trailing_stop_manager_spec.rb on lines 164..168
sample_agents/spec/trailing_stop_manager_spec.rb on lines 175..179
sample_agents/spec/trailing_stop_manager_spec.rb on lines 211..215
sample_agents/spec/trailing_stop_manager_spec.rb on lines 218..222
sample_agents/spec/trailing_stop_manager_spec.rb on lines 225..229
sample_agents/spec/trailing_stop_manager_spec.rb on lines 232..236
sample_agents/spec/trailing_stop_manager_spec.rb on lines 241..245
sample_agents/spec/trailing_stop_manager_spec.rb on lines 248..252
sample_agents/spec/trailing_stop_manager_spec.rb on lines 261..265
sample_agents/spec/trailing_stop_manager_spec.rb on lines 272..276

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

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

    positions.update_price(Jiji::Model::Trading::Tick.new({
      EURJPY: new_tick_value(130.94, 0.03),
      EURUSD: new_tick_value(1.0930, 0.00005),
      USDJPY: new_tick_value(0.9, 0.2)
    }, Time.new(2015, 12, 11)), pairs)
Severity: Major
Found in sample_agents/spec/trailing_stop_manager_spec.rb and 19 other locations - About 15 mins to fix
sample_agents/spec/trailing_stop_manager_spec.rb on lines 53..57
sample_agents/spec/trailing_stop_manager_spec.rb on lines 60..64
sample_agents/spec/trailing_stop_manager_spec.rb on lines 94..98
sample_agents/spec/trailing_stop_manager_spec.rb on lines 101..105
sample_agents/spec/trailing_stop_manager_spec.rb on lines 108..112
sample_agents/spec/trailing_stop_manager_spec.rb on lines 115..119
sample_agents/spec/trailing_stop_manager_spec.rb on lines 122..126
sample_agents/spec/trailing_stop_manager_spec.rb on lines 146..150
sample_agents/spec/trailing_stop_manager_spec.rb on lines 153..157
sample_agents/spec/trailing_stop_manager_spec.rb on lines 164..168
sample_agents/spec/trailing_stop_manager_spec.rb on lines 175..179
sample_agents/spec/trailing_stop_manager_spec.rb on lines 211..215
sample_agents/spec/trailing_stop_manager_spec.rb on lines 218..222
sample_agents/spec/trailing_stop_manager_spec.rb on lines 225..229
sample_agents/spec/trailing_stop_manager_spec.rb on lines 232..236
sample_agents/spec/trailing_stop_manager_spec.rb on lines 241..245
sample_agents/spec/trailing_stop_manager_spec.rb on lines 248..252
sample_agents/spec/trailing_stop_manager_spec.rb on lines 261..265
sample_agents/spec/trailing_stop_manager_spec.rb on lines 272..276

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

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

    def sample_variance(array)
      m = mean(array)
      sum = array.inject(0) { |a, e| a + (e - m)**2 }
      sum / (array.length - 1).to_f
Severity: Minor
Found in sample_agents/src/bollinger_bands_agent.rb and 1 other location - About 15 mins to fix
sample_agents/src/statistical_arbitrage_agent.rb on lines 118..121

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

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

    def sample_variance(array)
      m = mean(array)
      sum = array.inject(0) { |a, e| a + (e - m)**2 }
      sum / (array.length - 1).to_f
Severity: Minor
Found in sample_agents/src/statistical_arbitrage_agent.rb and 1 other location - About 15 mins to fix
sample_agents/src/bollinger_bands_agent.rb on lines 66..69

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

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