logging
This commit is contained in:
parent
d0771ad490
commit
d65751df48
|
|
@ -11,6 +11,13 @@ import statistics
|
|||
from credentials import get_credentials
|
||||
from threading import Thread
|
||||
|
||||
def write_to_log(message):
|
||||
'''
|
||||
Writes a message to the log file
|
||||
'''
|
||||
with open("log.txt", "a") as f:
|
||||
f.write(message)
|
||||
|
||||
|
||||
def yang_zhang(candles):
|
||||
'''
|
||||
|
|
@ -128,13 +135,13 @@ def fetch_data(broker: str, pair_list: list, timeframe: str, samples: int):
|
|||
try:
|
||||
data = exchange.fetch_ohlcv(pair,timeframe=timeframe,limit=samples)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
write_to_log(str(e))
|
||||
continue
|
||||
try:
|
||||
parkinson_volatility = parkinson(data)
|
||||
yangzhang_volatility = yang_zhang(data)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
write_to_log(str(e))
|
||||
continue
|
||||
for item in data:
|
||||
trading_volume += item[4]*item[5]
|
||||
|
|
|
|||
Loading…
Reference in New Issue