diff --git a/Documents/QA_FINANCIAL.md b/Documents/QA_FINANCIAL.md new file mode 100644 index 000000000..f055483bf --- /dev/null +++ b/Documents/QA_FINANCIAL.md @@ -0,0 +1,651 @@ +# QUANTAXIS 的一般/高级财务方法 + + +1.QA.QA_fetch_financial_report(code,report_date) + +其中, report_date 是需要手动指定的财务时间, 可以是单个时间,也可以是一列时间: + > '2018-03-31' 或者['2017-03-31','2017-06-30','2017-09-31','2017-12-31','2018-03-31'] + > 此方法的意义在于指定特定的财务时间(如年报) + +返回的是一个MultiIndex的dataframe + +2.QA.QA_fetch_financial_report_adv(code,start,end) + +支持随意的跨时间索引, start 和end不用刻意指定 + +如果end不写,则start参数等同于report_date的用法 + +返回的是QA_DataStruct_Financial 类 + +3. QA_DataStruct_Financial 类, 可以直接加载在基础方法返回的dataframe中 + +> QDF.get_report_by_date(code,date) 返回某个股票的某个时间点的财报 + +> QDF.get_key(code,date,key) 返回某个股票某个时间点的财报的某个指标 + + + +```python +import QUANTAXIS as QA +import pandas as pd + +``` +```python +res=QA.QA_fetch_financial_report(['000001','600100'],['2017-03-31','2017-06-30','2017-09-31','2017-12-31','2018-03-31']) +``` + + +```python +res +``` + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EPSdeductEPSundistributedProfitPerSharenetAssetsPerSharecapitalReservePerShareROEoperatingCashFlowPerSharemoneyFundstradingFinancialAssetsbillsReceivables...netProfitLastYear277278279280281282_idcodereport_date
report_datecode
2017-03-310000010.31000.31004.0510.94003.292.992-6.7007.121477e+114.404400e+10NaN...2.272700e+10NaNNaN2.06.955837e+082.890.36175b3edccc50d2c150487954150000012017-03-31
2017-06-300000010.68000.68004.2611.15003.296.100-7.4707.522773e+114.908300e+10NaN...2.286100e+10NaNNaN2.07.684470e+086.210.36705b3edcce50d2c150487961140000012017-06-30
2017-12-310000011.30001.30004.6411.77063.2911.474-6.9207.506320e+113.957500e+10NaN...2.318900e+10NaNNaN3.01.071157e+0911.620.23485b3edcd150d2c15048797c470000012017-12-31
2018-03-310000010.33000.33004.6911.85003.293.2422.4106.699981e+117.684500e+10NaN...2.357000e+10NaNNaN3.09.828775e+082.790.38185b3edcd250d2c15048798a070000012018-03-31
2017-03-31600100-0.0908-0.10302.577.18793.15-1.263-0.8857.738101e+099.173491e+0890043088.0...-1.169131e+09NaNNaN3.04.155126e+07-1.25-0.10305b3edccc50d2c15048795c3a6001002017-03-31
2017-06-30600100-0.0407-0.05982.376.97753.15-0.584-1.1248.756578e+097.745308e+0852524456.0...-7.752181e+08NaNNaN3.04.842445e+07-0.560.04325b3edcce50d2c150487969876001002017-06-30
2017-12-316001000.0350-0.01152.457.17653.100.4870.1539.766134e+095.818680e+08117617800.0...1.036393e+08NaNNaN4.05.628596e+070.480.07915b3edcd150d2c150487984ca6001002017-12-31
2018-03-31600100-0.0756-0.08712.377.14333.20-1.058-0.7577.666613e+095.546273e+0897230120.0...1.487741e+08NaNNaN2.04.165037e+07-1.06-0.08715b3edcd250d2c150487992896001002018-03-31
+

8 rows × 285 columns

