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 get the current value for the fund, not just in notify fcn?
-
In my backtesting program, I wanted to change cash when trading. Thus I added some code in notify_fund() to change cash. The problem is that I want to define a get_value() function which can get the current value of the fund (which is the value variable in the notify_fund() function). However, I don't know where I can find or get the value. Please give me some suggestions and thanks a lot.
-
See: Docs - Broker ->
get_fundvalue
-
Thank you for your quick reply. cerebro.broker.get_fundvalue() can give me the value. But the problem is that I want to get the value in the next() for Strategy class. Thus get_fundvalue is not available.
-
The broker is available in the strategy. See Docs - Strategy - Member Attributes
-
Got it, thank you !