|
|
|
|
@ -124,8 +124,10 @@ def upload_data(hap, data, ticker, period):
@@ -124,8 +124,10 @@ def upload_data(hap, data, ticker, period):
|
|
|
|
|
|
|
|
|
|
raw_data = serialized_bars.getvalue() |
|
|
|
|
|
|
|
|
|
print('Request: ', rq) |
|
|
|
|
hap.send_multipart([bytes(json.dumps(rq), "utf-8"), raw_data]) |
|
|
|
|
parts = hap.recv_multipart() |
|
|
|
|
print('Response: ', parts[0]) |
|
|
|
|
if parts[0] != b'OK': |
|
|
|
|
return False |
|
|
|
|
return True |
|
|
|
|
@ -140,9 +142,9 @@ def convert_ticker(s, data):
@@ -140,9 +142,9 @@ def convert_ticker(s, data):
|
|
|
|
|
current_mon = last_ts.date().month |
|
|
|
|
mon = get_month_by_code(s[-2]) |
|
|
|
|
if year >= current_year_in_dec: |
|
|
|
|
return s[:-2] + ".{}-{}".format(mon, current_dec + year) |
|
|
|
|
return s[:-2] + "-{}.{}".format(mon, current_dec + year) |
|
|
|
|
else: |
|
|
|
|
return s[:-2] + ".{}-{}".format(mon, current_dec + 10 + year) |
|
|
|
|
return s[:-2] + "-{}.{}".format(mon, current_dec + 10 + year) |
|
|
|
|
|
|
|
|
|
else: |
|
|
|
|
return s |
|
|
|
|
@ -205,6 +207,8 @@ def main():
@@ -205,6 +207,8 @@ def main():
|
|
|
|
|
|
|
|
|
|
max_retries = 3 |
|
|
|
|
for ticker in tickers: |
|
|
|
|
if ticker == "": |
|
|
|
|
continue |
|
|
|
|
for trynum in range(0, max_retries): |
|
|
|
|
if allow_ticker(blacklist, ticker): |
|
|
|
|
print("Requesting ticker from QHP: {}".format(ticker)) |
|
|
|
|
|