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

feat: ToStringOut() for series #1150

Draft
wants to merge 10 commits into
base: v3
Choose a base branch
from
Draft

feat: ToStringOut() for series #1150

wants to merge 10 commits into from

Conversation

DaveSkender
Copy link
Owner

@DaveSkender DaveSkender commented Jan 26, 2024

Description

This is a quirky helper utility to convert ISeries (quotes and results lists) to a fixed width, CSV, or JSON string. Mostly, I'm thinking this is helpful anyone debugging or wanting to output something to Console for quick visual inspections or general development sharing. Default is OutType.FixedWidth, since I mostly had Console output and .NET Fiddle use in mind.

   i  Timestamp      Open     High      Low    Close     Volume
---------------------------------------------------------------
   1  2017-01-03   212.71  213.350  211.520  212.570   96708880
   2  2017-01-04   212.64  214.220  212.638  213.648   83348752
   3  2017-01-05   213.14  214.060  213.020  213.685   82961968
   4  2017-01-06   213.41  215.170  213.414  214.318   75744152
   5  2017-01-09   213.87  214.530  213.866  214.193   49684316
   6  2017-01-10   214.03  214.890  213.520  214.083   67500792

To do

  • depends on merge of feat: Full chain streaming prototypes #1092, since it restructures IResult to be parameterless
  • question: isn't there a built-in set of converters that might work better here? seems like we're re-engineering something that probably already exists in C# features.
  • question: any way to use inner override of result class ToString()? Probably not. Maybe we just use .ToStringList() or .ToStringOut()
  • fix: order date as first property, it's inherited, so it is always at the end right now
  • fix: use of unused arguments for certain OutType values
  • fix: formatting issues for date. For OutType.FixedWidth, it would ideally be the smallest format possible, keeping in mind that bars could be high frequency date/time values or wider.
  • consider overload .ToString(int limitQty) or .ToString(int startIndex, int endIndex)
  • add separate backlog items if some classes might have their own (property, type, value, description (from XML docs)), ref:
    Property   Type          Value  Description
    -------------------------------------------------------------------
    Timestamp  DateTime 2024-02-02  The close date/time for this period
    Size       Decimal        3.00  High - Low price
    Body       Decimal        1.00  | Open - Close | (absolute value)
    UpperWick  Decimal        1.00  High - max(Open, Close)
    ...
  • fix: overall performance, needs major refactoring
  • add real unit tests

@DaveSkender DaveSkender added the on hold On hold / waiting label Jan 26, 2024
@DaveSkender DaveSkender self-assigned this Jan 26, 2024
@DaveSkender DaveSkender added this to the v3 milestone Jan 26, 2024
@DaveSkender
Copy link
Owner Author

Note: overriding ToString() doesn't work on enumerable, but does work for base types.

@DaveSkender DaveSkender added the experiment Pseudo-fork for experimental (do not merge) label Nov 11, 2024

Choose a reason for hiding this comment

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated no suggestions.

Comments skipped due to low confidence (4)

tests/indicators/_common/Results/Result.Utilities.ToStringOut.Tests.cs:12

  • The test method 'ToStringFixedWidth' is not implemented correctly and needs to be properly implemented.
Assert.Fail("Test not implemented, very wrong syntax.");

tests/indicators/_common/Results/Result.Utilities.ToStringOut.Tests.cs:26

  • The test method 'ToStringCSV' is not implemented correctly and needs to be properly implemented.
Assert.Fail("Test not implemented, very wrong syntax.");

tests/indicators/_common/Results/Result.Utilities.ToStringOut.Tests.cs:36

  • The test method 'ToStringJson' is not implemented correctly and needs to be properly implemented.
Assert.Fail("Test not implemented, very wrong syntax.");

src/_common/Generics/StringOut.cs:66

  • The message should be 'ToStringOut() for JSON output ignores the number format N{decimalsToDisplay}.'
string message = $"ToStringOut() for JSON output ignores number format N{decimalsToDisplay}.";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
experiment Pseudo-fork for experimental (do not merge) on hold On hold / waiting
Projects
Development

Successfully merging this pull request may close these issues.

1 participant