Closed shayandavoodii closed 2 years ago
Hey @shayandavoodii, to run CORN (or any other algorithm) you just call e.g.
S = ... dataframe with RAW prices
algo = CORN(window=10, rho=0.1)
result = algo.run(S)
print(result.summary())
result.plot(weights=False, assets=False, ucrp=True, logy=True);
the other methods like init_step
or step_slow
are internal (should have been prefixed with underscore) and you don't need need to know about them. What is interesting for analysis are methods and attributes of result
from the code above.
Hey @shayandavoodii, to run CORN (or any other algorithm) you just call e.g.
S = ... dataframe with RAW prices algo = CORN(window=10, rho=0.1) result = algo.run(S) print(result.summary()) result.plot(weights=False, assets=False, ucrp=True, logy=True);
the other methods like
init_step
orstep_slow
are internal (should have been prefixed with underscore) and you don't need need to know about them. What is interesting for analysis are methods and attributes ofresult
from the code above.
Hi! Thanks for your response! I have two other questions:
algo=[ANOTHER_ALGORITHM]()
result=algo.run()
result
variable in your code sample also contains optimal weights?run()
on themresult.B
. Check out result.__dict__
for a dictionary of available attributes
- Yes, all algorithms have consistent interface and it's enough to call
run()
on them- I guess you mean algorithm weights by "optimal weights"? If yes, then it can be accessed as
result.B
. Check outresult.__dict__
for a dictionary of available attributes
I meant the weight of each stock which should be the output of the algorithm. But, what are the result.weights
then?
result.weights
is a method that is run internally and returns B
. What you're looking for is result.B
.
algo.weights
is a method that is run internally and returns B
. It is then saved as result.B
attribute which is identical to result.weights
.
result.weights
is a method that is run internally and returnsB
. What you're looking for isresult.B
.
Thanks!
Just in case of curiosity, Do you mean, result.weights
returns the same thing as result.B
?
Yes, it's exactly the same. Sorry, I thought you were talking about algo.weights(...)
method. Updated my previous answer.
Yes, it's exactly the same. Sorry, I thought you were talking about
algo.weights(...)
method. Updated my previous answer.
Thanks a lot!
Hi, I'm trying to use your code for implementing the CORN strategy, But I'm confused about using it because of poor documentation. So, combining the CORN paper and your codes, I got a light taste, But not adequate.
So I decided to open an issue to get help from you. CORN class has three optional initial options, namely,
window
,rho
,fast_version
which are explicit. But to get the job done, there are further options ininit_step
module likeX
andstep_slow
module likex
,last_b
,history
which are not explicitly explained about their identity and meaning, But I guess some of them, which I need to know which one is true:X
: historical relative prices of all stocks in apandas.DataFrame
type.x
: maybe a container like a vector that contains the name of equities (stocks)last_b
: latest weights. (But I don't know what should I pass for the initial round!?)history
: again, probably historical relative prices of all stocks in apandas.DataFrame
type.Can you please shed light on these variables? Then I can properly give the correct values to these modules.
Thank you so much.