Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several errors in Performance Metrics #41

Closed
janckerchen opened this issue Jun 20, 2024 · 1 comment
Closed

Several errors in Performance Metrics #41

janckerchen opened this issue Jun 20, 2024 · 1 comment

Comments

@janckerchen
Copy link
Contributor

janckerchen commented Jun 20, 2024

follow https://panifie.github.io/PingPong.jl/stats/#Performance-Metrics

Stats.sharpe(strategy_instance, tf"1d", rfr=0.01)
Stats.sortino(strategy_instance, tf"1d", rfr=0.01)
Stats.calmar(strategy_instance, tf"1d")
Stats.expectancy(strategy_instance, tf"1d")

output

julia> balloons(s) # works great
julia> Stats.sharpe(s, tf"1d", rfr=0.01) #<----error
ERROR: MethodError: no method matching sharpe(::Strategies.SimStrategy{:SimpleStrategy, ExchangeID{:binance}, NoMargin, :USDT}, ::TimeFrames.Day; rfr::Float64)

Closest candidates are:
  sharpe(::Strategies.Strategy, ::Any, ::Any) got unsupported keyword argument "rfr"
   @ Stats /opt/opensource/jl/PingPong.jl/Stats/src/metrics.jl:77
  sharpe(::Strategies.Strategy, ::Any) got unsupported keyword argument "rfr"
   @ Stats /opt/opensource/jl/PingPong.jl/Stats/src/metrics.jl:77
  sharpe(::Strategies.Strategy) got unsupported keyword argument "rfr"
   @ Stats /opt/opensource/jl/PingPong.jl/Stats/src/metrics.jl:77

julia> Stats.sortino(s, tf"1d", rfr=0.01)  #<----error
ERROR: MethodError: no method matching sortino(::Strategies.SimStrategy{:SimpleStrategy, ExchangeID{:binance}, NoMargin, :USDT}, ::TimeFrames.Day; rfr::Float64)

Closest candidates are:
  sortino(::Strategies.Strategy, ::Any, ::Any) got unsupported keyword argument "rfr"
   @ Stats /opt/opensource/jl/PingPong.jl/Stats/src/metrics.jl:107
  sortino(::Strategies.Strategy, ::Any) got unsupported keyword argument "rfr"
   @ Stats /opt/opensource/jl/PingPong.jl/Stats/src/metrics.jl:107
  sortino(::Strategies.Strategy) got unsupported keyword argument "rfr"
   @ Stats /opt/opensource/jl/PingPong.jl/Stats/src/metrics.jl:107

julia> Stats.calmar(s, tf"1d") # works great
-0.3158866997026408

julia> Stats.expectancy(s, tf"1d")  #<----error
ERROR: UndefVarError: `returns` not defined
Stacktrace:
 [1] expectancy(s::Strategies.SimStrategy{:SimpleStrategy, ExchangeID{:binance}, NoMargin, :USDT}, tf::TimeFrames.Day)
   @ Stats /opt/opensource/jl/PingPong.jl/Stats/src/metrics.jl:206
 [2] top-level scope
   @ /opt/opensource/jl/PingPong.jl/TimeTicks/src/module.jl:61

@janckerchen
Copy link
Contributor Author

janckerchen commented Jun 20, 2024

The invocation demonstrated in the documentation, Stats.sharpe(s, tf"1d", rfr=0.01) , does not match the function signature.

function sharpe(s::Strategy, tf=tf"1d", rfr=0.0)
...
end

Changing it to the function signature will work.

julia> Stats.sharpe(s, tf"1d", 0.01)
-11.17254906151372

julia> Stats.sortino(s, tf"1d", 0.01)
-12.01871551753598

fix doc or signature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant