Thursday, February 2, 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 | Aug, 2022

learningcode_x1mckf by learningcode_x1mckf
September 5, 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 turning into a referred Medium Member or studying extra about C++ programming or AI in finance.

Photograph by Luke Chesser on Unsplash

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.

You might also like

C can be memory-safe – Security Boulevard

C++ Lambda Expressions Explained | Built In

C++ creator Bjarne Stroustrup defends its safety

Firm profile data from FMP Cloud.

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.

Inventory friends for Apple Laptop (image AAPL).

Value Quotes

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.

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

For starters, a single inventory worth 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 information for a lot of tickers without delay.

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 worth information and hourly worth information. These two calls return a LOT of knowledge so, for brevity, solely a small quantity is proven under.

Hourly inventory information, condensed model.
Minute-by-minute inventory worth information, condensed model.

Technical Indicators

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.

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

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.

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

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.

Cryptocurrency and overseas change information examples.

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.



Source link

Share30Tweet19
learningcode_x1mckf

learningcode_x1mckf

Recommended For You

C can be memory-safe – Security Boulevard

by learningcode_x1mckf
February 1, 2023
0
C can be memory-safe – Security Boulevard

The concept of memory-safe languages is within the information currently. C/C++ is known for being the world’s system language (that runs most issues) but in addition notorious for being...

Read more

C++ Lambda Expressions Explained | Built In

by learningcode_x1mckf
February 1, 2023
0
C++ Lambda Expressions Explained | Built In

One of many new options launched in trendy C++ ranging from C++ 11 is the lambda expression.It's a handy solution to outline an nameless operate object or functor....

Read more

C++ creator Bjarne Stroustrup defends its safety

by learningcode_x1mckf
January 31, 2023
0
C++ creator Bjarne Stroustrup defends its safety

The creator of C++, Bjarne Stroustrup, is defending the venerable programming language after the US Nationwide Safety Company (NSA) just lately really helpful towards utilizing it. NSA advises...

Read more

Solid Sands and Rapita target hard to do C++ code analysis … – eeNews Europe

by learningcode_x1mckf
January 30, 2023
0
Solid Sands and Rapita target hard to do C++ code analysis … – eeNews Europe

Solid Sands and Rapita target hard to do C++ code analysis ...  eeNews Europe Source link

Read more

Bjarne Stroustrup Defends C++ As Safe

by learningcode_x1mckf
January 29, 2023
0

It is not stunning to search out the creator of a language defending the language they created and so it's with the newest paper from Bjarne Stroustrup. Is...

Read more
Next Post
SwiftUI ImageRenderer: How to Create PDF Documents

SwiftUI ImageRenderer: How to Create PDF Documents

Leave a Reply Cancel reply

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

Related News

PT Matahari Department Store Tbk : Matahari Completes its Store Expansion in 2022 with Two New Stores at Mall @Bassura East Jakarta and Icon Mall Gresik, East Java

PT Matahari Department Store Tbk : Matahari Completes its Store Expansion in 2022 with Two New Stores at Mall @Bassura East Jakarta and Icon Mall Gresik, East Java

December 16, 2022
Beginners guide to functional Swift

Beginners guide to functional Swift

October 1, 2022
Visual Studio Build Tools Licensing Eased for Open Source C++ Projects — Visual Studio Magazine

Visual Studio Build Tools Licensing Eased for Open Source C++ Projects — Visual Studio Magazine

September 4, 2022

Browse by Category

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

RECENT POSTS

  • Java :Full Stack Developer – Western Cape saon_careerjunctionza_state
  • Pay What You Want for this Learn to Code JavaScript Certification Bundle
  • UPB Java Jam brings coffeehouse vibes to Taylor Down Under | Culture

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?