GithubHelp home page GithubHelp logo

stocks's Introduction

Stocks

Sample nodejs script that looksup the value of a portfolio and save portfolio value to csv file.

Getting Started

Prerequisites

The following are required to run the sample

  • git to clone the repository
  • npm + node to build, run, and test

Installing

Clone the repository

git clone https://github.com/johnB96/stocks.git

Building

From the stocks directory, run

npm install

Running

From the stock directory, run

npm run api

You should see a message similar to this

> [email protected] api /Users/johnbedalov/dev/src/stocks
> node index

Stocks file saved to: MSFT-VOO-SPCE-2020-02-21T16:30:11.065Z.csv

The file name inclues the ticker symbols and approximate time the current price was retrieved.

The results will be saved to the stocks directory.

The contents should look similar to this depending on the portfolio

Ticker,Quantity,Current Price,High,Low,Current Value
MSFT,171,$180.37,$188.18,$181.10,"$30,843.27"
VOO,218,$307.20,$311.59,$306.67,"$66,969.60"
SPCE,38,$34.97,$42.49,$28.71,"$1,328.86"
Total,,,,,"$99,141.73"

Updating Portfolio

The stock portfolio is saved to the portfolio.json file and can be changed to include different symbols and quantities; also more or less positions.

Here is an example portfolio.json

[
    {
        "Ticker": "MSFT",
        "Quantity": 171
    },
    {
        "Ticker": "VOO",
        "Quantity": 218
    },
    {
        "Ticker": "SPCE",
        "Quantity": 38
    }
]

Running Tests

To run tests with coverage, run the following

npm test

or

npm run test

stocks's People

Contributors

johnb96 avatar

Watchers

James Cloos 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.