tdameritrade icon indicating copy to clipboard operation
tdameritrade copied to clipboard

The accountid environment variable was not passed in

Open Aspire1Inspire2 opened this issue 4 years ago • 2 comments

why is the self.accountIds = account_ids or []? Is this intentional? Or should we use self.accountIds = account_ids or os.environ['TDAMERITRADE_ACCOUNT_ID']?

class TDClient(object):
    def __init__(self, client_id=None, refresh_token=None, account_ids=None):
        self._clientId = client_id or os.environ['TDAMERITRADE_CLIENT_ID']
        self._refreshToken = refresh_token or os.environ['TDAMERITRADE_REFRESH_TOKEN']
        self.accountIds = account_ids or []
        self.session = TDASession(self._refreshToken, self._clientId)

Aspire1Inspire2 avatar Apr 25 '20 20:04 Aspire1Inspire2

account_ids isn't necessary to be set, as generally speaking most people either have a single account, or want information on all their accounts. we could pick it up from the environment, sure, but theres no need since its not a secret like the tokens are. so making it an argument is fine.

timkpaine avatar Apr 25 '20 20:04 timkpaine

I load my account ID in an env file along with the rest of my account info since there's no need to have it checked in source control.

dahifi avatar Apr 29 '20 12:04 dahifi