Trading bot grain (#33)

* Trading bot Grain

* Fix a bit more of the trading bot

* Advance on the tradingbot grain

* Fix build

* Fix db script

* Fix user login

* Fix a bit backtest

* Fix cooldown and backtest

* start fixing bot start

* Fix startup

* Setup local db

* Fix build and update candles and scenario

* Add bot registry

* Add reminder

* Updateing the grains

* fix bootstraping

* Save stats on tick

* Save bot data every tick

* Fix serialization

* fix save bot stats

* Fix get candles

* use dict instead of list for position

* Switch hashset to dict

* Fix a bit

* Fix bot launch and bot view

* add migrations

* Remove the tolist

* Add agent grain

* Save agent summary

* clean

* Add save bot

* Update get bots

* Add get bots

* Fix stop/restart

* fix Update config

* Update scanner table on new backtest saved

* Fix backtestRowDetails.tsx

* Fix agentIndex

* Update agentIndex

* Fix more things

* Update user cache

* Fix

* Fix account load/start/restart/run
This commit is contained in:
Oda
2025-08-04 23:07:06 +02:00
committed by GitHub
parent cd378587aa
commit 082ae8714b
215 changed files with 9562 additions and 14028 deletions

View File

@@ -90,7 +90,7 @@ public class SettingsService : ISettingsService
private async Task SetupStochSTCTrend()
{
var name = "STCTrend";
var strategy = await _scenarioService.CreateStrategy(IndicatorType.Stc,
var strategy = await _scenarioService.CreateIndicatorForUser(null, IndicatorType.Stc,
name,
fastPeriods: 23,
slowPeriods: 50,
@@ -101,7 +101,7 @@ public class SettingsService : ISettingsService
private async Task SetupMacd()
{
var name = "MacdCross";
var strategy = await _scenarioService.CreateStrategy(IndicatorType.MacdCross,
var strategy = await _scenarioService.CreateIndicatorForUser(null, IndicatorType.MacdCross,
name,
fastPeriods: 12,
slowPeriods: 26,
@@ -112,7 +112,7 @@ public class SettingsService : ISettingsService
private async Task SetupRsiDiv()
{
var name = "RsiDiv6";
var strategy = await _scenarioService.CreateStrategy(IndicatorType.RsiDivergence,
var strategy = await _scenarioService.CreateIndicatorForUser(null, IndicatorType.RsiDivergence,
name,
period: 6);
await _scenarioService.CreateScenario(name, new List<string> { strategy.Name });
@@ -121,7 +121,7 @@ public class SettingsService : ISettingsService
private async Task SetupRsiDivConfirm()
{
var name = "RsiDivConfirm6";
var strategy = await _scenarioService.CreateStrategy(IndicatorType.RsiDivergenceConfirm,
var strategy = await _scenarioService.CreateIndicatorForUser(null, IndicatorType.RsiDivergenceConfirm,
name,
period: 6);
await _scenarioService.CreateScenario(name, new List<string> { strategy.Name });
@@ -130,7 +130,7 @@ public class SettingsService : ISettingsService
private async Task SetupSuperTrend()
{
var name = "SuperTrend";
var strategy = await _scenarioService.CreateStrategy(IndicatorType.SuperTrend,
var strategy = await _scenarioService.CreateIndicatorForUser(null, IndicatorType.SuperTrend,
name,
period: 10,
multiplier: 3);
@@ -140,7 +140,7 @@ public class SettingsService : ISettingsService
private async Task SetupChandelierExit()
{
var name = "ChandelierExit";
var strategy = await _scenarioService.CreateStrategy(IndicatorType.ChandelierExit,
var strategy = await _scenarioService.CreateIndicatorForUser(null, IndicatorType.ChandelierExit,
name,
period: 22,
multiplier: 3);
@@ -150,7 +150,7 @@ public class SettingsService : ISettingsService
private async Task SetupStochRsiTrend()
{
var name = "StochRsiTrend";
var strategy = await _scenarioService.CreateStrategy(IndicatorType.StochRsiTrend,
var strategy = await _scenarioService.CreateIndicatorForUser(null, IndicatorType.StochRsiTrend,
name,
period: 14,
stochPeriods: 14,
@@ -162,7 +162,7 @@ public class SettingsService : ISettingsService
private async Task SetupEmaTrend()
{
var name = "Ema200Trend";
var strategy = await _scenarioService.CreateStrategy(IndicatorType.EmaTrend,
var strategy = await _scenarioService.CreateIndicatorForUser(null, IndicatorType.EmaTrend,
name,
period: 200);
await _scenarioService.CreateScenario(name, new List<string> { strategy.Name });
@@ -171,7 +171,7 @@ public class SettingsService : ISettingsService
private async Task SetupEmaCross()
{
var name = "Ema200Cross";
var strategy = await _scenarioService.CreateStrategy(IndicatorType.EmaCross,
var strategy = await _scenarioService.CreateIndicatorForUser(null, IndicatorType.EmaCross,
name,
period: 200);
await _scenarioService.CreateScenario(name, new List<string> { strategy.Name });