Commit 61bfd381 authored by Dr.李's avatar Dr.李

update all the examples

parent 8839d11c
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"* 请在环境变量中设置`DB_URI`指向数据库"
]
},
{
"cell_type": "code",
"execution_count": null,
......@@ -8,6 +15,7 @@
"source": [
"%matplotlib inline\n",
"\n",
"import os\n",
"import numpy as np\n",
"import pandas as pd\n",
"from matplotlib import pyplot as plt\n",
......@@ -47,7 +55,7 @@
"ref_dates = makeSchedule(start_date, end_date, frequency, 'china.sse')\n",
"\n",
"executor = NaiveExecutor()\n",
"data_source = 'postgres+psycopg2://postgres:A12345678!@10.63.6.220/alpha'\n",
"data_source = os.environ['DB_URI']\n",
"engine = SqlEngine(data_source)"
]
},
......@@ -278,13 +286,6 @@
" ic_res.to_excel(writer, sheet_name='ic_stat')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
......@@ -309,7 +310,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
"version": "3.6.3"
},
"varInspector": {
"cols": {
......
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"* 请在环境变量中设置`DB_URI`指向数据库"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import numpy as np\n",
"import pandas as pd\n",
"from cvxpy import *\n",
......@@ -31,7 +39,7 @@
"risk_penlty = 0.5\n",
"ref_date = '2018-02-08'\n",
"\n",
"engine = SqlEngine()\n",
"engine = SqlEngine(os.environ['DB_URI'])\n",
"universe = Universe('custom', ['ashare_ex'])\n",
"codes = engine.fetch_codes(ref_date, universe)\n",
"\n",
......@@ -331,7 +339,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
"version": "3.6.3"
},
"varInspector": {
"cols": {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -4,7 +4,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"> The methodolegy is similar to The Barra China Equity Model (CNE5)'s documentation"
"* 方法参考自 The Barra China Equity Model (CNE5)'s 文档\n",
"\n",
"* 请在环境变量中设置`DB_URI`指向数据库"
]
},
{
......@@ -15,6 +17,7 @@
"source": [
"%matplotlib inline\n",
"\n",
"import os\n",
"import numpy as np\n",
"import pandas as pd\n",
"from matplotlib import pyplot as plt\n",
......@@ -54,7 +57,7 @@
"outputs": [],
"source": [
"def risk_factor_analysis(factor_name):\n",
" data_source = 'postgres+psycopg2://postgres:A12345678!@10.63.6.220/alpha'\n",
" data_source = os.environ['DB_URI']\n",
" engine = SqlEngine(data_source)\n",
" risk_names = list(set(risk_styles).difference({factor_name}))\n",
" industry_names = list(set(industry_styles).difference({factor_name}))\n",
......@@ -115,13 +118,6 @@
"df[['factor', 'abs t.']].groupby('factor').mean().sort_values('abs t.', ascending=False).head()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
......@@ -146,7 +142,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
"version": "3.6.3"
},
"varInspector": {
"cols": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment