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

hurst and runmad slow #34

Open
Roh-codeur opened this issue Feb 15, 2021 · 2 comments
Open

hurst and runmad slow #34

Roh-codeur opened this issue Feb 15, 2021 · 2 comments
Assignees

Comments

@Roh-codeur
Copy link

Roh-codeur commented Feb 15, 2021

hi

thanks for putting together this package. I run a series of technical analysis on stocks. If I run without hurst and runmap, it comes out to 4 seconds for 50 stocks, however, if I add these both, the time increases to 35 seconds!

I am using Julia 1.5 and the latest version of indicators

I am afraid I cant seem to print the profile trace. the issue seems to be:

function estimate_hurst(x::Array{T}; intercept::Bool=false)::T where {T<:Real} RS = genrsdata(x)
rsdata = [rsdata; genrsdata(a)] rsdata = [rsdata; genrsdata(b)]

Also, I noticed that if I replace the Close with the below, it now takes close to 9 seconds!

Close = 100.0 .+ cumsum(randn(n))
Any thoughts please?

thanks
Roh

@dysonance dysonance self-assigned this Apr 8, 2021
@dysonance
Copy link
Owner

Hey @Roh-codeur, thanks for bringing this forward. I definitely want to make sure the code is efficient as possible, so I appreciate you pointing out a potential improvement that could be made.

Could you provide some more context to help me figure out how to solve what could be causing the lag?

  • What does the rest of the code you are using look like? For example, what parameters are you using?
  • What is the nature of the dataset you're running against? For example, what variable types are you using? How long do the historical samples for the assets in the universe tend to be?

I tried testing both hurst and runmad on a 50-asset universe with historical prices starting in 2001 and wasn't able to replicate the kind of performance drag you seem to be experiencing, so some more information like the above might help me figure it out.

@Roh-codeur
Copy link
Author

Roh-codeur commented Dec 7, 2022

@dysonance : Sorry, forgot to reply earlier. on my machine the below code takes 0.34 seconds. the issue is not with length of x, it seems to be with the value of "n"

using Indicators N = 365*8 x = cumsum(randn(N)) @time hurstInd = hurst(x; n = 200)

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

No branches or pull requests

2 participants