All Projects → SimFin → Simfin

SimFin / Simfin

Licence: other
Simple financial data for Python

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Simfin

IEX CPP API
Unofficial C++ Lib for the IEXtrading API
Stars: ✭ 34 (-79.01%)
Mutual labels:  finance, financial-data
Akshare
AKShare is an elegant and simple financial data interface library for Python, built for human beings! 开源财经数据接口库
Stars: ✭ 4,334 (+2575.31%)
Mutual labels:  finance, financial-data
FinanceKit
FinanceKit is a Framework for iOS and Mac to build apps working with financial data, like money, currencies, stocks, portfolio, transactions and other concepts.
Stars: ✭ 15 (-90.74%)
Mutual labels:  finance, financial-data
dados-financeiros
Repositório de Fontes de Dados Financeiros do Brasil
Stars: ✭ 119 (-26.54%)
Mutual labels:  finance, financial-data
Awesome Quant
A curated list of insanely awesome libraries, packages and resources for Quants (Quantitative Finance)
Stars: ✭ 8,205 (+4964.81%)
Mutual labels:  finance, financial-data
okama
Investment portfolio and stocks analyzing tools for Python with free historical data
Stars: ✭ 87 (-46.3%)
Mutual labels:  finance, financial-data
Flutter Candlesticks
Elegant OHLC Candlestick and Trade Volume charts for @Flutter
Stars: ✭ 318 (+96.3%)
Mutual labels:  finance, financial-data
pytickersymbols
Fundamental stock data and yahoo/google ticker symbols for several indices.
Stars: ✭ 69 (-57.41%)
Mutual labels:  finance, financial-data
Tda Api
A TD Ameritrade API client for Python. Includes historical data for equities and ETFs, options chains, streaming order book data, complex order construction, and more.
Stars: ✭ 608 (+275.31%)
Mutual labels:  finance, financial-data
Go Finance
⚠️ Deprecrated in favor of https://github.com/piquette/finance-go
Stars: ✭ 536 (+230.86%)
Mutual labels:  finance, financial-data
TraderBot
No description or website provided.
Stars: ✭ 39 (-75.93%)
Mutual labels:  finance, financial-data
Algobot
A C++ stock market algorithmic trading bot
Stars: ✭ 78 (-51.85%)
Mutual labels:  finance, financial-data
akshare
AKShare is an elegant and simple financial data interface library for Python, built for human beings! 开源财经数据接口库
Stars: ✭ 5,155 (+3082.1%)
Mutual labels:  finance, financial-data
Sec Edgar Downloader
Download SEC filings from the EDGAR database using Python
Stars: ✭ 146 (-9.88%)
Mutual labels:  finance, financial-data
Stocksera
Web application that provides alternative data to retail investors
Stars: ✭ 426 (+162.96%)
Mutual labels:  finance, financial-data
Alpha vantage
A python wrapper for Alpha Vantage API for financial data.
Stars: ✭ 3,553 (+2093.21%)
Mutual labels:  finance, financial-data
fhub
Python client for Finnhub API
Stars: ✭ 31 (-80.86%)
Mutual labels:  finance, financial-data
rb3
A bunch of downloaders and parsers for data delivered from B3
Stars: ✭ 52 (-67.9%)
Mutual labels:  finance, financial-data
Finance Go
📊 Financial markets data library implemented in go.
Stars: ✭ 392 (+141.98%)
Mutual labels:  finance, financial-data
Contractmanager
ContractManager is a contract management software for the Jameica platform.
Stars: ✭ 10 (-93.83%)
Mutual labels:  finance, financial-data

docs downloads

SimFin - Simple financial data for Python

SimFin makes it easy to obtain and use financial and stock-market data in Python. It automatically downloads share-prices and fundamental data from the SimFin server, saves the data to disk for future use, and loads the data into Pandas DataFrames.

Installation

pip install simfin

More detailed installation instructions can be found below.

Example

Once the simfin package has been installed, the following Python program will automatically download all Income Statements for US companies, and print the Revenue and Net Income for Microsoft.

import simfin as sf
from simfin.names import *

# Set your API-key for downloading data.
# If the API-key is 'free' then you will get the free data,
# otherwise you will get the data you have paid for.
# See www.simfin.com for what data is free and how to buy more.
sf.set_api_key('free')

