Skip to content

Commit

Permalink
fix two bugs: std::min(vec vec) only return the smaller size vec and …
Browse files Browse the repository at this point in the history
…1/20 returns integer zero
  • Loading branch information
shrektan committed Sep 11, 2024
1 parent 86a8241 commit dbab020
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/tf-impl-001-060.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ Alpha_mfun alpha035 = [](const Quotes& qts) -> Timeseries {
auto rk_decay1 = rank(qts.apply(base_fun1));
auto rk_decay2 = rank(qts.apply(base_fun2));

return std::min(rk_decay1, rk_decay2) * -1.0;
return pmin(rk_decay1, rk_decay2) * -1.0;
};


Expand Down
10 changes: 5 additions & 5 deletions src/tf-impl-175-191.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,24 +254,24 @@ Alpha_fun alpha189 = [](const Quote& qt) -> double {
Alpha_fun alpha190 = [](const Quote& qt) -> double {
auto count_fun1 = [] (const Quote& qt) {
auto left = qt.close() / qt.close(1) - 1.0;
auto right = std::pow(qt.close() / qt.close(19), 1/20) - 1.0;
auto right = std::pow(qt.close() / qt.close(19), 1.0/20.0) - 1.0;
return left > right;
};
double param1 = count(qt.ts<bool>(20, count_fun1)) - 1.0;

auto double_muti_p = [](const Quote& qt) {
auto param1 = qt.close() / qt.close(1) - 1.0;
auto param2 = std::pow(qt.close() - qt.close(19), 1/20) - 1.0;
auto param2 = std::pow(qt.close() - qt.close(19), 1.0/20.0) - 1.0;
return std::pow(param1 - param2, 2.0);
};
auto bool_muti_p1 = [](const Quote& qt) {
auto left = qt.close() / qt.close(1) - 1.0;
auto right = std::pow(qt.close() / qt.close(19), 1/20) - 1.0;
auto right = std::pow(qt.close() / qt.close(19), 1.0/20.0) - 1.0;
return left < right;
};
auto bool_muti_p2 = [](const Quote& qt) {
auto left = qt.close() / qt.close(1) - 1.0;
auto right = std::pow(qt.close() / qt.close(19), 1/20) - 1.0;
auto right = std::pow(qt.close() / qt.close(19), 1.0/20.0) - 1.0;
return left > right;
};
double param2 = sum(filter(
Expand All @@ -281,7 +281,7 @@ Alpha_fun alpha190 = [](const Quote& qt) -> double {

auto count_fun2 = [] (const Quote& qt) {
auto left = qt.close() / qt.close(1) - 1.0;
auto right = pow(qt.close() / qt.close(19), 1/20) - 1.0;
auto right = std::pow(qt.close() / qt.close(19), 1.0/20.0) - 1.0;
return left < right;
};
double param3 = count(qt.ts<bool>(20, count_fun2));
Expand Down

0 comments on commit dbab020

Please sign in to comment.