Skip to content

Latest commit

 

History

History
executable file
·
627 lines (554 loc) · 15.4 KB

QA_FINANCIAL.md

File metadata and controls

executable file
·
627 lines (554 loc) · 15.4 KB

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 类

  1. QA_DataStruct_Financial 类, 可以直接加载在基础方法返回的dataframe中

QDF.get_report_by_date(code,date) 返回某个股票的某个时间点的财报

QDF.get_key(code,date,key) 返回某个股票某个时间点的财报的某个指标

import QUANTAXIS as QA
import pandas as pd
res=QA.QA_fetch_financial_report(['000001','600100'],['2017-03-31','2017-06-30','2017-09-31','2017-12-31','2018-03-31'])
res
EPS deductEPS undistributedProfitPerShare netAssetsPerShare capitalReservePerShare ROE operatingCashFlowPerShare moneyFunds tradingFinancialAssets billsReceivables ... netProfitLastYear 277 278 279 280 281 282 _id code report_date
report_date code
2017-03-31 000001 0.3100 0.3100 4.05 10.9400 3.29 2.992 -6.700 7.121477e+11 4.404400e+10 NaN ... 2.272700e+10 NaN NaN 2.0 6.955837e+08 2.89 0.3617 5b3edccc50d2c15048795415 000001 2017-03-31
2017-06-30 000001 0.6800 0.6800 4.26 11.1500 3.29 6.100 -7.470 7.522773e+11 4.908300e+10 NaN ... 2.286100e+10 NaN NaN 2.0 7.684470e+08 6.21 0.3670 5b3edcce50d2c15048796114 000001 2017-06-30
2017-12-31 000001 1.3000 1.3000 4.64 11.7706 3.29 11.474 -6.920 7.506320e+11 3.957500e+10 NaN ... 2.318900e+10 NaN NaN 3.0 1.071157e+09 11.62 0.2348 5b3edcd150d2c15048797c47 000001 2017-12-31
2018-03-31 000001 0.3300 0.3300 4.69 11.8500 3.29 3.242 2.410 6.699981e+11 7.684500e+10 NaN ... 2.357000e+10 NaN NaN 3.0 9.828775e+08 2.79 0.3818 5b3edcd250d2c15048798a07 000001 2018-03-31
2017-03-31 600100 -0.0908 -0.1030 2.57 7.1879 3.15 -1.263 -0.885 7.738101e+09 9.173491e+08 90043088.0 ... -1.169131e+09 NaN NaN 3.0 4.155126e+07 -1.25 -0.1030 5b3edccc50d2c15048795c3a 600100 2017-03-31
2017-06-30 600100 -0.0407 -0.0598 2.37 6.9775 3.15 -0.584 -1.124 8.756578e+09 7.745308e+08 52524456.0 ... -7.752181e+08 NaN NaN 3.0 4.842445e+07 -0.56 0.0432 5b3edcce50d2c15048796987 600100 2017-06-30
2017-12-31 600100 0.0350 -0.0115 2.45 7.1765 3.10 0.487 0.153 9.766134e+09 5.818680e+08 117617800.0 ... 1.036393e+08 NaN NaN 4.0 5.628596e+07 0.48 0.0791 5b3edcd150d2c150487984ca 600100 2017-12-31
2018-03-31 600100 -0.0756 -0.0871 2.37 7.1433 3.20 -1.058 -0.757 7.666613e+09 5.546273e+08 97230120.0 ... 1.487741e+08 NaN NaN 2.0 4.165037e+07 -1.06 -0.0871 5b3edcd250d2c15048799289 600100 2018-03-31

8 rows × 285 columns

res_adv=QA.QA_fetch_financial_report_adv('000001','2017-01-01','2018-05-01')
res_adv
< QA_DataStruct_Financial >
res_adv.data
EPS deductEPS undistributedProfitPerShare netAssetsPerShare capitalReservePerShare ROE operatingCashFlowPerShare moneyFunds tradingFinancialAssets billsReceivables ... netProfitLastYear 277 278 279 280 281 282 _id code report_date
report_date code
2017-03-31 000001 0.31 0.31 4.05 10.9400 3.29 2.992 -6.70 7.121477e+11 4.404400e+10 NaN ... 2.272700e+10 NaN NaN 2.0 6.955837e+08 2.89 0.3617 5b3edccc50d2c15048795415 000001 2017-03-31
2017-06-30 000001 0.68 0.68 4.26 11.1500 3.29 6.100 -7.47 7.522773e+11 4.908300e+10 NaN ... 2.286100e+10 NaN NaN 2.0 7.684470e+08 6.21 0.3670 5b3edcce50d2c15048796114 000001 2017-06-30
2017-09-30 000001 1.06 1.06 4.64 11.5400 3.29 8.782 -9.20 7.265024e+11 4.132700e+10 NaN ... 2.303300e+10 NaN NaN 3.0 8.339691e+08 9.60 0.3854 5b3edccf50d2c15048796eaa 000001 2017-09-30
2017-12-31 000001 1.30 1.30 4.64 11.7706 3.29 11.474 -6.92 7.506320e+11 3.957500e+10 NaN ... 2.318900e+10 NaN NaN 3.0 1.071157e+09 11.62 0.2348 5b3edcd150d2c15048797c47 000001 2017-12-31
2018-03-31 000001 0.33 0.33 4.69 11.8500 3.29 3.242 2.41 6.699981e+11 7.684500e+10 NaN ... 2.357000e+10 NaN NaN 3.0 9.828775e+08 2.79 0.3818 5b3edcd250d2c15048798a07 000001 2018-03-31

5 rows × 285 columns

fds=QA.QA_DataStruct_Financial(res)
fds
< QA_DataStruct_Financial >
fds.get_key('600100','2017-03-31','ROE')
-1.2630000114
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