Phase 0 completion: NT8 SDK core framework with risk management and position sizing
Some checks failed
Build and Test / build (push) Has been cancelled
Some checks failed
Build and Test / build (push) Has been cancelled
This commit is contained in:
49
tests/NT8.Core.Tests/TestDataBuilder.cs
Normal file
49
tests/NT8.Core.Tests/TestDataBuilder.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using NT8.Core.Common.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NT8.Core.Tests
|
||||
{
|
||||
public static class TestDataBuilder
|
||||
{
|
||||
public static StrategyIntent CreateValidIntent(
|
||||
string symbol = "ES",
|
||||
int stopTicks = 8,
|
||||
OrderSide side = OrderSide.Buy)
|
||||
{
|
||||
return new StrategyIntent(
|
||||
symbol: symbol,
|
||||
side: side,
|
||||
entryType: OrderType.Market,
|
||||
limitPrice: null,
|
||||
stopTicks: stopTicks,
|
||||
targetTicks: 16,
|
||||
confidence: 0.8,
|
||||
reason: "Test intent",
|
||||
metadata: new Dictionary<string, object>()
|
||||
);
|
||||
}
|
||||
|
||||
public static StrategyContext CreateTestContext(string symbol = "ES")
|
||||
{
|
||||
return new StrategyContext(
|
||||
symbol: symbol,
|
||||
currentTime: DateTime.UtcNow,
|
||||
currentPosition: new Position(symbol, 0, 0, 0, 0, DateTime.UtcNow),
|
||||
account: new AccountInfo(50000, 50000, 0, 0, DateTime.UtcNow),
|
||||
session: new MarketSession(DateTime.Today.AddHours(9.5), DateTime.Today.AddHours(16), true, "RTH"),
|
||||
customData: new Dictionary<string, object>()
|
||||
);
|
||||
}
|
||||
|
||||
public static RiskConfig CreateTestRiskConfig()
|
||||
{
|
||||
return new RiskConfig(
|
||||
dailyLossLimit: 1000,
|
||||
maxTradeRisk: 500,
|
||||
maxOpenPositions: 5,
|
||||
emergencyFlattenEnabled: true
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user