# Set the local directory where data-files are stored.
# The dir will be created if it does not already exist.
sf.set_data_dir('~/simfin_data/')

# Load the annual Income Statements for all companies in USA.
# The data is automatically downloaded if you don't have it already.
df = sf.load_income(variant='annual', market='us')

# Print all Revenue and Net Income for Microsoft (ticker MSFT).
print(df.loc['MSFT', [REVENUE, NET_INCOME]])

This produces the following output:

                  Revenue   Net Income
Report Date
2008-06-30   6.042000e+10  17681000000
2009-06-30   5.843700e+10  14569000000
2010-06-30   6.248400e+10  18760000000
2011-06-30   6.994300e+10  23150000000
2012-06-30   7.372300e+10  16978000000
2013-06-30   7.784900e+10  21863000000
2014-06-30   8.683300e+10  22074000000
2015-06-30   9.358000e+10  12193000000
2016-06-30   9.115400e+10  20539000000
2017-06-30   9.657100e+10  25489000000
2018-06-30   1.103600e+11  16571000000
2019-06-30   1.258430e+11  39240000000

We can also load the daily share-prices and plot the closing share-price for Microsoft (ticker MSFT):

# Load daily share-prices for all companies in USA.
# The data is automatically downloaded if you don't have it already.
df_prices = sf.load_shareprices(market='us', variant='daily')

# Plot the closing share-prices for ticker MSFT.
df_prices.loc['MSFT', CLOSE].plot(grid=True, figsize=(20,10), title='MSFT Close')

This produces the following image:

Share-price for MSFT

Documentation

Installation (Detailed Instructions)

The best way to install simfin and use it in your own project, is to use a virtual environment. You write the following in a Linux terminal:

virtualenv simfin-env

You can also use Anaconda instead of a virtualenv:

conda create --name simfin-env python=3

Then you can install the simfin package inside that virtual environment:

source activate simfin-env
pip install simfin

If the last command fails, or if you want to install the latest development version from this GitHub repository, then you can run the following instead:

pip install git+https://github.com/simfin/simfin.git

Now try and put the above example in a file called test.py and run:

python test.py

When you are done working on the project you can deactivate the virtualenv:

source deactivate

Development

If you want to modify your own version of the simfin package, then you should clone the GitHub repository to your local disk, using this command in a terminal:

git clone https://github.com/simfin/simfin.git

This will create a directory named simfin on your disk. Then you need to create a new virtual environment, where you install your local copy of the simfin package using these commands:

conda create --name simfin-dev python=3
source activate simfin-dev
cd simfin
pip install --editable .

You should now be able to edit the files inside the simfin directory and use them whenever you have a Python module that imports the simfin package, while you have the virtual environment simfin-dev active.

Testing

Two kinds of tests are provided with the simfin package:

Unit Tests

Unit-tests ensure the various functions of the simfin package can run without raising exceptions. The unit-tests generally do not test whether the data is valid. These tests are mainly used by developers when they make changes to the simfin package.

The unit-tests are run with the following commands from the root directory of the simfin package:

source activate simfin-env
pytest

Data Tests

Data-tests ensure the bulk-data downloaded from the SimFin servers is valid. These tests are mainly used by SimFin's database admin to ensure the data is always valid, but the end-user may also run these tests to ensure the downloaded data is valid.

First you need to install nbval, which enables support for Jupyter Notebooks in the pytest framework. This is not automatically installed with the simfin package, so as to keep the number of dependencies minimal for normal users of simfin. To install nbval run the following commands:

source activate simfin-env
pip install nbval

Then you can run the following commands from the root directory of the simfin package to execute both the unit-tests and data-tests:

pytest --nbval-lax

The following command only runs the data-tests:

pytest --nbval-lax -v tests/test_bulk_data.ipynb

More Tests

The tutorials provide more realistic use-cases of the simfin package, and they can also be run and tested automatically using pytest. See the tutorials' README for details.

Credits

The database is created by SimFin. The Python API and download system was originally designed and implemented by Hvass Labs. Further development of the Python API by SimFin and the community.

License (MIT)

This is published under the MIT License which allows very broad use for both academic and commercial purposes.

You are very welcome to modify and use this source-code in your own project. Please keep a link to the original repository.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].