You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
571 B

from os import curdir
1 year ago
import pandas as pd
from ..interfaces import Broker
class Backtest(Broker):
"""
Backtest Broker
"""
def __init__(self, f_name: str, start=0, **kwargs) -> None:
1 year ago
"""Read the csv file and store it into a dataframe"""
self.data = pd.read_csv(f_name, **kwargs)
self.curcor = start
1 year ago
def __bool__(self):
return self.curcor < len(self.data)
def next(self):
"""Return the next row of the dataframe"""
self.curcor += 1
return self.data.iloc[:self.curcor].copy()