+
+ + + + +```python +res_adv=QA.QA_fetch_financial_report_adv('000001','2017-01-01','2018-05-01') +``` + + +```python +res_adv +``` + + + + + < QA_DataStruct_Financial > + + + + +```python +res_adv.data +``` + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EPSdeductEPSundistributedProfitPerSharenetAssetsPerSharecapitalReservePerShareROEoperatingCashFlowPerSharemoneyFundstradingFinancialAssetsbillsReceivables...netProfitLastYear277278279280281282_idcodereport_date
report_datecode
2017-03-310000010.310.314.0510.94003.292.992-6.707.121477e+114.404400e+10NaN...2.272700e+10NaNNaN2.06.955837e+082.890.36175b3edccc50d2c150487954150000012017-03-31
2017-06-300000010.680.684.2611.15003.296.100-7.477.522773e+114.908300e+10NaN...2.286100e+10NaNNaN2.07.684470e+086.210.36705b3edcce50d2c150487961140000012017-06-30
2017-09-300000011.061.064.6411.54003.298.782-9.207.265024e+114.132700e+10NaN...2.303300e+10NaNNaN3.08.339691e+089.600.38545b3edccf50d2c15048796eaa0000012017-09-30
2017-12-310000011.301.304.6411.77063.2911.474-6.927.506320e+113.957500e+10NaN...2.318900e+10NaNNaN3.01.071157e+0911.620.23485b3edcd150d2c15048797c470000012017-12-31
2018-03-310000010.330.334.6911.85003.293.2422.416.699981e+117.684500e+10NaN...2.357000e+10NaNNaN3.09.828775e+082.790.38185b3edcd250d2c15048798a070000012018-03-31
+

5 rows × 285 columns

