googlefinance.client
====================
googlefinance.client is a python client library for google finance api
Installation
------------
::
$ pip install googlefinance.client
Usage
-----
.. code:: python
from googlefinance.client import get_price_data, get_closing_data, get_open_close_data
# Dow Jones
param = {
'q': ".DJI", # Stock symbol (ex: "AAPL")
'i': "86400", # Interval size in seconds ("86400" = 1 day intervals)
'x': "INDEXDJX", # Stock exchange symbol on which stock is traded (ex: "NASD")
'p': "1Y" # Period (Ex: "1Y" = 1 year)
}
# get price data (return pandas dataframe)
df = get_price_data(param)
print(df)
# Open High Low Close Volume
# 2016-05-17 05:00:00 17531.76 17755.8 17531.76 17710.71 88436105
# 2016-05-18 05:00:00 17701.46 17701.46 17469.92 17529.98 103253947
# 2016-05-19 05:00:00 17501.28 17636.22 17418.21 17526.62 79038923
# 2016-05-20 05:00:00 17514.16 17514.16 17331.07 17435.4 95531058
# 2016-05-21 05:00:00 17437.32 17571.75 17437.32 17500.94 111992332
# ... ... ... ... ... ...
params = [
# Dow Jones
{
'q': ".DJI",
'x': "INDEXDJX",
},
# NYSE COMPOSITE (DJ)
{
'q': "NYA",
'x': "INDEXNYSEGIS",
},
# S&P 500
{
'q': ".INX",
'x': "INDEXSP",
}
]
period = "1Y"
# get closing price data (return pandas dataframe)
df = get_closing_data(params, period)
print(df)
# .DJI NYA .INX
# 2016-05-17 17710.71 10332.4261 2066.66
# 2016-05-18 17529.98 10257.6102 2047.21
# 2016-05-19 17526.62 10239.6501 2047.63
# 2016-05-20 17435.40 10192.5015 2040.04
# 2016-05-21 17500.94 10250.4961 2052.32
# ... ... ... ...
params = [
# Dow Jones
{
'q': ".DJI",
'x': "INDEXDJX",
},
# NYSE COMPOSITE (DJ)
{
'q': "NYA",
'x': "INDEXNYSEGIS",
},
# S&P 500
{
'q': ".INX",
'x': "INDEXSP",
}
]
period = "1Y"
# get open and close price data (return pandas dataframe)
df = get_open_close_data(params, period)
print(df)
# .DJI_Open .DJI_Close NYA_Open NYA_Close .INX_Open \
# 2016-06-21 17736.87 17804.87 10456.9207 10450.0288 2075.58
# 2016-06-22 17827.33 17829.73 10481.1576 10490.7800 2085.19
# 2016-06-23 17832.67 17780.83 10507.9429 10473.0578 2089.75
# 2016-06-24 17844.11 18011.07 10573.4669 10641.1686 2092.80
# 2016-06-25 17946.63 17400.75 10335.9189 10183.5145 2103.81
# ... ... ... ... ... ...
Contributing
------------
1. Fork it
2. Create your feature branch (``git checkout -b my-new-feature``)
3. Commit your changes (``git commit -am 'Add some feature'``)
4. Push to the branch (``git push origin my-new-feature``)
5. Create new Pull Request
挣扎的蓝藻
- 粉丝: 14w+
- 资源: 15万+
最新资源
- 2011-2024年各省数字普惠金融指数数据.zip
- 数据结构排序算法:插入排序、希尔排序、冒泡排序及快速排序算法
- Nosql期末复习资料
- Python新年庆典倒计时与节日活动智能管理助手
- 塑料、玻璃、金属、纸张、木材检测36-YOLO(v5至v11)、COCO、CreateML、Paligemma、TFRecord、VOC数据集合集.rar
- 系统DLL文件修复工具
- 数据结构之哈希查找方法
- Python圣诞节倒计时与节日活动管理系统
- 塑料检测23-YOLO(v5至v11)、COCO、CreateML、Paligemma、TFRecord、VOC数据集合集.rar
- PPT模板WHUT-博学之光-PPT模板
- C#上位机开发与工控通讯实战课程
- HCIA-Datacom教师笔记-数据通信基础知识及网络模型详解
- MobileNet V2 网络实现的计算机视觉大项目:8种常见茶叶病害种类识别
- 文件格式是一种撒很快的哈的东西
- Python之正则表达式基础知识
- JLINK-OB下载器的原理图和HEX文件
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