Giter Site home page Giter Site logo

yfinance's Introduction

YFinance

A Haskell library for querying real time stock market data

module Example where

import qualified Data.Text as T
import Network.Yahoo.Finance

getStockQuote "YHOO"

-- λ> getStockQuote "YHOO"
-- Just (StockQuote {name = "Yahoo! Inc.", symbol = "YHOO", price = "32.93", change = "-1.17",
--                   dayHigh = "34.02", dayLow = "32.91", yearHigh = "52.62", yearLow = "32.91"})

Get the current stock price for a company

Yahoo finance responses are all strings so you will need to cast the response to a double.

-- Get the current price for Google stock
fmap (toDouble . price) <$> getStockQuote "GOOGL"
-- Just 644.03

Popular stock indexes

There are some helper methods for accessing popular indexes such as the S&P500 or NASDAQ

module Example where

import Network.Yahoo.Finance

-- λ> nasdaq
-- Just (StockQuote {name = "NASDAQ-100",
--                   symbol = "^NDX",
--                   price = "4197.27",
--                   change = "-187.86",
--                   dayHigh = "4361.32",
--                   dayLow = "4197.27",
--                   yearHigh = "4694.13",
--                   yearLow = "3700.23"})

Historical Prices

This example shows how to fetch the Stock prices for GOOGL between 2014 and 2015

module Example where

import Network.Yahoo.Finance

-- λ> historical "GOOGL" "2014-01-01" "2015-01-01"

yfinance's People

Contributors

owainlewis avatar bryce-anderson avatar

Stargazers

 avatar Nate George avatar Sam Jeeves avatar Joel avatar julian.zhang avatar Shmavon Gazanchyan avatar coder (π³) avatar Jose A. Alonso avatar Alex Gaziev avatar Daniel Pous Montardit avatar Philip avatar Mark B avatar Chris A. avatar  avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

r-wheeler silky

yfinance's Issues

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.