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<bool> HasOpenPositionAsync(string symbol)
{
try
{
IPosition position = await _tradingClient.GetPositionAsync(symbol);
return position != null && position.Quantity > 0;
}
catch (AlpacaRestException ex) when (ex.ErrorCode == 40410000)
{
// Il codice 40410000 indica che non ci sono posizioni aperte per quel simbolo
return false;
}
}