def __init__(self, args): self.args = args fx_api = ForeignExchancheCurrencyApi() fx_api.cur1 = args.send.upper() fx_api.cur2 = args.requ.upper() fx_api.data_path = os.path.dirname(__file__) # args.basepath if args.send_amount == None: fx_api.send_amount = 1.0 else: fx_api.send_amount = float(args.send_amount) if not args.nodownload: fx_api.download() fx_api.write_json() else: fx_api.read_json() if args.printjson: fx_api.pretty_print_json() requ_amount = fx_api.requ_amount() print( "You will get {requ_amount}{cur2} for {send_amount}{cur1} - {cur1}{cur2}@{rate}" .format(requ_amount=requ_amount, send_amount=fx_api.send_amount, cur1=fx_api.cur1, cur2=fx_api.cur2, rate=fx_api.rate())) #requ_amount/fx_api.send_amount
def load_fx_market(self): print("Loading FX market") self.fx_api = ForeignExchancheCurrencyApi() self.fx_api.cur1 = self.cur1 self.fx_api.cur2 = self.cur2 self.fx_api.send_amount = self.size self.fx_api.data_path = os.path.dirname(__file__) # args.basepath if not (args.nodownload or args.nodownloadFX): self.fx_api.download() self.fx_api.write_json() else: self.fx_api.read_json() if args.printjson: self.fx_api.pretty_print_json() #requ_amount = self.fx_api.requ_amount() #print("You will get {requ_amount}{cur2} for {send_amount}{cur1} - {cur1}{cur2}@{rate}".format( # requ_amount=requ_amount, send_amount=self.fx_api.send_amount, # cur1=self.fx_api.cur1, cur2=self.fx_api.cur2, rate=requ_amount/self.fx_api.send_amount)) self.fx_rate = self.fx_api.rate()