Topic: collection filename to include net profit
Hi,
I am trying to achieve the following in Express Generator:
- generate strategies for 2 years (max 200 collection)
- run the top 200 strategies for the following month, and pick the top 10 (simulating DEMO testing)
- run the top 10 for the next month (simulating REAL trading)
I've got everything I want working well. My final json file contains the 10 strategies with simulated "real" trading.
I can see the profits for each strategy in the json file uner "profit".
I would like to see a summary of all the profits in the collection in the filename.
Example:
output = ./collections/Coll_[SERVER]_[SYMBOL]_[PERIOD]_[YEAR]-[MONTH]-[DAY]_str_[PROFIT].json
I had a quick look though collection.js
let collectionPath = path
.replaceAll('[SERVER]', cleanName(dataId.source) )
.replaceAll('[SYMBOL]', cleanName(dataId.symbol) )
.replaceAll('[PERIOD]', periodToText(dataId.period) )
.replaceAll('[YEAR]' , date.getUTCFullYear().toString() )
.replaceAll('[MONTH]' , ('0' + (date.getUTCMonth() + 1).toString()).slice(-2) )
.replaceAll('[DAY]' , ('0' + date.getUTCDate().toString()).slice(-2) )
.replaceAll('[HOUR]' , date.getUTCHours().toString() )
.replaceAll('[MINUTE]', date.getUTCMinutes().toString() )
.replaceAll('[COUNT]' , count.toString() )
.replaceAll('[PROFIT]', ???? )
I'm after something that will add profit to the filename, but my JS knowledge isn't that great.
I could code up something in python to extract the data from the json file, but I was hoping there would be an easier way if anyone knows?