whittlem / pycryptobot

Python Crypto Bot (PyCryptoBot)
Apache License 2.0
1.97k stars 738 forks source link

average the margin_calculation on get_closed_trades in actions.py #687

Closed IfeanyiEmeagi closed 2 years ago

IfeanyiEmeagi commented 2 years ago

Description

The trade summary feature on the telegram returns the total gain or loss by summing all the gain(s) or loss(es) that occurred during the time under review. This does not show the actual gain or loss realized from all the trades. For example, if I had two 50USDT trades that made 10% profit margin each, the total margin the trade summary will display will be 20% and this is not actual profit realized from these trades rather the real profit is 10%.

This little hotfix hosted in a branch "hot/fix" resolved the issue by calculating the average of the total margin realized.

Fixes # (issue) Improper total margin calculation at the trade summary section.

Type of change

Please make your selection.

How Has This Been Tested?

I checked the trade summary at different intervals which returned the actual gain or loss incurred.

Checklist: