Fundamental Data: Periodic indicators & Instant indicators
-
Hallo,
i wonder how to get Fundamental Data for a Stock.
at:
https://quantiacs.com/documentation/en/user_guide/data_stocks.html?highlight=instant indicators#fundamental-data
there are two tables with keys to retrieve Fundamental-Data but i dont understand how to use them. I can not find examples.Best Regards.
-
@johback Hi, these features are experimental. You can adapt the following test code:
https://github.com/quantiacs/toolbox/blob/dev/qnt/tests/test_fundamental_data.py
or use:
import qnt.ta as qnta import qnt.data as qndata import qnt.output as qnout import qnt.stats as qns assets = qndata.stocks.load_ndx_list(tail=dt.timedelta(days=5*365)) data = qndata.stocks.load_ndx_data(tail=dt.timedelta(days=5*365), dims=("time", "field", "asset"), assets=assets_names, forward_order=True)
-
@support Thank you!
-
Hello
More examples are here https://github.com/quantiacs/toolbox/blob/main/qnt/tests/test_fundamental_data.py
This is a simple example.
import qnt.data as qndata import datetime as dt import qnt.data.secgov_indicators import qnt.data as qndata import qnt.stats as qns assets = qndata.stocks.load_ndx_list(tail=dt.timedelta(days=5 * 365)) assets_names = [i["id"] for i in assets] data = qndata.stocks.load_ndx_data(tail=dt.timedelta(days=5 * 365), dims=("time", "field", "asset"), assets=assets_names, forward_order=True) facts_names = ['operating_expense'] # 'assets', 'liabilities', 'ivestment_short_term' and other fundamental_data = qnt.data.secgov_load_indicators(assets, time_coord=data.time, standard_indicators=facts_names) # Operating expenses include marketing, noncapitalized R&D, # travel and entertainment, office supply, rent, salary, cogs... weights = fundamental_data.sel(field='operating_expense') is_liquid = data.sel(field="is_liquid") weights = weights * is_liquid # calc stats stats = qns.calc_stat(data, weights.sel(time=slice("2006-01-01", None))) display(stats.to_pandas().tail()) # graph performance = stats.to_pandas()["equity"] import qnt.graph as qngraph qngraph.make_plot_filled(performance.index, performance, name="PnL (Equity)", type="log")