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

invalid_token on get_transaction_history_v2 #68

Open
JasonGross opened this issue Aug 1, 2024 · 0 comments
Open

invalid_token on get_transaction_history_v2 #68

JasonGross opened this issue Aug 1, 2024 · 0 comments

Comments

@JasonGross
Copy link

JasonGross commented Aug 1, 2024

With code

# %%
from schwab_api import Schwab
import pprint

# Initialize our schwab instance
api = Schwab()
# %%
# Login using playwright
print("Logging into Schwab")
logged_in = api.login(
    username=getenv_or_input("SCHWAB_USERNAME"),
    password=getenv_or_input("SCHWAB_PASSWORD", input=getpass),
    totp_secret=getenv_or_input("SCHWAB_TOTP_SECRET", input=getpass),
    lazy=True,
    # Get this by generating TOTP at https://itsjafer.com/#/schwab
)
await api._async_login()
# %%
# Get information about a few tickers
quotes = api.quote_v2(["PFE", "AAPL"])
pprint.pprint(quotes)
# %%
# Get information about all accounts holdings
print("Getting account holdings information")
account_info = api.get_account_info()
pprint.pprint(account_info)

print("The following account numbers were found: " + str(account_info.keys()))

# %%
transactions = {account_id: api.get_transaction_history_v2(account_id) for account_id in account_info.keys()}
# %%
pprint.pprint(transactions)

I get the response

(['{"error_description":"5e9cdf15-22f1-126b-7c7c-259f2dbedaaf","error":"invalid_token"}'],
            False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant