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

add formatted console output for ISeries lists #1280

Closed
6 tasks done
DaveSkender opened this issue Nov 29, 2024 · 0 comments · Fixed by #1150
Closed
6 tasks done

add formatted console output for ISeries lists #1280

DaveSkender opened this issue Nov 29, 2024 · 0 comments · Fixed by #1150
Assignees
Labels
enhancement New feature or request

Comments

@DaveSkender
Copy link
Owner

DaveSkender commented Nov 29, 2024

the problem

This is a quirky helper utility to convert IEnumerable<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.61  213.35  211.52  212.80  96708880
 2  2017-01-04  213.16  214.22  213.15  214.06  83348752
 3  2017-01-05  213.77  214.06  213.02  213.89  82961968
 4  2017-01-06  214.02  215.17  213.42  214.66  75744152
 5  2017-01-09  214.38  214.53  213.91  213.95  49684316
 6  2017-01-10  213.97  214.89  213.52  213.95  67500792
 7  2017-01-11  213.86  214.55  213.13  214.55  79014928
 8  2017-01-12  213.99  214.22  212.53  214.02  76329760
 9  2017-01-13  214.21  214.84  214.17  214.51  66385084
10  2017-01-17  213.81  214.25  213.33  213.75  64821664
11  2017-01-18  214.02  214.27  213.42  214.22  57997156
12  2017-01-19  214.31  214.46  212.96  213.43  70503512

Must do

  • properties with [JsonIgnore] attribute are excluded

  • include optional formatting args

    • All fields can have named formatting preferences in args, for example:

      Dictionary<string, string> args new() = 
      {
          { "Open", "N2" },
          { "High", "N2" },
          { "Low", "N2" },
          { "Close", "N2" },
          { "Volume", "N0" }, // No decimal places
          { "Date", "yyyy-MM-dd HH:mm" } // Include milliseconds
      };
    • args can also target specific primitive types, but also allow overrides based on sequencing in the args list (last format wins)

      Dictionary<string, string> args new() = 
      {
          { "decimal", "N2" },
          { "Volume", "N0" },            // override decimal places
          { "Date", "yyyy-MM-dd HH:mm" } // Include milliseconds
      };
    • when args or individual properties aren't covered, do not apply formatting

  • include overloads

    • .ToStringOut(Dictionary<object,string> args? = null) is the standard
    • .ToStringOut(int limitQty, Dictionary<object,string> args? = null) limits to the first X
    • .ToStringOut(int startIndex, int endIndex, Dictionary<object,string> args? = null) between a range
@DaveSkender DaveSkender added the enhancement New feature or request label Nov 29, 2024
@DaveSkender DaveSkender self-assigned this Nov 29, 2024
@DaveSkender DaveSkender moved this from Maybe to In Progress in Stock Indicators for .NET Nov 29, 2024
@DaveSkender DaveSkender linked a pull request Nov 29, 2024 that will close this issue
10 tasks
@DaveSkender DaveSkender moved this from In Progress to In Review in Stock Indicators for .NET Dec 24, 2024
@github-project-automation github-project-automation bot moved this from In Review to Done in Stock Indicators for .NET Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant