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

get_transaction not working with transactionId #233

Open
mwhchen opened this issue May 29, 2021 · 0 comments
Open

get_transaction not working with transactionId #233

mwhchen opened this issue May 29, 2021 · 0 comments

Comments

@mwhchen
Copy link

mwhchen commented May 29, 2021

Please read the bug submission guidelines before submitting a bug.

Not following guidelines may result in your bug being ignored and/or closed.

Description of Bug

client.get_transaction(acctId, txnId) returns not found although txnId is definitely valid.
Note, however client.get_transaction(acctId, '') works

Code to Reproduce

### Get valid txnIds from get_transactions - this function is working
r = client.get_transactions(config.account_number, 
	transaction_type= client.Transactions.TransactionType.ALL,
	start_date= datetime.date(2020, 12, 29), 
	end_date= datetime.date(2020, 12, 29))
print(json.dumps(r.json(), indent=4))

### use a txnId to put into get_transaction
ID = r.json()[0]['transactionId']

# print(f'*'*20)
# print(f'ID = {ID}') # to make sure it got a valid transactionId
# print(f'*'*20)

r = client.get_transaction(config.account_number, ID)
print(r)
print(json.dumps(r.json(), indent=4))

### BEGIN REDACTED LOGS ###

[debug.py:163:_enable_bug_report_logging] tda-api version 1.3.2
[auth.py:37:load_token] Loading token from file token
[auth.py:153:from_loaded_token] Loaded metadata aware token with creation timestamp 1619697675
[auth.py:56:__normalize_api_key] Appending @AMER.OAUTHAP to API key
[auth.py:418:easy_client] Returning client loaded from token file 'token'
[auth.py:207:ensure_refresh_token_update] Updating refresh token:
 - Current timestamp is 1622220982
 - Token creation timestamp is 1619697675
 - Update interval is 7344000 seconds
[auth.py:217:ensure_refresh_token_update] Skipping refresh token update
[synchronous.py:14:_get_request] Req 1: GET to https://api.tdameritrade.com/v1/accounts/<REDACTED 0-transactionItem-accountId>/transactions, params={
    "apikey": "<REDACTED API_KEY>",
    "type": "ALL",
    "startDate": "2020-12-29",
    "endDate": "2020-12-29"
}
[base.py:59:_log_response] Req 1: GET response: 200, content=[ {
  "type" : "TRADE",
  "subAccount" : "2",
  "settlementDate" : "2020-12-31",
  "orderId" : "<REDACTED 0-orderId>",
  "netAmount" : ,REDACTED>,
  "transactionDate" : "2020-12-29T15:13:35+0000",
  "orderDate" : "2020-12-29T15:01:24+0000",
  "transactionSubType" : "BY",
  "transactionId" : <REDACTED 0-transactionId>,
  "cashBalanceEffectFlag" : true,
  "description" : "BUY TRADE",
  "fees" : {
    "rFee" : 0.0,
    "additionalFee" : 0.0,
    "cdscFee" : 0.0,
    "regFee" : 0.0,
    "otherCharges" : 0.0,
    "commission" : 0.0,
    "optRegFee" : 0.0,
    "secFee" : 0.0
  },
  "transactionItem" : {
    "accountId" : <REDACTED 0-transactionItem-accountId>,
    "amount" : <REDACTED>,
    "price" : <REDACTED>,
    "cost" : <REDACTED>,
    "instruction" : "BUY",
    "instrument" : {
      "symbol" : “REDACTED TICKER”,
      "cusip" : “REDACTED”,
      "assetType" : "EQUITY"
    }
  }
} ]
[auth.py:207:ensure_refresh_token_update] Updating refresh token:
 - Current timestamp is 1622220983
 - Token creation timestamp is 1619697675
 - Update interval is 7344000 seconds
[auth.py:217:ensure_refresh_token_update] Skipping refresh token update
[synchronous.py:14:_get_request] Req 2: GET to https://api.tdameritrade.com/v1/accounts/<REDACTED 0-transactionItem-accountId>/transactions/<REDACTED 0-transactionId>, params={
    "apikey": "<REDACTED API_KEY>"
}
[base.py:59:_log_response] Req 2: GET response: 404, content={
  "error" : "Not Found"
}

Expected Behavior
Returns specific txn info of txnId

Actual Behavior
Error: Not found

Note that get_transaction(acctId, '') works. So, I suspect it may be the way a txnId is entered as an integer/ string that could be the problem. I've also tried typing int(txnId), str(txnId) - don't work

Error/Exception Log, If Applicable
See here to learn how to turn on debug logging: https://tda-api.readthedocs.io/en/latest/help.html

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