Alpaca - Automated Trading with C#
Mar 3, 2020
Alpaca is a relatively new broker that is designed for people that want to create automated trading strategies. They offer a REST API that allows you to manage trades and pull data from Polygon.io for free if you have a live brokerage account. They also offer a paper trading API for free that uses IEX for data. If you decide to play around with it, I highly recommend opening a brokerage account so you get free data and can test everything more accurately. There are no commissions or inactivity fees. I am not being paid or sponsored in any way to write this post.
I signed up last year to try out their APIs but I never did anything with it, until now. They didn’t even have a way to place trades or close positions through the web interface when I first signed up - at least that’s what I remember.
I wrote a C# application that places trades on symbols you specify with a simple rule to buy at the low of the 9:00 AM hourly candle if it closes down. It holds forever until the position is up by half the hourly Average True Range (ATR). This is mostly for demonstration purposes, but I do plan to run this live in the near future buying 1 share at a time and scalping a few pennies.