Schwab-API-Python icon indicating copy to clipboard operation
Schwab-API-Python copied to clipboard

couple enums

Open elidonner opened this issue 10 months ago • 5 comments

What has changed

  • as mentioned in https://github.com/tylerebowers/Schwabdev/pull/43 I've pulled out some examples of what I think could be nice enum additions. I think enums like this are nice for various reasons, including code completion, type safety, self-documentation. Care was also taken to make it backwards compatible. I think long term making some of the order types more error proof with this type of structure could be interesting. However, I'm trying to gauge interest first.
  • Imports are reordered to classic format of default python libraries (alphabetically) followed by additional libraries (alphabetically).
  • I fix a few type checker issues (mostly for optionals)
  • I add a validate function which I think makes Token's init function a bit more readable

elidonner avatar Mar 04 '25 04:03 elidonner

All changes look good except I do not want to use DaysOfWeek enums since it is not as broad as TimeFormat and in this case adds a small level of ambiguity. In the streamer.start_auto function all that is done is to convert to enums and then convert back out during comparison. The ints that can be used are in the docstring as well as the documentation and most people won't be changing these anyways.

I will merge if:

  • DaysOfWeek enum is removed (Change: enums.py, stream.py -> Stream.start_auto)
  • Raise valueError in client.py -> Client._time_convert for the case _:.

tylerebowers avatar Mar 04 '25 15:03 tylerebowers

@elidonner Any updates?

tylerebowers avatar Mar 31 '25 02:03 tylerebowers

@elidonner Any updates?

will come back to this sometime this week

elidonner avatar Apr 07 '25 19:04 elidonner

comments addressed

elidonner avatar Apr 24 '25 02:04 elidonner

I will take a look at this in 1 week (very busy for this week). Just notifying so you know that this PR isn't dead.

tylerebowers avatar Apr 27 '25 21:04 tylerebowers