Skip to main content

AkShare is an elegant and simple financial data interface library for Python, built for human beings!

Project description

PyPI - Python Version PyPI Downloads Documentation Status Code style: black akshare Actions Status MIT Licence code style: prettier

Overview

AkShare requires Python 3.7 or greater, aims to make fetch financial data as convenient as possible.

Write less, get more!

Installation

General

pip install akshare --upgrade

China

pip install akshare -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host=mirrors.aliyun.com  --upgrade

PR

Please check documentation if you want to contribute to AkShare

Docker

Pull images

docker pull registry.cn-hangzhou.aliyuncs.com/akshare/akdocker

Run AkDocker

docker run -it registry.cn-hangzhou.aliyuncs.com/akshare/akdocker python

Test AkDocker

import akshare as ak
ak.__version__

Usage

Data

Code

import akshare as ak
hist_df = ak.stock_us_daily(symbol="AMZN")  # Get U.S. stock Amazon's price info
print(hist_df)

Output

                 open       high      low      close     volume        amount
date                                                                         
1997-05-15    29.2500    30.0000    23.13    23.5000  6013000.0  0.000000e+00
1997-05-16    23.6300    23.7500    20.50    20.7500  1225000.0  0.000000e+00
1997-05-19    21.1300    21.2500    19.50    20.5000   508900.0  0.000000e+00
1997-05-20    20.7500    21.0000    19.63    19.6300   455600.0  0.000000e+00
1997-05-21    19.6300    19.7500    16.50    17.1300  1571100.0  0.000000e+00
               ...        ...      ...        ...        ...           ...
2020-10-14  3447.0000  3464.8799  3340.00  3363.7100  5828916.0  5.752750e+10
2020-10-15  3292.0100  3355.8799  3280.00  3338.6499  5223448.0  5.752750e+10
2020-10-16  3363.2300  3399.6599  3160.00  3272.7100  6474353.0  5.752750e+10
2020-10-19  3299.6101  3329.0000  3192.74  3207.2100  5223626.0  5.752750e+10
2020-10-20  3222.2800  3266.0000  3192.01  3217.0100  4509678.0  5.752750e+10
[5896 rows x 6 columns]

Plot

Code

import akshare as ak
import mplfinance as mpf  # Please install mplfinance

stock_us_daily_df = ak.stock_us_daily(symbol="AAPL", adjust="qfq")
stock_us_daily_df = stock_us_daily_df[["open", "high", "low", "close", "volume"]]
stock_us_daily_df.columns = ["Open", "High", "Low", "Close", "Volume"]
stock_us_daily_df.index.name = "Date"
stock_us_daily_df = stock_us_daily_df["2020-04-01": "2020-04-29"]
mpf.plot(stock_us_daily_df, type='candle', mav=(3, 6, 9), volume=True, show_nontrading=False)

Output

Communication

Pay attention to 数据科学实战 WeChat Official Accounts to get the AkShare updated info:

Application to add AkShare-官方 QQ group and talk about AkShare issues, QQ group number: 942371170

Features

  • Easy of use: Just one line code to fetch the data;
  • Extensible: Easy to customize your own code with other application;
  • Powerful: Python ecosystem.

Tutorials

  1. Overview
  2. Installation
  3. Tutorial
  4. Data Dict
  5. Subjects

Contribution

AkShare is still under developing, feel free to open issues and pull requests:

  • Report or fix bugs
  • Require or publish interface
  • Write or fix documentation
  • Add test cases

Notice: We use Black to format the code

Statement

  1. All data provided by AkShare is just for academic research purpose;

  2. The data provided by AkShare is for reference only and does not constitute any investment proposal;

  3. Any investor based on AkShare research should pay more attention to data risk;

  4. AkShare will insist on providing open-source financial data;

  5. Based on some uncontrollable factors, some data interfaces in AkShare may be removed;

  6. Please follow the relevant open-source protocol used by AkShare

Show your style

Use the badge in your project's README.md:

