|
|
|
@ -49,7 +49,7 @@ def main(): |
|
|
|
max_dt = None |
|
|
|
max_dt = None |
|
|
|
time_delta = datetime.timedelta(hours=0) |
|
|
|
time_delta = datetime.timedelta(hours=0) |
|
|
|
if args.time_delta is not None: |
|
|
|
if args.time_delta is not None: |
|
|
|
time_delta = datetime.timedelta(hours=int(args.time_delta)) |
|
|
|
time_delta = datetime.timedelta(seconds=int(args.time_delta)) |
|
|
|
print('Applying delta:', time_delta) |
|
|
|
print('Applying delta:', time_delta) |
|
|
|
line_count = 0 |
|
|
|
line_count = 0 |
|
|
|
with open(args.input_file, 'r') as f: |
|
|
|
with open(args.input_file, 'r') as f: |
|
|
|
@ -88,26 +88,27 @@ def main(): |
|
|
|
if dt > max_dt: |
|
|
|
if dt > max_dt: |
|
|
|
max_dt = dt |
|
|
|
max_dt = dt |
|
|
|
|
|
|
|
|
|
|
|
if args.force_from is not None: |
|
|
|
if line_count > 0: |
|
|
|
min_dt = datetime.datetime.strptime(args.force_from, "%Y%m%d") |
|
|
|
if args.force_from is not None: |
|
|
|
|
|
|
|
min_dt = datetime.datetime.strptime(args.force_from, "%Y%m%d") |
|
|
|
|
|
|
|
|
|
|
|
if args.force_to is not None: |
|
|
|
if args.force_to is not None: |
|
|
|
max_dt = datetime.datetime.strptime(args.force_to, "%Y%m%d") |
|
|
|
max_dt = datetime.datetime.strptime(args.force_to, "%Y%m%d") |
|
|
|
|
|
|
|
|
|
|
|
rq = { |
|
|
|
rq = { |
|
|
|
"ticker" : out_symbol, |
|
|
|
"ticker" : out_symbol, |
|
|
|
"start_time" : min_dt.strftime("%Y-%m-%dT%H:%M:%S"), |
|
|
|
"start_time" : min_dt.strftime("%Y-%m-%dT%H:%M:%S"), |
|
|
|
"end_time" : max_dt.strftime("%Y-%m-%dT%H:%M:%S"), |
|
|
|
"end_time" : max_dt.strftime("%Y-%m-%dT%H:%M:%S"), |
|
|
|
"timeframe_sec" : sec_from_period(period) |
|
|
|
"timeframe_sec" : sec_from_period(period) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
print("Read {} lines".format(line_count)) |
|
|
|
print("Read {} lines".format(line_count)) |
|
|
|
raw_data = serialized_bars.getvalue() |
|
|
|
raw_data = serialized_bars.getvalue() |
|
|
|
print("Sending {} bytes".format(len(raw_data))) |
|
|
|
print("Sending {} bytes".format(len(raw_data))) |
|
|
|
|
|
|
|
|
|
|
|
s.send_multipart([bytes(json.dumps(rq), "utf-8"), raw_data]) |
|
|
|
s.send_multipart([bytes(json.dumps(rq), "utf-8"), raw_data]) |
|
|
|
parts = s.recv_multipart() |
|
|
|
parts = s.recv_multipart() |
|
|
|
print("Response:", parts) |
|
|
|
print("Response:", parts) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
if __name__ == '__main__': |
|
|
|
|