Sviluppo TradingBot

This commit is contained in:
2026-06-09 18:29:41 +02:00
parent 61f1e59964
commit e3c0bd51b2
133 changed files with 24903 additions and 1 deletions
@@ -0,0 +1,13 @@
public async Task PlaceBracketOrderAsync(string symbol, int quantity, decimal entryPrice, decimal takeProfitPrice, decimal stopLossPrice)
{
// 1. Ordine principale di acquisto (Buy) a mercato o limite
var entryOrder = MarketOrder.Buy(symbol, quantity);
// 2. Configura il Bracket Order inserendo Take Profit e Stop Loss
var bracketOrder = entryOrder.TakeProfit(takeProfitPrice).StopLoss(stopLossPrice);
// 3. Invia l'ordine ad Alpaca
IOrder order = await _tradingClient.PostOrderAsync(bracketOrder);
Console.WriteLine($"Ordine inviato con successo. ID: {order.OrderId}");
}