Friday, March 24, 2023
Learning Code
  • Home
  • JavaScript
  • Java
  • Python
  • Swift
  • C++
  • C#
No Result
View All Result
  • Home
  • JavaScript
  • Java
  • Python
  • Swift
  • C++
  • C#
No Result
View All Result
Learning Code
No Result
View All Result
Home C++

Fetching Fundamental and Technical Stock Data in C++ | by Anthony Morast

learningcode_x1mckf by learningcode_x1mckf
October 20, 2022
in C++
0
Fetching Fundamental and Technical Stock Data in C++ | by Anthony Morast | Aug, 2022
74
SHARES
1.2k
VIEWS
Share on FacebookShare on Twitter


Assist my content material by changing into a referred Medium Member or studying extra about C++ programming or AI in finance.

Picture by Luke Chesser on Unsplash

When investing within the inventory market good knowledge sources are paramount. Whether or not your funding choices are based mostly on elementary evaluation, technical evaluation, or a mixture of the 2, it may be difficult to seek out the requisite knowledge. Luckily for me, after I was constructing my inventory market analysis web site, ntrinsically.com, I discovered a wealthy (and reasonably priced) knowledge supply that offered each elementary and technical knowledge, 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 tasks 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 considering both of those matters are inspired to learn these weblog posts for extra info.

On this submit, I’ll introduce FMPCloudAPI, a C++ header-only wrapper across the FMP Cloud API. Slightly than displaying how the wrapper was constructed (which was fairly tedious) I’ll present instance utilization in C++. Extra instance utilization will be discovered within the take a look at and instance directories on the mission’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 knowledge is offered.

For starters, anybody wanting to make use of the API wrapper will want an API key. These are offered by FMP Cloud. Readers considering making an attempt out the API can join the free tier and get 250 requests monthly. I don’t consider 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 variety of knowledge accessible within the API which, once more, is extra simply seen in FMP Cloud’s documentation.

