B4. Plus the previous commit. Evaluate the algorithm
This commit is contained in:
@@ -40,19 +40,37 @@
|
||||
</div>
|
||||
|
||||
<!-- Tool Frame -->
|
||||
<div>
|
||||
<div class="gridFrame">
|
||||
<div>
|
||||
<div><h2>Actions</h2></div>
|
||||
<div>
|
||||
<input placeholder="Stock Symbol [NVDA]" @bind="addStockSymbol" />
|
||||
<button @onclick="addStock">Add To Tracked Stocks</button>
|
||||
<div>
|
||||
<input placeholder="Stock Symbol [NVDA]" @bind="addStockSymbol" />
|
||||
<button @onclick="addStock">Add To Watched Stocks</button>
|
||||
</div>
|
||||
<br />
|
||||
<div>
|
||||
<button @onclick="RunTest">Run 1Mo Evaluation</button>
|
||||
<br />
|
||||
<span>@TestResults</span>
|
||||
</div>
|
||||
<span>@resultError</span>
|
||||
</div>
|
||||
<br />
|
||||
</div>
|
||||
<!-- Tracked Stocks -->
|
||||
<div style="margin-top: 20px;" class="gridFrame">
|
||||
<div>
|
||||
<button @onclick="RunTest">Run 1Mo Test</button>
|
||||
<span>@TestResults</span>
|
||||
<h2>Watched Stocks</h2>
|
||||
</div>
|
||||
<div style="column-count: 2;">
|
||||
@foreach (Stock cur in Session.TrackedStocks){
|
||||
<div class="signalBlock">
|
||||
<p style="text-align: center; font-weight: bold;">@cur.Symbol</p>
|
||||
<p>AI Predicted Score: @cur.Score</p>
|
||||
<button @onclick="() => {removeStock(cur);}">Remove</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<span>@resultError</span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -60,23 +78,10 @@
|
||||
<!-- AI Frame -->
|
||||
@if (Session != null){
|
||||
<div>
|
||||
<!-- Tracked Stocks -->
|
||||
<div class="gridFrame">
|
||||
<div>
|
||||
<h2>Current Signal</h2>
|
||||
</div>
|
||||
@foreach (Stock cur in Session.TrackedStocks){
|
||||
<div class="signalBlock">
|
||||
<p style="text-align: center; font-weight: bold;">@cur.Symbol</p>
|
||||
<p>AI Predicted Score: @cur.Score</p>
|
||||
<button @onclick="() => {removeStock(cur);}">Remove</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<!-- Trade History -->
|
||||
<div class="gridFrame">
|
||||
<div>
|
||||
<h2>Trade History</h2>
|
||||
<h2>Auto Trade History</h2>
|
||||
</div>
|
||||
@foreach (PurchasedStock cur in Session.TradeHistory){
|
||||
<div class="signalBlock">
|
||||
@@ -205,8 +210,15 @@
|
||||
|
||||
string TestResults = "";
|
||||
async Task RunTest(){
|
||||
|
||||
// Make sure a session exists
|
||||
if (Session == null){
|
||||
return;
|
||||
}
|
||||
|
||||
// Simulate 1 month
|
||||
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";
|
||||
}
|
||||
|
||||
|
||||
@@ -62,25 +62,36 @@
|
||||
|
||||
.signalBlock {
|
||||
display: flex;
|
||||
width: min-content;
|
||||
margin-top: 5px;;
|
||||
}
|
||||
|
||||
.signalBlock > :nth-child(1) {
|
||||
border: solid #040 1px;
|
||||
border-radius: 15px;
|
||||
padding: 0px 20px;
|
||||
padding: 5px 20px;
|
||||
background-color: greenyellow;
|
||||
align-self: center;
|
||||
margin: 0;
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
.signalBlock > :nth-child(2) {
|
||||
padding: 0 30px;
|
||||
font-size: 30px;
|
||||
align-content: center;
|
||||
margin: 0;
|
||||
text-wrap: nowrap;
|
||||
}
|
||||
|
||||
.signalBlock > :nth-child(3) {
|
||||
color: white;
|
||||
padding: 0 30px;
|
||||
width: 40px;
|
||||
padding: 10px 30px;
|
||||
border: solid #000 1px;
|
||||
border-radius: 15px;
|
||||
}
|
||||
background-color: #F44;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.signalBlock > :nth-child(3):hover {
|
||||
background-color: #f00;
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
using Controllers.PythonInterop;
|
||||
using Entities;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
|
||||
namespace Controllers.ProjectTest {
|
||||
|
||||
@@ -10,20 +8,6 @@ namespace Controllers.ProjectTest {
|
||||
// TESTING Starting Money
|
||||
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
|
||||
List<PurchasedStock> StockHistory = new List<PurchasedStock>();
|
||||
|
||||
@@ -32,7 +16,7 @@ namespace Controllers.ProjectTest {
|
||||
_aiModule = aiModule;
|
||||
}
|
||||
|
||||
public async Task<float> Simulate() {
|
||||
public async Task<float> Simulate(List<Stock> TrackedStocks) {
|
||||
float StartingMoney = Money;
|
||||
// Run once for each day 30 days straight
|
||||
for (int i=30; i>=0; i--) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Entities {
|
||||
|
||||
class loginSession {
|
||||
public class loginSession {
|
||||
public string UserName { get; set; } = "";
|
||||
public float Money { get; set; } = 0;
|
||||
public List<Stock> TrackedStocks { get; set; } = new List<Stock>();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Entities {
|
||||
|
||||
class PurchasedStock {
|
||||
public class PurchasedStock {
|
||||
public string Symbol { get; set; } = "";
|
||||
public float Quantity { get; set; } = 0;
|
||||
public float PurchasePrice { get; set; } = 0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Entities {
|
||||
|
||||
class Stock {
|
||||
public class Stock {
|
||||
public string Symbol { get; set; } = "";
|
||||
public float Score { get; set; } = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user