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

in generated csv file, the field name mismatch with value #53

Open
Momingjian opened this issue Mar 7, 2020 · 2 comments
Open

in generated csv file, the field name mismatch with value #53

Momingjian opened this issue Mar 7, 2020 · 2 comments

Comments

@Momingjian
Copy link

The field name mismatch with its value. For example in my generated file:

executed_notional | execution_state | extended_hours | fees
{u'currency_id': u'1072fc76-1862-41ab-82c2-485837590762' | u'amount': u'903.80' | u'currency_code': u'USD'} | completed

@jlothringer
Copy link

When the file is read as comma delimited, commas within the executed_notional limit buy/sell field (which is a dictionary) cause that column to be read as three separate columns and this spills over to execution_state and extended_hours. The same is true for the total_notional column.

For a very quick fix, I've added the following snippet at line 74 of csv_export.py:

    if order['executed_notional'] is not None:
        order['executed_notional'] = order['executed_notional']['currency_id']+' | '+order['executed_notional']['amount']+' | '+order['executed_notional']['currency_code']
    if order['total_notional'] is not None:
        order['total_notional'] = order['total_notional']['currency_id']+' | '+order['total_notional']['amount']+' | '+order['total_notional']['currency_code']

@DeqingSun
Copy link

When the file is read as comma delimited, commas within the executed_notional limit buy/sell field (which is a dictionary) cause that column to be read as three separate columns and this spills over to execution_state and extended_hours. The same is true for the total_notional column.

For a very quick fix, I've added the following snippet at line 74 of csv_export.py:

    if order['executed_notional'] is not None:
        order['executed_notional'] = order['executed_notional']['currency_id']+' | '+order['executed_notional']['amount']+' | '+order['executed_notional']['currency_code']
    if order['total_notional'] is not None:
        order['total_notional'] = order['total_notional']['currency_id']+' | '+order['total_notional']['amount']+' | '+order['total_notional']['currency_code']

it seems last_trail_price may have the same issue.

        if order['executed_notional'] is not None:
            order['executed_notional'] = order['executed_notional']['currency_id']+' | '+order['executed_notional']['amount']+' | '+order['executed_notional']['currency_code']
        if order['total_notional'] is not None:
            order['total_notional'] = order['total_notional']['currency_id']+' | '+order['total_notional']['amount']+' | '+order['total_notional']['currency_code']
        if order['last_trail_price'] is not None:
            order['last_trail_price'] = order['last_trail_price']['currency_id']+' | '+order['last_trail_price']['amount']+' | '+order['last_trail_price']['currency_code']

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

3 participants