Phase 3a: Core-Domänenmodelle in den Core verschoben
- AccountState, Position, MarketData nach src/PolyTrader.Core/Models/ (Namespace PolyTraderSharp.Models beibehalten → keine Consumer-Änderung). - AccountState: ungenutzte usings (MongoDB.Driver, PolyTraderSharp.Extensions) entfernt (Core darf App-Shim nicht referenzieren). - MongoDB.Driver 2.24.0 als Core-Paket (für BsonId-Attribute). - Build 0 Fehler. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,100 +0,0 @@
|
||||
using System;
|
||||
using MongoDB.Driver;
|
||||
using PolyTraderSharp.Extensions;
|
||||
using System.ComponentModel;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Linq;
|
||||
|
||||
namespace PolyTraderSharp.Models
|
||||
{
|
||||
public class AccountState
|
||||
{
|
||||
[Browsable(false)]
|
||||
[MongoDB.Bson.Serialization.Attributes.BsonId] public int AccountId { get; set; }
|
||||
|
||||
[Category("01. General")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[Category("02. Wallet & Keys")]
|
||||
public string WalletAddress { get; set; } = string.Empty;
|
||||
|
||||
[Category("02. Wallet & Keys")]
|
||||
public string ApiKey { get; set; } = string.Empty;
|
||||
|
||||
[Category("02. Wallet & Keys")]
|
||||
public string ApiSecret { get; set; } = string.Empty;
|
||||
|
||||
[Category("02. Wallet & Keys")]
|
||||
public string ApiPassphrase { get; set; } = string.Empty;
|
||||
|
||||
[Category("02. Wallet & Keys")]
|
||||
public string PrivateKey { get; set; } = string.Empty;
|
||||
|
||||
[Category("01. General")]
|
||||
public bool IsDemo { get; set; }
|
||||
|
||||
[Category("01. General")]
|
||||
public bool IsActive { get; set; } = true;
|
||||
|
||||
[Category("01. General")]
|
||||
public bool CloseOnlyMode { get; set; } = false;
|
||||
|
||||
[Category("03. Payouts")]
|
||||
public string PayoutAddress { get; set; } = string.Empty;
|
||||
|
||||
[Category("03. Payouts")]
|
||||
public decimal PayoutLimitUsd { get; set; } = 0;
|
||||
|
||||
// Balances
|
||||
[Browsable(false)]
|
||||
public decimal TotalBalance { get; set; }
|
||||
|
||||
[Browsable(false)]
|
||||
public decimal AvailableBalance { get; set; }
|
||||
|
||||
// Risk Settings
|
||||
[Category("04. Risk Management")]
|
||||
public decimal PerMarketLimit { get; set; } = 5.0m;
|
||||
|
||||
[Category("04. Risk Management")]
|
||||
public decimal MaxPriceDifference { get; set; } = 2.0m;
|
||||
|
||||
[Category("04. Risk Management")]
|
||||
public decimal MaxBuyPrice { get; set; } = 0.98m;
|
||||
|
||||
[Category("04. Risk Management")]
|
||||
public decimal ProfitTarget { get; set; } = 50.0m;
|
||||
|
||||
[Category("04. Risk Management")]
|
||||
public decimal PreRedeemLimit { get; set; } = 0.0m;
|
||||
|
||||
[Category("04. Risk Management")]
|
||||
public decimal PerMasterLimit { get; set; } = 10.0m;
|
||||
|
||||
// Time limits
|
||||
[Category("05. Time Limits")]
|
||||
public decimal perMaxTime6h { get; set; } = 20.0m;
|
||||
|
||||
[Category("05. Time Limits")]
|
||||
public decimal perMaxTime24h { get; set; } = 20.0m;
|
||||
|
||||
[Category("05. Time Limits")]
|
||||
public decimal perMaxTime72h { get; set; } = 20.0m;
|
||||
|
||||
[Category("05. Time Limits")]
|
||||
public decimal perMaxTimeNone { get; set; } = 40.0m;
|
||||
|
||||
[Browsable(false)]
|
||||
public ConcurrentDictionary<string, Position> OpenPositions { get; } = new(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
[Browsable(false)]
|
||||
public bool HasOpenLimitOrders { get; set; } = false;
|
||||
|
||||
public void UpdateBalance(decimal available)
|
||||
{
|
||||
AvailableBalance = available;
|
||||
decimal inPositions = OpenPositions.Values.Sum(p => (decimal)p.AmountUsd);
|
||||
TotalBalance = AvailableBalance + inPositions;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
namespace PolyTraderSharp.Models
|
||||
{
|
||||
public class MarketData
|
||||
{
|
||||
[MongoDB.Bson.Serialization.Attributes.BsonId] public string Id { get; set; } = string.Empty;
|
||||
public string ConditionId { get; set; } = string.Empty;
|
||||
public string Question { get; set; } = string.Empty;
|
||||
public string Slug { get; set; } = string.Empty;
|
||||
public DateTime? EndDate { get; set; }
|
||||
public bool Active { get; set; }
|
||||
public bool Closed { get; set; }
|
||||
public string Category { get; set; } = string.Empty;
|
||||
|
||||
// Will store the JSON array string of token IDs, e.g. "[\"123\", \"456\"]"
|
||||
public string ClobTokenIds { get; set; } = string.Empty;
|
||||
|
||||
public string Outcomes { get; set; } = string.Empty; // e.g. "[\"Yes\", \"No\"]"
|
||||
|
||||
public bool NegRisk { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
namespace PolyTraderSharp.Models
|
||||
{
|
||||
public class Position
|
||||
{
|
||||
[MongoDB.Bson.Serialization.Attributes.BsonId]
|
||||
public string TokenId { get; set; } = string.Empty;
|
||||
public string MarketSlug { get; set; } = string.Empty;
|
||||
public string ConditionId { get; set; } = string.Empty;
|
||||
public int SourceTraderId { get; set; }
|
||||
public string SourceTraderName { get; set; } = string.Empty;
|
||||
public string SourceTraderAddress { get; set; } = string.Empty;
|
||||
public string MarketQuestion { get; set; } = string.Empty;
|
||||
public string Outcome { get; set; } = string.Empty;
|
||||
public string Side { get; set; } = "BUY";
|
||||
public decimal EntryPrice { get; set; }
|
||||
public decimal Size { get; set; } // Shares
|
||||
public decimal AmountUsd { get; set; }
|
||||
public decimal CurrentPrice { get; set; }
|
||||
public decimal CurrentValueUsd { get; set; }
|
||||
public System.DateTime? ExpiryDate { get; set; }
|
||||
public System.DateTime OpenedAt { get; set; } = System.DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user