tdameritrade
tdameritrade copied to clipboard
The accountid environment variable was not passed in
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)
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.
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.