modified position json function on socket emit

This commit is contained in:
Giulio De Pasquale 2020-12-16 09:37:14 +00:00
parent 054bb0dc04
commit dfdb2e46a9

View File

@ -88,9 +88,11 @@ def on_new_tick(event: Event, status: SymbolStatus):
def pos_to_json(pw: PositionWrapper): def pos_to_json(pw: PositionWrapper):
return { return {
"id": pw.position.id, "id": pw.position.id,
"base_price": pw.position.base_price,
"state": str(pw.state()),
"symbol": pw.position.symbol, "symbol": pw.position.symbol,
"profit_loss": pw.position.profit_loss, "profit_loss": pw.net_profit_loss(),
"profit_loss_percentage": pw.position.profit_loss_percentage "profit_loss_percentage": pw.net_profit_loss_percentage()
} }
tick = event.tick tick = event.tick