GithubHelp home page GithubHelp logo

andrewjbateman / ionic-angular-stock-data Goto Github PK

View Code? Open in Web Editor NEW
9.0 3.0 2.0 2.04 MB

:clipboard: Ionic app to chart historic stock prices from a financial data API. Take care if updating to ng16 or ng17 as chart.js and ng2-charts not Ivy compatible.

License: MIT License

JavaScript 8.86% TypeScript 59.50% HTML 13.50% SCSS 18.14%
api-rest financial-data tutorial-code ionic ng2-charts stock-price angular ionic6 angular15

ionic-angular-stock-data's Introduction

โšก Ionic Angular Charts

GitHub repo size GitHub pull requests GitHub Repo stars GitHub last commit

๐Ÿ“„ Table of contents

๐Ÿ“š General info

  • Tutorial code changed to show example financial data on initialisation and clear the stock entry field (TSLA is shown) as I preferred this to initially seeing an empty graph.
  • Tutorial code changed to avoid use of string literals - const history = res['historical']; caused a typescript error.
  • Note: I had to reverse both x and y array values (date & stock price) so data would not display backwards.
  • Important note on versions: This only works with ng2-charts v2.4.2, chart.js v2.9.4 and chartjs-plugin-zoom v0.7.7. Updating to the latest versions of these chart-based dependencies will mean this app does NOT work without major reconfiguration.
  • FMP financial data API free plan limited to 250 requests a day.

๐Ÿ“ท Screenshots

screenshot

๐Ÿ“ถ Technologies

๐Ÿ’พ Setup

  • Install dependencies using npm i
  • API key: sign up with FMP financial data API to get an API key.
  • Add API key to environments files
  • To start the server on localhost://8100 type: 'ionic serve -o'
  • Run npm run build to build the project. The build artifacts will be stored in the dist/ directory.

๐Ÿ’ป Code Examples

  • function to get data from API. Only stock variable is defined by user.
getData() {
  this.http
    .get(`
      https://financialmodelingprep.com/api/v3/historical-price-full/
      ${this.stock}?to=2022-02-02&from=2017-02-02`).subscribe(res => {
        const history = res['historical'];

        this.chartLabels = [];
        this.chartData[0].data = [];

        for (const entry of history) {
          this.chartLabels.push(entry.date);
          this.chartData[0].data.push(entry.close);
        }
      });
}

๐Ÿ†’ Features

  • ng2-charts has 10 types of charts: line, bar, doughnut, radar, pie, polarArea, bubble, scatter, dynamic & financial. In this app the user can choose between line (default) and bar charts.

๐Ÿ“‹ Status & To-do list

  • Status: Working
  • To-do: Nothing

๐Ÿ‘ Inspiration

๐Ÿ“ License

  • This project is licensed under the terms of the MIT license.

โœ‰๏ธ Contact

ionic-angular-stock-data's People

Contributors

andrewjbateman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.