Skip to content

[WIP] Update modules/strategy_single.py with SingleAssetAnalyzer class#2

Merged
Nicolascos merged 1 commit intomainfrom
copilot/update-strategy-single-module
Dec 3, 2025
Merged

[WIP] Update modules/strategy_single.py with SingleAssetAnalyzer class#2
Nicolascos merged 1 commit intomainfrom
copilot/update-strategy-single-module

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 3, 2025

  • Add necessary imports (yfinance, sklearn, statsmodels, datetime, itertools) to modules/strategy_single.py
  • Append new SingleAssetAnalyzer class to the end of modules/strategy_single.py (preserving all existing functions)
  • Add statsmodels to requirements.txt
  • Verify that the application still works (test imports)
Original prompt

The user wants to update modules/strategy_single.py with new code containing a SingleAssetAnalyzer class that uses sklearn and statsmodels.

The user explicitly requested "sans casser mon code" (without breaking my code).
The existing modules/strategy_single.py contains functional strategies (Buy & Hold, SMA, RSI, MACD, etc.) that are imported and used by app.py.
The new code provided is a class-based structure (SingleAssetAnalyzer) that implements some strategies (Momentum, Cross MMS, BB) and adds prediction models (Linear Regression, ARIMA, Random Forest), but lacks some existing strategies (RSI, MACD, Golden Cross) and has a different interface.

To satisfy the request of updating the file without breaking the application:

  1. Update modules/strategy_single.py:
    • Add the new necessary imports (yfinance, sklearn, statsmodels, datetime, itertools) at the top.
    • Preserve all existing functions (strategy_buy_and_hold, strategy_sma, etc.) so app.py imports remain valid.
    • Append the new SingleAssetAnalyzer class to the end of the file.
  2. Update requirements.txt:
    • Add statsmodels which is required by the new code but missing in the current requirements.

This approach allows the new logic to be available in the project (updating the file) while maintaining backward compatibility for the running application.

This pull request was created as a result of the following prompt from Copilot chat.

The user wants to update modules/strategy_single.py with new code containing a SingleAssetAnalyzer class that uses sklearn and statsmodels.

The user explicitly requested "sans casser mon code" (without breaking my code).
The existing modules/strategy_single.py contains functional strategies (Buy & Hold, SMA, RSI, MACD, etc.) that are imported and used by app.py.
The new code provided is a class-based structure (SingleAssetAnalyzer) that implements some strategies (Momentum, Cross MMS, BB) and adds prediction models (Linear Regression, ARIMA, Random Forest), but lacks some existing strategies (RSI, MACD, Golden Cross) and has a different interface.

To satisfy the request of updating the file without breaking the application:

  1. Update modules/strategy_single.py:
    • Add the new necessary imports (yfinance, sklearn, statsmodels, datetime, itertools) at the top.
    • Preserve all existing functions (strategy_buy_and_hold, strategy_sma, etc.) so app.py imports remain valid.
    • Append the new SingleAssetAnalyzer class to the end of the file.
  2. Update requirements.txt:
    • Add statsmodels which is required by the new code but missing in the current requirements.

This approach allows the new logic to be available in the project (updating the file) while maintaining backward compatibility for the running application.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@Nicolascos Nicolascos marked this pull request as ready for review December 3, 2025 17:23
@Nicolascos Nicolascos merged commit 416b98b into main Dec 3, 2025
1 check failed
Copilot AI requested a review from Nicolascos December 3, 2025 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants