Ejemplo n.º 1
0
    def generate_request_param(self, security_item, start, end, size,
                               timestamps):
        if len(timestamps) <= 10:
            param = {
                "color": "w",
                "fc": get_fc(security_item),
                "corpType": company_type_flag(security_item),
                # 0 means get all types
                "reportDateType": 0,
                "endDate": to_time_str(timestamps[0]),
                "latestCount": size
            }
        else:
            param = {
                "color": "w",
                "fc": get_fc(security_item),
                "corpType": company_type_flag(security_item),
                # 0 means get all types
                "reportDateType": 0,
                "endDate": to_time_str(timestamps[0]),
                "latestCount": 20
            }

        # if self.finance_report_type == 'LiRunBiaoList' or self.finance_report_type == 'XianJinLiuLiangBiaoList':
        if self.finance_report_type == 'INCOME_STATEMENT' or self.finance_report_type == 'CASHFLOW_STATEMENT':
            param['reportType'] = 1

        return param
Ejemplo n.º 2
0
    def init_timestamps(self, entity):
        param = {
            "color": "w",
            "fc": get_fc(entity),
            "DataType": 1
        }

        if self.finance_report_type == 'INCOME_STATEMENT' or self.finance_report_type == 'CASHFLOW_STATEMENT':
            param['ReportType'] = 1

        timestamp_json_list = call_joinquant_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]
Ejemplo n.º 3
0
    def init_timestamps(self, entity):
        param = {
            "color": "w",
            "fc": get_fc(entity),
            "DataType": self.data_type
        }

        timestamp_json_list = call_joinquant_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]