Stocks

Quantnet provides data for companies listed on the NYSE and NASDAQ. The data can be divided into three groups:

Available instruments

Let“s download information about the instruments available for trading for the previous 5 years:

import qnt.data as qndata 
import datetime as dt

assets = qndata.load_assets(tail=dt.timedelta(days=5*365))

или

assets = qndata.load_assets(min_date="2015-01-01")

There are 1002 financial instruments available. For each of them, brief information is provided:

assets[0]
{'name': 'ALPHA PRO TECH LTD',
 'sector': 'Health Technology',
 'symbol': 'APT',
 'exchange': 'AMEX',
 'industry': 'Medical Specialties',
 'id': 'AMEX:APT',
 'cik': '884269',
 'FIGI': 'BBG000C1H7Y2'}

You can find a complete list here

Market data

We recommend using data from 2015. Market share prices have been available since 2000.

To download market data, just use the following function:

import qnt.data    as qndata
import datetime    as dt

data = qndata.load_data(tail = dt.timedelta(days = 4*365),
                        forward_order = True)

price_open = data.sel(field="open")
price_close = data.sel(field="close")
price_high = data.sel(field="high")
price_low = data.sel(field="low")
volume_day = data.sel(field="vol")
is_liquid = data.sel(field="is_liquid")
Data name Description
open Open is the price at which a security first trades upon the opening of an exchange on a trading day. Daily open price.
close Daily close price.
high Daily high price.
low Daily low price.
vol Daily volume of trading in number of shares.
divs Dividends from shares.
split It indicates stock split. Split = 2.0 means that on this day there was a split of shares 2 to 1: the number of shares doubled, and their price halved.
split_cumprod split_cumprod & The product of split values from the very beginning. Used to restore original prices.
is_liquid We trade only liquid stocks, so this option determines whether this stock can be traded. This is top 500 most liquid stocks over the last month (sorted by trading volume = sum(close*vol) ). It changes once a month.

Table 1. Available market data.

Uploading certain companies

You can also limit the data loading by specifying the tools that interest you. In the assets_names variable, specify the companies you want to trade.

For example, you can generate a list of previously downloaded assets:

assets_names = [i["id"] for i in assets]

Or set the companies manually:

assets_names=['NASDAQ:AAPL', 'NASDAQ:GOOGL']

data = qndata.load_data(tail = dt.timedelta(days = 5*365),
                        assets=assets_names,
                        forward_order = True)

price_open = data.sel(field="open")   
price_open.to_pandas().tail()
asset NASDAQ:AAPL NASDAQ:GOOGL
time
2020-08-13 12816.160 1508.21
2020-08-14 12860.820 1513.61
2020-08-17 12999.000 1515.97
2020-08-18 12807.480 1526.12
2020-08-19 12990.124 1552.49

Fundamental data

[This] (https://quantnet.ai/referee/template/15325118/html) template shows how to download prepared fundamental data.

Instant indicators.

They reflect the current state of the company. The value has been updated with every report released.

Data name Description
assets Total Assets
assets_curr Current Assets
equity Common equity
liabilities Total liabilities
liabilities_curr Current liabilities
debt_lt Long term debt
debt_st Short term debt
goodwill Goodwill
inventory Total inventory
ivestment_short_term Short-Term investments
invested_capital Invested capital
shares Total shares outstanding. If reports do not contain such information we can use issued shares.
ppent Property Plant and Equipment Net
cash_equivalent Cash equivalents are investment securities that are meant for short-term investing; they have high credit quality and are highly liquid.

Table 2. Instant indicators.

Periodical indicators.

They correspond to a certain period. For example, income and sales. For periodical indicators, you can receive information with the quarter, annual frequency, or „last twelve-month“ value.

Data name Description
sales_revenue_ltm / sales_revenue_af / sales_revenue_qf Revenue from sales
total_revenue_ltm / total_revenue_af / total_revenue_qf Total revenue
cashflow_op_ltm / cashflow_op_af / cashflow_op_qf Cashflow from operating activities
cogs_ltm / cogs_af / cogs_qf Cost of goods sold
divs_ltm / divs_af / divs_qf Dividends
eps_ltm / eps_af / eps_qf Earnings per share
income_ltm / income_af / income_qf / Income
interest_expense_ltm / interest_expense_af / interest_expense_qf Interest expense
operating_expense_ltm / operating_expense_af / operating_expense_qf Operating expenses
operating_income_ltm / operating_income_af / operating_income_qf Operating income
rd_expense_ltm / rd_expense_af / rd_expense_qf Research and development expense
sales_ps_ltm / sales_ps_af / sales_ps_qf sales per share
sga_expense_ltm / sga_expense_af / sga_expense_qf Selling, general & administrative expense

Table 3. Periodical indicators.

We use the fundamental data from the company“s reports stored in the EDGAR database. One can find information manually, by entering company ticket on a U.S. Securities and Exchange Commission website. Reports consist of facts that are represented mainly in XBRL format. Available facts labels can be found here.