oceanprotocol / pdr-backend

Instructions & code to run predictoors, traders, more.
Apache License 2.0
22 stars 15 forks source link

[Bug, Sim] ppss.yaml 'take_profit_percent' says 'disabled if 100.0'; it should be 1.0 #1282

Closed trentmc closed 6 days ago

trentmc commented 6 days ago

The problem

In ppss.yaml, it has:

    stop_loss_percent: 1.0 # sell if price drops by this %, . 1.0 = disabled
    take_profit_percent: 100.0 # sell if price rises by this %, . 100.0 = disabled

Why is the first one disabled if 1.0, and the second only if 100.0? It's almost certainly a bug: the second is disabled if 1.0 (not 100.0).

Details

They're used in pdr_backend/sim/sim_trader.py. In __init__():

        self.tp_percent = self.ppss.trader_ss.take_profit_percent
        self.sl_percent = self.ppss.trader_ss.stop_loss_percent

Then example usage is:

                self.tp = cur_close + (cur_close * self.tp_percent)
                self.sl = cur_close - (cur_close * self.sl_percent)

Note how tp and sl are treated near-identically. And 1.0 = disabled makes sense for both.

trizin commented 6 days ago

This is to make sure it is definitely disabled. Price can increase by 100% and trigger TP.

trentmc commented 6 days ago

OK! Thanks for the clarification