3 changed files with 26 additions and 2 deletions
@ -0,0 +1,22 @@ |
|||
import pandas as pd |
|||
|
|||
from ..interfaces import Broker |
|||
|
|||
|
|||
class Backtest(Broker): |
|||
""" |
|||
Backtest Broker |
|||
""" |
|||
|
|||
def __init__(self, f_name: str) -> None: |
|||
"""Read the csv file and store it into a dataframe""" |
|||
self.data = pd.read_csv(f_name) |
|||
self.curcor = -1 |
|||
|
|||
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] |
Loading…
Reference in new issue