top | item 18675280

Show HN: Stock Trading with Insomnia REST Client and Alpaca API

71 points| shift8 | 7 years ago

I've created an Insomnia workspace to make it easier to debug your stock trading code and learn the Alpaca API. You can read about how here: https://medium.com/automation-generation/using-alpacas-stock...

The actual workspace JSON for you to import into Insomnia can be found here: https://github.com/alpacahq/insomnia-workspace

36 comments

order

nodesocket|7 years ago

I've been playing with the Alpaca streaming API's in Node to get quotes. I have it working, the next step is figure out a trading algorithm.

I am a pretty traditional long term investor, $AAPL, Berkshire, Bank of America, Ford, Amazon, AMD, $SPY, with 10+ years in the market. However with the crazy volatility, I have been toying with the idea of buying ProShares UltraPro Short $SQQQ to hedge my losses on big pre-market open down days. Today for example would have been a good day to own $SQQQ for the day (up 7.3%). Any insight on how to go about this hedge strategy using Alpaca? Can I get pre-market quotes for the Nasdaq?

9712263|7 years ago

Seems inherit the same limitation of RobinHood: you can't do short selling. Not sure how actually they could do a free commission order, so not sure why short selling is not supported, but it limits the use of long only strategy.

anonu|7 years ago

Interesting. I suppose it's a much more involved process where you need to locate shares to borrow. You need to maintain a list of easy to borrow and hard to borrow names. ETFs by definition are hard to borrow.

I used to work next to the stock loan desk at a bank. The equity markets are generally pretty tech driven these days but stock loan is still operating in a 1980s mentality.

ta1234567890|7 years ago

Open question: If, for one stock, you could predict tomorrow's closing price today (with 80% accuracy within 2% of the actual price), how would you trade that stock?

kgwgk|7 years ago

It's easy to predict tomorrow's closing price with that accuracy: it will be the same as today's closing price.

For a large majority of S&P 500 stocks this prediction will be within 2% of the actual price very often (more than 80% of the days). In aggregate, the hit rate is over 80% as well.

hueving|7 years ago

How far will it move if it doesn't land within the "80% accuracy"?

18nleung|7 years ago

Try an iron condor - you’ll profit if the price of the underlying asset stays between two points

pmalynin|7 years ago

Buy call / puts (depending on the current price) near the target price, with very close expiry dates. This would maximize your convexity.

thisisit|7 years ago

The bigger question is - what happens if you get the price 20% wrong? This might look like a winning strategy in a normal and calm market. But, it'll take only one day to wipe out all the gains.

hartator|7 years ago

More than 80% of stocks will close within 2% of previous day closing price.

rpedela|7 years ago

Alpaca looks awesome, but doesn't support after hours trading. Does anyone know of a good API that does?

malhotra_chetan|7 years ago

Yes. Narwhal. Narwhal provides commission free flat rate brokerage trading via tradier and you can trade both in pre and post market hours.

hellofunk|7 years ago

How is the access to historical data with these services?

kaycebasques|7 years ago

A commission-free trading API? How does Alpaca make money?

gschier|7 years ago

Likely the same as similar services like RobinHood. A quick Google suggests they make most of their money on interest from cash sitting around in user's accounts that has not been invested yet.

brian_herman|7 years ago

They probably use the algorithms implemented on their platform to make better ones.