Ok, I resolved using simply
side property of the order (maybe other flags seems (to me) not correctly populated like
I have another annoying issue: to reduce a bunch of chars on the output I need to understand if the order is done ad the open/closing candle time (open a market order long/short) or during a candle creation (ie: stop loss or take profit). So far I tried to understand it calculating the modulus of the timestamp divided by timeframe (in millisecs). For example in a 4h timeframe I check if the
execution timestamp % timeframe * 60000 == 0
But it is not reliable (ie: a timestamp at 16:00 can be dived by 4*60000 and the same for 18:00 that is in the middle of 4h candle).
Do you know if there is a way I can understand if a order is made at candle close/open?
Maybe all market orders (no stop nor limit) are in these conditions?