Baseline: Ausgangszustand vor Modularisierung
Erster Commit des bestehenden monolithischen WinForms-Copytraders, inklusive der Alt-Backups (*.bak), damit diese dauerhaft in der Historie rekonstruierbar bleiben. Threema-Lib unter libs/ wurde vendored (nested .git entfernt). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user