Browse Source

qhp-download: new option: replace ticker id

master
Denis Tereshkin 5 years ago
parent
commit
69d2fef45c
  1. 5
      qhp-download.py

5
qhp-download.py

@ -85,6 +85,7 @@ def main():
parser.add_argument('-t', '--to', action='store', dest='to', help='Ending date', required=True) parser.add_argument('-t', '--to', action='store', dest='to', help='Ending date', required=True)
parser.add_argument('-r', '--rescale', action='store', dest='rescale', help='Rescale to timeframe') parser.add_argument('-r', '--rescale', action='store', dest='rescale', help='Rescale to timeframe')
parser.add_argument('-d', '--time-delta', action='store', dest='time_delta', help='Add given time delta (in seconds)', required=False) parser.add_argument('-d', '--time-delta', action='store', dest='time_delta', help='Add given time delta (in seconds)', required=False)
parser.add_argument('-c', '--replace-ticker', action='store', dest='replace_ticker', help='Resulting symbol')
args = parser.parse_args() args = parser.parse_args()
@ -92,6 +93,8 @@ def main():
symbol = args.symbol symbol = args.symbol
filename = args.output_file filename = args.output_file
replace_ticker = args.replace_ticker
ctx = zmq.Context.instance() ctx = zmq.Context.instance()
s = ctx.socket(zmq.REQ) s = ctx.socket(zmq.REQ)
s.connect(args.qhp) s.connect(args.qhp)
@ -125,6 +128,8 @@ def main():
print("Error:", errmsg) print("Error:", errmsg)
sys.exit(1) sys.exit(1)
if replace_ticker is not None:
symbol = replace_ticker
line_count = 0 line_count = 0
with open(args.output_file, 'w', newline='') as f: with open(args.output_file, 'w', newline='') as f:

Loading…
Cancel
Save