-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathci.py
38 lines (30 loc) · 1.03 KB
/
ci.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import pandas as pd
import matplotlib.pyplot as plt
import os, glob
from trader import TradingStrategySimulator
source_dir = "ci/input"
output_dir = "ci/output"
plot_dir = "ci/plots"
params = {
'sell_high': True,
'buy_low': True,
'relative_sell': 30,
'relative_buy': 50,
'cash_interest': 0.12/252,
'high_sell_factor': 1.015, # how much above 52 week high in order to sell
'keep_minimum': 0.5,
'invest_cap': -250000,
'total_cap': -500000,
'hi_lo_weeks': 52
}
# Use glob to find all CSV files in the specified directory
file_list = glob.glob(os.path.join(source_dir, '*.csv'))
file_list = [os.path.basename(file) for file in file_list]
simulator = TradingStrategySimulator(initial_invest=5000,
start_date="2022-07-03",
period_months = 60,
plan=1,
source_dir = source_dir,
output_dir = output_dir,
params=params)
simulator.run(file_list)