itsjafer / schwab-api

A python library for placing trades on Charles Schwab
MIT License
201 stars 64 forks source link

Allow session to be cached to disk #56

Closed tristanpenman closed 2 months ago

tristanpenman commented 5 months ago

Raising this as a draft, for some early feedback. This is just my first pass at doing this, and I feel that some of the error cases are not yet handled well enough.

A quick summary of the changes so far:

Keen to hear what you think!

tristanpenman commented 3 months ago

@itsjafer apologies for taking so long to get this ready for review. This has been on my TODO list for many weeks now, and I've just gone through and tidied up my changes. The main changes since I first raised the PR are:

I've tried to ensure that this is all backwards compatible with the existing API.

As far as potential improvements go, I think it would be worth rate-limiting login attempts. However, I chose not to do that as part of this PR, to keep the changeset reasonably small. It is also possible for the async login process to get stuck when invalid credentials are used - I think this is pre-existing, so I'll raise an issue for that.

itsjafer commented 3 months ago

Thanks for the PR! I looked through the code and didn't find anything of note -- I'll test out the functionality locally sometime this week to confirm it works as expected, and then merge this in!