d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Offer 1000 Fg For Template Help
Add Reply New Topic New Poll
Member
Posts: 23,532
Joined: May 30 2006
Gold: 11,290.11
Aug 10 2020 07:22pm
So i got this raw data



Link to some of the raw data, so you can copy paste into excel etc

https://codeshare.io/5QNPoW

It will always look like this format, but can sometimes go back 10 years, other times 5 years, and a few times maybe like 50 years.

So what do i need:

- When i copy paste this into excel (or something else if thats easier), i need to automaticly calculate 3 things using the "Exit date" as dates and "Abs perf", being the numbers i wanna sumarize:

1. Abs perf sumarized per month (for example if its 5 years worth of data, i wanna see "Abs perf" summed for 2015 Jan - 2015 Feb - 2015 Mar - (...) - 2020 August
2. Abs perf sumarized per quarter (for example if its 5 years worth of data, i wanna see "Abs perf" summed for 2015 Q1 - 2015 Q2 - 2015 Q3 - (...) - 2020 Q3
3. abs perf sumarized per year (for example if its 5 years worth of data, i wanna see "Abs perf" summed for 2015 - 2016 - (...) - 2020

sidenote: if a month/quarter/year has no trades (no abs perf), i need abs perf to be 0. For example if Backtest A contains data from 01.01.2015 and Backtest B also has data from 01.01.2015 then the amount of months and quarters and years should be the same, even if Backtest B have several months without any trades. Those months should then see a sum = 0 for those months. So when graphed later, where i maybe look at the accumulated "abs perf" for each backtest, i have the same amount of data points, same goes for calculating correlation etc.

Why do i need it:

I want to be able to graph different backtests and compare the backtest results to each other, based on abs perf. So i want to be able to graph them, and i want to calculate monthly/quarterly/yearly correlation etc.

PM me for questions or if you need more data or whatever.

This post was edited by MongoBarnet on Aug 10 2020 07:31pm
Member
Posts: 30,959
Joined: Apr 13 2008
Gold: 11,786.69
Aug 10 2020 09:00pm
you need to use 2 loops to calculate your monthly absolute performance... here's some basic pseudocode

Code

for (int i = 0; i < nb of months; i++)
{
currentMonthAbsolutePerformance = 0
while (exit date is the same month as previous transaction)
{
currentMonthAbsolutePerformance += transactionAbsolutePerformance
}
print ( currentMonthAbsolutePerformance )
}
Member
Posts: 12,786
Joined: May 17 2013
Gold: 4,010.00
Aug 11 2020 02:40pm
I can do it in Python if you are fine with that

plotting the results you want shouldn't be difficult either
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll