@davidavr yes i came across vectorbt earlier. it seems interesting as well.
Latest posts made by dizzy0ny
-
RE: using backtrader with pandas
-
RE: using backtrader with pandas
@davidavr said in using backtrader with pandas:
CustomPandasFeed
So for this approach, every additional seriesi would want in my dataframe (which will be converted to a list/array of 'lines'), i would need to first define it in that CustomPandasFeed? or will the existing PandasData do that without having to define a custom feed?
This was helpful..thanks
-
RE: using backtrader with pandas
@ultra1971 said in using backtrader with pandas:
sed on yur short description you are using a vector based backtesting.
The second one mode is faster, the first one is more accurate, and you need to transform the logic from one method to another.
The use of talib is allow into the platform with data feed, so the process will be easy, laborious but easy.thank you. i was curious as to what advantages there are in event based (or time based) systems. Seems to me with vector based, you can almost instantaneously generate the history for buy/sell signals - even if the signals are time based (i.e. event 2 is preceded by event 1 being True).
i will do some testing w/ backtrader -
using backtrader with pandas
I am new here and considering moving to backtrader. but i do have alot of code that uses pandas dataframes. i am wondering if all that code needs to be rewritten using the backtrader objects that represents series'?
For example, typically, i keep all my indicators and calculated values as part of the same ohlcv dataframe, since the all must align to the same datetimeindex. for example
df = dataset //dateset is a Dataframe with ohlcv columns and a datetime index slow_per = 21; fast_per = 8; rsi_per = 2; rsi_ob = 90; rsi_os = 10 df['ma_slow'] = talib.SMA(df.close, timeperiod = slow_per) df['ma_fast'] = talib.SMA(df.close, timeperiod = fast_per) df['rsi'] = talib.RSI(df.close, timeperiod=rsi_per) _, _, df['macdhist'] = talib.MACD(df.close, 12, 26, 9)
This makes it simple in my code to slice and dice, wrangle, filter and perform calculations...and these operations are very optimized to boot with latest versions of the libraries.
Is there a possiblity of working with pandas dataframes seemlessly with backtrader?
thanks much.