Closed damianoporta closed 4 years ago
Maybe add a is_profit
column in the CTE that's based on the Case
expression? Then the annotation an be changed like so
.annotate(
drawdown=Max(cte.col.drawdown),
total_trades=Count(cte.col.strategy_id),
pips=Sum(cte.col.profit),
profit_count=Count(cte.col.is_profit), # I think you want to use Sum here instead of Count
)
It will be easier for me to give advice if you can give a working example. Please re-open and provide a full example if the above does not solve your issue.
Hello, in my query i have
this code works as expected but when i try to use the lookup __lt doing (i added profit_count):
i do not know what is the correct way to call __lt in this case. How should i use the lookups?