Initial commit: IBKRTrader

.NET WinForms-Anwendung (Core, Modules/CongressTrading, UI).
Enthaelt .gitignore und settings.example.json als Konfigurationsvorlage.
Echte settings.json mit Zugangsdaten ist bewusst ausgeschlossen.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Richard
2026-07-26 18:19:47 +02:00
co-authored by Claude Opus 4.8
commit ebeb035e92
47 changed files with 4527 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
using IBKRTrader.Core.Database;
using IBKRTrader.Core.Logging;
namespace IBKRTrader.Core.Trading;
/// <summary>Verwaltet core_trade_history Lesen und Schreiben von Trade-Einträgen.</summary>
public class TradeHistoryService
{
private readonly DatabaseService _db;
private readonly LoggingService _logger;
public TradeHistoryService(DatabaseService db, LoggingService logger)
{
_db = db;
_logger = logger;
}
public async Task RecordTradeAsync(
string module, string symbol, string action,
decimal quantity, decimal price, string? ibkrOrderId = null, string? notes = null)
{
await _db.ExecuteAsync(@"
INSERT INTO `core_trade_history`
(module, symbol, action, quantity, price, total_value, traded_at, ibkr_order_id, status, notes)
VALUES
(@module, @symbol, @action, @qty, @price, @total, @now, @orderId, 'Executed', @notes)",
new
{
module,
symbol,
action,
qty = quantity,
price,
total = quantity * price,
now = DateTime.UtcNow,
orderId = ibkrOrderId,
notes
});
_logger.Info(module, $"Trade gespeichert: {action} {quantity}x {symbol} @ {price:F2}");
}
public async Task<IEnumerable<dynamic>> GetRecentTradesAsync(int limit = 100)
=> await _db.QueryAsync<dynamic>(
"SELECT * FROM `core_trade_history` ORDER BY traded_at DESC LIMIT @limit",
new { limit });
}