sdcoffey / techan

Technical Analysis Library for Golang
https://godoc.org/github.com/sdcoffey/techan
MIT License
840 stars 143 forks source link

Use varargs for And/Or rule. #41

Open tomarus opened 3 years ago

tomarus commented 3 years ago

This changes the And & Or rules to variadic functions and AFAIK it has no side effect and it's backwards compatible.

This optimizes indentation for larger rules.

Before:

entry := And(
    &PositionNewRule{},
    And(
        &ToTheMoonIndicator{},
        And(
            &UnderIndicatorRule{moonRotation, NewConstantIndicator(90)},
            &HasProfitRule{},
        )
    }
)

After:

entry := And(
    &PositionNewRule{},
    &ToTheMoonIndicator{},
    &UnderIndicatorRule{moonRotation, NewConstantIndicator(90)},
    &HasProfitRule{},
)
codecov[bot] commented 3 years ago

Codecov Report

Merging #41 (279ca3a) into main (572c478) will increase coverage by 0.01%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #41      +/-   ##
==========================================
+ Coverage   98.36%   98.37%   +0.01%     
==========================================
  Files          42       42              
  Lines         611      615       +4     
==========================================
+ Hits          601      605       +4     
  Misses          7        7              
  Partials        3        3              
Impacted Files Coverage Δ
rule.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 572c478...279ca3a. Read the comment docs.