[![Data: akshare](https://img.shields.io/badge/Data%20Science-AkShare-green)](https://github.com/jindaxiang/akshare)

Using the badge in README.rst:

.. image:: https://img.shields.io/badge/Data%20Science-AkShare-green
    :target: https://github.com/jindaxiang/akshare

Looks like this:

Data: akshare

Citation

Please use this bibtex if you want to cite this repository in your publications:

@misc{akshare,
    author = {Albert King},
    title = {AkShare},
    year = {2019},
    publisher = {GitHub},
    journal = {GitHub repository},
    howpublished = {\url{https://github.com/jindaxiang/akshare}},
}

Acknowledgement

Special thanks FuShare for the opportunity of learning from the project;

Special thanks TuShare for the opportunity of learning from the project;

Thanks for the data provided by 生意社网站;

Thanks for the data provided by 奇货可查网站;

Thanks for the data provided by 智道智科网站;

Thanks for the data provided by 中国银行间市场交易商协会网站;

Thanks for the data provided by 99期货网站;

Thanks for the data provided by 英为财情网站;

Thanks for the data provided by 中国外汇交易中心暨全国银行间同业拆借中心网站;

Thanks for the data provided by 金十数据网站;

Thanks for the data provided by 交易法门网站;

Thanks for the data provided by 和讯财经网站;

Thanks for the data provided by 新浪财经网站;

Thanks for the data provided by Oxford-Man Institute 网站;

Thanks for the data provided by DACHENG-XIU 网站;

Thanks for the data provided by 上海证券交易所网站;

Thanks for the data provided by 深证证券交易所网站;

Thanks for the data provided by 中国金融期货交易所网站;

Thanks for the data provided by 上海期货交易所网站;

Thanks for the data provided by 大连商品交易所网站;

Thanks for the data provided by 郑州商品交易所网站;

Thanks for the data provided by 上海国际能源交易中心网站;

Thanks for the data provided by Timeanddate 网站;

Thanks for the data provided by 河北省空气质量预报信息发布系统网站;

Thanks for the data provided by 南华期货网站;

Thanks for the data provided by Economic Policy Uncertainty 网站;

Thanks for the data provided by 微博指数网站;

Thanks for the data provided by 百度指数网站;

Thanks for the data provided by 谷歌指数网站;

Thanks for the data provided by 申万指数网站;

Thanks for the data provided by 真气网网站;

Thanks for the data provided by 财富网站;

Thanks for the data provided by 中国证券投资基金业协会网站;

Thanks for the data provided by 猫眼电影网站;

Thanks for the data provided by Expatistan 网站;

Thanks for the data provided by 北京市碳排放权电子交易平台网站;

Thanks for the data provided by 国家金融与发展实验室网站;

Thanks for the data provided by IT桔子网站;

Thanks for the data provided by 东方财富网站;

Thanks for the data provided by 义乌小商品指数网站;

Thanks for the data provided by 中国国家发展和改革委员会网站;

Thanks for the data provided by 163网站;

Thanks for the data provided by 丁香园网站;

Thanks for the data provided by 百度新型肺炎网站;

Thanks for the data provided by 百度迁徙网站;

Thanks for the data provided by 新型肺炎-相同行程查询工具网站;

Thanks for the data provided by 新型肺炎-小区查询网站;

Thanks for the data provided by 商业特许经营信息管理网站;

Thanks for the data provided by 慈善中国网站;

Thanks for the data provided by 思知网站;

Thanks for the data provided by Currencyscoop网站;

Thanks for the data provided by 新加坡交易所网站;

Thanks for the data provided by 中国期货市场监控中心;

Thanks for the data provided by 宽客在线;

Thanks for the tutorials provided by 微信公众号: Python大咖谈.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

akshare-0.6.95.tar.gz (379.1 kB view details)

Uploaded Source

Built Distribution

akshare-0.6.95-py3-none-any.whl (468.1 kB view details)

Uploaded Python 3

File details

Details for the file akshare-0.6.95.tar.gz.

File metadata

  • Download URL: akshare-0.6.95.tar.gz
  • Upload date:
  • Size: 379.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for akshare-0.6.95.tar.gz
Algorithm Hash digest
SHA256 fb52d94a5f533b57df66bc1bb68e0ba057d154518b39562d271492cb63c88b95
MD5 2d476f9f77f821ae8a17b2c60e29496d
BLAKE2b-256 ddae643018aec4a7dff559917f3595c672fe20b901a08f7a49a3d1d3e00a7963

See more details on using hashes here.

File details

Details for the file akshare-0.6.95-py3-none-any.whl.

File metadata

  • Download URL: akshare-0.6.95-py3-none-any.whl
  • Upload date:
  • Size: 468.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for akshare-0.6.95-py3-none-any.whl
Algorithm Hash digest
SHA256 80da1b91045078f4e357c7a7b517c8c867d899c3128f3194a130bbf50cb7d60f
MD5 2e3fafd5c30dc6a191905cba227e2a3b
BLAKE2b-256 65a8af99f7f11d2309c3b7110c81c649e8b509fc4b1adc29bdc7503e217b6faa

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page