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

how to disable shorting



  • Is there any way to disable shorting (Selling more stock than balance in the account is not allowed) through some configuration or I have to do it manually ?

    There's a set_cash in broker's API, may be a set_stock to specify the initial stock account is useful?


  • administrators

    No. But there should be no inherent difficulty in avoiding going short, or is there?

    @eggachecat said in how to disable shorting:

    There's a set_cash in broker's API, may be a set_stock to specify the initial stock account is useful?

    backtrader starts from scratch and not with open positions. Setting the cash is needed to be able to operate long (you can set it to 0).