itsjafer / schwab-api

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

Get all accounts in get_account_info #32

Closed WinesProof closed 8 months ago

WinesProof commented 8 months ago

This hopefully ensures that get_account_info() returns info for all accounts even with the v2 login process.

With this change, there's a chance that if a user calls get_account_info() then some other v1 method that requires a particular account to be selected, there could cause problems. If so, I think we can figure out how to add/modify the cookies to specify an account for those methods.

cnMuggle commented 8 months ago

Run into some issues with v1 get_account_info at the moment. But I am working to resolve it. It's mainly because I want to access the settled_fund feature which is still not available in get_account_info_v2(). If I can figure it out in v2, I don't need to use the v1 version. image

WinesProof commented 8 months ago

@cnMuggle , try this: https://github.com/WinesProof/schwab-api/tree/fix_multiple_cookies_error

WinesProof commented 8 months ago

Alternatively, it looks like the "v2" endpoints that return settled cash include "https://ausgateway.schwab.com/api/is.Balances/V1/Balances/balances/brokerage?selectionType=S1" and "https://ausgateway.schwab.com/api/is.TradeOrderManagementWeb/v1/TradeOrderManagementWebPort/account/balancespositions", so we could write a new method to get data from one/both of those.

cnMuggle commented 8 months ago

@cnMuggle , try this: https://github.com/WinesProof/schwab-api/tree/fix_multiple_cookies_error

This works great! Really appreciate it. Suggested you to check in. It turns out it's my trade_v2 issue. So I move back to use v2 endpoints without settled fund, but I will try to add this settled fund feature if I managed to have time.