def holdings(category='', holding_date=''): a, d = parse_request('a', 'd') holding_dates = stock.holding_date_cache[category] holding_list = stock.get_holding_data(category, holding_date, a, d) return render_template( 'index.html', category=category, category_names=stock.category_names, holding_dates=holding_dates, holding_date=holding_date, a=a, d=d, holding_list=holding_list, )
def index(): holding_list = [] if len(stock.categories) > 0: category = stock.categories[0] if category in stock.holding_date_cache and len(stock.holding_date_cache[category]) > 0: holding_dates = stock.holding_date_cache[category] holding_date = stock.holding_date_cache[category][0] holding_list = stock.get_holding_data(category, holding_date) return render_template( 'index.html', category_names=stock.category_names, category=category, holding_date=holding_date, holding_dates=holding_dates, a='', d='', holding_list=holding_list, )
def index(): holding_list = [] if len(stock.categories) > 0: category = stock.categories[0] if category in stock.holding_date_cache and len( stock.holding_date_cache[category]) > 0: holding_dates = stock.holding_date_cache[category] holding_date = stock.holding_date_cache[category][0] holding_list = stock.get_holding_data(category, holding_date) return render_template( 'index.html', category_names=stock.category_names, category=category, holding_date=holding_date, holding_dates=holding_dates, a='', d='', holding_list=holding_list, )
def download(download_type=''): def generate(holding_list): for holding in holding_list: yield holding.get_line() + '\n' holding_list = [] if download_type == 'single': holding_list = stock.get_holding_data(*parse_request('category', 'holding_date', 'a', 'd')) elif download_type == 'multiple': params = parse_request('holding_date', 'jj', 'sb', 'qf', 'ja', 'jd', 'sa', 'sd', 'qa', 'qd') params = params[:1] + parse_checkbox(*params[1:4]) + params[4:] cross_ret = stock.cross_select(*params) for code in cross_ret: for category in cross_ret[code]: holding_list.append(cross_ret[code][category]) response = Response(generate(holding_list), mimetype='text/csv') response.headers['Content-Disposition'] = 'attachment; filename=stockforces.csv' return response
def download(download_type=''): def generate(holding_list): for holding in holding_list: yield holding.get_line() + '\n' holding_list = [] if download_type == 'single': holding_list = stock.get_holding_data( *parse_request('category', 'holding_date', 'a', 'd')) elif download_type == 'multiple': params = parse_request('holding_date', 'jj', 'sb', 'qf', 'ja', 'jd', 'sa', 'sd', 'qa', 'qd') params = params[:1] + parse_checkbox(*params[1:4]) + params[4:] cross_ret = stock.cross_select(*params) for code in cross_ret: for category in cross_ret[code]: holding_list.append(cross_ret[code][category]) response = Response(generate(holding_list), mimetype='text/csv') response.headers[ 'Content-Disposition'] = 'attachment; filename=stockforces.csv' return response