When investing within the inventory market good information sources are paramount. Whether or not your funding choices are primarily based on basic evaluation, technical evaluation, or a mix of the 2, it may be difficult to seek out the requisite information. Luckily for me, after I was constructing my inventory market analysis web site, ntrinsically.com, I came upon a wealthy (and inexpensive) information supply that offered each basic and technical information, FMP Cloud. With a free tier that offers plenty of monthly requests for the average user and a starter tier offering unlimited requests for only $14/month, in my thoughts, entry to this API was important.
One drawback with any API when constructing computational instruments is definitely and effectively accessing the information. In my case, I’ve many upcoming finance-focused initiatives utilizing C++ and thought it could be extraordinarily helpful to have entry to FMP Cloud’s API endpoints so I’ve constructed a wrapper across the API that abstracts entry to its endpoints and returns RapidJSON Document objects. I’ve written earlier than about building API wrappers in Python and parsing JSON data in C++ using RapidJSON, readers desirous about both of those subjects are inspired to learn these weblog posts for extra data.
On this publish, I’ll introduce FMPCloudAPI, a C++ header-only wrapper across the FMP Cloud API. Fairly than exhibiting how the wrapper was constructed (which was fairly tedious) I’ll present instance utilization in C++. Extra instance utilization could be discovered within the check and instance directories on the challenge’s GitHub repository. The wrapper implements virtually each endpoint within the API so the API documentation is an effective place to begin to see precisely what information is accessible.
For starters, anybody wanting to make use of the API wrapper will want an API key. These are offered by FMP Cloud. Readers desirous about attempting out the API can join the free tier and get 250 requests monthly. I don’t imagine any of the endpoints are hidden behind a paywall so any API key, free or in any other case, ought to have full entry to the API performance.
As many of the methodology names within the wrapper class’ header file are self-documenting, under I share the category methodology declarations. As seen on this code snippet there may be a whole lot of information accessible within the API which, once more, is extra simply seen in FMP Cloud’s documentation.
That is most likely not the easiest way to show this data however with a lot information accessible this publish could be an hour lengthy simply describing what every endpoint does. As an alternative, I’ll soar proper into some examples that show some key endpoints (word that the examples under are simply what I discover most helpful within the API, every consumer will discover various quantities of utility from these endpoints).
Earlier than utilizing the API wrapper, cURL will need to be installed on your system of choice (I’m utilizing Debian Linux). Moreover, RapidJSON is a header-only C++ JSON parsing library so that will need to be downloaded from their GitHub as effectively. RapidJSON may also be put in by way of CMake in the event you want to make use of the dependency that approach, don’t neglect to incorporate the linker flag when compiling your code in the event you take that route.
The supply code for these examples could be discovered in the project’s GitHub repository beneath the examples listing.
Primary Firm Data
The primary instance will fetch firm profile and inventory peer data.
The corporate profile returns essential details about the corporate such because the title, an outline of the corporate, its web site’s URL, the CEO, the sector it belongs to, and many others.
The following API name fetches the friends for a specific firm offered the inventory’s ticker image. An organization’s friends are different corporations which can be deemed to be most associated to the corporate.
No inventory market information API could be full with out fundamental worth quote data. FMP Cloud presents many endpoints to fetch inventory pricing data together with present quotes, historic worth information, and batch end-of-day pricing information. A few of this performance is demonstrated on this instance.
For starters, a single inventory worth quote is fetched for Intel Company (INTC) ensuing within the following JSON.
Subsequent, a vector of ticker symbols is offered to the identical perform name to fetch quote information for a lot of tickers without delay.
The ultimate two examples fetch historic minute-by-minute worth information and hourly worth information. These two calls return a LOT of knowledge so, for brevity, solely a small quantity is proven under.
Different helpful buying and selling methods are created with technical indicators corresponding to varied transferring averages, RSI, and commonplace deviation. This data is definitely retrieved from the API. The indications accessible are SMA, EMA, WMA, DEMA, TEMA, WILLIAMS, RSI, ADX, and STDDEV. The instance under demonstrates fetching this information.
As with the historic information above, a whole lot of information is returned from the API for these technical indicator calls so a small snippet of the information is proven under.
Monetary Statements and SEC Paperwork
For my part, among the most helpful data from FMP Cloud is the monetary assertion information. These endpoints return information from the revenue, money move, and stability sheet statements which is important for basic evaluation. Since a lot information is returned by way of these API calls, solely the code used to fetch the information is proven under.
Foreign exchange and Crypto
Lastly, FMP Cloud presents restricted overseas change and cryptocurrency information. This information consists of present and historic worth quotes for the foreign money exchanges.
Once more, for brevity’s sake, the output from these calls will not be included on this publish. readers are invited to run the examples within the GitHub repository with the provided Makefile, or, higher but, to develop functions of their very own utilizing the API wrapper.
In conclusion, the FMP Cloud API is a superb and inexpensive useful resource for any sort of inventory market investing. The aim of this weblog publish was to introduce a C++ header-only wrapper across the API which makes the performance far more accessible to C++ builders. The wrapper is dependent upon the cURL and RapidJSON libraries. This publish offered some instance utilization of the API wrapper however the demonstrations barely scratch the floor of what’s accessible from FMP Cloud and, thusly, from this API wrapper.