Content-Length: 258038 | pFad | https://github.com/kernc/backtesting.py/issues/493

F7 Broker Cash, Strange Metric · Issue #493 · kernc/backtesting.py · GitHub
Skip to content

Broker Cash, Strange Metric #493

@shaunpatterson

Description

@shaunpatterson

Expected Behavior

Start with $1000
Buy $100 of stock
self._broker._cash should be $900.
Sell $150 of stock
self._broker._cash should be $1050

Actual Behavior

Start with $1000
Buy $100 of stock
self._broker._cash doesn't change
Sell $150 of stock
self._broker._cash is now $1050 (cash += closed_trade.pl)

I don't understand this behavior. The variable is named cash, but it's not really the current cash value.

If you want to make trades based on your actual available cash, self._broker.margin_available seems to be what you want... but that seems strange.

Am I missing something here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/kernc/backtesting.py/issues/493

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy