Reply

Saving strategy WFM results in .sqx

2 replies

Lorena Rangel

Subscriber, bbp_participant, customer, community, sq-ultimate, 8 replies.

Visit profile

2 weeks ago #290714

After executing Optimizer (or Task Optimize Strategies in workflow), and trying to save the result, I get not only the WFM result, but also System Parameter Permutation and Optimization profile are executed and saved. I want to save only the best WFM result. How can i do that?

0

Lorena Rangel

Subscriber, bbp_participant, customer, community, sq-ultimate, 8 replies.

Visit profile

2 weeks ago #290720

I wrote a code but the symbol and timeframe are null. When I try to use the result on portfolio master, I get an error.

 

`package SQ.CustomAnalysis;

import com.strategyquant.lib.*;

import java.util.ArrayList;
import java.util.List;

import com.strategyquant.datalib.*;
import com.strategyquant.tradinglib.*;

public class SaveBestWalkForwardMatrixResult extends CustomAnalysisMethod {

//————————————————————————
//————————————————————————
//————————————————————————

/**
* set the type of CA snippet here – it is either used as:
* – strategy filter – it will call filterStrategy() method for one strategy
* – databank processor – it will call processDatabank() for all strategies in databank
*
* Uncomment the one you want to use.
*/
public SaveBestWalkForwardMatrixResult() {
super(“SaveBestWalkForwardMatrixResult”, TYPE_PROCESS_DATABANK);
}

@Override
public ArrayList processDatabank(String project, String task, String databankName, ArrayList databankRG) throws Exception {

for (ResultsGroup result : databankRG) {
try {
// Removes optimization profile
result.setOptimizationProfile(null);

// Get keys to work on
List keysSnapshot = new ArrayList<>(result.getResultKeys());
String bestWFMResultKey = result.getBestWFResultKey();
String mainResultsKey = result.getMainResultKey();

// Gets best WFM subresult and settings
Result bestWFMResult = result.subResult(bestWFMResultKey);
SettingsMap bestWFMSettingsMap = bestWFMResult.getSettings();

// Removes all wfm simulations results
for (String currentKey : keysSnapshot) {
if (!currentKey.equals(bestWFMResultKey) && !currentKey.equals(mainResultsKey)) {
result.removeSubresult(currentKey, true);
}
}

// Removes original WFM separetaly to avoid duplication
String originalWFResult = result.getOriginalWFResultKey();
result.removeSubresult(originalWFResult, true);

// Removes main result in order to maintain only best WF
result.removeSubresult(mainResultsKey, true);
} catch (Exception e) {
throw e;
}
}

return databankRG;
}
}

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

1 week ago #291157

Hello,

we plan to release a tutorial on how to work with WF results through Custom analysis soon

0

Viewing 2 replies - 1 through 2 (of 2 total)