def getsettleandsunny(request): dailyobj = DailyData() day = dailyobj.getBasicDay() key = '{0}_getsettleandsunny'.format(day) result = cache.get(key) if result is None: settleobj = settlement_list.Settlement() settle_result = settleobj.getsettlementdata() riserate_result = dailyobj.getRisePercentList() lowlevelresult = dailyobj.getLowLevelData() #top price fell rate and is low level 底値圏突入 # #result =[item for item in riserate_result] result = [ item for item in riserate_result if item['company_code'] in [riseobj['company_code'] for riseobj in lowlevelresult] ] #A top price fell rate and is low level 底値圏突入 and # 決算 is sunny result = [ item for item in result if item['company_code'] in [reobj['company_code'] for reobj in settle_result] ] cache.set(key, result, 60 * 60 * 12) context = { 'companylist': result, } return render(request, 'rise_rate_company.html', context)
def getsrhomepage(request): dailyobj = DailyData() day = dailyobj.getBasicDay() key = '{0}_getsrhomepage'.format(day) result = cache.get(key) if result is None: settleobj = settlement_list.Settlement() settle_result = settleobj.getsettlementdata() riserate_result = dailyobj.getRisePercentList() lowlevelresult = dailyobj.getLowLevelData() favoritelist = dailyobj.getFavoriteCompanylist()['companylist'] #print(favoritelist) #top price fell rate and is low level 底値圏突入 result = [ item for item in riserate_result if item['company_code'] in [riseobj['company_code'] for riseobj in lowlevelresult] ] #A top price fell rate and is low level 底値圏突入 and # 決算 is sunny #result =[item for item in result if item['company_code'] in [reobj['company_code'] for reobj in settle_result]] #B and fiveweight (should buy?) result = [ item for item in result if item['company_code'] in [reobj.company_code for reobj in favoritelist] ] cache.set(key, result, 60 * 60 * 12) context = { 'companylist': result, } return render(request, 'rise_rate_company.html', context)
def homepage(request): dailyobj = DailyData() day = dailyobj.getBasicDay() key = '{0}_homepage'.format(day) context = cache.get(key) if context is None: result = dailyobj.getFivedayWeightList() basic_company = dailyobj.getBasicCompany() day = dailyobj.getBasicDay() #filter(Q(class_name=class_name[0])| Q(class_name=class_name[1]) ) context = { 'day': day.strftime('%Y/%m/%d'), #'class_name' :class_name, 'companylist': result, 'basic_company': basic_company } cache.set(key, context, 60 * 60 * 12) return render(request, 'homepage.html', context)
def rise_rate_company(request): dailyobj = DailyData() day = dailyobj.getBasicDay() key = '{0}_rise_rate_company'.format(day) result = cache.get(key) if result is None: result = dailyobj.getRisePercentList() cache.set(key, result, 60 * 60 * 12) context = { 'companylist': result, } return render(request, 'rise_rate_company.html', context)