Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Environments #46

Merged
merged 75 commits into from
Nov 28, 2024
Merged

Feature: Environments #46

merged 75 commits into from
Nov 28, 2024

Conversation

seekersoftec
Copy link
Contributor

This PR introduces enhancements and new functionality focused on improving the management and flexibility of trading environments within the Trade_Flow application. Key updates include:

  1. Environment Management:

    • Implementation of modular and customizable environments for backtesting, live trading, and simulation.
    • Seamless integration with external services and data sources, such as MetaTrader, for enhanced data ingestion and execution.
  2. Reinforcement Learning Integration:

    • Addition of support for Gym-compatible environments, enabling the use of reinforcement learning agents for strategy optimization and testing.
    • Improved interface for creating and training RL agents with storage and checkpointing capabilities.
  3. Task Management Improvements:

    • Introduction of a robust TaskManager class to manage processes and threads, enabling smooth orchestration of tasks like backtesting or live data streaming.
  4. Code Quality and Testing:

    • Enhanced testing capabilities using pytest for validating environments and agent performance.
    • Refactored codebase for better readability and maintainability, adhering to modern Python best practices.
  5. Additional Features:

    • Support for multithreading and asynchronous operations in environment interactions.
    • Better logging and monitoring capabilities for debugging and performance analysis.

Objective:

These changes aim to streamline the development and deployment of advanced trading systems by providing a robust and extensible environment framework, making it easier to experiment with, validate, and deploy trading strategies.

Adds instructions to the README on how to download data using freqtrade.
Adds several technical indicators, candlestick patterns, and normalized returns to the feature engineering process.
Includes Weighted Bollinger Bands, MACD, and various bullish/bearish candlestick patterns.  Improves return calculations and normalizes annual returns using daily volatility.

Adds `can_short` attribute and `informative_pairs` method.  Refactors RSI calculation to use a 30-period lookback.  Removes raw price and volume features.
Improves the reward function by incorporating volatility normalization, dynamic penalties for long trades, and logarithmic scaling for exit rewards.  Removes TODO comments and unused code blocks.  Adds a new `most_recent_return` function to calculate tick-to-tick returns.

This enhances the agent's learning process by providing a smoother, more informative reward signal, encouraging more strategic trading behavior.
Adds new RL agents `TradeFlowSRAgent` and `TradeFlowRSIWithSRAgent` that leverage support/resistance levels for enhanced trading decisions.

`TradeFlowSRAgent` focuses on SR levels, while `TradeFlowRSIWithSRAgent` integrates RSI with SR indicators.

Modifies the `config.test.json` to support the new agents and adjust trading parameters.

Removes unused `most_recent_return` function from `TradeFlowAgent`.

Updates reward calculation to factor in trade duration, volatility, and proximity to support/resistance levels.  Includes penalties for inactivity and holding positions too long.  Improves reward logic for entry and exit actions.
Decomposes complex reward function into smaller, more manageable methods. This improves readability and makes it easier to understand the logic behind reward calculations.  The core reward logic remains unchanged.

Renames `TradeFlowAgent` to `TradeFlowSimpleAgent` to better reflect its purpose.
@seekersoftec seekersoftec merged commit 4e3f9f7 into main Nov 28, 2024
0 of 2 checks passed
@seekersoftec seekersoftec changed the title Feature: Environments* Feature: Environments Nov 28, 2024
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.

1 participant