HellAmbro / Trading212API

Unofficial Trading212 API
MIT License
59 stars 27 forks source link

Orders does not include the 'Fill Price' #17

Closed Adam48521 closed 2 years ago

Adam48521 commented 2 years ago

Hi,

The order extract is missing several details including the fill price, exchange rate and FX Fee. Would it be possible to include these in the dictionary you extract with trading212.get_orders(older_than=older_than, newer_than=newer_than please?

Thanks, Adam

HellAmbro commented 2 years ago

Hi, thanks for the report, I just added the api to do this, you can refer to this example, also added in example.py.

orders = trading212.get_orders(older_than=older_than, newer_than=newer_than)
for o in orders['data']:
        order_details = trading212.get_order_details(o['detailsPath'])
        fx_fee = order_details['sections'][3]['rows'][0]['value']['context']['amount']
        total = order_details['sections'][3]['rows'][1]['value']['context']['amount']
        exchange_rate = order_details['sections'][2]['rows'][4]['value']['context']['quantity']

You can parse the response to get all data that you needs