Skip to main content

Quotes API for Digital Portals client library for Python

Project description

FactSet

Quotes API for Digital Portals client library for Python

PyPi Apache-2 license

The Quotes API combines endpoints for retrieving security end-of-day, delayed, and realtime prices with performance key figures and basic reference data on the security and market level.

The API supports over 20 different price types for each quote and comes with basic search endpoints based on security identifiers and instrument names. Market coverage is included in the Sample Use Cases section below.

The Digital Portal use case is focused on high-performance applications that are

  • serving millions of end-users,
  • accessible by client browsers via the internet,
  • supporting subscriptions for streamed updates out-of-the-box,
  • typically combining a wide variety of for Digital Portals-APIs into a highly use-case specific solution for customers,
  • integrated into complex infrastructures such as existing frontend frameworks, authentication services.

All APIs labelled for Digital Portals have been designed for direct use by client web applications and feature extreme low latency: The average response time across all endpoints is 30 ms whereas 99% of all requests are answered in close to under 300ms.

See the Time Series API for Digital Portals for direct access to price histories, and the News API for Digital Portals for searching and fetching related news.

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 2
  • Package version: 0.10.7
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements

  • Python >= 3.7

Installation

Poetry

poetry add fds.sdk.utils fds.sdk.QuotesAPIforDigitalPortals

pip

pip install fds.sdk.utils fds.sdk.QuotesAPIforDigitalPortals

Usage

  1. Generate authentication credentials.
  2. Setup Python environment.
    1. Install and activate python 3.7+. If you're using pyenv:

      pyenv install 3.9.7
      pyenv shell 3.9.7
      
    2. (optional) Install poetry.

  3. Install dependencies.
  4. Run the following:
from fds.sdk.utils.authentication import ConfidentialClient

import fds.sdk.QuotesAPIforDigitalPortals
from fds.sdk.QuotesAPIforDigitalPortals.api import basic_api
from fds.sdk.QuotesAPIforDigitalPortals.models import *
from dateutil.parser import parse as dateutil_parser
from pprint import pprint

# See configuration.py for a list of all supported configuration parameters.

# Examples for each supported authentication method are below,
# choose one that satisfies your use case.

# (Preferred) OAuth 2.0: FactSetOAuth2
# See https://github.com/FactSet/enterprise-sdk#oauth-20
# for information on how to create the app-config.json file
# See https://github.com/FactSet/enterprise-sdk-utils-python#authentication
# for more information on using the ConfidentialClient class
configuration = fds.sdk.QuotesAPIforDigitalPortals.Configuration(
    fds_oauth_client=ConfidentialClient('/path/to/app-config.json')
)

# Basic authentication: FactSetApiKey
# See https://github.com/FactSet/enterprise-sdk#api-key
# for information how to create an API key
# configuration = fds.sdk.QuotesAPIforDigitalPortals.Configuration(
#     username='USERNAME-SERIAL',
#     password='API-KEY'
# )

# Enter a context with an instance of the API client
with fds.sdk.QuotesAPIforDigitalPortals.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = basic_api.BasicApi(api_client)
    # NOTE: The parameter variable defined below is just an example and may potentially contain non valid values. So please replace this with valid values.
    attributes = [
        "_attributes_example",
    ] # [str] | Limit the attributes returned in the response to the specified set. (optional)

    try:
        # List of asset classes.
        api_response = api_instance.get_basic_asset_class_list(attributes=attributes)
        pprint(api_response)
    except fds.sdk.QuotesAPIforDigitalPortals.ApiException as e:
        print("Exception when calling BasicApi->get_basic_asset_class_list: %s\n" % e)

    # Get response, http status code and response headers
    # try:
    #     # List of asset classes.
    #     api_response, http_status_code, response_headers = api_instance.get_basic_asset_class_list_with_http_info(attributes=attributes)
    #     pprint(api_response)
    #     pprint(http_status_code)
    #     pprint(response_headers)
    # except fds.sdk.QuotesAPIforDigitalPortals.ApiException as e:
    #     print("Exception when calling BasicApi->get_basic_asset_class_list: %s\n" % e)

    # Get response asynchronous
    # try:
    #     # List of asset classes.
    #     async_result = api_instance.get_basic_asset_class_list_async(attributes=attributes)
    #     api_response = async_result.get()
    #     pprint(api_response)
    # except fds.sdk.QuotesAPIforDigitalPortals.ApiException as e:
    #     print("Exception when calling BasicApi->get_basic_asset_class_list: %s\n" % e)

    # Get response, http status code and response headers asynchronous
    # try:
    #     # List of asset classes.
    #     async_result = api_instance.get_basic_asset_class_list_with_http_info_async(attributes=attributes)
    #     api_response, http_status_code, response_headers = async_result.get()
    #     pprint(api_response)
    #     pprint(http_status_code)
    #     pprint(response_headers)
    # except fds.sdk.QuotesAPIforDigitalPortals.ApiException as e:
    #     print("Exception when calling BasicApi->get_basic_asset_class_list: %s\n" % e)

