finlab-python / finlab_crypto

Documentation
https://finlab-python.github.io/finlab_crypto/index.html
GNU General Public License v3.0
267 stars 98 forks source link

Update strategy #7

Closed jrycw closed 3 years ago

jrycw commented 3 years ago

It seems that if self._default_parameters scenario can be covered by if variables scenario.

koreal6803 commented 3 years ago

Thank you for the contribution. But, I don't think if variables literally covers all the scenarios. Here is an example:

@Strategy(n1=1, n2=2)
def strategy(ohlcv):
    ...
   return entries, exits

With the strategy above, if we perform backtesting

strategy.backtest(ohlcv, {'n1': 11, 'n2': 3})

then the variables of the strategy become:

strategy.n1 # 11
strategy.n2 # 3

If we perform backtesting again as follows

strategy.backtest(ohlcv, {'n2': 2})

, the variable n1 is set to 11, not 1, which could confuse users. Thank you and look forward to other improvements.

jrycw commented 3 years ago

Understood. This is a use case that I did not consider.