开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

Re: About commissionReport.realizedPNL


 

That value (1.797...e+308) is the maximum value a double can hold. IB uses that to indicate the value is unset. In the C++ API code, they have an UNSET_DOUBLE constant that you can compare against, there may be something similar in the python code.

Also, my python is a little rusty, but I think you need to pass an array to writerow, something like: writer.writerow([commissionReport.realizedPNL])

On Thu, Jul 21, 2022 at 10:01 AM <david03kimo@...> wrote:
When I execute an order I get the?commissionReport.But I cannot read the?commissionReport.realizedPNL such like?1.7976931348623157e+308.
When I create a new position, the?commissionReport.realizedPNL shows?1.7976931348623157e+308.After the position closed,the?commissionReport.realizedPNL shows the normal profit and loss amount.
I'd like to export the Profit and loss to csv after every positions closed.But I don't know how to handle the??commissionReport.realizedPNL such like?1.7976931348623157e+308.
It cannot export?commissionReport.realizedPNL to csv by?writer.writerow(commissionReport.realizedPNL).It shows error message:csv.Error: iterable expected, not float

I don't know how to do? Any ideas is welcome.


--


------
Forex trader
David Liao

Join twsapi@groups.io to automatically receive all group messages.