If there is no position, get_position() returns an error.
Is this the intended result ?
p=api.get_position(‘TSLA’)
p.qty
5
p=api.get_position(‘AAPL’)
p.qty
APIError: position does not exist
If there is no position, get_position() returns an error.
Is this the intended result ?
p=api.get_position(‘TSLA’)
p.qty
5
p=api.get_position(‘AAPL’)
p.qty
APIError: position does not exist
I have the same problem. I can’t figure it out.
Try this
p=api.get_position(‘AMD’).qty
print(‘total number of share:’ + str§);