I am using C# in VS2019. I tried the C# SDK but kept running into ‘not authorized’ programs. So I started writing requests myself just using the RestClient() code. That at least gets me the simpler things like accounts, etc.
I am not trying to gets 1 minutes data for multiple stocks to drive my algorithm but do not see how to format up the request. I only have a paper trading account at this time and the documentation says connect to “https://data.alpaca.markets/v1/bars” for data. The docs show calls to .GetBarsetAsync() and I would like to know how to format that data as it is not clear in the Docs or trying to read someone else code.
I have tried:
string url = Program.APCA_API_BASE + “/bars”;
url += “/AAPL”;
url += “/1min/10”;
var client = new RestClient(url);
client.Timeout = -1;
var request = new RestRequest(Method.GET);
request.AddHeader("APCA-API-KEY-ID", Program.APCA_API_KEY_ID);
request.AddHeader("APCA-API-SECRET-KEY", Program.APCA_API_SECRET_KEY);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
This returns ‘endpoint not found’