stress test check weight start date issue

Answered
63
7
created on 2021-02-14 15:02:15

Comments (7)

Yongcheng · about 2 weeks ago

Hello, is it failing during the step where an environment with missing data is simulated? If so, can you try using the createMissingData method to simulate an environment with NAs in data? the code below should help you with checking the behaviour of the payout


port.createMissingData()

port.evaluate(zoom = "2003::2018")

port.weightsMatrix

Zhou · about 2 weeks ago

Thank you YongCheng!


It is failing during the step when missing data is simulated, and now I rewrite the code and it can generate weight before 2004-01-02 when there is missing data.

However, I have another problem:

> port1=portfolio.createMissingData(portAllocation)
> portfolio.eval(port1)
send2Log: Generating portfolio weights using: strategy1 payout 
send2Log: features object used for the first slot of the payout 
Error in `dimnames<-.xts`(`*tmp*`, value = dn) : 
  length of 'dimnames' [2] not equal to array extent

when i evaluate the portfolio with missing data, the error is "length of dimnames not equal to array extent'' . May i ask what may cause this error?


Thank you!

Yongcheng · about 2 weeks ago

Hi Zhou. Thanks for the follow up.


this looks like your payout is unable to be ran with missing data. can you try running your payout with the features from port1?

something like the below


payout(port1@features)


you can contact me on alphachat.alphien.com if anything is still unclear

Zhou · about 2 weeks ago

Hi Yongcheng,


Thank you for your help! Now i solved the missing data issue, but I encountered another error when submitting the strategy.

The error is "some of my payouts are not in Qlib'. I have checked the wiki page, but I am not sure what caused the problem. Could you please help me with this problem? What might be the causes of this error? Thank you!


> testGlobalAllocationSubmission(portAllocation)
Checking that sum of weights is always 1 at any point in time.

Checking that each asset allocation is between 0 and 0.2 at any point in time.

Checking that sharpe ratio > 0.25.

Checking that weight should be generated before/on 2004-01-02.

Checking that returns should be generated before/on 2004-01-10.

Checking if payout is able to be ran with missing data.

Checking if payout is fufilling competition requirements even with missing data.

Name = 'strategy1zhou210218' 
User = 'zhou' 
Date = '2021-02-18 23:12:24'

Checking logic of indicator function

Running payout in a 50 day loop

Date Range = 2008-12-12 :: 2009-01-31

Comparing original weights with test weights generated with subsetted data. This might take some time...
  |==================================================| 100% elapsed=04m 50s

No look ahead bias detected

Performing simple backtest...


Simple analysis
---------------

[1] "portfolio"
                          strategy1zhou210218
Annualized Return (%)                11.69646
Annualized Volatility (%)             8.85804
Sharpe Ratio                          1.32043
Calmar Ratio                          1.09050
Maximum Drawdown (%)                -10.72574
Alphien Drawdown Ratio                1.21085

[1] Qlib.Functions
 
<0 rows> (or 0-length row.names)

  Used.Functions
 
1      strategy1
Error in stressTest.portfolio(strat, maxiter = maxiter) : 
Some of your payouts are not in qlib. Please refer to following wiki page and create one. https://wiki.alphien.com/ALwiki/Creating_a_payout



Manas · about 2 weeks ago

Hi Zhou,


It seems that you've defined your payout in the function 'strategy1' which you are just defining in the notebook. You need to publish this function in the Qlib, which is a repository of all your User Defined Functions.

Please look at this documentation (last step: publishing a payout)

https://dashboard.alphien.com/knowledge-base/Creating_a_payout

Manas


Zhou · about 2 weeks ago

Hello Manas,


Thank you for your help! I will try now

Zhou · about 2 weeks ago

Dear Manas,


Hello! Our team has just made our first submission. Thank you for your help and we look forward to your review!

Best regards,

Zhou