{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "5fa775be",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['akshare@1.0.8']\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "from dotenv import load_dotenv\n",
    "from openbb import obb\n",
    "\n",
    "if 'info' in obb.reference:\n",
    "    obj = obb.reference[\"info\"][\"extensions\"][\"openbb_provider_extension\"]\n",
    "    print([item for item in obj if \"akshare\" in item])\n",
    "\n",
    "symbols = \"601919,600519,000001,00300\"\n",
    "symbols_a = \"601919,600519,000001,600325,600028,600036,430047\"\n",
    "symbol_a = \"600325\"\n",
    "symbol_hk = \"01658\"\n",
    "provider = \"akshare\"\n",
    "\n",
    "load_dotenv() \n",
    "akshare_api_key = os.environ.get(\"AKSHARE_API_KEY\")\n",
    "if akshare_api_key is None:\n",
    "    raise ValueError(\"AKSHARE_API_KEY environment variable not set.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "5ffc81d6",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "2026-01-31 11:40:34,575 - openbb_akshare.utils.helpers - INFO - Getting equity 000001 historical data from cache...\n"
     ]
    }
   ],
   "source": [
    "result = obb.equity.price.historical(symbol='000001', provider='akshare')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "5dce0406",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "             open   high    low  close   volume        amount  change  \\\n",
      "date                                                                    \n",
      "2025-02-05  11.50  11.52  11.33  11.37   843434  9.611936e+08   -0.10   \n",
      "2025-02-06  11.35  11.45  11.30  11.36   955603  1.084793e+09   -0.01   \n",
      "2025-02-07  11.36  11.45  11.31  11.38  1407493  1.601622e+09    0.02   \n",
      "2025-02-10  11.38  11.50  11.36  11.43  1026591  1.174045e+09    0.05   \n",
      "2025-02-11  11.40  11.47  11.37  11.42   844520  9.638656e+08   -0.01   \n",
      "...           ...    ...    ...    ...      ...           ...     ...   \n",
      "2026-01-26  10.98  11.06  10.92  10.96  1106247  1.214803e+09   -0.03   \n",
      "2026-01-27  10.96  11.03  10.93  10.94   894091  9.811198e+08   -0.02   \n",
      "2026-01-28  10.94  10.99  10.82  10.84  1438766  1.570013e+09   -0.10   \n",
      "2026-01-29  10.84  10.98  10.66  10.96  1852994  2.001845e+09    0.12   \n",
      "2026-01-30  10.94  11.03  10.83  10.83  1091755  1.191181e+09   -0.13   \n",
      "\n",
      "            change_percent  \n",
      "date                        \n",
      "2025-02-05           -0.87  \n",
      "2025-02-06           -0.09  \n",
      "2025-02-07            0.18  \n",
      "2025-02-10            0.44  \n",
      "2025-02-11           -0.09  \n",
      "...                    ...  \n",
      "2026-01-26           -0.27  \n",
      "2026-01-27           -0.18  \n",
      "2026-01-28           -0.91  \n",
      "2026-01-29            1.11  \n",
      "2026-01-30           -1.19  \n",
      "\n",
      "[245 rows x 8 columns]\n"
     ]
    }
   ],
   "source": [
    "print(result.to_dataframe())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "7a29ee75",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>symbol</th>\n",
       "      <td>600325</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>period_ending</th>\n",
       "      <td>2025-06-30</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>fiscal_period</th>\n",
       "      <td>2025半年报</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>market_cap</th>\n",
       "      <td>15577180977.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>股票代码</th>\n",
       "      <td>600325.SH</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>证券简称</th>\n",
       "      <td>华发股份</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>基本每股收益(元)</th>\n",
       "      <td>0.062</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>扣非每股收益(元)</th>\n",
       "      <td>0.060</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>稀释每股收益(元)</th>\n",
       "      <td>0.060</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>每股净资产(元)</th>\n",
       "      <td>7.001</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>每股资本公积金(元)</th>\n",
       "      <td>0.413</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>每股未分配利润(元)</th>\n",
       "      <td>5.163</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>每股经营现金流(元)</th>\n",
       "      <td>3.450</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>营业总收入(元)</th>\n",
       "      <td>38,198,579,315.21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>净利润(元)</th>\n",
       "      <td>171,909,026.61</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>扣非净利润(元)</th>\n",
       "      <td>152,237,122.65</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>净资产收益率(%)</th>\n",
       "      <td>0.88%</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>销售毛利率(%)</th>\n",
       "      <td>14.16%</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>资产负债率(%)</th>\n",
       "      <td>69.91%</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>总股本(股)</th>\n",
       "      <td>2,752,152,116</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>流通股本(股)</th>\n",
       "      <td>2,752,152,116</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>pe_ratio</th>\n",
       "      <td>45.306</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>市盈率(TTM)</th>\n",
       "      <td>-109.568</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>市盈率(静)</th>\n",
       "      <td>16.375</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>市净率</th>\n",
       "      <td>0.806</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>52周最低</th>\n",
       "      <td>4.6731</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>52周最高</th>\n",
       "      <td>7.8937</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>股息(TTM)</th>\n",
       "      <td>0.124</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>股息率(TTM)</th>\n",
       "      <td>2.191</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>发行日期</th>\n",
       "      <td>2004-02-25 00:00:00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                 0\n",
       "symbol                      600325\n",
       "period_ending           2025-06-30\n",
       "fiscal_period              2025半年报\n",
       "market_cap           15577180977.0\n",
       "股票代码                     600325.SH\n",
       "证券简称                          华发股份\n",
       "基本每股收益(元)                    0.062\n",
       "扣非每股收益(元)                    0.060\n",
       "稀释每股收益(元)                    0.060\n",
       "每股净资产(元)                     7.001\n",
       "每股资本公积金(元)                   0.413\n",
       "每股未分配利润(元)                   5.163\n",
       "每股经营现金流(元)                   3.450\n",
       "营业总收入(元)         38,198,579,315.21\n",
       "净利润(元)              171,909,026.61\n",
       "扣非净利润(元)            152,237,122.65\n",
       "净资产收益率(%)                    0.88%\n",
       "销售毛利率(%)                    14.16%\n",
       "资产负债率(%)                    69.91%\n",
       "总股本(股)               2,752,152,116\n",
       "流通股本(股)              2,752,152,116\n",
       "pe_ratio                    45.306\n",
       "市盈率(TTM)                  -109.568\n",
       "市盈率(静)                      16.375\n",
       "市净率                          0.806\n",
       "52周最低                       4.6731\n",
       "52周最高                       7.8937\n",
       "股息(TTM)                      0.124\n",
       "股息率(TTM)                     2.191\n",
       "发行日期           2004-02-25 00:00:00"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "obb.equity.fundamental.metrics(symbol=symbol_a, provider=provider).to_dataframe().T"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "966ce661",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>title</th>\n",
       "      <th>url</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>date</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2025-11-25 07:52:56</th>\n",
       "      <td>华发股份:融资净偿还98.65万元,融资余额7.17亿元(11-24)</td>\n",
       "      <td>http://stock.eastmoney.com/a/20251125357352563...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2025-11-25 19:10:30</th>\n",
       "      <td>融创文旅最后时刻“附条件行权”,深圳前海冰雪世界项目股权迎变数</td>\n",
       "      <td>http://finance.eastmoney.com/a/202511253574369...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2025-11-25 19:52:03</th>\n",
       "      <td>华发股份:融创文旅拟回购深圳冰雪城项目股权</td>\n",
       "      <td>http://finance.eastmoney.com/a/202511253574395...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2025-11-26 07:35:13</th>\n",
       "      <td>华发股份:融资净买入46.32万元,融资余额7.18亿元(11-25)</td>\n",
       "      <td>http://stock.eastmoney.com/a/20251126357466675...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2025-11-26 19:55:22</th>\n",
       "      <td>融创文旅“压线”回购,华发前海冰雪世界归属再生波澜</td>\n",
       "      <td>http://finance.eastmoney.com/a/202511263575602...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2025-11-27 07:33:15</th>\n",
       "      <td>华发股份:融资净买入695.48万元,融资余额7.25亿元(11-26)</td>\n",
       "      <td>http://stock.eastmoney.com/a/20251127357585802...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2025-11-27 21:20:43</th>\n",
       "      <td>融创“奇袭”华发行使回购权,百亿冰雪资产引爆争夺战</td>\n",
       "      <td>http://finance.eastmoney.com/a/202511273576824...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2025-11-28 07:40:11</th>\n",
       "      <td>华发股份:融资净偿还283.6万元,融资余额7.22亿元(11-27)</td>\n",
       "      <td>http://stock.eastmoney.com/a/20251128357705772...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2025-11-29 07:46:59</th>\n",
       "      <td>华发股份:融资净买入174.04万元,融资余额7.24亿元(11-28)</td>\n",
       "      <td>http://stock.eastmoney.com/a/20251129357820361...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2025-11-29 11:11:09</th>\n",
       "      <td>争夺“全球最大室内滑雪场” 融创突袭回购华发深圳冰雪世界</td>\n",
       "      <td>http://finance.eastmoney.com/a/202511293578277...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2025-12-01 16:02:11</th>\n",
       "      <td>融创突袭回购华发冰雪世界,股权博弈背后的资本暗战</td>\n",
       "      <td>http://finance.eastmoney.com/a/202512013579139...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2025-12-02 07:45:30</th>\n",
       "      <td>华发股份:融资净买入2935.93万元,融资余额7.53亿元(12-01)</td>\n",
       "      <td>http://stock.eastmoney.com/a/20251202357971531...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2025-12-03 07:47:47</th>\n",
       "      <td>华发股份:连续3日融资净买入累计4195.01万元(12-02)</td>\n",
       "      <td>http://stock.eastmoney.com/a/20251203358088044...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2025-12-03 15:44:10</th>\n",
       "      <td>全球最大室内冰雪世界股权生变:融创欲“赎回”,华发称“正协商”</td>\n",
       "      <td>http://finance.eastmoney.com/a/202512033581505...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2025-12-04 07:48:00</th>\n",
       "      <td>华发股份:连续4日融资净买入累计4540.49万元(12-03)</td>\n",
       "      <td>http://stock.eastmoney.com/a/20251204358203565...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2025-12-05 07:32:51</th>\n",
       "      <td>华发股份:连续5日融资净买入累计5383.12万元(12-04)</td>\n",
       "      <td>http://stock.eastmoney.com/a/20251205358308367...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2025-12-06 03:23:33</th>\n",
       "      <td>深圳前海冰雪世界归属再生波折</td>\n",
       "      <td>http://finance.eastmoney.com/a/202512063584232...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2025-12-06 07:29:54</th>\n",
       "      <td>华发股份:融资净偿还389.37万元,融资余额7.72亿元(12-05)</td>\n",
       "      <td>http://stock.eastmoney.com/a/20251206358426521...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2025-12-08 22:05:35</th>\n",
       "      <td>华发股份:截至三季度末公司应付债券总金额为262.48亿元</td>\n",
       "      <td>http://finance.eastmoney.com/a/202512083585582...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2025-12-09 07:55:25</th>\n",
       "      <td>华发股份:融资净偿还463.37万元,融资余额7.67亿元(12-08)</td>\n",
       "      <td>http://stock.eastmoney.com/a/20251209358584061...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                     title  \\\n",
       "date                                                         \n",
       "2025-11-25 07:52:56    华发股份:融资净偿还98.65万元,融资余额7.17亿元(11-24)   \n",
       "2025-11-25 19:10:30        融创文旅最后时刻“附条件行权”,深圳前海冰雪世界项目股权迎变数   \n",
       "2025-11-25 19:52:03                  华发股份:融创文旅拟回购深圳冰雪城项目股权   \n",
       "2025-11-26 07:35:13    华发股份:融资净买入46.32万元,融资余额7.18亿元(11-25)   \n",
       "2025-11-26 19:55:22              融创文旅“压线”回购,华发前海冰雪世界归属再生波澜   \n",
       "2025-11-27 07:33:15   华发股份:融资净买入695.48万元,融资余额7.25亿元(11-26)   \n",
       "2025-11-27 21:20:43              融创“奇袭”华发行使回购权,百亿冰雪资产引爆争夺战   \n",
       "2025-11-28 07:40:11    华发股份:融资净偿还283.6万元,融资余额7.22亿元(11-27)   \n",
       "2025-11-29 07:46:59   华发股份:融资净买入174.04万元,融资余额7.24亿元(11-28)   \n",
       "2025-11-29 11:11:09           争夺“全球最大室内滑雪场” 融创突袭回购华发深圳冰雪世界   \n",
       "2025-12-01 16:02:11               融创突袭回购华发冰雪世界,股权博弈背后的资本暗战   \n",
       "2025-12-02 07:45:30  华发股份:融资净买入2935.93万元,融资余额7.53亿元(12-01)   \n",
       "2025-12-03 07:47:47       华发股份:连续3日融资净买入累计4195.01万元(12-02)   \n",
       "2025-12-03 15:44:10        全球最大室内冰雪世界股权生变:融创欲“赎回”,华发称“正协商”   \n",
       "2025-12-04 07:48:00       华发股份:连续4日融资净买入累计4540.49万元(12-03)   \n",
       "2025-12-05 07:32:51       华发股份:连续5日融资净买入累计5383.12万元(12-04)   \n",
       "2025-12-06 03:23:33                         深圳前海冰雪世界归属再生波折   \n",
       "2025-12-06 07:29:54   华发股份:融资净偿还389.37万元,融资余额7.72亿元(12-05)   \n",
       "2025-12-08 22:05:35          华发股份:截至三季度末公司应付债券总金额为262.48亿元   \n",
       "2025-12-09 07:55:25   华发股份:融资净偿还463.37万元,融资余额7.67亿元(12-08)   \n",
       "\n",
       "                                                                   url  \n",
       "date                                                                    \n",
       "2025-11-25 07:52:56  http://stock.eastmoney.com/a/20251125357352563...  \n",
       "2025-11-25 19:10:30  http://finance.eastmoney.com/a/202511253574369...  \n",
       "2025-11-25 19:52:03  http://finance.eastmoney.com/a/202511253574395...  \n",
       "2025-11-26 07:35:13  http://stock.eastmoney.com/a/20251126357466675...  \n",
       "2025-11-26 19:55:22  http://finance.eastmoney.com/a/202511263575602...  \n",
       "2025-11-27 07:33:15  http://stock.eastmoney.com/a/20251127357585802...  \n",
       "2025-11-27 21:20:43  http://finance.eastmoney.com/a/202511273576824...  \n",
       "2025-11-28 07:40:11  http://stock.eastmoney.com/a/20251128357705772...  \n",
       "2025-11-29 07:46:59  http://stock.eastmoney.com/a/20251129357820361...  \n",
       "2025-11-29 11:11:09  http://finance.eastmoney.com/a/202511293578277...  \n",
       "2025-12-01 16:02:11  http://finance.eastmoney.com/a/202512013579139...  \n",
       "2025-12-02 07:45:30  http://stock.eastmoney.com/a/20251202357971531...  \n",
       "2025-12-03 07:47:47  http://stock.eastmoney.com/a/20251203358088044...  \n",
       "2025-12-03 15:44:10  http://finance.eastmoney.com/a/202512033581505...  \n",
       "2025-12-04 07:48:00  http://stock.eastmoney.com/a/20251204358203565...  \n",
       "2025-12-05 07:32:51  http://stock.eastmoney.com/a/20251205358308367...  \n",
       "2025-12-06 03:23:33  http://finance.eastmoney.com/a/202512063584232...  \n",
       "2025-12-06 07:29:54  http://stock.eastmoney.com/a/20251206358426521...  \n",
       "2025-12-08 22:05:35  http://finance.eastmoney.com/a/202512083585582...  \n",
       "2025-12-09 07:55:25  http://stock.eastmoney.com/a/20251209358584061...  "
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "obb.news.company(\n",
    "        symbol=\"600325\", provider=\"akshare\", use_cache=True\n",
    "    ).to_dataframe()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "openbb-akshare-py3.12",
   "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.12.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}