(feat) fix getting data issue

This commit is contained in:
cardosofede
2023-12-12 20:33:55 -03:00
parent 02fd04e82c
commit 0cda68b4c7

View File

@@ -11,7 +11,39 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 25,
"outputs": [],
"source": [
"import sys\n",
"import os\n",
"\n",
"root_path = os.path.abspath(os.path.join(os.getcwd(), '../../..'))\n",
"sys.path.append(root_path)"
],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-12-12T23:32:30.950209Z",
"start_time": "2023-12-12T23:32:30.930263Z"
}
}
},
{
"cell_type": "code",
"execution_count": 17,
"outputs": [],
"source": [],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-12-12T23:32:13.047434Z",
"start_time": "2023-12-12T23:32:13.042314Z"
}
}
},
{
"cell_type": "code",
"execution_count": 27,
"outputs": [],
"source": [
"from typing import Optional, Callable\n",
@@ -23,7 +55,7 @@
"\n",
"def get_market_data_dfs(trading_pair: str, intervals: list, base_path: Optional[str] = None):\n",
" if base_path is None:\n",
" base_path = \"/Users/dardonacci/Documents/work/dashboard/data/candles/\"\n",
" base_path = f\"{root_path}/data/candles/\"\n",
" market_data = {}\n",
" for file_path in glob.glob(f\"{base_path}*.csv\"):\n",
" tp = file_path.split(\"_\")[-2]\n",
@@ -70,14 +102,14 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-12-11T22:49:11.468119Z",
"start_time": "2023-12-11T22:49:11.445037Z"
"end_time": "2023-12-12T23:33:11.159384Z",
"start_time": "2023-12-12T23:33:11.154356Z"
}
}
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 28,
"outputs": [],
"source": [
"trading_pair = \"WLD-USDT\"\n",
@@ -88,21 +120,21 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-12-11T22:49:12.635737Z",
"start_time": "2023-12-11T22:49:12.554125Z"
"end_time": "2023-12-12T23:33:11.527517Z",
"start_time": "2023-12-12T23:33:11.489614Z"
}
}
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 29,
"outputs": [
{
"data": {
"text/plain": " date date_1h\n0 2023-09-12 22:00:00 2023-09-12 22:00:00\n1 2023-09-12 22:03:00 2023-09-12 22:00:00\n2 2023-09-12 22:06:00 2023-09-12 22:00:00\n3 2023-09-12 22:09:00 2023-09-12 22:00:00\n4 2023-09-12 22:12:00 2023-09-12 22:00:00",
"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>date_1h</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>2023-09-12 22:00:00</td>\n <td>2023-09-12 22:00:00</td>\n </tr>\n <tr>\n <th>1</th>\n <td>2023-09-12 22:03:00</td>\n <td>2023-09-12 22:00:00</td>\n </tr>\n <tr>\n <th>2</th>\n <td>2023-09-12 22:06:00</td>\n <td>2023-09-12 22:00:00</td>\n </tr>\n <tr>\n <th>3</th>\n <td>2023-09-12 22:09:00</td>\n <td>2023-09-12 22:00:00</td>\n </tr>\n <tr>\n <th>4</th>\n <td>2023-09-12 22:12:00</td>\n <td>2023-09-12 22:00:00</td>\n </tr>\n </tbody>\n</table>\n</div>"
},
"execution_count": 4,
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
@@ -113,14 +145,14 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-12-11T22:49:13.670013Z",
"start_time": "2023-12-11T22:49:13.639838Z"
"end_time": "2023-12-12T23:33:11.813341Z",
"start_time": "2023-12-12T23:33:11.807231Z"
}
}
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 24,
"outputs": [],
"source": [
"def add_indicators(df, length=50, multiplier=3):\n",
@@ -130,8 +162,8 @@
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2023-12-11T22:49:14.566166Z",
"start_time": "2023-12-11T22:49:14.562194Z"
"end_time": "2023-12-12T23:32:25.137032Z",
"start_time": "2023-12-12T23:32:25.131080Z"
}
}
},