{"id":13700042,"url":"https://github.com/jealous/cn_stock_src","last_synced_at":"2025-07-10T20:08:10.757Z","repository":{"id":36901852,"uuid":"41208871","full_name":"jealous/cn_stock_src","owner":"jealous","description":"Data source for stock data","archived":false,"fork":false,"pushed_at":"2016-11-09T16:45:26.000Z","size":293,"stargazers_count":33,"open_issues_count":0,"forks_count":13,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-19T22:53:03.394Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jealous.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-22T13:45:20.000Z","updated_at":"2025-04-01T19:45:44.000Z","dependencies_parsed_at":"2022-08-30T04:11:05.902Z","dependency_job_id":null,"html_url":"https://github.com/jealous/cn_stock_src","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/jealous/cn_stock_src","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jealous%2Fcn_stock_src","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jealous%2Fcn_stock_src/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jealous%2Fcn_stock_src/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jealous%2Fcn_stock_src/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jealous","download_url":"https://codeload.github.com/jealous/cn_stock_src/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jealous%2Fcn_stock_src/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264647620,"owners_count":23643651,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T20:00:47.682Z","updated_at":"2025-07-10T20:08:10.734Z","avatar_url":"https://github.com/jealous.png","language":"HTML","funding_links":[],"categories":["Python"],"sub_categories":["Data Sources"],"readme":"# Stock data source for Chinese markets\n\n[![Build Status](https://travis-ci.org/jealous/cn_stock_src.svg?branch=master)](https://travis-ci.org/jealous/cn_stock_src)\n[![Coverage Status](https://coveralls.io/repos/jealous/cn_stock_src/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/jealous/cn_stock_src?branch=master)\n\n## Introduction\n\nRetrieve stock data from web interface and saved in pandas ``DataFrame``.\n\nTested on python 2.7\n\n## Installation\n\n``pip install cn_stock_src``\n\n\n## Tutorial\n\n* Get the latest trading data for stock indices.\n\nExample:\n\n```python\nlatest('sh600000', 'sh600238', 'sz000001')\n```\n\nOutput:\n\n```\n          name   open  close  price   high    low     volume        amount  \\\nsh600000  浦发银行  13.93  14.22  12.87  13.95  12.80  334859429  4.407389e+09\nsh600238  海南椰岛  12.60  12.91  11.62  12.60  11.62   12069736  1.421766e+08\nsz000001  平安银行  11.10  11.50  10.35  11.17  10.35  151802968  1.601529e+09\n\n          buy1_volume  buy1_price    ...     sell2_volume  sell2_price  \\\nsh600000       981800       12.87    ...            71334        12.89\nsh600238            0        0.00    ...            12913        11.63\nsz000001            0        0.00    ...           284420        10.36\n\n          sell3_volume  sell3_price  sell4_volume  sell4_price  sell5_volume  \\\nsh600000        241900        12.90        238100        12.91         37500\nsh600238          2000        11.65          2300        11.68          9200\nsz000001         68739        10.37        212580        10.38         57200\n\n          sell5_price      date      time\nsh600000        12.92  20150824  15:03:04\nsh600238        11.70  20150824  15:03:04\nsz000001        10.39  20150824  15:05:55\n\n[3 rows x 30 columns]\n```\n\n* Get the basic company information for stock indices.\n\nExample:\n\n```python\nlatest_company_info('sh600000', 'sh600238', 'sz000001')\n```\n\nOutput:\n\n```\n             type pinyin  per-share earnings(year)  \nsh600000    A   pfyh                     2.521\nsh600238    A   hnyd                     0.090\nsz000001    A   payh                     1.730\n\n          per-share earnings(four quarters)  per-share earnings(quarter)  \nsh600000                             2.5877                       1.2810\nsh600238                             0.0038                       0.0033\nsz000001                             1.7603                       0.8400\n\n          net assets per share    unknown  general capital(10,000Y)  \nsh600000               13.7120  6085.9750              1865347.1415\nsh600238                1.9813   517.2827                44820.0000\nsz000001               10.5400  3688.2195              1430867.6139\n\n          floating stock(10,000Y)  floating A stock(10,000Y)  \nsh600000             1492277.7132               1492277.7132\nsh600238               44473.1580                 44473.1580\nsz000001             1180405.4579               1180405.4579\n\n          floating B stock(10,000Y) currency  annual net profit(10**8Y)  \nsh600000                          0      CNY                   470.2600\nsh600238                          0      CNY                     0.4189\nsz000001                          0      CNY                   198.0200\n\n          four quarters net profit(10**8Y)  issue price  unknown  \nsh600000                          482.7300         10.0        1\nsh600238                            0.0178          4.1        1\nsz000001                          213.1500         40.0        1\n\n          return on equity  quarter main business income(10**8Y)  \nsh600000              9.35                                707.01\nsh600238              0.17                                  1.88\nsz000001              7.68                                465.75\n\n          quarter net profit(10**8Y)\nsh600000                    239.0300\nsh600238                      0.0148\nsz000001                    115.8500\n```\n\n* Get the daily k-line for stock indices\n\nExample:\n\n```python\ndata = daily_k_line('sh600000', 'sh600238', 'sz000001')\ndata.next()\n```\n\nOutput:\n\n```\nsh600000      open      high       low     close     volume  adjClose\ndate\n19991110  29.50000  29.80000  27.00001  27.74999  617827800   5.03743\n19991111  27.57999  28.38001  27.52998  27.70999  104352900   5.03017\n19991112  27.86001  28.30001  27.77000  28.04998   53263200   5.09189\n...            ...       ...       ...       ...        ...       ...\n20150819  14.87000  15.17000  14.50000  15.00000  199062100  15.00000\n20150820  14.94000  14.99000  14.66000  14.68000   88124700  14.68000\n20150821  14.61000  14.74000  14.20000  14.22000  123792800  14.22000\n```\n\n* Get history basic financial data of a stock (by season).\n\nThis result is parsed from html from netease.  Use it with caution.\n\nExample:\n\n```python\nfinancial_info('sh600238')\n```\n\nOutput:\n\n```\n         name per-share earnings net assets per share  \\\ndate                                               \n20150930 海南椰岛      -0.03                 1.95   \n20150630 海南椰岛          0                 None   \n20150331 海南椰岛          0                 None   \n...\n         Net cash flow from operating activities per share  \\\ndate                                                         \n20150930                                             -0.22   \n20150630                                              None   \n20150331                                              None   \n...\n         main business income(10**5) main business profit(10**5)  \\\ndate                                                               \n20150930                        6827                        1967   \n20150630                        9150                        2929   \n20150331                        9649                        3658   \n...\n         operating profit(10**5) equity earnings(10**5)  \\\ndate                                                      \n20150930                   -2628                   -759   \n20150630                   -1232                   -104   \n20150331                      86                    550   \n...\n         net non-operating income(10**5) total profit(10**5)  \\\ndate                                                           \n20150930                            None               -1381   \n20150630                            None                 -49   \n20150331                            None                 275   \n...\n         net margin(10**5)  \\\ndate                         \n20150930             -1448   \n20150630                77   \n20150331                72   \n...\n         Net profit (ex. non recurring gains and losses)(10**5)  \\\ndate                                                              \n20150930                                               None       \n20150630                                               None       \n20150331                                               None       \n...\n         Net cash flow from operating activities(10**5)  \\\ndate                                                      \n20150930                                         -10066   \n20150630                                          -7532   \n20150331                                          -3412   \n...\n         Net increase in cash and cash equivalents(10**5) total assets(10**5)  \\\ndate                                                                            \n20150930                                            -7977              124629   \n20150630                                            -8384              126958   \n20150331                                             -912              137809   \n...\n         floating assets(10**5) gross liabilities(10**5)  \\\ndate                                                       \n20150930                  77675                    37206   \n20150630                  79353                    38078   \n20150331                  89095                    49008   \n...\n         floating liabilities(10**5) shareholders interests(10**5)  \\\ndate                                                                 \n20150930                       29585                         87346   \n20150630                       30422                         88801   \n20150331                       41316                         88723   \n...\n         net assets yield weighted (%)  \ndate                                    \n20150930                         -1.48  \n20150630                          0.17  \n20150331                          0.08  \n...\n         per-share earnings net assets per share  \\\ndate                                               \n20150930              -0.03                 1.95   \n20150630                  0                 None   \n20150331                  0                 None   \n...\n         Net cash flow from operating activities per share  \\\ndate                                                         \n20150930                                             -0.22   \n20150630                                              None   \n20150331                                              None   \n...\n         main business income(10**5) main business profit(10**5)  \\\ndate                                                               \n20150930                        6827                        1967   \n20150630                        9150                        2929   \n20150331                        9649                        3658   \n...\n         operating profit(10**5) equity earnings(10**5)  \\\ndate                                                      \n20150930                   -2628                   -759   \n20150630                   -1232                   -104   \n20150331                      86                    550   \n...\n         net non-operating income(10**5) total profit(10**5)  \\\ndate                                                           \n20150930                            None               -1381   \n20150630                            None                 -49   \n20150331                            None                 275   \n...\n         net margin(10**5)  \\\ndate                         \n20150930             -1448   \n20150630                77   \n20150331                72   \n...\n         Net profit (ex. non recurring gains and losses)(10**5)  \\\ndate                                                              \n20150930                                               None       \n20150630                                               None       \n20150331                                               None       \n...\n         Net cash flow from operating activities(10**5)  \\\ndate                                                      \n20150930                                         -10066   \n20150630                                          -7532   \n20150331                                          -3412   \n...\n         Net increase in cash and cash equivalents(10**5) total assets(10**5)  \\\ndate                                                                            \n20150930                                            -7977              124629   \n20150630                                            -8384              126958   \n20150331                                             -912              137809   \n...\n         floating assets(10**5) gross liabilities(10**5)  \\\ndate                                                       \n20150930                  77675                    37206   \n20150630                  79353                    38078   \n20150331                  89095                    49008   \n...\n         floating liabilities(10**5) shareholders interests(10**5)  \\\ndate                                                                 \n20150930                       29585                         87346   \n20150630                       30422                         88801   \n20150331                       41316                         88723   \n...\n         net assets yield weighted (%)  \ndate                                    \n20150930                         -1.48  \n20150630                          0.17  \n20150331                          0.08  \n...\n```\n\nTo file issue, please visit:\n\nhttps://github.com/jealous/cn_stock_src\n\n\nContact author:\n\ncedric.zhuang@gmail.com","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjealous%2Fcn_stock_src","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjealous%2Fcn_stock_src","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjealous%2Fcn_stock_src/lists"}