That is most likely not one of the simplest ways to show this info however with a lot knowledge accessible this submit could be an hour lengthy simply describing what every endpoint does. As a substitute, I’ll leap proper into some examples that exhibit some key endpoints (observe 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 through CMake in the event you choose to make use of the dependency that means, don’t overlook to incorporate the linker flag when compiling your code in the event you take that route.

The supply code for these examples will be discovered in the project’s GitHub repository underneath the examples listing.

Fundamental Firm Info

The primary instance will fetch firm profile and inventory peer info.

The corporate profile returns necessary 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.

You might also like

US NSA tells developers to shun C and C++ programming language – The Siasat Daily

Introducing Carbon, Google's Experimental Successor for C++ – MUO – MakeUseOf

C vs. C++: 12 Key Differences and Similarities – Spiceworks News and Insights

Firm profile info from FMP Cloud.

The subsequent API name fetches the friends for a specific firm offered the inventory’s ticker image. An organization’s friends are different firms which can be deemed to be most associated to the corporate.

Inventory friends for Apple Laptop (image AAPL).

Value Quotes

No inventory market knowledge API could be full with out fundamental value quote info. FMP Cloud provides many endpoints to fetch inventory pricing info together with present quotes, historic value knowledge, and batch end-of-day pricing knowledge. A few of this performance is demonstrated on this instance.

Fetching inventory value quotes for a ticker and a batch of tickers in addition to hourly and minutely historic knowledge.

For starters, a single inventory value quote is fetched for Intel Company (INTC) ensuing within the following JSON.

Inventory quote for INTC.

Subsequent, a vector of ticker symbols is offered to the identical perform name to fetch quote knowledge for a lot of tickers directly.

A batch of inventory quotes for ticker symbols: INTC, AAPL, QCOM, PARA, BABA, AMD, TSLA, WMT, and WM.

The ultimate two examples fetch historic minute-by-minute value knowledge and hourly value knowledge. These two calls return a LOT of information so, for brevity, solely a small quantity is proven under.

Hourly inventory knowledge, condensed model.
Minute-by-minute inventory value knowledge, condensed model.

Technical Indicators

Different helpful buying and selling methods are created with technical indicators equivalent to varied transferring averages, RSI, and commonplace deviation. This info is definitely retrieved from the API. The symptoms accessible are SMA, EMA, WMA, DEMA, TEMA, WILLIAMS, RSI, ADX, and STDDEV. The instance under demonstrates fetching this knowledge.

As with the historic knowledge above, a variety of knowledge is returned from the API for these technical indicator calls so a small snippet of the information is proven under.

A ten-period exponential transferring common (EMA) for Fastly (FSLY).
A snippet of information returned when querying for a 5-period easy transferring common (SMA) for Pinterest (PINS).

Monetary Statements and SEC Paperwork

In my view, a few of the most helpful info from FMP Cloud is the monetary assertion knowledge. These endpoints return knowledge from the revenue, money circulation, and steadiness sheet statements which is crucial for elementary evaluation. Since a lot knowledge is returned through these API calls, solely the code used to fetch the information is proven under.

The logic used to fetch monetary statements and SEC submitting knowledge.

Foreign exchange and Crypto

Lastly, FMP Cloud provides restricted international alternate and cryptocurrency knowledge. This knowledge consists of present and historic value quotes for the foreign money exchanges.

Cryptocurrency and international alternate knowledge examples.

Once more, for brevity’s sake, the output from these calls will not be included on this submit. readers are invited to run the examples within the GitHub repository with the provided Makefile, or, higher but, to develop purposes of their very own utilizing the API wrapper.

In conclusion, the FMP Cloud API is a wonderful and reasonably priced useful resource for any sort of inventory market investing. The aim of this weblog submit was to introduce a C++ header-only wrapper across the API which makes the performance rather more accessible to C++ builders. The wrapper depends upon the cURL and RapidJSON libraries. This submit 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.



Source link

Share30Tweet19
learningcode_x1mckf

learningcode_x1mckf

Recommended For You

US NSA tells developers to shun C and C++ programming language – The Siasat Daily

by learningcode_x1mckf
March 22, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

US NSA tells developers to shun C and C++ programming language  The Siasat Day by day Source link

Read more

Introducing Carbon, Google's Experimental Successor for C++ – MUO – MakeUseOf

by learningcode_x1mckf
March 22, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

Introducing Carbon, Google's Experimental Successor for C++  MUO - MakeUseOf Source link

Read more

C vs. C++: 12 Key Differences and Similarities – Spiceworks News and Insights

by learningcode_x1mckf
March 21, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

C vs. C++: 12 Key Differences and Similarities  Spiceworks Information and Insights Source link

Read more

I want to learn C++ Directx9 – Graphics and GPU Programming – GameDev.net

by learningcode_x1mckf
March 20, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

I want to learn C++ Directx9 - Graphics and GPU Programming  GameDev.web Source link

Read more

Is Java Losing Ground to C++, Python? – Dice Insights

by learningcode_x1mckf
March 20, 2023
0
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

Is Java Losing Ground to C++, Python?  Cube Insights Source link

Read more
Next Post
Cloudflare previews workerd, an open source JavaScript/Wasm runtime for “nanoservices” • DEVCLASS

Cloudflare previews workerd, an open source JavaScript/Wasm runtime for 'nanoservices' • DEVCLASS

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Related News

Oracle Sets Foundation for the Language’s Future in Java 19

Oracle Sets Foundation for the Language’s Future in Java 19

October 11, 2022
Swift visitor design pattern – The.Swift.Dev.

Swift visitor design pattern – The.Swift.Dev.

September 6, 2022
Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

Java class data sharing upgrade would boost startup times – InfoWorld

February 13, 2023

Browse by Category

  • C#
  • C++
  • Java
  • JavaScript
  • Python
  • Swift

RECENT POSTS

  • Java Developer Survey Reveals Increased Need for Java … – PR Newswire
  • What You Should Definitely Pay Attention to When Hiring Java Developers – Modern Diplomacy
  • Java Web Frameworks Software Market Research Report 2023 … – Los Alamos Monitor

CATEGORIES

  • C#
  • C++
  • Java
  • JavaScript
  • Python
  • Swift

© 2022 Copyright Learning Code

No Result
View All Result
  • Home
  • JavaScript
  • Java
  • Python
  • Swift
  • C++
  • C#

© 2022 Copyright Learning Code

Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?