def getBitcoinPrice():
    URL = 'https://www.bitstamp.net/api/ticker/'
    try:
        r = requests.get(URL)
        bitcoindata = json.loads(r.text)
        bitcoindata['datetime'] = datetime.utcfromtimestamp(int(bitcoindata['timestamp'])).strftime('%Y-%m-%d-%H-%M-%S')
        with open(args.outputfile, mode='a') as file:
            file.write('{},\n'.format(json.dumps(bitcoindata)))
    except:
        (exc_type, exc_value, exc_traceback) = sys.exc_info()
        with open(args.errorfile, mode='a') as file:
            traceback.print_exc(file=file)
            file.write((('-' * 100) + '\n\n'))
def getBitcoinPrice():
    URL = 'https://www.bitstamp.net/api/ticker/'
    try:
        r = requests.get(URL)
        bitcoindata = json.loads(r.text)
        bitcoindata['datetime'] = datetime.utcfromtimestamp(int(bitcoindata['timestamp'])).strftime('%Y-%m-%d-%H-%M-%S')
        with open(args.outputfile, mode='a') as file:
            file.write('{},\n'.format(json.dumps(bitcoindata)))
    except:
        (exc_type, exc_value, exc_traceback) = sys.exc_info()
        with open(args.errorfile, mode='a') as file:
            traceback.print_exc(file=file)
            file.write((('-' * 100) + '\n\n'))