Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
A
alpha-mind
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dr.李
alpha-mind
Commits
29b63f78
Commit
29b63f78
authored
Apr 01, 2018
by
Dr.李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adjusted to the new finance-python api
parent
87e3232b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
25 deletions
+6
-25
Example 3 - Multi Weight Gap Comparison.ipynb
notebooks/Example 3 - Multi Weight Gap Comparison.ipynb
+6
-25
No files found.
notebooks/Example 3 - Multi Weight Gap Comparison.ipynb
View file @
29b63f78
...
...
@@ -44,7 +44,7 @@
"batch = 0\n",
"horizon = map_freq(freq)\n",
"universe = Universe(\"custom\", ['zz800'])\n",
"data_source = 'postgres+psycopg2://postgres:
A12345678!@10.63.6.220
/alpha'\n",
"data_source = 'postgres+psycopg2://postgres:
we083826@localhost
/alpha'\n",
"benchmark_code = 905\n",
"method = 'tv'\n",
"target_vol = 0.05\n",
...
...
@@ -269,9 +269,9 @@
"outputs": [],
"source": [
"def create_report(ret_df, windows):\n",
" sharp_calc = MovingSharp(windows)\n",
" drawdown_calc = MovingMaxDrawdown(windows)\n",
" max_drawdown_calc = MovingMaxDrawdown(len(ret_df))\n",
" sharp_calc = MovingSharp(windows
, x='ret', y='riskFree'
)\n",
" drawdown_calc = MovingMaxDrawdown(windows
, x='ret'
)\n",
" max_drawdown_calc = MovingMaxDrawdown(len(ret_df)
, x='ret'
)\n",
"\n",
" res_df = pd.DataFrame(columns=['daily_return', 'cum_ret', 'sharp', 'drawdown', 'max_drawn', 'leverage'])\n",
" total_returns = 0.\n",
...
...
@@ -285,8 +285,8 @@
"\n",
" res_df.loc[date, 'daily_return'] = ret\n",
" res_df.loc[date, 'cum_ret'] = total_returns\n",
" res_df.loc[date, 'drawdown'] = drawdown_calc.result()
[0]
\n",
" res_df.loc[date, 'max_drawn'] = max_drawdown_calc.result()
[0]
\n",
" res_df.loc[date, 'drawdown'] = drawdown_calc.result()\n",
" res_df.loc[date, 'max_drawn'] = max_drawdown_calc.result()\n",
" res_df.loc[date, 'leverage'] = ret_df.loc[date, 'leverage']\n",
"\n",
" if i < 5:\n",
...
...
@@ -328,13 +328,6 @@
" alpha_logger.info(f\"target_vol: {target_vol:.4f} finished\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
...
...
@@ -349,18 +342,6 @@
"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.6.4"
},
"varInspector": {
"cols": {
"lenName": 16,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment