Hi, I’m able to receive trades with alpaca-py but not with .Net C# using same key and secret,
reduced it to the simplest test:
using System;
using System.Threading.Tasks;
using Alpaca.Markets;
class Program
{
private const string API_KEY = "\_________MY_KEY";
private const string API_SECRET = "\_______MY_SECRET";
static async Task Main()
{
var client = Environments.Paper.GetAlpacaDataStreamingClient(new SecretKey(API_KEY, API_SECRET));
var tradeSubscription = client.GetTradeSubscription("SPY"); // Replace with your desired symbol
tradeSubscription.Received += trade =>
{
Console.WriteLine($"Trade: {trade.Symbol} @ {trade.Price} x {trade.Size}");
};
await client.ConnectAsync();
await client.SubscribeAsync(tradeSubscription);
Console.WriteLine("Streaming live trades... Press Enter to exit.");
Console.ReadLine();
await client.DisconnectAsync();
}
}
what am i doing wrong?
Thank you