def monitor(self): fetcher = jisilu_fetcher() bonds = fetcher.get_kezhuanzhai() res = [] if len(bonds) <= 0: return res for bond in bonds: tmp = float(bond["premium_rt"][:-1]) if tmp <= premium_rt: res.append(bond) return res
def monitor(self, fund_num): result = [] fetcher = jisilu_fetcher() fetch_result = fetcher.get_a_level_fund_list() for item in fetch_result: if len(result) >= fund_num: break if item["left_year"] != u"永续": continue if item["descr"].find(u"无下折") != -1: continue result.append(item) last_result = self.load_results_from_file( "../result/levela_lundong_result")[-1] sell_list = [] buy_list = [] for item in last_result[1]: found_flag = False for item2 in result: if item["id"] == item2["id"]: found_flag = True if not found_flag: sell_list.append(item) for item in result: found_flag = False for item2 in last_result[1]: if item["id"] == item2["id"]: found_flag = True if not found_flag: buy_list.append(item) final_result = {} final_result["result"] = result final_result["last_result"] = last_result final_result["sell_list"] = sell_list final_result["buy_list"] = buy_list self.append_result_to_file("../result/levela_lundong_result", result) return final_result
def monitor(self, fund_num): result = [] fetcher = jisilu_fetcher() fetch_result = fetcher.get_a_level_fund_list() for item in fetch_result: if len(result) >= fund_num: break if item["left_year"] != u"永续": continue if item["descr"].find(u"无下折") != -1: continue result.append(item) last_result = self.load_results_from_file("../result/levela_lundong_result")[-1] sell_list = [] buy_list = [] for item in last_result[1]: found_flag = False for item2 in result: if item["id"] == item2["id"]: found_flag = True if not found_flag: sell_list.append(item) for item in result: found_flag = False for item2 in last_result[1]: if item["id"] == item2["id"]: found_flag = True if not found_flag: buy_list.append(item) final_result = {} final_result["result"] = result final_result["last_result"] = last_result final_result["sell_list"] = sell_list final_result["buy_list"] = buy_list self.append_result_to_file("../result/levela_lundong_result", result) return final_result