diff --git a/1 Month Test Result.png b/1 Month Test Result.png new file mode 100644 index 00000000..be88b96a Binary files /dev/null and b/1 Month Test Result.png differ diff --git a/WebServer/Components/Pages/Home.razor b/WebServer/Components/Pages/Home.razor index c98f054b..330d0e54 100644 --- a/WebServer/Components/Pages/Home.razor +++ b/WebServer/Components/Pages/Home.razor @@ -207,7 +207,7 @@ async Task RunTest(){ D683_Project_Test tests = new D683_Project_Test(aiModule); float score = await tests.Simulate(); - TestResults = "Performance [measured in dollars difference from starting money]: " + score.ToString(); + TestResults = $"The amount of money the AI did better than the SPY: ${score} or { score / 10 }% better"; } } \ No newline at end of file diff --git a/WebServer/Controllers/ProjectTest.cs b/WebServer/Controllers/ProjectTest.cs index a541b70f..8764a5d6 100644 --- a/WebServer/Controllers/ProjectTest.cs +++ b/WebServer/Controllers/ProjectTest.cs @@ -108,8 +108,18 @@ namespace Controllers.ProjectTest { next:; } - // Return a score [Bigger than 0 is money earned] or [Less than 0 is money lost] - return Money - StartingMoney; + // Get price of SPY starting and end + float SPYbegin = _aiModule.GetCurrentPrice( "SPY", 30 ); + float SPYend = _aiModule.GetCurrentPrice( "SPY" ); + + // Get max quantity for the amount of money given + int SPYQty = (int)( StartingMoney / SPYbegin ); + + // Calculate how much money you would end with if just stayed in the normal S&P500 + float earned = StartingMoney / SPYbegin * SPYend; + + // Return the difference between the AI and the SPY -> if value returned is 10. The AI did better than the SPY by $10 + return Money - earned; }