예제 #1
0
 def historical_summary(self, date=None):
     # Test that valid date is supplied.
     if date:
         if not bool(re.match(r"[0-9]{6}", str(date))):
             raise ValueError("Must specify date as YYYYMM")
         parse_date(str(date) + "01")
         params = {'date': date}
     else:
         params = {}
     return self._get("historical", params=params)
예제 #2
0
    def chart(self,
              range='1m',
              chartByDay=None,
              chartSimplify=None,
              chartInterval=None,
              chartCloseOnly=None,
              token=None):
        """
            Args:
                range - what range of data to retrieve. The variable 'CHART_RANGES'
                        has possible values in addition to a date.
        """

        # Setup parameters
        params = {
            'chartByDay': chartByDay,
            'chartSimplify': chartSimplify,
            'chartInterval': chartInterval,
            'chartCloseOnly': chartCloseOnly,
            'token': token
        }
        params = {k: param_bool(v) for k, v in params.items() if v}
        if chartByDay and type(chartByDay) != bool:
            raise ValueError("chartByDay must be bool")
        if chartSimplify and type(chartSimplify) != bool:
            raise ValueError("chartSimplify must be bool")
        if chartInterval and type(chartInterval) != int:
            raise ValueError("chartInterval must be int")
        if chartCloseOnly and type(chartCloseOnly) != bool:
            raise ValueError("chartCloseOnly must be bool")
        if token and type(token) != str:
            raise ValueError("token must be str")

        # Validate range is appropriate
        validate_range_set(range, CHART_RANGES)

        # date match
        date_match = re.match('^[0-9]{8}$', range)

        if date_match:
            range = parse_date(range)
            url = f"chart/date/{range}"
        else:
            url = f"chart/{range}"

        return self._get(url, params=params)
예제 #3
0
 def short_interest(self, date=None):
     date = parse_date(date)
     url = f"short-interest/{date}" if date else "short-interest"
     return self._get(url)
예제 #4
0
 def threshold_securities(self, date=None):
     date = parse_date(date)
     url = f"threshold-securities/{date}" if date else "threshold-securities"
     return self._get(url)
예제 #5
0
 def iex_listed_symbol_directory(self, date=None):
     date = parse_date(date)
     url = f"daily-list/symbol-directory/{date}" if date else "daily-list/symbol-directory"
     return self._get(url)
예제 #6
0
 def iex_next_day_ex_date(self, date=None):
     date = parse_date(date)
     url = f"daily-list/next-day-ex-date/{date}" if date else "daily-list/next-day-ex-date"
     return self._get(url)
예제 #7
0
 def iex_dividends(self, date=None):
     date = parse_date(date)
     url = f"daily-list/dividends/{date}" if date else "daily-list/dividends"
     return self._get(url)
예제 #8
0
 def iex_corporate_actions(self, date=None):
     date = parse_date(date)
     url = f"daily-list/corporate-actions/{date}" if date else "daily-list/corporate-actions"
     return self._get(url)