Put the candidate strategies in observation without capital
Relative momentum among coins and all-time highs on stocks are now in the code as candidates: they collect signals, have no share, no capital and no order path, and every way forward refuses them. The crypto one ran the protocol once and failed it (DSR 0.744, worst fall 35.3%), so it is archived and decides nothing; the stock one waits for the Alpaca history. refs #74 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9d1a4f2f69
commit
fb0ab223a5
33 files changed
+1747
-82
No files matched your search
@@ -36,16 +36,18 @@ public sealed class TradingServiceTests
|
||||
// Every strategy starts in observation, crypto on OKX and stocks on Alpaca.
|
||||
CollectionAssert.AreEqual(new[]
|
||||
{
|
||||
(StrategyNames.CryptoRelativeMomentum, "OKX simulatore", StrategyNames.Observation),
|
||||
(StrategyNames.CryptoTrend, "OKX simulatore", StrategyNames.Observation),
|
||||
(StrategyNames.EquityMeanrev, "Alpaca simulatore", StrategyNames.Observation),
|
||||
(StrategyNames.EquityMomentum, "Alpaca simulatore", StrategyNames.Observation),
|
||||
(StrategyNames.StockAthBreakout, "Alpaca simulatore", StrategyNames.Observation),
|
||||
}, (await StrategiesAsync(rig).ConfigureAwait(false)).ToArray());
|
||||
|
||||
// A second start finds what is there.
|
||||
using var again = Service(rig, http);
|
||||
await again.StartAsync(_none).ConfigureAwait(false);
|
||||
Assert.HasCount(2, await rig.QueryAsync("SELECT id FROM accounts", r => r.Id("id")).ConfigureAwait(false));
|
||||
Assert.HasCount(3, await StrategiesAsync(rig).ConfigureAwait(false));
|
||||
Assert.HasCount(5, await StrategiesAsync(rig).ConfigureAwait(false));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -62,9 +64,11 @@ public sealed class TradingServiceTests
|
||||
Assert.IsFalse(accounts.Any(a => a.Environment == TradingEnvironments.Live), "Never a real account in this phase (SPEC 2.2).");
|
||||
CollectionAssert.AreEqual(new[]
|
||||
{
|
||||
(StrategyNames.CryptoRelativeMomentum, "OKX simulatore", StrategyNames.Observation),
|
||||
(StrategyNames.CryptoTrend, "OKX simulatore", StrategyNames.Observation),
|
||||
(StrategyNames.EquityMeanrev, "Alpaca simulatore", StrategyNames.Observation),
|
||||
(StrategyNames.EquityMomentum, "Alpaca paper", StrategyNames.Observation),
|
||||
(StrategyNames.StockAthBreakout, "Alpaca simulatore", StrategyNames.Observation),
|
||||
}, (await StrategiesAsync(rig).ConfigureAwait(false)).ToArray(), "A strategy with a history stays where it is.");
|
||||
}
|
||||
|
||||
@@ -90,7 +94,7 @@ public sealed class TradingServiceTests
|
||||
|
||||
Assert.AreEqual(1000m, await BookAsync(Venues.Okx, "EUR").ConfigureAwait(false));
|
||||
Assert.AreEqual(2200m, await BookAsync(Venues.Alpaca, "USD").ConfigureAwait(false), "Funded once, not again at every call.");
|
||||
var shares = await rig.QueryAsync("SELECT strategy, capital FROM strategy_state ORDER BY strategy", r => (r.Text("strategy"), r.Money("capital"))).ConfigureAwait(false);
|
||||
var shares = await rig.QueryAsync("SELECT strategy, capital FROM strategy_state WHERE share > 0 ORDER BY strategy", r => (r.Text("strategy"), r.Money("capital"))).ConfigureAwait(false);
|
||||
CollectionAssert.AreEqual(new[] { (StrategyNames.CryptoTrend, 1000m), (StrategyNames.EquityMeanrev, 550m), (StrategyNames.EquityMomentum, 1650m) }, shares.ToArray());
|
||||
|
||||
// The dollar falls: saving the same euro again changes nothing, and only a new euro amount is converted at today's rate.
|
||||
|
||||
Reference in new issue
Block a user