stress test check weight start date issue

Dear Alphien team,


Hello, I could not pass the portfolio.stressTestCheckWeightsStartDate. Below is the error message.

Error in portfolio.stressTestCheckWeightsStartDate(strat = stratNew, expectedStartDate = “2004-01-02”) :
Please ensure the weights are generated from: 2004-01-02

However, in my portAllocation@weightsMatrix, my first date is on 2003-07-01 which fulfils the criterion.

> portAllocation@weightsMatrix
DM SP NQ VG Z SMix NX HI KM XP TU FV TY US RX G JB XM GC
2003-07-01 0.0 0.2 0.2 0.0 0.0 0.0 0.2 0.0 0.2 0.0 0.0 0.0 0.0 0.2 0.0 0.0 0.0 0.0 0
2004-05-11 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.2 0.0 0.0 0.0 0.2 0.2 0.2 0.2 0
2004-06-07 0.0 0.2 0.2 0.0 0.0 0.0 0.2 0.0 0.0 0.2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.2 0
2004-07-08 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.2 0.2 0.2 0.2 0.0 0.0 0.2


Could you please help me with this issue?


Thank you!


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

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!

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

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



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)

Alphien Dashboard

Manas


Hello Manas,


Thank you for your help! I will try now

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