How to use the hikyuu.Datetime.max function in hikyuu

To help you get started, we’ve selected a few hikyuu examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fasiondog / hikyuu / tools / hikyuu / data_driver / pytdx_data_driver.py View on Github external
def _getIndexRangeByDate(self, market, code, query):
        """
        【重载接口】(必须)按日期获取指定的K线数据
        
        :param str market: 市场标识
        :param str code: 证券代码
        :param KQuery query: 日期查询条件(QueryByDate)        
        """
        print("getIndexRangeByDate")

        if query.queryType != Query.DATE:
            return (0, 0)
        
        start_datetime = query.startDatetime
        end_datetime = query.endDatetime
        if start_datetime >= end_datetime or start_datetime > Datetime.max():
            return (0, 0)
        
        data = self._get_bars(market, code, query.kType)
        total = len(data)
        if total == 0:
            return (0, 0)
        
        mid, low = 0, 0
        high = total-1
        while low <= high:
            tmp_datetime = Datetime(data[high].get('datetime'))
            if start_datetime > tmp_datetime:
                mid = high + 1
                break
            
            tmp_datetime = Datetime(data[low].get('datetime'))
github fasiondog / hikyuu / hikyuu / data_driver / jqdata_data_driver.py View on Github external
def _getIndexRangeByDate(self, market, code, query):
        """
        【重载接口】(必须)按日期获取指定的K线数据
        
        :param str market: 市场标识
        :param str code: 证券代码
        :param KQuery query: 日期查询条件(QueryByDate)        
        """
        print("getIndexRangeByDate")

        if query.queryType != Query.DATE:
            return (0, 0)
        
        start_datetime = query.startDatetime
        end_datetime = query.endDatetime
        if start_datetime >= end_datetime or start_datetime > Datetime.max():
            return (0, 0)
        
        data = self._get_bars(market, code, query.kType)
        total = len(data)
        if total == 0:
            return (0, 0)
        
        mid, low = 0, 0
        high = total-1
        while low <= high:
            tmp_datetime = Datetime(data.index[high])
            if start_datetime > tmp_datetime:
                mid = high + 1
                break
            
            tmp_datetime = Datetime(data.index[low])
github fasiondog / hikyuu / hikyuu / data_driver / pytdx_data_driver.py View on Github external
def _getIndexRangeByDate(self, market, code, query):
        """
        【重载接口】(必须)按日期获取指定的K线数据
        
        :param str market: 市场标识
        :param str code: 证券代码
        :param KQuery query: 日期查询条件(QueryByDate)        
        """
        print("getIndexRangeByDate")

        if query.queryType != Query.DATE:
            return (0, 0)
        
        start_datetime = query.startDatetime
        end_datetime = query.endDatetime
        if start_datetime >= end_datetime or start_datetime > Datetime.max():
            return (0, 0)
        
        data = self._get_bars(market, code, query.kType)
        total = len(data)
        if total == 0:
            return (0, 0)
        
        mid, low = 0, 0
        high = total-1
        while low <= high:
            tmp_datetime = Datetime(data[high].get('datetime'))
            if start_datetime > tmp_datetime:
                mid = high + 1
                break
            
            tmp_datetime = Datetime(data[low].get('datetime'))