How to use the hikyuu.KRecord 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
:param int start_ix: 起始位置
        :param int end_ix: 结束位置
        :param KRecordListPtr out_buffer: 传入的数据缓存,读取数据后使用 
                                           out_buffer.append(krecord) 加入数据        
        """
        if start_ix >= end_ix or start_ix <0 or end_ix <0:
            return
        
        data = self._get_bars(market, code, ktype)
                    
        if len(data) < start_ix:
            return
        
        total = end_ix if end_ix < len(data) else len(data)
        for i in range(start_ix, total):
            record = KRecord()
            record.datetime = Datetime(data[i].get('datetime'))
            record.openPrice = data[i].get('open')
            record.highPrice = data[i].get('high')
            record.lowPrice = data[i].get('low')
            record.closePrice = data[i].get('close')
            record.transAmount = data[i].get('amount')
            record.transCount = data[i].get('vol')
            out_buffer.append(record)
github fasiondog / hikyuu / hikyuu / data_driver / jqdata_data_driver.py View on Github external
def getKRecord(self, market, code, pos, ktype):
        """
        【重载接口】(必须)获取指定位置的K线记录
        
        :param str market: 市场标识
        :param str code: 证券代码
        :param int pos: 指定位置(大于等于0)
        :param KQuery.KType ktype: K线类型        
        """
        record = KRecord()
        if pos < 0:
            return record
        
        data = self._get_bars(market, code, ktype)
        if data is None:
            return record
        
        if pos < len(data):
            record.datetime =  Datetime(data.index[pos])
            record.openPrice = data['open'][pos]
            record.highPrice = data['high'][pos]
            record.lowPrice = data['low'][pos]
            record.closePrice = data['close'][pos]
            record.transAmount = data['money'][pos]
            record.transCount = data['volume'][pos]
github fasiondog / hikyuu / tools / hikyuu / data_driver / pytdx_data_driver.py View on Github external
def getKRecord(self, market, code, pos, ktype):
        """
        【重载接口】(必须)获取指定位置的K线记录
        
        :param str market: 市场标识
        :param str code: 证券代码
        :param int pos: 指定位置(大于等于0)
        :param KQuery.KType ktype: K线类型        
        """
        record = KRecord()
        if pos < 0:
            return record
        
        data = self._get_bars(market, code, ktype)
        if data is None:
            return record
        
        if pos < len(data):
            record.datetime = Datetime(data[pos].get('datetime'))
            record.openPrice = data[pos].get('open')
            record.highPrice = data[pos].get('high')
            record.lowPrice = data[pos].get('low')
            record.closePrice = data[pos].get('close')
            record.transAmount = data[pos].get('amount')
            record.transCount = data[pos].get('vol')
github fasiondog / hikyuu / hikyuu / data_driver / pytdx_data_driver.py View on Github external
def getKRecord(self, market, code, pos, ktype):
        """
        【重载接口】(必须)获取指定位置的K线记录
        
        :param str market: 市场标识
        :param str code: 证券代码
        :param int pos: 指定位置(大于等于0)
        :param KQuery.KType ktype: K线类型        
        """
        record = KRecord()
        if pos < 0:
            return record
        
        data = self._get_bars(market, code, ktype)
        if data is None:
            return record
        
        if pos < len(data):
            record.datetime = Datetime(data[pos].get('datetime'))
            record.openPrice = data[pos].get('open')
            record.highPrice = data[pos].get('high')
            record.lowPrice = data[pos].get('low')
            record.closePrice = data[pos].get('close')
            record.transAmount = data[pos].get('amount')
            record.transCount = data[pos].get('vol')
github fasiondog / hikyuu / hikyuu / data_driver / pytdx_data_driver.py View on Github external
:param int start_ix: 起始位置
        :param int end_ix: 结束位置
        :param KRecordListPtr out_buffer: 传入的数据缓存,读取数据后使用 
                                           out_buffer.append(krecord) 加入数据        
        """
        if start_ix >= end_ix or start_ix <0 or end_ix <0:
            return
        
        data = self._get_bars(market, code, ktype)
                    
        if len(data) < start_ix:
            return
        
        total = end_ix if end_ix < len(data) else len(data)
        for i in range(start_ix, total):
            record = KRecord()
            record.datetime = Datetime(data[i].get('datetime'))
            record.openPrice = data[i].get('open')
            record.highPrice = data[i].get('high')
            record.lowPrice = data[i].get('low')
            record.closePrice = data[i].get('close')
            record.transAmount = data[i].get('amount')
            record.transCount = data[i].get('vol')
            out_buffer.append(record)
github fasiondog / hikyuu / hikyuu / data_driver / jqdata_data_driver.py View on Github external
:param int start_ix: 起始位置
        :param int end_ix: 结束位置
        :param KRecordListPtr out_buffer: 传入的数据缓存,读取数据后使用 
                                           out_buffer.append(krecord) 加入数据        
        """
        if start_ix >= end_ix or start_ix <0 or end_ix <0:
            return

        data = self._get_bars(market, code, ktype)
                    
        if len(data) < start_ix:
            return
        
        total = end_ix if end_ix < len(data) else len(data)
        for i in range(start_ix, total):
            record = KRecord()
            record.datetime = Datetime(data.index[i])
            record.openPrice = data['open'][i]
            record.highPrice = data['high'][i]
            record.lowPrice = data['low'][i]
            record.closePrice = data['close'][i]
            record.transAmount = data['money'][i]
            record.transCount = data['volume'][i]
            out_buffer.append(record)