Skip to content

[Refactor] Extract Complex Methods in TimeSeriesModel.fit_arch #182

@astrogilda

Description

@astrogilda

Is your feature request related to a problem? Please describe.
The TimeSeriesModel.fit_arch method is currently 95+ lines long with multiple conditional branches, making it difficult to understand, test, and maintain.

Describe the solution you'd like
Extract the model creation logic into separate factory methods:

  • Extract GARCH model creation into _create_garch_model()
  • Extract EGARCH model creation into _create_egarch_model()
  • Extract TGARCH model creation into _create_tgarch_model()
  • Extract common parameter validation into _validate_arch_params()

Describe alternatives you've considered

  • Strategy pattern for model creation
  • Builder pattern for complex model configurations

Additional context
This refactoring will:

  • Improve code readability
  • Enable unit testing of individual model creation logic
  • Make it easier to add new model types in the future
  • Follow the Single Responsibility Principle

Part of codebase quality improvement initiative identified in refactoring analysis.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions