Exemple #1
0
    def init_timestamps(self, entity, http_session):
        param = {
            "color": "w",
            "fc": get_fc(entity),
            "DataType": self.data_type
        }

        if self.finance_report_type == 'LiRunBiaoList' or self.finance_report_type == 'XianJinLiuLiangBiaoList':
            param['ReportType'] = 1

        timestamp_json_list = call_eastmoney_api(
            http_session,
            url=self.timestamps_fetching_url,
            path_fields=self.timestamp_list_path_fields,
            param=param)

        if timestamp_json_list is not None and self.timestamp_path_fields:
            timestamps = [
                get_from_path_fields(data, self.timestamp_path_fields)
                for data in timestamp_json_list
            ]
        else:
            return []

        return [to_pd_timestamp(t) for t in timestamps]
Exemple #2
0
    def init_timestamps(self, entity):
        param = {
            "color": "w",
            "fc": get_fc(entity),
            "DataType": self.data_type
        }

        if self.finance_report_type == "LiRunBiaoList" or self.finance_report_type == "XianJinLiuLiangBiaoList":
            param["ReportType"] = 1

        timestamp_json_list = call_eastmoney_api(
            url=self.timestamps_fetching_url,
            path_fields=self.timestamp_list_path_fields,
            param=param)

        if self.timestamp_path_fields:
            timestamps = [
                get_from_path_fields(data, self.timestamp_path_fields)
                for data in timestamp_json_list
            ]

        return [to_pd_timestamp(t) for t in timestamps]