diff --git a/notebooks/feat_list_available_indicators.ipynb b/notebooks/feat_list_available_indicators.ipynb new file mode 100644 index 0000000..a5c9444 --- /dev/null +++ b/notebooks/feat_list_available_indicators.ipynb @@ -0,0 +1,142 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "a484e963", + "metadata": {}, + "outputs": [], + "source": [ + "# %%\n", + "# filename: feat_list_available_indicators_grouped.ipynb\n", + "# Purpose: To list all available indicators from the primary TA libraries,\n", + "# grouped by category and sorted alphabetically.\n", + "\n", + "import talib\n", + "import pandas_ta as ta\n", + "import tulipy as ti\n", + "import pandas as pd" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "31ee8f84", + "metadata": {}, + "outputs": [], + "source": [ + "# %%\n", + "# --- 1. TA-Lib ---\n", + "# TA-Lib provides a dictionary of function groups, which is perfect for this task.\n", + "\n", + "print(\"--- TA-Lib Available Functions (Grouped & Sorted) ---\")\n", + "talib_groups = talib.get_function_groups()\n", + "\n", + "# Sort the group names alphabetically\n", + "sorted_group_names = sorted(talib_groups.keys())\n", + "\n", + "for group in sorted_group_names:\n", + " print(f\"\\n# Group: {group}\")\n", + " # Sort the function names within each group alphabetically\n", + " sorted_functions = sorted(talib_groups[group])\n", + " print(sorted_functions)\n", + "\n", + "print(\"\\n\" + \"=\"*50 + \"\\n\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8ede729f", + "metadata": {}, + "outputs": [], + "source": [ + "# %%\n", + "# --- 2. pandas-ta ---\n", + "# pandas-ta stores its indicators in a well-structured `ta.Category` dictionary.\n", + "\n", + "print(\"--- pandas-ta Available Indicators (Grouped & Sorted) ---\")\n", + "\n", + "# The keys of the ta.Category dictionary are the group names\n", + "sorted_categories = sorted(ta.Category.keys())\n", + "\n", + "for category in sorted_categories:\n", + " # The values are the lists of indicator names\n", + " indicator_list = ta.Category[category]\n", + " if isinstance(indicator_list, list): # Ensure it's a list\n", + " print(f\"\\n# Category: {category}\")\n", + " print(sorted(indicator_list))\n", + "\n", + "print(\"\\n\" + \"=\"*50 + \"\\n\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3f80feff", + "metadata": {}, + "outputs": [], + "source": [ + "# %%\n", + "# --- 3. Tulip Indicators (tulipy) ---\n", + "# By inspecting a function object, we discovered it has a '.type' attribute\n", + "# which can be used for grouping, similar to TA-Lib.\n", + "\n", + "print(\"--- Tulip Indicators (tulipy) Available Functions (Grouped & Sorted) ---\")\n", + "\n", + "# Create a dictionary to hold the groups\n", + "tulip_groups = {}\n", + "\n", + "# Find all potential function names\n", + "potential_functions = [func for func in dir(ti) if not func.startswith('_') and func.islower()]\n", + "\n", + "for func_name in potential_functions:\n", + " # Get the actual function object from the module\n", + " func_obj = getattr(ti, func_name)\n", + "\n", + " # Check if the object has the '.type' attribute (it's a proper indicator)\n", + " if hasattr(func_obj, 'type'):\n", + " group_name = func_obj.type\n", + "\n", + " # If the group doesn't exist in our dictionary, create it\n", + " if group_name not in tulip_groups:\n", + " tulip_groups[group_name] = []\n", + "\n", + " # Add the function name to the correct group\n", + " tulip_groups[group_name].append(func_name)\n", + "\n", + "# Now, print the grouped and sorted results\n", + "sorted_group_names = sorted(tulip_groups.keys())\n", + "\n", + "for group in sorted_group_names:\n", + " print(f\"\\n# Group: {group}\")\n", + " # Sort the function names within each group alphabetically\n", + " sorted_functions = sorted(tulip_groups[group])\n", + " print(sorted_functions)\n", + "\n", + "print(\"\\n\" + \"=\"*50 + \"\\n\")" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "strategy-optimizer_env_bck", + "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.12.11" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}