def start_requests(self):
        security_item = self.settings.get("security_item")

        if security_item is not None:
            item = security_item
            data_url = self.get_finance_url(item['code'])
            data_path = get_finance_path(item)

            yield Request(url=data_url,
                          meta={
                              'path': data_path,
                              'item': item
                          },
                          callback=self.download_finance_csv)
        else:
            for _, item in get_security_list(exchanges=['nasdaq']).iterrows():
                data_url = self.get_finance_url(item['code'])
                data_path = get_finance_path(item)

                yield Request(url=data_url,
                              meta={
                                  'path': data_path,
                                  'item': item
                              },
                              callback=self.download_finance_csv)
    def start_requests(self):
        security_item = self.settings.get("security_item")

        if security_item is not None:
            item = security_item
            data_url = self.get_finance_url(item['code'])
            data_path = get_finance_path(item)

            yield Request(url=data_url,
                          meta={'path': data_path,
                                'item': item},
                          callback=self.download_finance_csv)
        else:
            for _, item in get_security_list(exchanges=['nasdaq']).iterrows():
                data_url = self.get_finance_url(item['code'])
                data_path = get_finance_path(item)

                yield Request(url=data_url,
                              meta={'path': data_path,
                                    'item': item},
                              callback=self.download_finance_csv)
예제 #3
0
def get_finance_summary_items(security_item, start_date=None, report_period=None):
    path = get_finance_path(security_item)
    if not os.path.exists(path):
        return pd.DataFrame()

    df = pd.read_csv(path)

    if start_date:
        df = df[df["reportDate"] >= start_date]
        return df

    if report_period:
        return df[df["reportDate"] == report_period]
    return df
예제 #4
0
def get_finance_summary_items(security_item,
                              start_date=None,
                              report_period=None):
    path = get_finance_path(security_item)
    if not os.path.exists(path):
        return pd.DataFrame()

    df = pd.read_csv(path)

    if start_date:
        df = df[df["reportDate"] >= start_date]
        return df

    if report_period:
        return df[df["reportDate"] == report_period]
    return df