kohjb / AmeritradeAPIwGoogleScripts

Ameritrade API with Google Scripts tutorial repository of code
18 stars 4 forks source link

Compatability with Schwab #3

Open bdf0506 opened 5 months ago

bdf0506 commented 5 months ago

Now that TD Ameritrade is dead and the Schwab API is live, are there any attempts to make this compatible with Schwab?

https://developer.schwab.com/home https://discord.gg/zjtxdVkjJS

kohjb commented 5 months ago

Yes, I will attempt to port the scripts to Schwab's API. But as I have yet to be activated on their platform yet, this will take some time. The current activation date where my account is moved over is in May 2024, so I'll only be able to work on the scripts after that and see what changes are necessary.

bdf0506 commented 5 months ago

Awesome. I’ve started to see what I can get working, as my account moved to Schwab a few weeks ago, and I’ve been impatiently waiting for the API to be released.

Biggest issue I see is that a refresh token is only valid for 7 days on Schwab, compared to 90 days with TD. Based on the flow that exists in this app, seems we need to rewrite something so that it can somehow reauth in a better way, as every 7 days is super painful.

Might need to reference a better OAuth2 script for Google sheets, maybe something from this library could assist: https://github.com/googleworkspace/apps-script-oauth2

bdf0506 commented 4 months ago

Here is a working version with Schwab, which is heavily based on this repo: https://github.com/bdf0506/schwab-googlesheets

You still have to authenticate every 7 days. If you can figure out a way to avoid the every 7 day counter let me know.

kohjb commented 4 months ago

Ok, great!! I'm still not migrated yet, so I'll only be able to try it out from June onwards. Will post here if anything comes up.