Exemple #1
0
    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)
Exemple #2
0
    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)