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

allow cash to get negative



  • Is it possible to let broker trade even if there is not enough cash? Say, get_cash() reports $1000. My strategy says it should buy some asset for a value of $2000. Backtrader broker normal behaviour will be not to execute the order since the trade would cost more cash than available.
    I would like to let the trade happen and allow cash to get negative (equivalent to having borrowed cash). Is this possible? Or should I determine that I have not enough cash, and add a certain amount of cash to my account?
    I'd prefer the first option, since I don't want my account value to increase when I borrow. I'd rather like to keep track of my dept in account value. My position sizing indeed depends on account value and I don't want the strategy to start oversizing positions because it sees fresh cash coming and does not understand that this is borrowed money and that the net account value does not increase when money is borrowed.


  • administrators

    Use leverage. The broker won't let you have a negative position in cash.



  • @backtrader Thanks! Yes I am exploring this route. I may come up with a few questions later.
    Cheers


Log in to reply
 

Looks like your connection to Backtrader Community was lost, please wait while we try to reconnect.