Ask HN: What stock trading API do you use or recommend?

25 points by codegeek ↗ HN
I am thinking of playing with stocks (small amounts just for fun). But I do want to do real money. What are some of the stock trading APIs that folks here at HN recommend ? Ideally I would create an application that can place orders for the stocks that are pre-selected and mostly do buy/sell. I guess the idea is that I want to play with my own custom algorithm for fun to see if I can make some money through my stocks using some type of automated way (not talking about HFT or anything too serious).

12 comments

[ 0.29 ms ] story [ 45.3 ms ] thread
TD Ameritrade has a decent API, if you ask them nicely.
Robinhood has a reverse engineered API. You could probably use that for trading, though I'm not sure.

Interactive Brokers has an advanced API as well.

For data, IEX serves free stock api that supports websockets

https://iextrading.com/developer/

To research and backtest strategies, check out the Quantopian community. You can perform your analysis right in an IPython Notebook and share it with really smart people.

https://www.quantopian.com/notebooks/survey

Will Robinhood ever release an "official" API for commission-free algo trading? They may have their hands full with all the inexperienced options traders getting their first margin calls last week. In the meantime there's plenty of room for competition:

Alpaca | Algo Trading Commission Free With REST API

https://alpaca.markets/

Best of luck and research your risks before using real money ;)

Interactive Brokers is very good. It has the benefit of having a very good python interface and a decent R interface. If Python or R is your analytics engine, IB can be a great choice.
I've always wanted to use IB, but once I saw that I couldn't use special characters in my password on signup, I decided it was a no-go, haha.
Never realized that ... very strange! But, I have very little confidence in passwords these days. I prefer 2FA much more. Thankfully .. in India .. most things of value need a second authentication via an SMS OTP code
(comment deleted)
I'm currently using MetaTrader software[1] and their language MQL ( MetaQuotes Language ), which is basically C++ with some trading functions/libraries.

Most of my code is written in Python, so I only use the C++ part to place orders. Everything else is done with Python.

The 2 main advantages that I see with MetaTrader is that:

- I can change brokers without having to rewrite anything or learn a new API. I just need to enter the server + login information in MetaTrader. At least in my country, almost all brokers have MetaTrader support.

- I can run and store the code locally. If you use something like quantopian.com, the code is run and stored in their servers. This brings a series of limitations like outdated/missing libraries or slow backtesting since they have to limit CPU/memory resources.

[1] https://www.metatrader5.com/

Hey - can you email me please (in my profile)
I'm using Tradier and like it. But I use it more for stock data than actual trading. It is free if you open an account and fund it. https://brokerage.tradier.com/

For trading I prefer https://www.motifinvesting.com/ which lets me name a given strategy, purchase up to 30 stocks, and they will track returns. It is manual, not API driven but the returns tracking and public track record is worth it for me.