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.

30 lines
959 B

from auto_trading.broker.backtest import Backtest
from auto_trading.strat.all_in import AllIn
from auto_trading.ptf.in_memory import InMemoryPortfolio
from auto_trading.predictor.mean_agg import MeanAggregator
from auto_trading.predictor.normalized import NormalizedPredictor
from auto_trading.predictor.selector import SelectorPredictor
from auto_trading.main import Bot
if __name__ == '__main__':
csv = "data/price_history.csv"
with open(csv, 'r') as f:
head = f.readline().replace("\n", "").split(",")[1:]
pred = MeanAggregator([NormalizedPredictor(), SelectorPredictor({"Tether": 0.7})])
bot = Bot(
ptf=InMemoryPortfolio({k:1 for k in head}),
strategy=AllIn(),
broker=Backtest(csv, index_col=0, skiprows=1600, names=head),
predictor=pred
)
bot.print_results()
print("\n")
for _ in range(3):
bot.run_once()
bot.print_results()
print("\n")