Ejemplo n.º 1
0
    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
Ejemplo n.º 2
0
  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