金融建模准备API的Python包装器

fmp-python的Python项目详细描述


Build StatusPyPI versionAverage time to resolve an issuePercentage of issues still open

财务建模准备Python模块

Python模块从财务建模准备API获取股票数据

安装

此库要求您拥有财务建模准备帐户(注册here

您可以安装软件包:

  • 使用pip
pip install fmp_python
  • 来源:
^{pr2}$

使用

要从API获取数据:

  • 导入库并使用API密钥调用对象:
from fmp_python.fmp import FMP

fmp = FMP(api_key='YOUR_API_KEY')
fmp.get_quote('AAL')
  • 您可以将其存储在环境变量\fmu中
from fmp_python.fmp import FMP

fmp = FMP(output_format='pandas', write_to_file=True)
fmp.get_quote('AAL')

您可以选择您想要的数据输出格式output_format='pandas'或'json'。在

'json'是默认值

您还可以通过设置write_to_file=True来选择是否要将输出存储在文件中(在C:/tmp中)

'False'是默认值

实时股价

Referencehttps://financialmodelingprep.com/developer/docs/#Company-Quote

fmp.get_quote(symbol: str)

用法示例

fmp = FMP(output_format = 'pandas', write_to_file= True)
fmp.get_quote('AAL')

股票时间序列

1。股价

Referencehttps://financialmodelingprep.com/developer/docs/#Stock-Price

fmp.get_quote_short(symbol: str)

用法示例

fmp = FMP(output_format = 'pandas', write_to_file= True)
fmp.quote_short('AAL')

2。股票历史价格

Referencehttps://financialmodelingprep.com/developer/docs/#Stock-Historical-Price

fmp.get_historical_chart(interval:str, symbol: str)

用法示例

fmp = FMP(output_format = 'pandas', write_to_file= True)
fmp.get_historical_chart('5min','AAL')

市场指数

1。大多数主要股指(道琼斯、纳斯达克、标准普尔500)

Referencehttps://financialmodelingprep.com/developer/docs/#Most-of-the-majors-indexes-(Dow-Jones,-Nasdaq,-S&P-500)

fmp.get_index_quote(symbol: str)

用法示例

fmp = FMP(output_format = 'pandas', write_to_file= True)
fmp.get_index_quote('GSPC')

2。历史股票指数价格

Referencehttps://financialmodelingprep.com/developer/docs/#Historical-stock-index-prices

  • 时间安排:
fmp.get_historical_chart_index(interval:str,symbol: str)

用法示例

fmp = FMP(output_format = 'pandas', write_to_file= True)
fmp.get_historical_chart_index('5min', GSPC')
  • 每日:
fmp.get_historical_price(symbol: str)

用法示例

fmp = FMP(output_format = 'pandas', write_to_file= True)
fmp.get_historical_price('GSPC')

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java JavaFX TableView更新单元格,不更新对象值   在扫描器中使用分隔符的java   java OkHttp 4.9.2,连接无法重用,导致端口耗尽   eclipse中的c JNI:运行Java代码   java是否在出厂的所有硬件设备中都有/mnt/sdcard/Android/data文件夹(或等效文件夹)?   Java,在eclipse中访问资源文件夹中的图像   java为什么Bluemix dashDB操作抛出SqlSyntaxErrorException,SQLCODE=1667?   JavaHtmlUnitWebClient。getPage不处理javascript   Google API认证的java问题   java如何将JSON数组反序列化为Apache beam PCollection<javaObject>   ServerSocket停止接收命令,java/安卓   来自Java类的安卓 Toast消息   java如何自动重新加载应用程序引擎开发服务器?   java是否可以尝试/捕获一些东西来检查是否抛出了异常?   java如何做到这一点当我按下load game时,它不仅会加载信息,还会将您带到游戏中?   Java选项Xmx代表什么?   Java映射,它在插入时打印值   设置“ulimit c unlimited”后,java无法生成系统核心转储