Wednesday, 1 May 2019

Infrastructure Question for 6k updates per minute

I'm building a stock market app where the idea is alerts trigger every time there's a significant rise/drop in percentage price (say, a stock goes up 3% in a minute, or down 7% in 5 minutes). The idea is to have a chart that contains the active price for all stock symbols following by the most recent 1, 2, 3, 4, 5, 10, 15, 30, 60 minutes prices. Some quick math will calculate the % change between these times and the present, then if a condition is met trigger an email or text notification.You probably can sense the difficult part by now. There are 6,000 stocks listed on the NYSE & NASDAQ. Since prices for each change minute by minute one needs to fetch and write all these values to the DB. I am using the IEX API to bulk fetch and Postgres as a DB. It's not fast enough to write all these values. Not only that, but as the value changes every minute, I want to move each value down the chain (i.e. when a new present time is fetched move the previous present time to 1 minute ago, move the previous 1 minute ago to 2 minutes ago, etc.). Bulk fetch will give current prices for a number of stocks, but if I need to query previous price points in the day, the only way I'm aware to do that is with individual requests, which takes a good deal of time.Can someone suggest the best tools to tackle this issue? I'm not as experienced with Redis or MongoDB but I'm under the impression this massive writes in a short amount of time are what these NoSQL databases excel in.Any comments / suggestions are appreciated.

Submitted May 02, 2019 at 02:44AM by empireofryan

No comments:

Post a Comment