For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
Data CSV in Strategy
-
Hi
how can get dataframe in strategy and work it by pandas dataframe in init function of strategy
and get list of close values
like thisimport backtrader as bt import pandas as pd class test2(bt.Strategy): def __init__(self): print(pd.DataFrame(self.data.close[0]))
-
how can I get list of close values in strategy?
I want to get all values ! -
You can get all of the close values at the end of the backtest in stop.
def stop(self): a = self.data.get(0,len(self.data))
-
@run-out can I get that in init function? I want to use it in next function!
-
@sadegh said in Data CSV in Strategy:
can I get that in init function? I want to use it in next function!
But you already have the close values available in next. What exactly are you trying to do?
-
I want to get all close values in init function as a list
-
@run-out I mean I want to process all data in init function and use the result in next function