Using Pandas

To convert an API response to a Pandas DataFrame, it is necessary to transform it first to a dictionary.

import pandas as pd

response_dict = api_response.to_dict()['data']

simple_json_response = pd.DataFrame(response_dict)
nested_json_response = pd.json_normalize(response_dict)

Debugging

The SDK uses the standard library logging module.

Setting debug to True on an instance of the Configuration class sets the log-level of related packages to DEBUG and enables additional logging in Pythons HTTP Client.

Note: This prints out sensitive information (e.g. the full request and response). Use with care.

import logging
import fds.sdk.QuotesAPIforDigitalPortals

logging.basicConfig(level=logging.DEBUG)

configuration = fds.sdk.QuotesAPIforDigitalPortals.Configuration(...)
configuration.debug = True

Documentation for API Endpoints

All URIs are relative to https://api.factset.com/wealth/v1

Class Method HTTP request Description
BasicApi get_basic_asset_class_list GET /basic/assetClass/list List of asset classes.
BasicApi get_basic_benchmark_type_list GET /basic/benchmark/type/list List of benchmark types.
BasicApi get_basic_frequency_type_list GET /basic/frequency/type/list List of frequency types.
BasicApi get_basic_language_get GET /basic/language/get Details for a language.
BasicApi get_basic_language_get_by_code GET /basic/language/getByCode Details for a language identified by code.
BasicApi get_basic_language_list GET /basic/language/list List of languages.
BasicApi get_basic_market_get GET /basic/market/get Details of a market.
BasicApi get_basic_market_group_list GET /basic/market/group/list List of market groups.
BasicApi get_basic_market_type_list GET /basic/market/type/list List of market types.
BasicApi get_basic_media_kind_list GET /basic/media/kind/list List of media kinds.
BasicApi get_basic_region_continent_get GET /basic/region/continent/get Details for a continent.
BasicApi get_basic_region_continent_list GET /basic/region/continent/list List of continents.
BasicApi get_basic_region_country_get GET /basic/region/country/get Details for a country.
BasicApi get_basic_region_country_get_by_code GET /basic/region/country/getByCode Details for a country identified by code.
BasicApi get_basic_region_country_list GET /basic/region/country/list List of countries.
BasicApi get_basic_region_get GET /basic/region/get Details for a region.
BasicApi get_basic_region_list GET /basic/region/list List of regions.
BasicApi get_basic_timezone_get GET /basic/timezone/get Details of a timezone.
BasicApi get_basic_timezone_get_by_name GET /basic/timezone/getByName Details of a timezone identified by name.
BasicApi get_basic_value_unit_alternative_list GET /basic/valueUnit/alternative/list List of alternative units.
BasicApi get_basic_value_unit_currency_fractional_get GET /basic/valueUnit/currency/fractional/get Details of a fractional currency.
BasicApi get_basic_value_unit_currency_fractional_list GET /basic/valueUnit/currency/fractional/list List of fractional currencies.
BasicApi get_basic_value_unit_get GET /basic/valueUnit/get Details of a value unit.
BasicApi post_basic_background_text_type_list POST /basic/backgroundText/type/list List of background text types.
BasicApi post_basic_delivery_list POST /basic/delivery/list List of deliveries.
BasicApi post_basic_market_list POST /basic/market/list List of markets.
BasicApi post_basic_media_type_list POST /basic/media/type/list List of Internet media types.
BasicApi post_basic_mic_operating_list POST /basic/mic/operating/list List of operating market identifier codes (MIC).
BasicApi post_basic_timezone_list POST /basic/timezone/list List of timezones.
BasicApi post_basic_value_unit_currency_list POST /basic/valueUnit/currency/list List of currencies.
BasicApi post_basic_value_unit_currency_main_list POST /basic/valueUnit/currency/main/list List of main currencies.
BasicApi post_basic_value_unit_list POST /basic/valueUnit/list List of value units.
CategoryApi get_category_dataset_list GET /category/dataset/list List of entitled category datasets.
CategoryApi get_category_get GET /category/get Details of a category.
CategoryApi get_category_instrument_list GET /category/instrument/list List of instruments where a specific dataset has assigned a given category.
CategoryApi get_category_level_get GET /category/level/get Details of a category level.
CategoryApi get_category_list GET /category/list List of categories.
CategoryApi get_category_list_by_level GET /category/listByLevel List of categories assigned to a category level.
CategoryApi get_category_list_by_system GET /category/listBySystem List of categories assigned to a category system.
CategoryApi get_category_path_get GET /category/path/get Path from the first level to the level of a specific category.
CategoryApi get_category_system_get GET /category/system/get Details of an entitled category system.
CategoryApi get_category_system_list GET /category/system/list List of entitled category systems.
CategoryApi get_category_system_type_list GET /category/system/type/list List of category system types.
InstrumentApi get_instrument_background_text_list_by_instrument GET /instrument/backgroundText/listByInstrument Background texts of an instrument.
InstrumentApi get_instrument_compliance_property_list_by_instrument GET /instrument/complianceProperty/listByInstrument Compliance properties of an instrument.
InstrumentApi get_instrument_composite_get GET /instrument/composite/get Composite instrument and its components.
InstrumentApi get_instrument_coupon_day_count_convention_type_list GET /instrument/coupon/dayCountConvention/type/list List of day count convention types.
InstrumentApi get_instrument_coupon_interest_rate_type_list GET /instrument/coupon/interestRate/type/list List of interest rate types.
InstrumentApi get_instrument_coupon_key_data_get GET /instrument/coupon/keyData/get Interest rate details for selected periods of an interest-bearing instrument.
InstrumentApi get_instrument_coupon_list GET /instrument/coupon/list List of coupons for an interest-bearing instrument.
InstrumentApi get_instrument_cross_reference_get_by_isin GET /instrument/crossReference/getByISIN Translate ISIN to instrument.
InstrumentApi get_instrument_cross_reference_get_by_wkn GET /instrument/crossReference/getByWKN Translate WKN to instrument.
InstrumentApi get_instrument_cross_reference_history_get_by_isin GET /instrument/crossReference/history/getByISIN ISIN to instrument translation history.
InstrumentApi get_instrument_cross_reference_history_get_by_wkn GET /instrument/crossReference/history/getByWKN WKN to instrument translation history.
InstrumentApi get_instrument_exchange_rate_get GET /instrument/exchangeRate/get Retrieve an exchange rate instrument identifier.
InstrumentApi get_instrument_exchange_rate_get_by_iso_code GET /instrument/exchangeRate/getByISOCode Retrieve an exchange rate instrument identifier.
InstrumentApi get_instrument_get GET /instrument/get Basic data for an instrument.
InstrumentApi get_instrument_get_by_notation GET /instrument/getByNotation Basic data for an instrument.
InstrumentApi get_instrument_legal_entity_background_text_list_by_instrument GET /instrument/legalEntity/backgroundText/listByInstrument Role-specific background texts of legal entities related to an instrument.
InstrumentApi get_instrument_legal_entity_compliance_property_list_by_instrument GET /instrument/legalEntity/complianceProperty/listByInstrument Role-specific compliance properties of legal entities related to an instrument.
InstrumentApi get_instrument_mifid_get GET /instrument/mifid/get MiFID II data for a financial instrument.
InstrumentApi get_instrument_search_basic GET /instrument/search/basic Basic search for instruments.
InstrumentApi post_instrument_background_text_type_list POST /instrument/backgroundText/type/list List of background text types for instruments.
InstrumentApi post_instrument_benchmark_list POST /instrument/benchmark/list List of benchmarks of a financial instrument.
InstrumentApi post_instrument_category_list POST /instrument/category/list List of categories assigned to a specific instrument the application is entitled to see.
InstrumentApi post_instrument_compliance_property_list POST /instrument/complianceProperty/list List of compliance properties for instruments.
InstrumentApi post_instrument_cross_reference_list_by_isin POST /instrument/crossReference/listByISIN Translate a list of ISINs to instruments.
InstrumentApi post_instrument_cross_reference_list_by_wkn POST /instrument/crossReference/listByWKN Translate a list of WKNs to instruments.
InstrumentApi post_instrument_notation_list POST /instrument/notation/list List of active, entitled notations for a set of instruments.
InstrumentApi post_instrument_rating_grade_list POST /instrument/rating/grade/list List of rating grades for a list of instruments.
NotationApi get_notation_cross_reference_fact_set_identifier_get GET /notation/crossReference/factSetIdentifier/get Retrieve FactSet identifiers for a given notation.
NotationApi get_notation_cross_reference_get_by_fact_set_market_symbol GET /notation/crossReference/getByFactSetMarketSymbol Translate a FactSet market symbol to a notation.
NotationApi get_notation_get GET /notation/get Basic data for a notation.
NotationApi get_notation_key_figures_month_1_get GET /notation/keyFigures/month/1/get End-of-day (EOD) key figures for the time range of one month.
NotationApi get_notation_key_figures_month_1_list GET /notation/keyFigures/month/1/list End-of-day (EOD) key figures for the time range of one month, for a list of notations.
NotationApi get_notation_key_figures_month_3_get GET /notation/keyFigures/month/3/get End-of-day (EOD) key figures for the time range of three months.
NotationApi get_notation_key_figures_month_3_list GET /notation/keyFigures/month/3/list End-of-day (EOD) key figures for the time range of three months, for a list of notations.
NotationApi get_notation_key_figures_month_6_get GET /notation/keyFigures/month/6/get End-of-day (EOD) key figures for the time range of six months.
NotationApi get_notation_key_figures_month_6_list GET /notation/keyFigures/month/6/list End-of-day (EOD) key figures for the time range of six months, for a list of notations.
NotationApi get_notation_key_figures_week_1_get GET /notation/keyFigures/week/1/get End-of-day (EOD) key figures for the time range of one week.
NotationApi get_notation_key_figures_week_1_list GET /notation/keyFigures/week/1/list End-of-day (EOD) key figures for the time range of one week, for a list of notations.
NotationApi get_notation_key_figures_year_10_get GET /notation/keyFigures/year/10/get End-of-day (EOD) key figures for the time range of ten years.
NotationApi get_notation_key_figures_year_10_list GET /notation/keyFigures/year/10/list End-of-day (EOD) key figures for the time range of ten years, for a list of notations.
NotationApi get_notation_key_figures_year_1_get GET /notation/keyFigures/year/1/get End-of-day (EOD) key figures for the time range of one year.
NotationApi get_notation_key_figures_year_1_list GET /notation/keyFigures/year/1/list End-of-day (EOD) key figures for the time range of one year, for a list of notations.
NotationApi get_notation_key_figures_year_3_get GET /notation/keyFigures/year/3/get End-of-day (EOD) key figures for the time range of three years.
NotationApi get_notation_key_figures_year_3_list GET /notation/keyFigures/year/3/list End-of-day (EOD) key figures for the time range of three years, for a list of notations.
NotationApi get_notation_key_figures_year_5_get GET /notation/keyFigures/year/5/get End-of-day (EOD) key figures for the time range of five years.
NotationApi get_notation_key_figures_year_5_list GET /notation/keyFigures/year/5/list End-of-day (EOD) key figures for the time range of five years, for a list of notations.
NotationApi get_notation_key_figures_year_7_get GET /notation/keyFigures/year/7/get End-of-day (EOD) key figures for the time range of seven years.
NotationApi get_notation_key_figures_year_7_list GET /notation/keyFigures/year/7/list End-of-day (EOD) key figures for the time range of seven years, for a list of notations.
NotationApi get_notation_key_figures_year_to_date_get GET /notation/keyFigures/yearToDate/get End-of-day (EOD) key figures for the time range year-to-date (YTD)..
NotationApi get_notation_key_figures_year_to_date_list GET /notation/keyFigures/yearToDate/list End-of-day (EOD) key figures for the time range year-to-date (YTD), for a list of notations..
NotationApi get_notation_list GET /notation/list Basic data for a list of notations.
NotationApi get_notation_search_basic GET /notation/search/basic Basic search for notations.
NotationApi get_notation_search_by_text_ranked_by_volume GET /notation/searchByTextRankedByVolume Basic search for notations.
NotationApi get_notation_status_get GET /notation/status/get Intraday trading status of a notation.
NotationApi post_notation_cross_reference_fact_set_identifier_list_by_fact_set_identifier POST /notation/crossReference/factSetIdentifier/listByFactSetIdentifier Retrieve a list of notations for a given FactSet identifier.
NotationApi post_notation_cross_reference_fact_set_identifier_list_by_instrument POST /notation/crossReference/factSetIdentifier/listByInstrument Retrieve a list of FactSet identifiers for a given instrument.
NotationApi post_notation_cross_reference_list_by_instrument POST /notation/crossReference/listByInstrument List of entitled notations.
NotationApi post_notation_cross_reference_list_by_isin POST /notation/crossReference/listByISIN List of entitled notations.
NotationApi post_notation_cross_reference_list_by_symbol POST /notation/crossReference/listBySymbol List of entitled notations.
NotationApi post_notation_market_list POST /notation/market/list List of markets with entitled notations.
NotationApi post_notation_search_by_text POST /notation/searchByText Text-based search for notations.
PricesApi get_prices_bid_ask_get GET /prices/bidAsk/get Most recent bid and ask prices (best bid / offer) for a notation.
PricesApi get_prices_bid_ask_list GET /prices/bidAsk/list Most recent bid and ask prices (best bid / offer) for a list of notations.
PricesApi get_prices_get GET /prices/get Overview of trading on the most recent trading day, including the latest price, for a notation.
PricesApi get_prices_list GET /prices/list Overview of trading on the most recent trading day, including the latest price, for a list of notations.
PricesApi get_prices_orderbook_aggregated_get GET /prices/orderbook/aggregated/get Orderbook aggregated by price.
PricesApi get_prices_orderbook_full_get GET /prices/orderbook/full/get Full orderbook
PricesApi get_prices_trading_schedule_event_type_list GET /prices/tradingSchedule/event/type/list Trading schedule event types.
PricesApi post_prices_trading_schedule_event_list POST /prices/tradingSchedule/event/list Sequence of market-related events.

Documentation For Models

Documentation For Authorization

FactSetApiKey

  • Type: HTTP basic authentication

FactSetOAuth2

  • Type: OAuth
  • Flow: application
  • Authorization URL:
  • Scopes: N/A

Notes for Large OpenAPI documents

If the OpenAPI document is large, imports in fds.sdk.QuotesAPIforDigitalPortals.apis and fds.sdk.QuotesAPIforDigitalPortals.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1: Use specific imports for apis and models like:

  • from fds.sdk.QuotesAPIforDigitalPortals.api.default_api import DefaultApi
  • from fds.sdk.QuotesAPIforDigitalPortals.model.pet import Pet

Solution 2: Before importing the package, adjust the maximum recursion limit as shown below:

import sys
sys.setrecursionlimit(1500)
import fds.sdk.QuotesAPIforDigitalPortals
from fds.sdk.QuotesAPIforDigitalPortals.apis import *
from fds.sdk.QuotesAPIforDigitalPortals.models import *

Contributing

Please refer to the contributing guide.

Copyright

Copyright 2022 FactSet Research Systems Inc

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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