{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Found cached dataset text (C:/Users/WINSTON-ITX/.cache/huggingface/datasets/boomsss___text/boomsss--SPX_full_30min-37ae67efd8a1cc91/0.0.0/cb1e9bd71a82ad27976be3b12b407850fe2837d80c22c5e03a28949843a8ace2)\n" ] } ], "source": [ "import pandas as pd\n", "import numpy as np\n", "import model_day\n", "import model_30m\n", "import model_1h\n", "import model_90m" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "getting econ tickers: 100%|██████████| 3/3 [00:00<00:00, 3.22it/s]\n", "Getting release dates: 100%|██████████| 8/8 [00:02<00:00, 3.78it/s]\n", "Making indicators: 100%|██████████| 8/8 [00:00<00:00, 3996.48it/s]\n", "Merging econ data: 100%|██████████| 8/8 [00:00<00:00, 888.11it/s]\n", "getting econ tickers: 100%|██████████| 3/3 [00:00<00:00, 4.14it/s]\n", "Getting release dates: 100%|██████████| 8/8 [00:01<00:00, 4.32it/s]\n", "Making indicators: 100%|██████████| 8/8 [00:00<00:00, 7985.35it/s]\n", "Found cached dataset text (C:/Users/WINSTON-ITX/.cache/huggingface/datasets/boomsss___text/boomsss--SPX_full_30min-37ae67efd8a1cc91/0.0.0/cb1e9bd71a82ad27976be3b12b407850fe2837d80c22c5e03a28949843a8ace2)\n", "Merging econ data: 100%|██████████| 8/8 [00:00<00:00, 999.03it/s]\n", "getting econ tickers: 100%|██████████| 3/3 [00:00<00:00, 4.55it/s]\n", "Getting release dates: 100%|██████████| 8/8 [00:02<00:00, 3.26it/s]\n", "Making indicators: 100%|██████████| 8/8 [00:00<00:00, 3995.05it/s]\n", "Found cached dataset text (C:/Users/WINSTON-ITX/.cache/huggingface/datasets/boomsss___text/boomsss--SPX_full_30min-37ae67efd8a1cc91/0.0.0/cb1e9bd71a82ad27976be3b12b407850fe2837d80c22c5e03a28949843a8ace2)\n", "Merging econ data: 100%|██████████| 8/8 [00:00<00:00, 930.93it/s]\n", "getting econ tickers: 100%|██████████| 3/3 [00:00<00:00, 5.78it/s]\n", "Getting release dates: 100%|██████████| 8/8 [00:01<00:00, 5.24it/s]\n", "Making indicators: 100%|██████████| 8/8 [00:00<00:00, 3996.00it/s]\n", "Found cached dataset text (C:/Users/WINSTON-ITX/.cache/huggingface/datasets/boomsss___text/boomsss--SPX_full_30min-37ae67efd8a1cc91/0.0.0/cb1e9bd71a82ad27976be3b12b407850fe2837d80c22c5e03a28949843a8ace2)\n", "Merging econ data: 100%|██████████| 8/8 [00:00<00:00, 999.18it/s]\n" ] } ], "source": [ "_, df_final_day, _ = model_day.get_data()\n", "_, df_final_30m, _ = model_30m.get_data()\n", "_, df_final_1h, _ = model_1h.get_data()\n", "_, df_final_90m, _ = model_90m.get_data()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "LR Model: 100%|██████████| 1177/1177 [00:03<00:00, 391.99it/s]\n", "d:\\Projects\\gamedayspx\\model_day.py:63: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", " for_merge['RegrModelOut'] = for_merge['RegrModelOut'] > 0\n", "CLF Model: 100%|██████████| 1077/1077 [00:08<00:00, 120.80it/s]\n", "LR Model: 100%|██████████| 1177/1177 [00:03<00:00, 367.13it/s]\n", "d:\\Projects\\gamedayspx\\model_30m.py:61: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", " for_merge['RegrModelOut'] = for_merge['RegrModelOut'] > 0\n", "CLF Model: 100%|██████████| 1077/1077 [00:10<00:00, 105.72it/s]\n", "LR Model: 100%|██████████| 1177/1177 [00:03<00:00, 351.68it/s]\n", "d:\\Projects\\gamedayspx\\model_1h.py:60: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", " for_merge['RegrModelOut'] = for_merge['RegrModelOut'] > 0\n", "CLF Model: 100%|██████████| 1077/1077 [00:10<00:00, 102.81it/s]\n", "LR Model: 100%|██████████| 1177/1177 [00:03<00:00, 368.34it/s]\n", "d:\\Projects\\gamedayspx\\model_90m.py:60: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", " for_merge['RegrModelOut'] = for_merge['RegrModelOut'] > 0\n", "CLF Model: 100%|██████████| 1077/1077 [00:10<00:00, 106.84it/s]\n" ] } ], "source": [ "res_day, _, _ = model_day.walk_forward_validation_seq(df_final_day.dropna(axis=0), 'Target_clf', 'Target', 100, 1)\n", "res_30m, _, _ = model_30m.walk_forward_validation_seq(df_final_30m.dropna(axis=0), 'Target_clf', 'Target', 100, 1)\n", "res_1h, _, _ = model_1h.walk_forward_validation_seq(df_final_1h.dropna(axis=0), 'Target_clf', 'Target', 100, 1)\n", "res_90m, _, _ = model_90m.walk_forward_validation_seq(df_final_90m.dropna(axis=0), 'Target_clf', 'Target', 100, 1)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | True | \n", "Predicted | \n", "
---|---|---|
index | \n", "\n", " | \n", " |
2019-04-23 | \n", "False | \n", "0.798423 | \n", "
2019-04-24 | \n", "False | \n", "0.235411 | \n", "
2019-04-25 | \n", "True | \n", "0.479671 | \n", "
2019-04-26 | \n", "True | \n", "0.180924 | \n", "
2019-04-29 | \n", "True | \n", "0.457531 | \n", "
... | \n", "... | \n", "... | \n", "
2023-07-26 | \n", "False | \n", "0.863622 | \n", "
2023-07-27 | \n", "True | \n", "0.875761 | \n", "
2023-07-28 | \n", "True | \n", "0.506219 | \n", "
2023-07-31 | \n", "False | \n", "0.273154 | \n", "
2023-08-01 | \n", "False | \n", "0.238163 | \n", "
1077 rows × 2 columns
\n", "\n", " | True | \n", "Predicted | \n", "HighConfidence | \n", "PredDirection | \n", "RedDays | \n", "GreenDays | \n", "Correct | \n", "
---|---|---|---|---|---|---|---|
index | \n", "\n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " |
2019-04-23 | \n", "False | \n", "0.798423 | \n", "True | \n", "True | \n", "True | \n", "False | \n", "False | \n", "
2019-04-24 | \n", "False | \n", "0.235411 | \n", "True | \n", "False | \n", "True | \n", "False | \n", "True | \n", "
2019-04-25 | \n", "True | \n", "0.479671 | \n", "False | \n", "False | \n", "False | \n", "True | \n", "False | \n", "
2019-04-26 | \n", "True | \n", "0.180924 | \n", "True | \n", "False | \n", "False | \n", "True | \n", "False | \n", "
2019-04-29 | \n", "True | \n", "0.457531 | \n", "False | \n", "False | \n", "False | \n", "True | \n", "False | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
2023-07-26 | \n", "False | \n", "0.863622 | \n", "True | \n", "True | \n", "True | \n", "False | \n", "False | \n", "
2023-07-27 | \n", "True | \n", "0.875761 | \n", "True | \n", "True | \n", "False | \n", "True | \n", "True | \n", "
2023-07-28 | \n", "True | \n", "0.506219 | \n", "False | \n", "True | \n", "False | \n", "True | \n", "True | \n", "
2023-07-31 | \n", "False | \n", "0.273154 | \n", "True | \n", "False | \n", "True | \n", "False | \n", "True | \n", "
2023-08-01 | \n", "False | \n", "0.238163 | \n", "True | \n", "False | \n", "True | \n", "False | \n", "True | \n", "
1077 rows × 7 columns
\n", "\n", " | HighConfidence | \n", "HighConfidence | \n", "HighConfidence | \n", "HighConfidence | \n", "PredDirection | \n", "PredDirection | \n", "PredDirection | \n", "PredDirection | \n", "Correct | \n", "Correct | \n", "Correct | \n", "Correct | \n", "GreenDays | \n", "RedDays | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2019-04-23 | \n", "True | \n", "True | \n", "True | \n", "True | \n", "True | \n", "False | \n", "True | \n", "True | \n", "False | \n", "True | \n", "False | \n", "False | \n", "False | \n", "True | \n", "
2019-04-24 | \n", "True | \n", "True | \n", "True | \n", "True | \n", "False | \n", "False | \n", "False | \n", "False | \n", "True | \n", "True | \n", "True | \n", "True | \n", "False | \n", "True | \n", "
2019-04-25 | \n", "False | \n", "True | \n", "True | \n", "False | \n", "False | \n", "False | \n", "True | \n", "True | \n", "False | \n", "False | \n", "True | \n", "True | \n", "True | \n", "False | \n", "
2019-04-26 | \n", "True | \n", "True | \n", "True | \n", "True | \n", "False | \n", "True | \n", "True | \n", "True | \n", "False | \n", "True | \n", "True | \n", "True | \n", "True | \n", "False | \n", "
2019-04-29 | \n", "False | \n", "True | \n", "True | \n", "True | \n", "False | \n", "False | \n", "False | \n", "False | \n", "False | \n", "False | \n", "False | \n", "False | \n", "True | \n", "False | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
2023-07-26 | \n", "True | \n", "True | \n", "True | \n", "True | \n", "True | \n", "True | \n", "True | \n", "True | \n", "False | \n", "False | \n", "False | \n", "False | \n", "False | \n", "True | \n", "
2023-07-27 | \n", "True | \n", "True | \n", "True | \n", "True | \n", "True | \n", "True | \n", "True | \n", "True | \n", "True | \n", "True | \n", "True | \n", "True | \n", "True | \n", "False | \n", "
2023-07-28 | \n", "False | \n", "False | \n", "True | \n", "True | \n", "True | \n", "True | \n", "True | \n", "True | \n", "True | \n", "True | \n", "True | \n", "True | \n", "True | \n", "False | \n", "
2023-07-31 | \n", "True | \n", "True | \n", "True | \n", "True | \n", "False | \n", "False | \n", "False | \n", "False | \n", "True | \n", "True | \n", "True | \n", "True | \n", "False | \n", "True | \n", "
2023-08-01 | \n", "True | \n", "True | \n", "True | \n", "True | \n", "False | \n", "False | \n", "False | \n", "False | \n", "True | \n", "True | \n", "True | \n", "True | \n", "False | \n", "True | \n", "
1077 rows × 14 columns
\n", "