-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbacktesting.py
More file actions
34 lines (26 loc) · 809 Bytes
/
backtesting.py
File metadata and controls
34 lines (26 loc) · 809 Bytes
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
from strategy import Printer_strategy
import logging
import pandas
import threading
import datetime
from time import sleep
logging.getLogger(__name__)
logging.basicConfig(filename='backtesting.log', format='%(asctime)s: %(name)s: %(levelname)s: %(message)s', level=logging.INFO)
printer = Printer_strategy()
ohlc = pandas.read_csv('test_data.csv', index_col=0)
def data_feeder(count):
column = 89 + 25 + 28 + count
feed = ohlc.iloc[0:column]
return feed
def thr_nme():
while 1:
print(threading.enumerate())
sleep(1)
while 1:
for i in range(300):
data = data_feeder(i)
logging.info(data.index[-1])
print(data.index[-1])
# print(threading.enumerate())
printer.printer(data)
sleep(6.5)