+
+ + + + +```python +fds=QA.QA_DataStruct_Financial(res) +``` + + +```python +fds +``` + + + + + < QA_DataStruct_Financial > + + + + +```python +fds.get_key('600100','2017-03-31','ROE') +``` + + + + + -1.2630000114 + + + + +```python +fds.get_report_by_date('600100','2017-03-31') +``` + + + + + EPS -0.0908 + deductEPS -0.103 + undistributedProfitPerShare 2.57 + netAssetsPerShare 7.1879 + capitalReservePerShare 3.15 + ROE -1.263 + operatingCashFlowPerShare -0.885 + moneyFunds 7.7381e+09 + tradingFinancialAssets 9.17349e+08 + billsReceivables 9.00431e+07 + accountsReceivables 7.19131e+09 + prepayments 1.51541e+09 + otherReceivables 9.41644e+08 + interCompanyReceivables NaN + interestReceivables 0 + dividendsReceivables 1.68134e+07 + inventory 9.57452e+09 + expendableBiologicalAssets NaN + noncurrentAssetsDueWithinOneYear 0 + otherLiquidAssets 3.17298e+09 + totalLiquidAssets 3.11582e+10 + availableForSaleSecurities 2.92698e+09 + heldToMaturityInvestments 0 + longTermReceivables 8.95877e+08 + longTermEquityInvestment 1.33009e+10 + investmentRealEstate 1.45896e+07 + fixedAssets 3.26195e+09 + constructionInProgress 6.67087e+08 + engineerMaterial 0 + fixedAssetsCleanUp 0 + ... + socialSecurityNumber NaN + socialSecurityShareholding NaN + privateEquityNumber 1 + privateEquityShareholding 8.00007e+06 + financialCompanyNumber NaN + financialCompanyShareholding NaN + pensionInsuranceAgencyNumber NaN + pensionInsuranceAgencyShareholfing NaN + totalNumberOfTopTenCirculationShareholders 5.85248e+08 + firstLargeCirculationShareholdersNumber 4.73639e+08 + freeCirculationStock 1.72424e+09 + limitedCirculationAShares 7.66017e+08 + generalRiskPreparation NaN + otherComprehensiveIncome -2.10654e+08 + totalComprehensiveIncome -5.05396e+08 + shareholdersOwnershipOfAParentCompany 2.13041e+10 + bankInstutionNumber NaN + bankInstutionShareholding NaN + corporationNumber 1 + corporationShareholding 4.73639e+08 + netProfitLastYear -1.16913e+09 + 277 NaN + 278 NaN + 279 3 + 280 4.15513e+07 + 281 -1.25 + 282 -0.103 + _id 5b3edccc50d2c15048795c3a + code 600100 + report_date 2017-03-31 00:00:00 + Name: (2017-03-31 00:00:00, 600100), Length: 285, dtype: object + + + + +```python + + +``` diff --git a/QUANTAXIS/QAData/QAFinancialStruct.py b/QUANTAXIS/QAData/QAFinancialStruct.py index 48900091c..a48d16bee 100644 --- a/QUANTAXIS/QAData/QAFinancialStruct.py +++ b/QUANTAXIS/QAData/QAFinancialStruct.py @@ -44,8 +44,8 @@ def __repr__(self): def get_report_by_date(self, code, date): return self.data.loc[pd.Timestamp(date), code] - def get_key(self, code, reportdate, values): + def get_key(self, code, reportdate, key): if isinstance(reportdate, list): - return self.data.loc[(slice(pd.Timestamp(reportdate[0]), pd.Timestamp(reportdate[-1])), code), values] + return self.data.loc[(slice(pd.Timestamp(reportdate[0]), pd.Timestamp(reportdate[-1])), code), key] else: - return self.data.loc[(pd.Timestamp(reportdate), code), values] + return self.data.loc[(pd.Timestamp(reportdate), code), key] diff --git a/jupyterexample/QA_FINANCIAL.ipynb b/jupyterexample/QA_FINANCIAL.ipynb new file mode 100644 index 000000000..d657bd50e --- /dev/null +++ b/jupyterexample/QA_FINANCIAL.ipynb @@ -0,0 +1,891 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [ + "import QUANTAXIS as QA\n", + "import pandas as pd\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## QUANTAXIS 的一般/高级财务方法\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "1.QA.QA_fetch_financial_report(code,report_date)\n", + "\n", + "其中, report_date 是需要手动指定的财务时间, 可以是单个时间,也可以是一列时间:\n", + " > '2018-03-31' 或者['2017-03-31','2017-06-30','2017-09-31','2017-12-31','2018-03-31']\n", + " > 此方法的意义在于指定特定的财务时间(如年报)\n", + " \n", + "返回的是一个MultiIndex的dataframe\n", + " \n", + "2.QA.QA_fetch_financial_report_adv(code,start,end)\n", + "\n", + "支持随意的跨时间索引, start 和end不用刻意指定\n", + "\n", + "如果end不写,则start参数等同于report_date的用法\n", + "\n", + "返回的是QA_DataStruct_Financial 类\n", + "\n", + "3. QA_DataStruct_Financial 类, 可以直接加载在基础方法返回的dataframe中\n", + "\n", + "> QDF.get_report_by_date(code,date) 返回某个股票的某个时间点的财报\n", + "\n", + "> QDF.get_key(code,date,key) 返回某个股票某个时间点的财报的某个指标" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "res=QA.QA_fetch_financial_report(['000001','600100'],['2017-03-31','2017-06-30','2017-09-31','2017-12-31','2018-03-31'])" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
EPSdeductEPSundistributedProfitPerSharenetAssetsPerSharecapitalReservePerShareROEoperatingCashFlowPerSharemoneyFundstradingFinancialAssetsbillsReceivables...netProfitLastYear277278279280281282_idcodereport_date
report_datecode
2017-03-310000010.31000.31004.0510.94003.292.992-6.7007.121477e+114.404400e+10NaN...2.272700e+10NaNNaN2.06.955837e+082.890.36175b3edccc50d2c150487954150000012017-03-31
2017-06-300000010.68000.68004.2611.15003.296.100-7.4707.522773e+114.908300e+10NaN...2.286100e+10NaNNaN2.07.684470e+086.210.36705b3edcce50d2c150487961140000012017-06-30
2017-12-310000011.30001.30004.6411.77063.2911.474-6.9207.506320e+113.957500e+10NaN...2.318900e+10NaNNaN3.01.071157e+0911.620.23485b3edcd150d2c15048797c470000012017-12-31
2018-03-310000010.33000.33004.6911.85003.293.2422.4106.699981e+117.684500e+10NaN...2.357000e+10NaNNaN3.09.828775e+082.790.38185b3edcd250d2c15048798a070000012018-03-31
2017-03-31600100-0.0908-0.10302.577.18793.15-1.263-0.8857.738101e+099.173491e+0890043088.0...-1.169131e+09NaNNaN3.04.155126e+07-1.25-0.10305b3edccc50d2c15048795c3a6001002017-03-31
2017-06-30600100-0.0407-0.05982.376.97753.15-0.584-1.1248.756578e+097.745308e+0852524456.0...-7.752181e+08NaNNaN3.04.842445e+07-0.560.04325b3edcce50d2c150487969876001002017-06-30
2017-12-316001000.0350-0.01152.457.17653.100.4870.1539.766134e+095.818680e+08117617800.0...1.036393e+08NaNNaN4.05.628596e+070.480.07915b3edcd150d2c150487984ca6001002017-12-31
2018-03-31600100-0.0756-0.08712.377.14333.20-1.058-0.7577.666613e+095.546273e+0897230120.0...1.487741e+08NaNNaN2.04.165037e+07-1.06-0.08715b3edcd250d2c150487992896001002018-03-31
\n", + "

8 rows × 285 columns

\n", + "
" + ], + "text/plain": [ + " EPS deductEPS undistributedProfitPerShare \\\n", + "report_date code \n", + "2017-03-31 000001 0.3100 0.3100 4.05 \n", + "2017-06-30 000001 0.6800 0.6800 4.26 \n", + "2017-12-31 000001 1.3000 1.3000 4.64 \n", + "2018-03-31 000001 0.3300 0.3300 4.69 \n", + "2017-03-31 600100 -0.0908 -0.1030 2.57 \n", + "2017-06-30 600100 -0.0407 -0.0598 2.37 \n", + "2017-12-31 600100 0.0350 -0.0115 2.45 \n", + "2018-03-31 600100 -0.0756 -0.0871 2.37 \n", + "\n", + " netAssetsPerShare capitalReservePerShare ROE \\\n", + "report_date code \n", + "2017-03-31 000001 10.9400 3.29 2.992 \n", + "2017-06-30 000001 11.1500 3.29 6.100 \n", + "2017-12-31 000001 11.7706 3.29 11.474 \n", + "2018-03-31 000001 11.8500 3.29 3.242 \n", + "2017-03-31 600100 7.1879 3.15 -1.263 \n", + "2017-06-30 600100 6.9775 3.15 -0.584 \n", + "2017-12-31 600100 7.1765 3.10 0.487 \n", + "2018-03-31 600100 7.1433 3.20 -1.058 \n", + "\n", + " operatingCashFlowPerShare moneyFunds \\\n", + "report_date code \n", + "2017-03-31 000001 -6.700 7.121477e+11 \n", + "2017-06-30 000001 -7.470 7.522773e+11 \n", + "2017-12-31 000001 -6.920 7.506320e+11 \n", + "2018-03-31 000001 2.410 6.699981e+11 \n", + "2017-03-31 600100 -0.885 7.738101e+09 \n", + "2017-06-30 600100 -1.124 8.756578e+09 \n", + "2017-12-31 600100 0.153 9.766134e+09 \n", + "2018-03-31 600100 -0.757 7.666613e+09 \n", + "\n", + " tradingFinancialAssets billsReceivables ... \\\n", + "report_date code ... \n", + "2017-03-31 000001 4.404400e+10 NaN ... \n", + "2017-06-30 000001 4.908300e+10 NaN ... \n", + "2017-12-31 000001 3.957500e+10 NaN ... \n", + "2018-03-31 000001 7.684500e+10 NaN ... \n", + "2017-03-31 600100 9.173491e+08 90043088.0 ... \n", + "2017-06-30 600100 7.745308e+08 52524456.0 ... \n", + "2017-12-31 600100 5.818680e+08 117617800.0 ... \n", + "2018-03-31 600100 5.546273e+08 97230120.0 ... \n", + "\n", + " netProfitLastYear 277 278 279 280 281 \\\n", + "report_date code \n", + "2017-03-31 000001 2.272700e+10 NaN NaN 2.0 6.955837e+08 2.89 \n", + "2017-06-30 000001 2.286100e+10 NaN NaN 2.0 7.684470e+08 6.21 \n", + "2017-12-31 000001 2.318900e+10 NaN NaN 3.0 1.071157e+09 11.62 \n", + "2018-03-31 000001 2.357000e+10 NaN NaN 3.0 9.828775e+08 2.79 \n", + "2017-03-31 600100 -1.169131e+09 NaN NaN 3.0 4.155126e+07 -1.25 \n", + "2017-06-30 600100 -7.752181e+08 NaN NaN 3.0 4.842445e+07 -0.56 \n", + "2017-12-31 600100 1.036393e+08 NaN NaN 4.0 5.628596e+07 0.48 \n", + "2018-03-31 600100 1.487741e+08 NaN NaN 2.0 4.165037e+07 -1.06 \n", + "\n", + " 282 _id code report_date \n", + "report_date code \n", + "2017-03-31 000001 0.3617 5b3edccc50d2c15048795415 000001 2017-03-31 \n", + "2017-06-30 000001 0.3670 5b3edcce50d2c15048796114 000001 2017-06-30 \n", + "2017-12-31 000001 0.2348 5b3edcd150d2c15048797c47 000001 2017-12-31 \n", + "2018-03-31 000001 0.3818 5b3edcd250d2c15048798a07 000001 2018-03-31 \n", + "2017-03-31 600100 -0.1030 5b3edccc50d2c15048795c3a 600100 2017-03-31 \n", + "2017-06-30 600100 0.0432 5b3edcce50d2c15048796987 600100 2017-06-30 \n", + "2017-12-31 600100 0.0791 5b3edcd150d2c150487984ca 600100 2017-12-31 \n", + "2018-03-31 600100 -0.0871 5b3edcd250d2c15048799289 600100 2018-03-31 \n", + "\n", + "[8 rows x 285 columns]" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "res_adv=QA.QA_fetch_financial_report_adv('000001','2017-01-01','2018-05-01')" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "< QA_DataStruct_Financial >" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res_adv" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
EPSdeductEPSundistributedProfitPerSharenetAssetsPerSharecapitalReservePerShareROEoperatingCashFlowPerSharemoneyFundstradingFinancialAssetsbillsReceivables...netProfitLastYear277278279280281282_idcodereport_date
report_datecode
2017-03-310000010.310.314.0510.94003.292.992-6.707.121477e+114.404400e+10NaN...2.272700e+10NaNNaN2.06.955837e+082.890.36175b3edccc50d2c150487954150000012017-03-31
2017-06-300000010.680.684.2611.15003.296.100-7.477.522773e+114.908300e+10NaN...2.286100e+10NaNNaN2.07.684470e+086.210.36705b3edcce50d2c150487961140000012017-06-30
2017-09-300000011.061.064.6411.54003.298.782-9.207.265024e+114.132700e+10NaN...2.303300e+10NaNNaN3.08.339691e+089.600.38545b3edccf50d2c15048796eaa0000012017-09-30
2017-12-310000011.301.304.6411.77063.2911.474-6.927.506320e+113.957500e+10NaN...2.318900e+10NaNNaN3.01.071157e+0911.620.23485b3edcd150d2c15048797c470000012017-12-31
2018-03-310000010.330.334.6911.85003.293.2422.416.699981e+117.684500e+10NaN...2.357000e+10NaNNaN3.09.828775e+082.790.38185b3edcd250d2c15048798a070000012018-03-31
\n", + "

5 rows × 285 columns

\n", + "
" + ], + "text/plain": [ + " EPS deductEPS undistributedProfitPerShare \\\n", + "report_date code \n", + "2017-03-31 000001 0.31 0.31 4.05 \n", + "2017-06-30 000001 0.68 0.68 4.26 \n", + "2017-09-30 000001 1.06 1.06 4.64 \n", + "2017-12-31 000001 1.30 1.30 4.64 \n", + "2018-03-31 000001 0.33 0.33 4.69 \n", + "\n", + " netAssetsPerShare capitalReservePerShare ROE \\\n", + "report_date code \n", + "2017-03-31 000001 10.9400 3.29 2.992 \n", + "2017-06-30 000001 11.1500 3.29 6.100 \n", + "2017-09-30 000001 11.5400 3.29 8.782 \n", + "2017-12-31 000001 11.7706 3.29 11.474 \n", + "2018-03-31 000001 11.8500 3.29 3.242 \n", + "\n", + " operatingCashFlowPerShare moneyFunds \\\n", + "report_date code \n", + "2017-03-31 000001 -6.70 7.121477e+11 \n", + "2017-06-30 000001 -7.47 7.522773e+11 \n", + "2017-09-30 000001 -9.20 7.265024e+11 \n", + "2017-12-31 000001 -6.92 7.506320e+11 \n", + "2018-03-31 000001 2.41 6.699981e+11 \n", + "\n", + " tradingFinancialAssets billsReceivables ... \\\n", + "report_date code ... \n", + "2017-03-31 000001 4.404400e+10 NaN ... \n", + "2017-06-30 000001 4.908300e+10 NaN ... \n", + "2017-09-30 000001 4.132700e+10 NaN ... \n", + "2017-12-31 000001 3.957500e+10 NaN ... \n", + "2018-03-31 000001 7.684500e+10 NaN ... \n", + "\n", + " netProfitLastYear 277 278 279 280 281 \\\n", + "report_date code \n", + "2017-03-31 000001 2.272700e+10 NaN NaN 2.0 6.955837e+08 2.89 \n", + "2017-06-30 000001 2.286100e+10 NaN NaN 2.0 7.684470e+08 6.21 \n", + "2017-09-30 000001 2.303300e+10 NaN NaN 3.0 8.339691e+08 9.60 \n", + "2017-12-31 000001 2.318900e+10 NaN NaN 3.0 1.071157e+09 11.62 \n", + "2018-03-31 000001 2.357000e+10 NaN NaN 3.0 9.828775e+08 2.79 \n", + "\n", + " 282 _id code report_date \n", + "report_date code \n", + "2017-03-31 000001 0.3617 5b3edccc50d2c15048795415 000001 2017-03-31 \n", + "2017-06-30 000001 0.3670 5b3edcce50d2c15048796114 000001 2017-06-30 \n", + "2017-09-30 000001 0.3854 5b3edccf50d2c15048796eaa 000001 2017-09-30 \n", + "2017-12-31 000001 0.2348 5b3edcd150d2c15048797c47 000001 2017-12-31 \n", + "2018-03-31 000001 0.3818 5b3edcd250d2c15048798a07 000001 2018-03-31 \n", + "\n", + "[5 rows x 285 columns]" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "res_adv.data" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [ + "fds=QA.QA_DataStruct_Financial(res)" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "< QA_DataStruct_Financial >" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fds" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "-1.2630000114" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fds.get_key('600100','2017-03-31','ROE')" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "EPS -0.0908\n", + "deductEPS -0.103\n", + "undistributedProfitPerShare 2.57\n", + "netAssetsPerShare 7.1879\n", + "capitalReservePerShare 3.15\n", + "ROE -1.263\n", + "operatingCashFlowPerShare -0.885\n", + "moneyFunds 7.7381e+09\n", + "tradingFinancialAssets 9.17349e+08\n", + "billsReceivables 9.00431e+07\n", + "accountsReceivables 7.19131e+09\n", + "prepayments 1.51541e+09\n", + "otherReceivables 9.41644e+08\n", + "interCompanyReceivables NaN\n", + "interestReceivables 0\n", + "dividendsReceivables 1.68134e+07\n", + "inventory 9.57452e+09\n", + "expendableBiologicalAssets NaN\n", + "noncurrentAssetsDueWithinOneYear 0\n", + "otherLiquidAssets 3.17298e+09\n", + "totalLiquidAssets 3.11582e+10\n", + "availableForSaleSecurities 2.92698e+09\n", + "heldToMaturityInvestments 0\n", + "longTermReceivables 8.95877e+08\n", + "longTermEquityInvestment 1.33009e+10\n", + "investmentRealEstate 1.45896e+07\n", + "fixedAssets 3.26195e+09\n", + "constructionInProgress 6.67087e+08\n", + "engineerMaterial 0\n", + "fixedAssetsCleanUp 0\n", + " ... \n", + "socialSecurityNumber NaN\n", + "socialSecurityShareholding NaN\n", + "privateEquityNumber 1\n", + "privateEquityShareholding 8.00007e+06\n", + "financialCompanyNumber NaN\n", + "financialCompanyShareholding NaN\n", + "pensionInsuranceAgencyNumber NaN\n", + "pensionInsuranceAgencyShareholfing NaN\n", + "totalNumberOfTopTenCirculationShareholders 5.85248e+08\n", + "firstLargeCirculationShareholdersNumber 4.73639e+08\n", + "freeCirculationStock 1.72424e+09\n", + "limitedCirculationAShares 7.66017e+08\n", + "generalRiskPreparation NaN\n", + "otherComprehensiveIncome -2.10654e+08\n", + "totalComprehensiveIncome -5.05396e+08\n", + "shareholdersOwnershipOfAParentCompany 2.13041e+10\n", + "bankInstutionNumber NaN\n", + "bankInstutionShareholding NaN\n", + "corporationNumber 1\n", + "corporationShareholding 4.73639e+08\n", + "netProfitLastYear -1.16913e+09\n", + "277 NaN\n", + "278 NaN\n", + "279 3\n", + "280 4.15513e+07\n", + "281 -1.25\n", + "282 -0.103\n", + "_id 5b3edccc50d2c15048795c3a\n", + "code 600100\n", + "report_date 2017-03-31 00:00:00\n", + "Name: (2017-03-31 00:00:00, 600100), Length: 285, dtype: object" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "fds.get_report_by_date('600100','2017-03-31')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.5" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}