Move away from Python Interop for better stability

This commit is contained in:
2026-03-09 17:11:59 -07:00
parent 52c5062d6e
commit ac67be137c
8 changed files with 134 additions and 60 deletions
+20 -6
View File
@@ -4,15 +4,29 @@ using Controllers.DataBase;
using Controllers.Payment;
// Load the module in globally and use correct path for local or docker runners
#if DEBUG
AIModule interopModule = new AIModule(PythonPathBase: "/usr/", PythonVersion: "python3.11");
#else
AIModule interopModule = new AIModule();
#endif
AIModule interopModule = new AIModule();
if (args.Contains("Pull-Stock-Data")) {
if (args.Contains("Retrain-AI")) {
// This runs once per month on the first -> set by the crontab.txt
interopModule.PullAI();
interopModule.TrainAI();
} else if (args.Contains("Perform-AI")) {
// This runs every hour that the stock market is open -> set by the crontab.txt
// Get all current holdings for Stocks
// Perform the AI Signal per stock
// Perform action in background for each stock
} else {
// This runs when the server is started normally
// Make sure the data is ready before first run
string firstPullRan = (new DbDriver()).Get("FirstPull");
if (firstPullRan != "1") {
interopModule.PullAI();
interopModule.TrainAI();
(new DbDriver()).Set("FirstPull", "1");
}
// Create the webapp
var builder = WebApplication.CreateBuilder(args);