For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
Get tradeid of order in order_notify
-
Hi,
How would it be possible to get the tradeid value of the order in notify_order method when the status of the order changes. For example, when my order gets completed I would like to check via tradeid which order it was.
I found this forum post, but one of the answers did not work (int object has not attribute "ref" error) and the other answer was as useless as it can get.
-
Answering my own question.
The order.ref answer that was given in that forum post actually works. My mistake was that I wanted to get the attributes directly and compare them. However the order class has overwritten the == method in which itself it compares ref attributes.
So instead of
if self.tradeid == order.ref:
I had to write
if self.tradeid == order: