r/backtickbot • • Mar 09 '21

https://np.reddit.com/r/wallstreetbets/comments/m0kf6k/i_programmed_my_leds_to_change_colours_depending/gqb30zw/

I didn't realize that to have recent data it cost money

The URL I used was for the price target - not the current price, so it hasn't been updated in some time. If you want the current price, you can check the quote: https://finnhub.io/api/v1/quote?symbol=AAPL&token=sandbox_aaaaaaaaaa which returns the following:

{
  "c":116.36,
  "h":121,
  "l":116.21,
  "o":120.93,
  "pc":121.42,
  "t":1615248000
}

According to the documentation, c is the current price, h is the high price (of the day), l is the low price (of the day), o is the open price, pc is the previous close, and t is not documented - I assume it's a timestamp.

You can also use websockets or webhooks to get live data, where calling the /quote/ url is limited by the 60 checks/minute rate limit.

Also this all looks like it's python ...

The examples I linked are in Python, but the documentation includes a few other versions. They're HTTP "GET" requests, so basically it applies to any language. The returned data is in JSON, which is just a string of data formatted a certain way.

You can make HTTP GET requests in C, here is an example using libcurl.

0 Upvotes

0 comments sorted by