18 lines
500 B
Python
18 lines
500 B
Python
from bfxbot.models import PositionWrapper
|
|
|
|
|
|
def net_pl_percentage(perc: float, reference_fee_perc: float):
|
|
return perc - reference_fee_perc
|
|
|
|
|
|
def pos_to_json(pw: PositionWrapper):
|
|
return {
|
|
"id": pw.position.id,
|
|
"amount": pw.position.amount,
|
|
"base_price": pw.position.base_price,
|
|
"state": str(pw.state()),
|
|
"symbol": pw.position.symbol,
|
|
"profit_loss": pw.net_profit_loss(),
|
|
"profit_loss_percentage": pw.net_profit_loss_percentage()
|
|
}
|