Intrinio API客户端

intrinio的Python项目详细描述


Build Status

python的非正式intrinio api客户端。它让你很容易进入 财务数据。

设置

使用PIP工具安装此软件包:

pip install intrinio

在使用包检索数据之前,api用户名和密码 必须通过设置用户名和密码进行配置 intrinio包的属性:

importintriniointrinio.client.username='USERNAME_FROM_INTRINIO'intrinio.client.password='PASSWORD_FROM_INTRINIO'

或者通过设置系统环境变量:

  • intrinio_用户名
  • 输入密码

快速启动

安装intrinio包,将其导入并将用户名和密码设置为 首先。

从2016-01-01开始为苹果定价:

intrinio.prices('AAPL',start_date='2016-01-01')

获得年度基本面,包括市盈率、净债务、总资本和 超过100个苹果的其他变量:

intrinio.financials('AAPL')

获取有关谷歌的公司信息:

intrinio.companies('GOOG')

使用低级的get获取有关谷歌的公司信息 功能:

intrinio.get('companies',identifier='GOOG')

获取公司中有“银行”的公司的CIK、LEI、名称和代码 姓名:

intrinio.companies(query='Bank')

市盈率高于10的屏幕股票:

intrinio.screener('pricetoearnings~gt~10')

用法

有一个高级和低级函数用于访问intrinio 应用程序编程接口。

高级函数主要是get的简单包装器 使用可选参数检索所有数据以筛选 数据。他们还可以进行一些数据转换,例如 日期列用作 熊猫数据框。

有关可用终结点及其参数的详细信息,请参见 intrinio api文档位于:Intrinio Docs

低级功能

  • get(端点,**参数):

    使用可选查询从终结点获取完整数据集 参数。

    参数:

    endpoint: Intrinio endpoint, for example: companies
    parameters: Optional query parameters
    

    返回:数据集作为pandas数据框

  • 获取页面(端点,页面号=1,页面大小=无,**参数):

    使用可选查询参数从终结点获取数据集页。

    参数:

    endpoint: Intrinio endpoint, for example: companies
    page_number: Optional page number where 1 is first page (default 1)
    page_size: Optional page size (default max page size for the endpoint)
    parameters: Optional query parameters
    

    返回:数据集页作为pandas数据框,并附加一个 总页数属性

