Spaces:
No application file
No application file
Update GDELT mean sentiment alpha/Alpha Implementation/Alpha Implementation.ipynb
Browse files
GDELT mean sentiment alpha/Alpha Implementation/Alpha Implementation.ipynb
CHANGED
|
@@ -38,21 +38,7 @@
|
|
| 38 |
"The first step involves importing and sanitizing time‐series data for thirteen composite futures (six energy and seven metals) and the S&P GSCI Energy & Metals Index benchmark. We load each CSV, parse the “Date” column into datetime, and strip non‐numeric characters (commas, percent signs) from columns AvgTone, Price, Open, High, Low, Vol., and Change % before converting them to floats to ensure consistent numeric types."
|
| 39 |
]
|
| 40 |
},
|
| 41 |
-
|
| 42 |
-
"cell_type": "code",
|
| 43 |
-
"execution_count": 2,
|
| 44 |
-
"id": "f55219fe",
|
| 45 |
-
"metadata": {},
|
| 46 |
-
"outputs": [
|
| 47 |
-
{
|
| 48 |
-
"ename": "SyntaxError",
|
| 49 |
-
"evalue": "unmatched ')' (100150859.py, line 38)",
|
| 50 |
-
"output_type": "error",
|
| 51 |
-
"traceback": [
|
| 52 |
-
"\u001b[0;36m Cell \u001b[0;32mIn[2], line 38\u001b[0;36m\u001b[0m\n\u001b[0;31m contracts[f.replace(\"_data.csv\",\"\")] = df\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m unmatched ')'\n"
|
| 53 |
-
]
|
| 54 |
-
}
|
| 55 |
-
],
|
| 56 |
"source": [
|
| 57 |
"import pandas as pd, numpy as np, matplotlib.pyplot as plt\n",
|
| 58 |
"from pathlib import Path\n",
|
|
@@ -91,7 +77,7 @@
|
|
| 91 |
"for f in contracts_csv:\n",
|
| 92 |
" df = load_and_clean_csv(f).sort_values(\"Date\").reset_index(drop=True)\n",
|
| 93 |
" df[\"Return\"] = df[\"Price\"].pct_change()\n",
|
| 94 |
-
" contracts[f.replace(\"_data.csv\",\"\")] = df
|
| 95 |
]
|
| 96 |
},
|
| 97 |
{
|
|
|
|
| 38 |
"The first step involves importing and sanitizing time‐series data for thirteen composite futures (six energy and seven metals) and the S&P GSCI Energy & Metals Index benchmark. We load each CSV, parse the “Date” column into datetime, and strip non‐numeric characters (commas, percent signs) from columns AvgTone, Price, Open, High, Low, Vol., and Change % before converting them to floats to ensure consistent numeric types."
|
| 39 |
]
|
| 40 |
},
|
| 41 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
"source": [
|
| 43 |
"import pandas as pd, numpy as np, matplotlib.pyplot as plt\n",
|
| 44 |
"from pathlib import Path\n",
|
|
|
|
| 77 |
"for f in contracts_csv:\n",
|
| 78 |
" df = load_and_clean_csv(f).sort_values(\"Date\").reset_index(drop=True)\n",
|
| 79 |
" df[\"Return\"] = df[\"Price\"].pct_change()\n",
|
| 80 |
+
" contracts[f.replace(\"_data.csv\",\"\")] = df"
|
| 81 |
]
|
| 82 |
},
|
| 83 |
{
|