def record_exchange(db, route, amount, fee, participant, status, error=None):

    assert route.participant.id == participant.id

    with db.get_cursor() as cursor:

        exchange_id = cursor.one("""
            INSERT INTO exchanges
                   (amount, fee, participant, status, route, note)
            VALUES (%s, %s, %s, %s, %s, %s)
         RETURNING id
        """, (amount, fee, participant.username, status, route.id, error))

        if status == 'failed':
            propagate_exchange(cursor, participant, route, error, 0)
        elif amount < 0:
            amount -= fee
            propagate_exchange(cursor, participant, route, '', amount)

    return exchange_id
Plots Mean and Standard Deviation with a Bar Graph
dataset/ETHPy150Open gratipay/gratipay.com/gratipay/billing/exchanges.py/record_exchange--crossover with--dataset/ETHPy150Open automl/RoBO/robo/visualization/evaluation.py/bar_plot