예제 #1
0
파일: app.py 프로젝트: jangxyz/snowball
def stock_expected_rate_by_price(code):
    stock = db.stock_by_code(code)
    try:
        expected_rate_price = float(request.args.get('price'))
    except ValueError:
        return redirect(url_for('stock', code=code))
    return render_template('stock_detail.html', stock=stock, expected_rate_price=expected_rate_price)
예제 #2
0
파일: app.py 프로젝트: princox/snowball
def stock_adjusted_future_pbr(code):
    if request.method == 'POST':
        stock = db.stock_by_code(code)
        stock['adjusted_future_pbr'] = float(
            request.form.get('adjusted_future_pbr', 0))
        db.save_stock(stock)
        return redirect(url_for('stock_refresh', code=code))
예제 #3
0
파일: app.py 프로젝트: gerald-kim/snowball
def stock(code):
    stock = db.stock_by_code(code)
    filters = db.all_filters()
    return render_template('stock_detail.html',
                           VERSION=VERSION,
                           stock=stock,
                           filters=filters)
예제 #4
0
파일: app.py 프로젝트: jangxyz/snowball
def stock_status(code, status, on):
    stock = db.stock_by_code(code)
    stock[status] = on == 'on'
    if status == 'owned' and stock[status]:
        stock['starred'] = False
    elif status == 'starred' and stock[status]:
        stock['owned'] = False
    db.save_stock(stock)
    return redirect(url_for('stock', code=code))
예제 #5
0
파일: app.py 프로젝트: gerald-kim/snowball
def stock_records(code):
    import historical
    stock = db.stock_by_code(code)
    records_by_year = historical.records_by_year(stock)
    now = datetime.now()
    records_by_year = [
        data for data in records_by_year
        if data[0].year >= now.replace(year=now.year - 2).year
    ]
    return render_template('stock_records.html',
                           VERSION=VERSION,
                           stock=stock,
                           records_by_year=records_by_year)
예제 #6
0
파일: app.py 프로젝트: jangxyz/snowball
def stock_clear_adjusted_future_roe(code):
    stock = db.stock_by_code(code)
    stock['adjusted_future_roe'] = 0
    db.save_stock(stock)
    return redirect(url_for('stock_refresh', code=code))
예제 #7
0
파일: app.py 프로젝트: jangxyz/snowball
def stock_update_note(code):
    if request.method == 'POST':
        stock = db.stock_by_code(code)
        stock['note'] = str(request.form.get('note', ''))
        db.save_stock(stock)
        return redirect(url_for('stock', code=code))
예제 #8
0
파일: app.py 프로젝트: jangxyz/snowball
def stock_my_price(code):
    if request.method == 'POST':
        stock = db.stock_by_code(code)
        stock['my_price'] = float(request.form.get('my_price', 0))
        db.save_stock(stock)
        return redirect(url_for('stock_refresh', code=code))
예제 #9
0
파일: app.py 프로젝트: jangxyz/snowball
def stock(code):
    stock = db.stock_by_code(code)
    return render_template('stock_detail.html', stock=stock)
예제 #10
0
def stock_expected_rate_by_price(code):
    if request.method == 'POST':
        stock = db.stock_by_code(code)
        expected_rate_price = float(request.form.get('expected_rate_price', 0))
        return render_template('stock_detail.html', stock=stock, expected_rate_price=expected_rate_price)