Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 13, 2025

Summary

This PR completes the remaining tasks from PR #1318 "feat: Catalog utility" by implementing the missing catalog listing definitions, specialized parameter types, and automation support features.

Key Changes

✅ Main Catalog Population (Task 8.9)

  • Populated main IndicatorCatalog with all 94 individual indicator listings from existing catalog files
  • Fixed validation issues in ElderRay, Fcb, and Gator indicators (missing default result markers)
  • Implemented lazy initialization with thread-safe catalog population
  • Connected registry system to auto-populate from the comprehensive catalog

✅ Enhanced Parameter System

  • Added AddDateParameter() convenience method for DateTime parameters (VWAP use case)
  • Added AddSeriesParameter() convenience method for IEnumerable parameters (Beta, Correlation, PRS use cases)
  • Updated indicators to use specialized parameter methods:
    • VWAP now uses AddDateParameter() for start date
    • Beta and Correlation use AddSeriesParameter() for quote series
  • Fixed culture-specific formatting warning in DateTime handling

✅ Automation Support

  • Added MethodName property to IndicatorListing for programmatic discovery
  • Added WithMethodName() builder method for setting method names
  • Updated sample indicators (EMA, VWAP) with method names for automation use cases
  • Style information already included in JSON serialization via existing JsonConverter

Technical Details

Catalog Architecture

// Before: Empty catalog
public static IReadOnlyList<IndicatorListing> Catalog => _catalog; // Empty list

// After: Fully populated catalog with lazy initialization
public static IReadOnlyList<IndicatorListing> Catalog
{
    get
    {
        EnsureInitialized(); // Populates all 94 listings on first access
        return _catalog;
    }
}

Enhanced Parameter Types

// Before: Generic approach only
.AddParameter<DateTime>("startDate", "Start Date", ...)
.AddParameter<IEnumerable<Quote>>("sourceA", "Source A", ...)

// After: Specialized convenience methods
.AddDateParameter("startDate", "Start Date", ...)
.AddSeriesParameter("sourceA", "Source A", ...)

Automation Support

// New: Method name for automation
internal static readonly IndicatorListing SeriesListing =
    new IndicatorListingBuilder()
        .WithName("Exponential Moving Average")
        .WithId("EMA")
        .WithMethodName("ToEma") // ← New for automation
        .WithStyle(Style.Series)
        // ...

Impact

For Developers

  • Complete indicator discovery: All 94+ indicators now accessible through unified catalog
  • Type-safe parameter handling: Specialized methods for common parameter types
  • Multi-style support: Series, Stream, and Buffer implementations properly catalogued

For Automation

  • Method name discovery: Programmatic access to corresponding static method names
  • Comprehensive metadata: Full indicator information available via JSON serialization
  • Style differentiation: Automation tools can distinguish between implementation styles

For Library Maintenance

  • Structured foundation: Catalog system ready for future documentation generation
  • Validation improvements: Built-in checks ensure catalog integrity
  • Performance optimization: Lazy loading prevents unnecessary initialization overhead

Breaking Changes

None. All changes are additive and maintain backward compatibility.

Testing

  • ✅ All existing catalog tests pass
  • ✅ Build succeeds without warnings (after fixing culture-specific DateTime formatting)
  • ✅ New parameter types work correctly with existing indicators
  • ✅ Catalog population verified with 94 total listings

Related Issues

Completes all high-priority and key medium-priority tasks from PR #1318:

  • Task 8.9: Add missing listing definitions based on catalog.bak.json
  • Add missing ParamAttribute types for ParamDate and ParamSeries
  • Add Style to output
  • Return method name for automation use case

Migration Guide

No migration required. New features are opt-in:

// Optional: Use new specialized parameter methods
.AddDateParameter("startDate", "Start Date")        // Instead of AddParameter<DateTime>
.AddSeriesParameter("quotes", "Quote Series")       // Instead of AddParameter<IEnumerable<Quote>>

