Code Monkey home page Code Monkey logo

yfinance-async-downloader's Introduction

yfinance-async-downloader: Faster stock market queries

The yfinance module by ranarrousi was slow for large stock market queries, and would usually be the larget time requirement in programs. yfinance-async-downloader solves that problem by working on similar grounds to yfinance, but getting the data cocurrently with asyncio in python.

Quick Start

For most purposes, the download module will suffice. The download module lacks some of the more niche functionality of yfinance such as financials, quarterly financial, major holders etc, since those have to be scraped. It only provides the dividends, splits, and history per stock (if it can be found).

data = download(['AAPL', 'MSFT', 'AMZN], datetime.datetime(2020,1,1), datetime.datetime.today(), '1d')
history_data = data['History']
dividend_data = data['Dividends']
split_data = data['Splits']

history_data['AAPL']
# data for AAPL history

dividend_data['MSFT']
# data for MSFT dividends

split_data['AMZN']
# data for AMZN splits

Speed

All information as of November 5 2020

Speed is tested against yfinance's download function, which uses threading for the most fair comparision. Speed will be measured using time.perf_counter(). Will be conducted in four tests. One stock (AAPL), a list of the 30 largest stocks, the S&P 500 component stocks, and the Russell 2000 index. Tests will be conducted on a computer running the latest version of Windows 10 with a i7 7700k.

1 Stock

Time taken to download data for AAPL from November 4 2019 to November 4 2020, rounded to two decimal places

yfinance:

0.42 seconds

async-downloader:

0.40 seconds

30 Stocks

Time taken to download the largest 10 stocks by market cap over the same period

yfinance:

1.15 seconds

async-downloader:

0.57 seconds

500 Stocks

Time taken to download the entire S&P 500 over the same period

yfinance:

13.82 seconds

async-downloader:

8.69 seconds

Russell 2000

Time taken to download 2000 stocks over the same period

yfinance:

263.23 seconds

async-downloader:

15.03 seconds

yfinance-async-downloader's People

Contributors

skunnavakkam 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.