Commit 3321d3af authored by Dr.李's avatar Dr.李

update example

parent 01c9058f
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
"benchmark = 'zz500'\n", "benchmark = 'zz500'\n",
"factor = 'ROEAfterNonRecurring' # 'DROEAfterNonRecurring'\n", "factor = 'ROEAfterNonRecurring' # 'DROEAfterNonRecurring'\n",
"\n", "\n",
"conn = sqlalchemy.create_engine('mysql+mysqldb://root:we083826@localhost:3306/multifactor?charset=utf8')\n", "conn = sqlalchemy.create_engine('mysql+pymysql://sa:we083826@10.63.6.176:3306/multifactor?charset=utf8')\n",
"df = pd.read_sql('select factor_data.{0}, trade_data.Return as dailyReturn, {1}.*, 1 as Market '\n", "df = pd.read_sql('select factor_data.{0}, trade_data.Return as dailyReturn, {1}.*, 1 as Market '\n",
" 'from factor_data, trade_data, {1} '\n", " 'from factor_data, trade_data, {1} '\n",
" 'where factor_data.Date = {1}.Date and factor_data.Code = {1}.Code '\n", " 'where factor_data.Date = {1}.Date and factor_data.Code = {1}.Code '\n",
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"total_data.pos.groupby(groups).apply(lambda x: np.abs(x).sum()).head()" "total_data.pos.groupby(groups).apply(lambda x: x.sum()).head()"
] ]
}, },
{ {
...@@ -484,7 +484,9 @@ ...@@ -484,7 +484,9 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": {}, "metadata": {
"collapsed": true
},
"outputs": [], "outputs": [],
"source": [ "source": [
"import gc\n", "import gc\n",
...@@ -503,9 +505,9 @@ ...@@ -503,9 +505,9 @@
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "Python [conda root]", "display_name": "Python 3",
"language": "python", "language": "python",
"name": "conda-root-py" "name": "python3"
}, },
"language_info": { "language_info": {
"codemirror_mode": { "codemirror_mode": {
...@@ -517,9 +519,9 @@ ...@@ -517,9 +519,9 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.5.3" "version": "3.6.1"
} }
}, },
"nbformat": 4, "nbformat": 4,
"nbformat_minor": 2 "nbformat_minor": 1
} }
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