Пример #1
0
def send_list():
    by_ratio = sorted(_amount_ratio_list.items(), key=lambda x: x[1][0], reverse=True)
    stub.SetTodayAmountRatioList(stock_provider_pb2.CodeList(codelist=[br[0] for br in by_ratio[:20]]))

    by_momentum = sorted(_amount_momentum_list.items(), key=lambda x: x[1][0], reverse=True)
    stub.SetTodayAmountMomentumList(stock_provider_pb2.CodeList(codelist=[bm[0] for bm in by_momentum[:20]]))

    by_amount = sorted(_amount_top_list.items(), key=lambda x: x[1][0], reverse=True)
    stub.SetTodayAmountTopList(stock_provider_pb2.CodeList(codelist=[ba[0] for ba in by_amount[:20]]))

    _amount_momentum_list.clear()
Пример #2
0
 def GetSubscribeCodes(self, request, context):
     codes_filtered = []
     codes = morning_client.get_subscribe_codes()
     for code in codes:
         if (code.startswith('A')
                 or code.startswith('U')) and len(code) <= 7:
             codes_filtered.append(code)
     return stock_provider_pb2.CodeList(codelist=codes_filtered)
Пример #3
0
    def GetTodayTopAmountList(self, request, context):
        _LOGGER.info('GetTodayTopAmountList')
        codelist = None
        if request.selection == stock_provider_pb2.TodayTopSelection.TOP_BY_RATIO:
            codelist = self.today_top_list['ratio']
        elif request.selection == stock_provider_pb2.TodayTopSelection.TOP_BY_MOMENTUM:
            codelist = self.today_top_list['momentum']
        elif request.selection == stock_provider_pb2.TodayTopSelection.TOP_BY_AMOUNT:
            codelist = self.today_top_list['amount']

        if codelist is None:
            codelist = []
        return stock_provider_pb2.CodeList(codelist=codelist)
Пример #4
0
 def GetFavoriteList(self, request, context):
     return stock_provider_pb2.CodeList(codelist=favorite.get_favorite())
Пример #5
0
 def GetRecentSearch(self, request, context):
     return stock_provider_pb2.CodeList(codelist=recent_search_codes)
Пример #6
0
 def GetTodayNineThirtyList(self, request, context):
     _LOGGER.info('GetTodayNineThirtyList')
     return stock_provider_pb2.CodeList(codelist=[])