Open ivelsantos opened 3 weeks ago
With the changes of 6ecfc8d Testnet is no longer used in testing mode. Now the bidPrice
is used on sell operations like Stop_loss
and Take_profit
and askPrice
is used in Buy
.
The problem now is that the real trading does not sell at the exactly bidPrice
due to volume and competition.
Insert a loss percentage to more accurate reflect real transaction
Currently
Take_profit
uses the higher bid price as comparison to their limit:https://github.com/ivelsantos/cryptor/blob/41844c1e0c5031d0a2337931a971cf3e8e4ce9fa/services/trading/operations/operations.go#L219-L228
The problem with this approach is that if the quantity of the bid price fetched is not equal or greater than the quantity being sold then the end price tends to be less than the higher bid price.
Proposal
Check the quantity of the higher bid price. In the case of that being less than the sold quantity, it should be made a weighted mean getting a more accurate market price to the
Take_profit
.