B4. Plus the previous commit. Evaluate the algorithm

This commit is contained in:
2026-03-12 18:53:03 -07:00
parent aa38f9745a
commit b6798e84f5
8 changed files with 63 additions and 48 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 522 KiB

+8
View File
@@ -42,3 +42,11 @@ docker compose up -d
## Usage ## Usage
Navigate to [localhost:5000](http://127.0.0.1:5000). Navigate to [localhost:5000](http://127.0.0.1:5000).
Register an account with a username and password
Add as many stock symbols as you would like to the watched stocks
Sit back and let the AI day trade for you
This will auto trade once per day based on the AI predicted stock movement 5 days in advance
-------------------
If you would like to simulate your watched stocks on the last 30 days of stock history you can run the 'Run 1Mo Evaluation'
This will simulate, such as the real algorithm, the stock trade's per day on your watched stocks so you can get a feel for your watched stocks
+23 -11
View File
@@ -40,31 +40,29 @@
</div> </div>
<!-- Tool Frame --> <!-- Tool Frame -->
<div>
<div class="gridFrame"> <div class="gridFrame">
<div> <div>
<div><h2>Actions</h2></div> <div><h2>Actions</h2></div>
<div> <div>
<input placeholder="Stock Symbol [NVDA]" @bind="addStockSymbol" /> <input placeholder="Stock Symbol [NVDA]" @bind="addStockSymbol" />
<button @onclick="addStock">Add To Tracked Stocks</button> <button @onclick="addStock">Add To Watched Stocks</button>
</div> </div>
<br /> <br />
<div> <div>
<button @onclick="RunTest">Run 1Mo Test</button> <button @onclick="RunTest">Run 1Mo Evaluation</button>
<br />
<span>@TestResults</span> <span>@TestResults</span>
</div> </div>
<span>@resultError</span> <span>@resultError</span>
</div> </div>
</div> </div>
}
<!-- AI Frame -->
@if (Session != null){
<div>
<!-- Tracked Stocks --> <!-- Tracked Stocks -->
<div class="gridFrame"> <div style="margin-top: 20px;" class="gridFrame">
<div> <div>
<h2>Current Signal</h2> <h2>Watched Stocks</h2>
</div> </div>
<div style="column-count: 2;">
@foreach (Stock cur in Session.TrackedStocks){ @foreach (Stock cur in Session.TrackedStocks){
<div class="signalBlock"> <div class="signalBlock">
<p style="text-align: center; font-weight: bold;">@cur.Symbol</p> <p style="text-align: center; font-weight: bold;">@cur.Symbol</p>
@@ -73,10 +71,17 @@
</div> </div>
} }
</div> </div>
</div>
</div>
}
<!-- AI Frame -->
@if (Session != null){
<div>
<!-- Trade History --> <!-- Trade History -->
<div class="gridFrame"> <div class="gridFrame">
<div> <div>
<h2>Trade History</h2> <h2>Auto Trade History</h2>
</div> </div>
@foreach (PurchasedStock cur in Session.TradeHistory){ @foreach (PurchasedStock cur in Session.TradeHistory){
<div class="signalBlock"> <div class="signalBlock">
@@ -205,8 +210,15 @@
string TestResults = ""; string TestResults = "";
async Task RunTest(){ async Task RunTest(){
// Make sure a session exists
if (Session == null){
return;
}
// Simulate 1 month
D683_Project_Test tests = new D683_Project_Test(aiModule); D683_Project_Test tests = new D683_Project_Test(aiModule);
float score = await tests.Simulate(); float score = await tests.Simulate(Session.TrackedStocks);
TestResults = $"The amount of money the AI did better than the SPY: ${score} or { score / 10 }% better"; TestResults = $"The amount of money the AI did better than the SPY: ${score} or { score / 10 }% better";
} }
+15 -4
View File
@@ -62,25 +62,36 @@
.signalBlock { .signalBlock {
display: flex; display: flex;
width: min-content;
margin-top: 5px;;
} }
.signalBlock > :nth-child(1) { .signalBlock > :nth-child(1) {
border: solid #040 1px; border: solid #040 1px;
border-radius: 15px; border-radius: 15px;
padding: 0px 20px; padding: 5px 20px;
background-color: greenyellow; background-color: greenyellow;
align-self: center;
margin: 0;
width: 100px;
} }
.signalBlock > :nth-child(2) { .signalBlock > :nth-child(2) {
padding: 0 30px; padding: 0 30px;
font-size: 30px; font-size: 30px;
align-content: center; align-content: center;
margin: 0;
text-wrap: nowrap;
} }
.signalBlock > :nth-child(3) { .signalBlock > :nth-child(3) {
color: white; padding: 10px 30px;
padding: 0 30px;
width: 40px;
border: solid #000 1px; border: solid #000 1px;
border-radius: 15px; border-radius: 15px;
background-color: #F44;
text-align: center;
}
.signalBlock > :nth-child(3):hover {
background-color: #f00;
} }
+1 -17
View File
@@ -1,7 +1,5 @@
using Controllers.PythonInterop; using Controllers.PythonInterop;
using Entities; using Entities;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Razor.TagHelpers;
namespace Controllers.ProjectTest { namespace Controllers.ProjectTest {
@@ -10,20 +8,6 @@ namespace Controllers.ProjectTest {
// TESTING Starting Money // TESTING Starting Money
float Money = 1000; float Money = 1000;
// TESTING WATCH STOCK LIST
List<Stock> TrackedStocks = new List<Stock>() {
new Stock(){ Symbol="NVDA" },
new Stock(){ Symbol="INTL" },
new Stock(){ Symbol="AAPL" },
new Stock(){ Symbol="SHOP" },
new Stock(){ Symbol="PANW" },
new Stock(){ Symbol="BBBY" },
new Stock(){ Symbol="REAL" },
new Stock(){ Symbol="W" },
new Stock(){ Symbol="ROKU" },
new Stock(){ Symbol="FUN" }
};
// TESTING STOCK HISTORY // TESTING STOCK HISTORY
List<PurchasedStock> StockHistory = new List<PurchasedStock>(); List<PurchasedStock> StockHistory = new List<PurchasedStock>();
@@ -32,7 +16,7 @@ namespace Controllers.ProjectTest {
_aiModule = aiModule; _aiModule = aiModule;
} }
public async Task<float> Simulate() { public async Task<float> Simulate(List<Stock> TrackedStocks) {
float StartingMoney = Money; float StartingMoney = Money;
// Run once for each day 30 days straight // Run once for each day 30 days straight
for (int i=30; i>=0; i--) { for (int i=30; i>=0; i--) {
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Entities { namespace Entities {
class loginSession { public class loginSession {
public string UserName { get; set; } = ""; public string UserName { get; set; } = "";
public float Money { get; set; } = 0; public float Money { get; set; } = 0;
public List<Stock> TrackedStocks { get; set; } = new List<Stock>(); public List<Stock> TrackedStocks { get; set; } = new List<Stock>();
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Entities { namespace Entities {
class PurchasedStock { public class PurchasedStock {
public string Symbol { get; set; } = ""; public string Symbol { get; set; } = "";
public float Quantity { get; set; } = 0; public float Quantity { get; set; } = 0;
public float PurchasePrice { get; set; } = 0; public float PurchasePrice { get; set; } = 0;
+1 -1
View File
@@ -1,6 +1,6 @@
namespace Entities { namespace Entities {
class Stock { public class Stock {
public string Symbol { get; set; } = ""; public string Symbol { get; set; } = "";
public float Score { get; set; } = 0; public float Score { get; set; } = 0;
} }