// Optional: Add method names for automation
.WithMethodName("ToYourIndicator")

// Automatic: Catalog now fully populated on first access
var allIndicators = IndicatorCatalog.Catalog; // Returns 94+ listings

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Summary by CodeRabbit

  • New Features

    • Introduced a flexible builder and configuration system for custom indicators, enabling fluent parameterization, serialization, and dynamic execution.
    • Added comprehensive documentation and workflow guides for indicator catalog entries, Markdown formatting, and NuGet package management.
  • Enhancements

    • Updated indicator catalog entries to include explicit method names and improved result metadata, standardizing the use of reusable flags.
    • Improved catalog initialization, thread safety, and registry management for indicator listings.
    • Deprecated the legacy indicator class in favor of specific indicator classes.
  • Bug Fixes

    • Improved case-insensitive property matching for XML documentation extraction.
  • Documentation

    • Expanded and updated guides for catalog conventions, builder usage, and test requirements.
    • Added detailed instructions for catalog automation and documentation best practices.
  • Tests

    • Added robust test suites to validate catalog structure, metadata integrity, automation compatibility, and style counts.

Copilot AI and others added 3 commits July 13, 2025 08:52
…ion issues

Co-authored-by: DaveSkender <8432125+DaveSkender@users.noreply.github.com>
Co-authored-by: DaveSkender <8432125+DaveSkender@users.noreply.github.com>
…priority tasks

Co-authored-by: DaveSkender <8432125+DaveSkender@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Finalizing Tasks from Active Pull Request feat: Complete catalog utility implementation with enhanced parameter types and automation support Jul 13, 2025
@Copilot Copilot AI requested a review from DaveSkender July 13, 2025 09:01
Copilot finished work on behalf of DaveSkender July 13, 2025 09:01
Copy link
Owner

@DaveSkender DaveSkender left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to items below, ensure tests for catalog use depict entry quantities per style, there should be more than 80 series types, 2 for buffer, 6+ for hub types. You’ll have to get accurate numbers to pass.

…key comment feedback

Co-authored-by: DaveSkender <8432125+DaveSkender@users.noreply.github.com>

This comment was marked as resolved.

@Copilot Copilot AI requested a review from DaveSkender July 13, 2025 09:27
Copilot finished work on behalf of DaveSkender July 13, 2025 09:27
…lated value and test counts

Co-authored-by: DaveSkender <8432125+DaveSkender@users.noreply.github.com>
@Copilot Copilot AI requested a review from DaveSkender July 14, 2025 01:20
Copilot finished work on behalf of DaveSkender July 14, 2025 01:20
Signed-off-by: Dave Skender <8432125+DaveSkender@users.noreply.github.com>
Repository owner deleted a comment from github-actions bot Jul 14, 2025
Signed-off-by: Dave Skender <8432125+DaveSkender@users.noreply.github.com>
Copy link
Contributor

coderabbitai bot commented Jul 17, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Signed-off-by: Dave Skender <8432125+DaveSkender@users.noreply.github.com>
@DaveSkender
Copy link
Owner

@copilot You have a severely flawed implementation approach for these catalog use tests that are failing. Please fix the overall approach to the tests, or make a thoughtful recommendation on how to address the catalog code implementation architecture to enable simpler execution from catalog entries.

Try again, you failed to initialize

Copy link
Contributor Author

Copilot AI commented Jul 17, 2025

@copilot You have a severely flawed implementation approach for these catalog use tests that are failing. Please fix the overall approach to the tests, or make a thoughtful recommendation on how to ...

The catalog test approach is fundamentally flawed. I generated tests that try to use reflection and parameter arrays to call indicator methods, but this doesn't work because method signatures vary significantly. The catalog system already provides proper execution via listing.Execute<T>(quotes) - I should use that instead of recreating method invocation logic. I'll delete the broken tests and implement a simpler approach following the working EMA pattern.

…automation validation