高级功能

  • 公司(标识符=无,查询=无):

    使用参数获取具有可选筛选的公司。

    参数:

    identifier: Identifier for the legal entity or a security associated
        with the company: TICKER SYMBOL | FIGI | OTHER IDENTIFIER
    query: Search of company name or ticker symbol
    

    返回:数据集作为pandas数据框

  • 证券(标识符=无,查询=无,exch_symbol=无):

    使用参数获取具有可选筛选的证券。

    参数:

    identifier: Identifier for the legal entity or a security associated
        with the company: TICKER SYMBOL | FIGI | OTHER IDENTIFIER
    query: Search of security name or ticker symbol
    exch_symbol: Exchange symbol
    

    返回:数据集作为pandas数据框

  • 索引(标识符=无,查询=无,类型=无):

    使用参数获取带有可选筛选的索引。

    参数:

    identifier: Intrinio symbol associated with the index
    query: Search of index name or symbol
    type: Type of indices: stock_market | economic | sic
    

    返回:数据集作为pandas数据框

  • 价格(标识符,开始日期=无,结束日期=无, 频率='daily',排序顺序='desc'):

    获取历史股票市场价格或指数。

    参数:

    identifier: Stock market symbol or index
    start_date: Start date of prices (default no filter)
    end_date: Last date (default today)
    frequency: Frequency of prices: daily (default) | weekly | monthly |
        quarterly | yearly
    sort_order: Order of prices: asc | desc (default)
    

    返回:数据集作为pandas数据框

  • 新闻(标识符):

    为公司获取新闻。

    参数:

    identifier: stock market ticker symbol associated with the company's
        common stock. If the company is foreign, use the stock exchange
        code, followed by a colon, then the ticker.
    

    返回:数据集作为pandas数据框

  • 财务数据(标识符,type='fy',statement='calculations'):

    获取公司的标准化基础数据。

    参数:

    identifier: stock market ticker symbol associated with the company's
        common stock. If the company is foreign, use the stock exchange
        code, followed by a colon, then the ticker.
    type: Period type: FY (default) | QTR | TTM | YTD
    statement: Type of fundamental data: calculations (default) |
        income_statement | balance_sheet | cash_flow_statement
    

    返回:数据集作为pandas数据框

  • 财务期间(标识符,会计年度,会计期间='fy', 语句='计算'):

    为一家公司获取单一时期的标准化基础数据。

    参数:

    fiscal_year: Year
    fiscal_period: FY (default) | Q1 | Q2 | Q3 | Q4 | Q1TTM | Q2TTM | Q3TTM
        | Q2YTD | Q3YTD
    identifier: stock market ticker symbol associated with the company's
        common stock. If the company is foreign, use the stock exchange
        code, followed by a colon, then the ticker.
    statement: Type of fundamental data: calculations (default) |
        income_statement | balance_sheet | cash_flow_statement
    

    返回:数据集作为pandas数据框

  • 基本原理(标识符,类型='fy',语句='calculations'):

    使用标准化的基本数据获取 公司。

    参数:

    identifier: stock market ticker symbol associated with the company's
        common stock. If the company is foreign, use the stock exchange
        code, followed by a colon, then the ticker.
    type: Period type: FY (default) | QTR | TTM | YTD
    statement: Type of fundamental data: calculations (default) |
        income_statement | balance_sheet | cash_flow_statement
    

    返回:数据集作为pandas数据集框架

  • 筛选器(条件,order_column=none,order_direction=none, 仅初级=无,逻辑=无:

    找到符合条件清单的证券。

    参数:

    conditions: Comma-separated list of conditions. Each condition
        consists of three or four elements separated by tildes (~):
        Data_tag~Operator~Value~Label(Optional)
    order_column: A data tag by which to order the results
    order_direction: Order of the results: asc (default) | desc
    primary_only: Return only primary securities (excluding special
        securities such as preferred shares)
    logic: How the conditions are applied using AND by default
    

    returns:满足熊猫条件的票务列表 数据框

测试

测试将在~/.cache/intrinio中缓存api请求以进行测试 加快速度,避免过多的api流量。不建议使用 缓存用于非测试目的,应仅用于测试。

在项目的根目录中使用pytest运行测试:

py.test

或者运行runtests脚本来生成覆盖率报告(保存到 tmp/)。

bin/runtests

版本历史记录

  • 请参见changelog.md

许可证

  • 麻省理工学院许可证

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

推荐PyPI第三方库


热门话题
java嗨,我正在尝试运行一个简单的奇偶程序,但它给了我一个错误“预期标识符”   java程序输出问题   使用全新Spring上下文的java启动JUnit测试   oauth获取Java中Microsoft Graph API的令牌   java如何停止声音   for loop Java 8向集合中添加自定义元素的方法?   java如何将数组的第n个值赋给变量   java局部变量在使用前必须初始化,例如实例变量,没有这样的限制,为什么?   macos在Mac上安装和运行Java应用程序   运行jar文件时发生java NoClassDefFoundError   用于映射同一数据库中多个MySQL表的java Hibernate配置文件(.cfg.xml)?   如何使用Java通过代理发送华为推送通知   datetime Java将MessagePack时间戳转换为日期   java如何从读取器返回的字符串中删除unicode空格。readLine()   java返回Ljava的字符串值。lang.对象   如何使用java方法在jsp中打印arraylist   JAVAutil。扫描器java。lang.NumberFormatException与一个只有int的txt文件   java Dijkstra单调路径   键入错误号时发生java错误