Skip to content

Commit

Permalink
add fund analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
williamsyb committed Jan 17, 2021
1 parent 931f9b7 commit 0163b2f
Show file tree
Hide file tree
Showing 14 changed files with 30,267 additions and 995 deletions.
28,821 changes: 27,829 additions & 992 deletions notebooks/指数.ipynb

Large diffs are not rendered by default.

1,307 changes: 1,306 additions & 1 deletion notebooks/画图.ipynb

Large diffs are not rendered by default.

248 changes: 248 additions & 0 deletions notebooks/随意研究.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23656,6 +23656,254 @@
"ak.stock_zh_index_hist_csindex(symbol=\"H30533\")"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"本接口即将停止更新,请尽快使用Pro版接口:https://waditu.com/document/2\n"
]
},
{
"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>date</th>\n",
" <th>open</th>\n",
" <th>close</th>\n",
" <th>high</th>\n",
" <th>low</th>\n",
" <th>volume</th>\n",
" <th>code</th>\n",
" <th>upper</th>\n",
" <th>middle</th>\n",
" <th>lower</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>2020-08-20</td>\n",
" <td>80.00</td>\n",
" <td>77.39</td>\n",
" <td>80.00</td>\n",
" <td>77.11</td>\n",
" <td>57993.0</td>\n",
" <td>600600</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>2020-08-21</td>\n",
" <td>78.28</td>\n",
" <td>82.00</td>\n",
" <td>82.81</td>\n",
" <td>77.81</td>\n",
" <td>103342.0</td>\n",
" <td>600600</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>2020-08-24</td>\n",
" <td>82.15</td>\n",
" <td>82.00</td>\n",
" <td>83.87</td>\n",
" <td>81.15</td>\n",
" <td>71416.0</td>\n",
" <td>600600</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>2020-08-25</td>\n",
" <td>82.02</td>\n",
" <td>82.19</td>\n",
" <td>84.02</td>\n",
" <td>81.50</td>\n",
" <td>51316.0</td>\n",
" <td>600600</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>2020-08-26</td>\n",
" <td>82.03</td>\n",
" <td>82.59</td>\n",
" <td>84.00</td>\n",
" <td>81.16</td>\n",
" <td>62641.0</td>\n",
" <td>600600</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>95</th>\n",
" <td>2021-01-11</td>\n",
" <td>106.10</td>\n",
" <td>104.50</td>\n",
" <td>106.55</td>\n",
" <td>101.90</td>\n",
" <td>67829.0</td>\n",
" <td>600600</td>\n",
" <td>110.868916</td>\n",
" <td>102.9350</td>\n",
" <td>95.001084</td>\n",
" </tr>\n",
" <tr>\n",
" <th>96</th>\n",
" <td>2021-01-12</td>\n",
" <td>103.93</td>\n",
" <td>104.48</td>\n",
" <td>107.64</td>\n",
" <td>103.71</td>\n",
" <td>63452.0</td>\n",
" <td>600600</td>\n",
" <td>110.472445</td>\n",
" <td>102.7830</td>\n",
" <td>95.093555</td>\n",
" </tr>\n",
" <tr>\n",
" <th>97</th>\n",
" <td>2021-01-13</td>\n",
" <td>106.47</td>\n",
" <td>100.50</td>\n",
" <td>106.50</td>\n",
" <td>99.98</td>\n",
" <td>83290.0</td>\n",
" <td>600600</td>\n",
" <td>109.992639</td>\n",
" <td>102.4695</td>\n",
" <td>94.946361</td>\n",
" </tr>\n",
" <tr>\n",
" <th>98</th>\n",
" <td>2021-01-14</td>\n",
" <td>101.34</td>\n",
" <td>96.97</td>\n",
" <td>101.49</td>\n",
" <td>95.80</td>\n",
" <td>79097.0</td>\n",
" <td>600600</td>\n",
" <td>109.544039</td>\n",
" <td>101.9655</td>\n",
" <td>94.386961</td>\n",
" </tr>\n",
" <tr>\n",
" <th>99</th>\n",
" <td>2021-01-15</td>\n",
" <td>95.51</td>\n",
" <td>93.13</td>\n",
" <td>95.55</td>\n",
" <td>91.00</td>\n",
" <td>106162.0</td>\n",
" <td>600600</td>\n",
" <td>109.861399</td>\n",
" <td>101.4270</td>\n",
" <td>92.992601</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>100 rows × 10 columns</p>\n",
"</div>"
],
"text/plain": [
" date open close high low volume code upper \\\n",
"0 2020-08-20 80.00 77.39 80.00 77.11 57993.0 600600 NaN \n",
"1 2020-08-21 78.28 82.00 82.81 77.81 103342.0 600600 NaN \n",
"2 2020-08-24 82.15 82.00 83.87 81.15 71416.0 600600 NaN \n",
"3 2020-08-25 82.02 82.19 84.02 81.50 51316.0 600600 NaN \n",
"4 2020-08-26 82.03 82.59 84.00 81.16 62641.0 600600 NaN \n",
".. ... ... ... ... ... ... ... ... \n",
"95 2021-01-11 106.10 104.50 106.55 101.90 67829.0 600600 110.868916 \n",
"96 2021-01-12 103.93 104.48 107.64 103.71 63452.0 600600 110.472445 \n",
"97 2021-01-13 106.47 100.50 106.50 99.98 83290.0 600600 109.992639 \n",
"98 2021-01-14 101.34 96.97 101.49 95.80 79097.0 600600 109.544039 \n",
"99 2021-01-15 95.51 93.13 95.55 91.00 106162.0 600600 109.861399 \n",
"\n",
" middle lower \n",
"0 NaN NaN \n",
"1 NaN NaN \n",
"2 NaN NaN \n",
"3 NaN NaN \n",
"4 NaN NaN \n",
".. ... ... \n",
"95 102.9350 95.001084 \n",
"96 102.7830 95.093555 \n",
"97 102.4695 94.946361 \n",
"98 101.9655 94.386961 \n",
"99 101.4270 92.992601 \n",
"\n",
"[100 rows x 10 columns]"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pandas as pd\n",
"import numpy as np\n",
"import talib as ta\n",
"import tushare as ts\n",
"dw = ts.get_k_data(\"600600\")\n",
"dw = dw[-100:]\n",
"dw.index = range(len(dw))\n",
"dw['upper'], dw['middle'], dw['lower'] = ta.BBANDS(\n",
" dw.close.values,\n",
" timeperiod=20,\n",
" # number of non-biased standard deviations from the mean\n",
" nbdevup=2,\n",
" nbdevdn=2,\n",
" # Moving average type: simple moving average here\n",
" matype=0)\n",
"dw"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import setuptools

with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
Expand All @@ -12,7 +13,8 @@
# url="https://github.com/pypa/sampleproject",
# packages=setuptools.find_packages(), # 指定需要安装的模块
packages=['sniper', 'sniper.industry', 'sniper.plot', 'sniper.utils',
'sniper.env', 'sniper.protocol', 'sniper.csindex', 'sniper.index_finance'],
'sniper.env', 'sniper.protocol', 'sniper.csindex', 'sniper.index_finance', 'sniper.analysis',
'sniper.funds'],
# packages=find_packages(exclude=['contrib', 'docs', 'tests*']),
# py_modules=["six"], # 剔除不属于包的单文件Python模块
# install_requires=['peppercorn'], # 指定项目最低限度需要运行的依赖项
Expand Down
Empty file added sniper/analysis/__init__.py
Empty file.
Loading

0 comments on commit 0163b2f

Please sign in to comment.