try: vesusd['interbanex'] = fetch_interbanex_bs_usd() except Exception as e: print(e) with open('vesusd.json', 'w') as f: f.write(json.dumps(vesusd)) if sys.argv[1] == 'usdbtc': oer_prices = oer_prices() for currency in oer_prices: check_and_add_exchange_rate_snapshot('openexchangerates', 'openexchangerates', currency, 'USD', oer_prices[currency]) session.commit() lbtc_vesusd = Trade.mean_time(60) * oer_prices['BTC'] if lbtc_vesusd: check_and_add_exchange_rate_snapshot('localbitcoins 1h', 'shauna.website', 'VES', 'USD', lbtc_vesusd) session.commit() else: logger.error( 'not adding exchange rate %s:%s %s/%s because it\'s zero', 'localbitcoins 1h', 'shauna.website', 'VES', 'USD') dicom_price = fetch_dicom_bs_usd() check_and_add_exchange_rate_snapshot('dicom', 'banco central de venezuela', 'VES', 'USD', dicom_price) session.commit()