GAP-031: fix submitted trade provenance
- serialize grade, score, ORB ticks, and resolved mode from accepted submission data - add exact-value JSONL provenance test - prepare governance for Gate Run 3 Build: clean | Tests: 498 passing | Dual-deployed: yes
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NT8.Core.Common.Models;
|
||||
using NT8.Core.Intelligence;
|
||||
using NT8.Core.Logging;
|
||||
|
||||
namespace NT8.Core.Tests.Logging
|
||||
{
|
||||
[TestClass]
|
||||
public class TradeProvenanceSerializerTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void Serialize_SubmittedIntent_WritesComputedProvenanceValues()
|
||||
{
|
||||
var confluence = new ConfluenceScore(
|
||||
0.81,
|
||||
0.83,
|
||||
TradeGrade.A,
|
||||
new List<ConfluenceFactor>(),
|
||||
DateTime.UtcNow,
|
||||
new Dictionary<string, object>());
|
||||
var metadata = new Dictionary<string, object>();
|
||||
metadata.Add("confluence_score", confluence);
|
||||
metadata.Add("orb_range_ticks", 42.5);
|
||||
var intent = new StrategyIntent(
|
||||
"NQ",
|
||||
OrderSide.Buy,
|
||||
OrderType.Market,
|
||||
null,
|
||||
20,
|
||||
40,
|
||||
0.83,
|
||||
"synthetic trade",
|
||||
metadata);
|
||||
|
||||
string json = TradeProvenanceSerializer.Serialize(
|
||||
"session-1",
|
||||
1,
|
||||
new DateTime(2026, 8, 3, 12, 0, 0, DateTimeKind.Utc),
|
||||
intent,
|
||||
2,
|
||||
20.0,
|
||||
"Mode1DualLeg",
|
||||
"PCP",
|
||||
0.0,
|
||||
"RTH_ORB",
|
||||
"test-version");
|
||||
JObject result = JObject.Parse(json);
|
||||
|
||||
Assert.AreEqual("A", (string)result["confluence_grade"]);
|
||||
Assert.AreEqual(0.83, (double)result["confluence_score"], 0.000001);
|
||||
Assert.AreEqual("Mode1DualLeg", (string)result["resolved_runner_mode"]);
|
||||
Assert.AreEqual(42.5, (double)result["OrbRangeTicks"], 0.000001);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user