Visual Studio
c# .NET 6.0
Alpaca SDK 6.05
Wanted to try out this API and check out this example: A Simple Mean Reversion Stock Trading Script in C#
wanted to see if I could adapt the code to what I need but wont run due to error and cant find a way around it
class MeanReversionPaperOnly
{
private string API_KEY = “REPLACEME”;
private string API_SECRET = “REPLACEME”;
private string API_URL = “https://paper-api.alpaca.markets”;
private string symbol = "SPY";
private Decimal scale = 200;
private ***RestClient*** restClient;
private Guid lastTradeId = Guid.NewGuid();
private List<Decimal> closingPrices = new List<Decimal>();
public void Run()
{
restClient = new ***RestClient***(API_KEY, API_SECRET, API_URL);
// First, cancel any existing orders so they don't impact our buying power.
var orders = restClient.ListOrdersAsync().Result;
foreach (var order in orders)
{
restClient.DeleteOrderAsync(order.OrderId);
}