コード例 #1
0
ファイル: app.py プロジェクト: kvikshaug/btc.kvikshaug.no
def ticker():
    last_price = Price.last()
    if last_price is not None:
        return jsonify(btcnok={
            'buy': str(round(last_price.btcnok(rate=settings['BUY_RATE']), 2)),
            'sell': str(round(last_price.btcnok(rate=settings['SELL_RATE']), 2)),
        })
    else:
        abort(503)
コード例 #2
0
def ticker():
    last_price = Price.last()
    if last_price is not None:
        return jsonify(
            btcnok={
                'buy':
                str(round(last_price.btcnok(rate=settings['BUY_RATE']), 2)),
                'sell':
                str(round(last_price.btcnok(rate=settings['SELL_RATE']), 2)),
            })
    else:
        abort(503)
コード例 #3
0
def home():
    now = settings['TIMEZONE'].fromutc(datetime.utcnow())
    last_price = Price.last()
    if last_price is not None:
        current_price = {
            'buy': last_price.btcnok(rate=settings['BUY_RATE']),
            'sell': last_price.btcnok(rate=settings['SELL_RATE']),
        }
    else:
        current_price = None

    context = {
        'current_price': current_price,
        'price_history': json.dumps(get_price_history(app)),
        'now': now,
    }
    return render_template('home.html', **context)
コード例 #4
0
ファイル: app.py プロジェクト: kvikshaug/btc.kvikshaug.no
def home():
    now = settings['TIMEZONE'].fromutc(datetime.utcnow())
    last_price = Price.last()
    if last_price is not None:
        current_price = {
            'buy': last_price.btcnok(rate=settings['BUY_RATE']),
            'sell': last_price.btcnok(rate=settings['SELL_RATE']),
        }
    else:
        current_price = None

    context = {
        'current_price': current_price,
        'price_history': json.dumps(get_price_history(app)),
        'now': now,
    }
    return render_template('home.html', **context)