PnL snapshot endpoint does not work

Hi All –

after a hiatus, I’m back to working with the Tradovate API. I am using the requests library to get a snapshot of my account PnL. Here is my code:

def get_pnl():

bearer = 'Bearer '+str(main_authenticator.access_token) 

headers = {

    'Accept': 'application/json',

    'Authorization': bearer,

    }

data = '{ "accountId": "999999"}'

response = requests.post('https://demo.tradovateapi.com/v1/cashBalance/getcashbalancesnapshot', headers=headers, data=data)

response_message = response.content

print(response_message)

This returns the error: b’Invalid request: error id: 3d78e68f-7ed0-4a87-89b8-0bf884f2a196’. Anyone know what’s going on?

Maybe try “accountId” value as a number instead of a string?

1 Like

Tried that, instead of the actual data that the call is supposed to return, I just get an empty “b” frame, “b’’”

anyone else have any ideas? why would this return an empty b frame?

also have noticed the error returning only when i include a space in the header for bearer ("Bearer " instead of “Bearer”). thanks again, everyone