For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

PnL Net calculation Quote currency Bitcoin

  • Hi,
    I need help. To calculate Sharpe Ratio and VWR I need PnL Net in Dollar.

    My startcash is in $
    startcash = 10000

    cerebro.addsizer(bt.sizers.SizerFix, stake=2)

    symbol = 'ETH/BTC'

    At the moment I am getting PnL Net in BTC and it adds BTC value (for example 0.5 PnL Net) to Initail Porfolio Value. At the end my Final Porfolio Value is 10000.56 $ instead 12500$. I think because of this I am getting Sharpe Ratio -359.41 and VWR: 0.0

    How could I solve this problem? That Cerebro calculate automatically BTC PnL Net value in Dollars.

    With all other Quote Pairs like (BTC-EUR), USD, USDT etc I am getting right Sharpe and VWR.

  • I have got the solution. It was very simple :-) I just took startcash 1 instead 10000 and the calculations are good.

  • administrators

    This is because in the pair BTC/ETH there is nothing which is expressed in fiat currency, which is what you were referring to. Glad you saw it so quickly.

  • @abyaby

    Hi abyaby,
    For my own informaiton, please, how do you import in backtrader BTC/ETH trading data?
    I thank you in advance for your feedback.
    Have a good evening.
    Best regards,

Log in to reply