Skip to content

Commit

Permalink
Combining multiple append into a single call. (#189)
Browse files Browse the repository at this point in the history
# Describe Request

Combining multiple append into a single call.

Fixed #182 

# Change Type

Code improvement.
  • Loading branch information
cinar authored Jul 20, 2024
1 parent 53ae058 commit 315cc88
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
6 changes: 2 additions & 4 deletions strategy/and_strategy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ func TestAndStrategy(t *testing.T) {
expected := helper.Map(results, func(r *strategy.Result) strategy.Action { return r.Action })

and := strategy.NewAndStrategy("And Strategy")
and.Strategies = append(and.Strategies, strategy.NewBuyAndHoldStrategy())
and.Strategies = append(and.Strategies, strategy.NewBuyAndHoldStrategy())
and.Strategies = append(and.Strategies, strategy.NewBuyAndHoldStrategy(), strategy.NewBuyAndHoldStrategy())

actual := and.Compute(snapshots)

Expand All @@ -45,8 +44,7 @@ func TestAndStrategyReport(t *testing.T) {
}

and := strategy.NewAndStrategy("And Strategy")
and.Strategies = append(and.Strategies, strategy.NewBuyAndHoldStrategy())
and.Strategies = append(and.Strategies, strategy.NewBuyAndHoldStrategy())
and.Strategies = append(and.Strategies, strategy.NewBuyAndHoldStrategy(), strategy.NewBuyAndHoldStrategy())

report := and.Report(snapshots)

Expand Down
6 changes: 2 additions & 4 deletions strategy/majority_strategy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ func TestMajorityStrategy(t *testing.T) {
expected := helper.Map(results, func(r *strategy.Result) strategy.Action { return r.Action })

majority := strategy.NewMajorityStrategy("Majority Strategy")
majority.Strategies = append(majority.Strategies, strategy.NewBuyAndHoldStrategy())
majority.Strategies = append(majority.Strategies, trend.NewMacdStrategy())
majority.Strategies = append(majority.Strategies, strategy.NewBuyAndHoldStrategy(), trend.NewMacdStrategy())

actual := majority.Compute(snapshots)

Expand All @@ -46,8 +45,7 @@ func TestMajorityStrategyReport(t *testing.T) {
}

majority := strategy.NewMajorityStrategy("Majority Strategy")
majority.Strategies = append(majority.Strategies, strategy.NewBuyAndHoldStrategy())
majority.Strategies = append(majority.Strategies, trend.NewMacdStrategy())
majority.Strategies = append(majority.Strategies, strategy.NewBuyAndHoldStrategy(), trend.NewMacdStrategy())

report := majority.Report(snapshots)

Expand Down
6 changes: 2 additions & 4 deletions strategy/or_strategy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ func TestOrStrategy(t *testing.T) {
expected := helper.Map(results, func(r *strategy.Result) strategy.Action { return r.Action })

or := strategy.NewOrStrategy("Or Strategy")
or.Strategies = append(or.Strategies, strategy.NewBuyAndHoldStrategy())
or.Strategies = append(or.Strategies, trend.NewMacdStrategy())
or.Strategies = append(or.Strategies, strategy.NewBuyAndHoldStrategy(), trend.NewMacdStrategy())

actual := or.Compute(snapshots)

Expand All @@ -46,8 +45,7 @@ func TestOrStrategyReport(t *testing.T) {
}

or := strategy.NewOrStrategy("Or Strategy")
or.Strategies = append(or.Strategies, strategy.NewBuyAndHoldStrategy())
or.Strategies = append(or.Strategies, trend.NewMacdStrategy())
or.Strategies = append(or.Strategies, strategy.NewBuyAndHoldStrategy(), trend.NewMacdStrategy())

report := or.Report(snapshots)

Expand Down

0 comments on commit 315cc88

Please sign in to comment.