Co-authored-by: DaveSkender <8432125+DaveSkender@users.noreply.github.com>
Copilot finished work on behalf of DaveSkender July 17, 2025 06:00
Repository owner deleted a comment from coderabbitai bot Jul 17, 2025
@DaveSkender
Copy link
Owner

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented Jul 17, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

coderabbitai bot commented Jul 17, 2025

Walkthrough

This update introduces significant enhancements to the indicator catalog system, including new builder and executor classes for dynamic indicator configuration and execution, a robust serialization mechanism for indicator configurations, and comprehensive documentation and testing. Catalog entries now explicitly specify method names and use an isReusable flag for results. Numerous catalog files were updated to align with these conventions, and extensive new tests and documentation were added to validate and guide catalog usage and automation.

Changes

Files/Groups Change Summary
.editorconfig Removed lines disabling XML doc diagnostics for non-public members.
.vscode/settings.json Added markdown file association and formatter config.
.github/instructions/*.md, .github/prompts/catalog.prompt.md Added detailed documentation and workflow guides for catalog entries, markdown, NuGet, and code comments.
src/_common/Catalog/Catalog.cs Made catalog initialization lazy and thread-safe; added Clear method for testing.
src/_common/Catalog/CustomIndicatorBuilder.cs Added fluent builder and extension methods for configuring and executing custom indicators.
src/_common/Catalog/IndicatorConfig.cs Introduced serializable indicator configuration class and extensions for builder conversion and execution.
src/_common/Catalog/IndicatorExecutor.cs Added dynamic indicator executor for reflection-based method invocation using catalog metadata.
src/_common/Catalog/IndicatorRegistry.cs Added auto-initialization control, new lookup by ID and style, and improved registry clearing for tests.
src/_common/Catalog/Schema/IndicatorListing.cs Added nullable MethodName property for automation metadata.
src/_common/Catalog/Schema/IndicatorListingBuilder.cs Added method name support, new parameter types, renamed isDefault to isReusable, updated validation logic.
src/_common/Catalog/Schema/IndicatorResult.cs Renamed IsDefault property to IsReusable with updated documentation.
src/_common/Generics/StringOut.Type.cs Made XML doc property matching case-insensitive.
src/_common/ObsoleteV3.cs Marked Indicator class as obsolete and excluded from coverage.
src/_common/Catalog/Examples/CatalogExamples.cs Removed example code file for catalog usage.
src/_common/Catalog/GUIDES.md Updated builder API docs to use isReusable instead of isDefault.
src/a-d/*/*.Catalog.cs, src/e-k/*/*.Catalog.cs, src/m-r/*/*.Catalog.cs, src/s-z/*/*.Catalog.cs Updated all indicator catalog entries: added explicit method names, replaced isDefault with isReusable for results, improved parameter declarations.
tests/indicators/_common/Catalog/CatalogAutomation.Tests.cs Added new tests for automation: method name presence, execution, parameter validation, style counts, and structure.
tests/indicators/_common/Catalog/CatalogBuilder.Tests.cs Updated tests to use isReusable instead of isDefault; changed logic for multiple results without reusable flag.
tests/indicators/_common/Catalog/CatalogEntryTests.cs Added comprehensive tests for catalog metadata, uniqueness, automation validity, and method callability.
tests/indicators/_common/Catalog/CatalogStyleCounts.Tests.cs Added test for verifying indicator counts by style in the catalog.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CustomIndicatorBuilder
    participant IndicatorListing
    participant IndicatorExecutor
    participant IndicatorRegistry
    participant IndicatorCatalog

    User->>CustomIndicatorBuilder: Create builder from IndicatorListing
    User->>CustomIndicatorBuilder: Set parameters (WithParamValue/WithParams)
    User->>CustomIndicatorBuilder: Set source data (FromSource)
    User->>CustomIndicatorBuilder: Execute<TResult>()
    CustomIndicatorBuilder->>IndicatorExecutor: Execute with parameters and source
    IndicatorExecutor->>IndicatorListing: Retrieve method name and metadata
    IndicatorExecutor->>IndicatorRegistry: Lookup indicator method via reflection
    IndicatorExecutor->>Indicator: Invoke method with parameters
    Indicator->>IndicatorExecutor: Return results
    IndicatorExecutor->>CustomIndicatorBuilder: Return typed results
    CustomIndicatorBuilder->>User: Results
Loading
sequenceDiagram
    participant User
    participant IndicatorConfig
    participant CustomIndicatorBuilder
    participant IndicatorListing
    participant IndicatorRegistry

    User->>IndicatorConfig: Deserialize config from JSON
    User->>IndicatorConfig: ToBuilder()
    IndicatorConfig->>IndicatorRegistry: Lookup IndicatorListing by ID and style
    IndicatorRegistry->>IndicatorConfig: Return IndicatorListing
    IndicatorConfig->>CustomIndicatorBuilder: Create builder with parameters
    CustomIndicatorBuilder->>User: Ready for execution
Loading

Poem

(\(\
( -.-) A catalog grows, with method names anew,
((")(") Results now reusable, with flags that are true.
Builders and executors, working in sync,
Tests and docs flourish, more robust than you think!
The rabbit hops on, with metadata delight—
Automation and structure, all catalog entries just right!


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Join our Discord community for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copilot finished work on behalf of DaveSkender July 17, 2025 06:37
@DaveSkender
Copy link
Owner

@copilot fix failing tests


Failed ShouldFindMultiStyleIndicatorByAllSupportedStyles [50 ms]
  Error Message:
   Expected collection 
Skender.Stock.Indicators.IndicatorListing
    {
        Category = Category.VolumeBased {value: 10}, 
        LegendTemplate = "Accumulation Distribution Line (ADL) (ADL)", 
        MethodName = "ToAdl", 
        Name = "Accumulation Distribution Line (ADL)", 
        Parameters = <null>, 
        {
        Results = Skender.Stock.Indicators.IndicatorResult
            {
                DataName = "Adl", 
                DataType = ResultType.Default {value: 0}, 
                DisplayName = "Accumulation Distribution Line (ADL)", 
                IsReusable = True
                    }
        }, 
        ReturnType = <null>, 
        Style = Style.Series {value: 0}, 
        Uiid = "ADL", 
        UiidEndpoint = "/adl"
    }, 
    Skender.Stock.Indicators.IndicatorListing
    {
        Category = Category.PriceTrend {value: 8}, 
        LegendTemplate = "Average Directional Index (ADX) (ADX)", 
        MethodName = "ToAdx", 
        Name = "Average Directional Index (ADX)", 
        Parameters = Skender.Stock.Indicators.IndicatorParam
        {
            {
                DataType = "Int32", 
                DefaultValue = 14, 
                Description = <null>, 
                DisplayName = "Lookback Periods", 
                EnumOptions = <null>, 
                IsRequired = False, 
                Maximum = 250.0, 
                Minimum = 2.0, 
                ParameterName = "lookbackPeriods"
            }
        }, 

…d DoNotParallelize for robust registry state management

Co-authored-by: DaveSkender <8432125+DaveSkender@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jul 17, 2025

@copilot fix failing tests

...

Fixed in commit 67ef963. The test failure was caused by race conditions during parallel test execution where the real catalog would overwrite test data. Added proper test isolation using [TestInitialize]/[TestCleanup] pattern and [DoNotParallelize] attribute to ensure robust registry state management.

Copilot finished work on behalf of DaveSkender July 17, 2025 06:50
@DaveSkender DaveSkender merged commit 91508a1 into auto-meta Jul 17, 2025
13 checks passed
@DaveSkender DaveSkender deleted the copilot/fix-abb41670-cfd4-4210-a346-5ce481c3efbe branch July 17, 2025 06:54
@github-project-automation github-project-automation bot moved this from In Review to Done in Stock Indicators for .NET Jul 17, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants