• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python vtObject.VtBarData类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中vnpy.trader.vtObject.VtBarData的典型用法代码示例。如果您正苦于以下问题:Python VtBarData类的具体用法?Python VtBarData怎么用?Python VtBarData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了VtBarData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: loadBar

 def loadBar(self, dbName, collectionName, days):
     """从数据库中读取Bar数据,startDate是datetime对象"""
     startDate = self.today - timedelta(days)
     
     d = {'datetime':{'$gte':startDate}}
     barData = self.mainEngine.dbQuery(dbName, collectionName, d)
     
     l = []
     for d in barData:
         bar = VtBarData()
         bar.__dict__ = d
         l.append(bar)
     return l
开发者ID:porfavor,项目名称:vnpy,代码行数:13,代码来源:ctaEngine.py


示例2: loadBar

    def loadBar(self, dbName, collectionName, days):
        """从数据库中读取Bar数据,startDate是datetime对象"""
        print "%s.%s.%s" % (__name__, self.__class__.__name__, get_current_function_name())
        startDate = self.today - timedelta(days)

        d = {'datetime': {'$gte': startDate}}
        barData = self.mainEngine.dbQuery(dbName, collectionName, d, 'datetime')

        l = []
        for d in barData:
            bar = VtBarData()
            bar.__dict__ = d
            l.append(bar)
        return l
开发者ID:QuantFeng,项目名称:vnpy,代码行数:14,代码来源:ctaEngine.py


示例3: loadBar

 def loadBar(self, dbName, collectionName, days):
     """从数据库中读取Bar数据,startDate是datetime对象"""
     # 优先尝试从RQData获取数据
     if dbName == MINUTE_DB_NAME and collectionName.upper() in self.rqSymbolSet:
         l = self.loadRqBar(collectionName, days)
         return l
     
     # 如果没有则从数据库中读取数据
     startDate = self.today - timedelta(days)
     
     d = {'datetime':{'$gte':startDate}}
     barData = self.mainEngine.dbQuery(dbName, collectionName, d, 'datetime')
     
     l = []
     for d in barData:
         bar = VtBarData()
         bar.__dict__ = d
         l.append(bar)
     return l
开发者ID:roccox,项目名称:vnpy,代码行数:19,代码来源:ctaEngine.py


示例4: loadData

 def loadData(self):
     """加载数据"""
     mc = MongoClient()
     db = mc[DAILY_DB_NAME]
     
     for vtSymbol in self.vtSymbolList:
         flt = {'datetime':{'$gte':self.startDt,
                            '$lte':self.endDt}} 
         
         collection = db[vtSymbol]
         cursor = collection.find(flt).sort('datetime')
         
         for d in cursor:
             bar = VtBarData()
             bar.__dict__ = d
             
             barDict = self.dataDict.setdefault(bar.datetime, OrderedDict())
             barDict[bar.vtSymbol] = bar
         
         self.output(u'%s数据加载完成,总数据量:%s' %(vtSymbol, cursor.count()))
     
     self.output(u'全部数据加载完成')
开发者ID:viponedream,项目名称:vnpy,代码行数:22,代码来源:turtleEngine.py


示例5: loadCsv

def loadCsv(filename):
    """"""
    symbol = filename.split('.')[0]
    
    mc = MongoClient()
    db = mc[DAILY_DB_NAME]
    collection = db[symbol]
    
    with open(filename) as f:
        r = DictReader(f)
        for d in r:
            bar = VtBarData()
            bar.datetime = datetime.strptime(d['date'], '%Y/%m/%d')
            bar.vtSymbol = symbol
            bar.open = float(d['open'])
            bar.high = float(d['high'])
            bar.low = float(d['low'])
            bar.close = float(d['close'])
            bar.volume= int(d['volume'])
        
            collection.insert(bar.__dict__)
开发者ID:roccox,项目名称:vnpy,代码行数:21,代码来源:loadCsv.py


示例6: generateVtBar

def generateVtBar(symbol, d):
    """生成K线"""
    bar = VtBarData()
    
    bar.symbol = symbol
    bar.vtSymbol = symbol
    bar.datetime = datetime.datetime.strptime(d['time_open'], '%Y-%m-%dT%H:%M:%S.%f0Z')
    bar.date = bar.datetime.strftime('%Y%m%d')
    bar.time = bar.datetime.strftime('%H:%M:%S')
    bar.open = d['price_open']
    bar.high = d['price_high']
    bar.low = d['price_low']
    bar.close = d['price_close']
    bar.volume = d['volume_traded']
    
    return bar
开发者ID:aaront2000,项目名称:vnpy,代码行数:16,代码来源:dataService.py


示例7: downloadEquityDailyBar

    def downloadEquityDailyBar(self, symbol):
        """
        下载股票的日行情,symbol是股票代码
        """
        print u'开始下载%s日行情' %symbol
        
        # 查询数据库中已有数据的最后日期
        cl = self.dbClient[DAILY_DB_NAME][symbol]
        cx = cl.find(sort=[('datetime', pymongo.DESCENDING)])
        if cx.count():
            last = cx[0]
        else:
            last = ''
        
        # 开始下载数据
        path = 'api/market/getMktEqud.json'
            
        params = {}
        params['ticker'] = symbol
        if last:
            params['beginDate'] = last['date']
        
        data = self.datayesClient.downloadData(path, params)
        
        if data:
            # 创建datetime索引
            self.dbClient[DAILY_DB_NAME][symbol].ensure_index([('datetime', pymongo.ASCENDING)], 
                                                                unique=True)                

            for d in data:
                bar = VtBarData()
                bar.vtSymbol = symbol
                bar.symbol = symbol
                try:
                    bar.exchange = DATAYES_TO_VT_EXCHANGE.get(d.get('exchangeCD', ''), '')
                    bar.open = d.get('openPrice', 0)
                    bar.high = d.get('highestPrice', 0)
                    bar.low = d.get('lowestPrice', 0)
                    bar.close = d.get('closePrice', 0)
                    bar.date = d.get('tradeDate', '').replace('-', '')
                    bar.time = ''
                    bar.datetime = datetime.strptime(bar.date, '%Y%m%d')
                    bar.volume = d.get('turnoverVol', 0)
                except KeyError:
                    print d
                
                flt = {'datetime': bar.datetime}
                self.dbClient[DAILY_DB_NAME][symbol].update_one(flt, {'$set':bar.__dict__}, upsert=True)            
            
            print u'%s下载完成' %symbol
        else:
            print u'找不到合约%s' %symbol    
开发者ID:BetabrainLEE,项目名称:vnpy,代码行数:52,代码来源:ctaHistoryData.py


示例8: loadMcCsv

def loadMcCsv(fileName, dbName, symbol):
    """将Multicharts导出的csv格式的历史数据插入到Mongo数据库中"""
    import csv
    
    start = time()
    print u'开始读取CSV文件%s中的数据插入到%s的%s中' %(fileName, dbName, symbol)
    
    # 锁定集合,并创建索引
    client = pymongo.MongoClient(globalSetting['mongoHost'], globalSetting['mongoPort']) 
    collection = client[dbName][symbol]
    collection.ensure_index([('datetime', pymongo.ASCENDING)], unique=True)   
    
    # 读取数据和插入到数据库
    reader = csv.DictReader(file(fileName, 'r'))
    for d in reader:
        bar = VtBarData()
        bar.vtSymbol = symbol
        bar.symbol = symbol
        bar.open = float(d['Open'])
        bar.high = float(d['High'])
        bar.low = float(d['Low'])
        bar.close = float(d['Close'])
        bar.date = datetime.strptime(d['Date'], '%Y-%m-%d').strftime('%Y%m%d')
        bar.time = d['Time']
        bar.datetime = datetime.strptime(bar.date + ' ' + bar.time, '%Y%m%d %H:%M:%S')
        bar.volume = d['TotalVolume']

        flt = {'datetime': bar.datetime}
        collection.update_one(flt, {'$set':bar.__dict__}, upsert=True)  
        print bar.date, bar.time
    
    print u'插入完毕,耗时:%s' % (time()-start)
开发者ID:GenesisOrg,项目名称:vnpy,代码行数:32,代码来源:ctaHistoryData.py


示例9: loadOKEXCsv

def loadOKEXCsv(fileName, dbName, symbol):
    """将OKEX导出的csv格式的历史分钟数据插入到Mongo数据库中"""
    start = time()
    print u'开始读取CSV文件%s中的数据插入到%s的%s中' %(fileName, dbName, symbol)

    # 锁定集合,并创建索引
    client = pymongo.MongoClient(globalSetting['mongoHost'], globalSetting['mongoPort'])
    collection = client[dbName][symbol]
    collection.ensure_index([('datetime', pymongo.ASCENDING)], unique=True)

    # 读取数据和插入到数据库
    reader = csv.reader(open(fileName,"r"))
    for d in reader:
        if len(d[1]) > 10:
            bar = VtBarData()
            bar.vtSymbol = symbol
            bar.symbol = symbol

            bar.datetime = datetime.strptime(d[1], '%Y-%m-%d %H:%M:%S')
            bar.date = bar.datetime.date().strftime('%Y%m%d')
            bar.time = bar.datetime.time().strftime('%H:%M:%S')

            bar.open = float(d[2])
            bar.high = float(d[3])
            bar.low = float(d[4])
            bar.close = float(d[5])

            bar.volume = float(d[6])
            bar.tobtcvolume = float(d[7])

            flt = {'datetime': bar.datetime}
            collection.update_one(flt, {'$set':bar.__dict__}, upsert=True)
            print('%s \t %s' % (bar.date, bar.time))

    print u'插入完毕,耗时:%s' % (time()-start)
开发者ID:GenesisOrg,项目名称:vnpy,代码行数:35,代码来源:ctaHistoryData.py


示例10: generateVtBar

def generateVtBar(row):
    """生成K线"""
    bar = VtBarData()
    
    bar.symbol = row['code']
    bar.exchange = ''
    bar.vtSymbol = bar.symbol
    bar.open = row['open']
    bar.high = row['high']
    bar.low = row['low']
    bar.close = row['close']
    bar.volume = row['volume']
    bar.datetime = datetime.strptime(row['time_key'], '%Y-%m-%d %H:%M:%S')
    bar.date = bar.datetime.strftime("%Y%m%d")
    bar.time = bar.datetime.strftime("%H:%M:%S")
    
    return bar
开发者ID:KobeZhao,项目名称:vnpy,代码行数:17,代码来源:dataService.py


示例11: generateVtBar

def generateVtBar(symbol, d):
    """生成K线"""
    bar = VtBarData()
    
    bar.symbol = symbol
    bar.vtSymbol = symbol
    bar.open = d['open']
    bar.high = d['high']
    bar.low = d['low']
    bar.close = d['close']
    bar.volume = d['volume']
    bar.openInterest = d['open_oi']
    bar.datetime = datetime.fromtimestamp(d['datetime']/1000000000)
    bar.date = bar.datetime.strftime("%Y%m%d")
    bar.time = bar.datetime.strftime("%H:%M:%S")
    
    return bar
开发者ID:KobeZhao,项目名称:vnpy,代码行数:17,代码来源:dataService.py


示例12: loadRqBar

 def loadRqBar(self, symbol, days):
     """从RQData加载K线数据"""
     endDate = datetime.now()
     startDate = endDate - timedelta(days)
     
     df = self.rq.get_price(symbol.upper(), 
                            frequency='1m', 
                            fields=['open', 'high', 'low', 'close', 'volume'],
                            start_date=startDate,
                            end_date=endDate)
     
     l = []
     
     for ix, row in df.iterrows():
         bar = VtBarData()
         bar.symbol = symbol
         bar.vtSymbol = symbol
         bar.open = row['open']
         bar.high = row['high']
         bar.low = row['low']
         bar.close = row['close']
         bar.volume = row['volume']
         bar.datetime = row.name
         bar.date = bar.datetime.strftime("%Y%m%d")
         bar.time = bar.datetime.strftime("%H:%M:%S")
         
         l.append(bar)
     
     return l
开发者ID:roccox,项目名称:vnpy,代码行数:29,代码来源:ctaEngine.py


示例13: VtBarData

print u'数据下载完成'

# 创建MongoDB连接
client = pymongo.MongoClient('localhost', 27017)
collection = client[DAILY_DB_NAME][vtSymbol]
collection.create_index('datetime')

print u'MongoDB连接成功'

# 将数据插入历史数据库
for row in data.iterrows():
    date = row[0]
    data = row[1]
    
    bar = VtBarData()
    bar.vtSymbol = vtSymbol
    bar.symbol = symbol
    bar.exchange = exchange
    bar.date = date
    bar.datetime = datetime.strptime(date, '%Y-%m-%d')
    bar.open = data['open']
    bar.high = data['high']
    bar.low = data['low']
    bar.close = data['close']
    bar.volume = data['volume']
    
    flt = {'datetime': bar.datetime}
    collection.update_one(flt, {'$set':bar.__dict__}, upsert=True)

print u'数据插入完成'
开发者ID:cydrain,项目名称:Coding_Practice,代码行数:30,代码来源:method_vnpy.py


示例14: generateVtBar

def generateVtBar(row, symbol):
    """生成K线"""
    bar = VtBarData()
    
    bar.symbol = symbol
    bar.vtSymbol = symbol
    bar.open = row['open']
    bar.high = row['high']
    bar.low = row['low']
    bar.close = row['close']
    bar.volume = row['volume']
    bar.datetime = row.name
    bar.date = bar.datetime.strftime("%Y%m%d")
    bar.time = bar.datetime.strftime("%H:%M:%S")
    
    return bar
开发者ID:roccox,项目名称:vnpy,代码行数:16,代码来源:dataService.py


示例15: downloadFuturesDailyBar

    def downloadFuturesDailyBar(self, symbol):
        """
        下载期货合约的日行情,symbol是合约代码,
        若最后四位为0000(如IF0000),代表下载连续合约。
        """
        print u'开始下载%s日行情' %symbol
        
        # 查询数据库中已有数据的最后日期
        cl = self.dbClient[DAILY_DB_NAME][symbol]
        cx = cl.find(sort=[('datetime', pymongo.DESCENDING)])
        if cx.count():
            last = cx[0]
        else:
            last = ''
        
        # 主力合约
        if '0000' in symbol:
            path = 'api/market/getMktMFutd.json'
            
            params = {}
            params['contractObject'] = symbol.replace('0000', '')
            params['mainCon'] = 1
            if last:
                params['startDate'] = last['date']
        # 交易合约
        else:
            path = 'api/market/getMktFutd.json'
            
            params = {}
            params['ticker'] = symbol
            if last:
                params['startDate'] = last['date']
        
        # 开始下载数据
        data = self.datayesClient.downloadData(path, params)
        
        if data:
            # 创建datetime索引
            self.dbClient[DAILY_DB_NAME][symbol].ensure_index([('datetime', pymongo.ASCENDING)], 
                                                                      unique=True)                

            for d in data:
                bar = VtBarData()
                bar.vtSymbol = symbol
                bar.symbol = symbol
                try:
                    bar.exchange = DATAYES_TO_VT_EXCHANGE.get(d.get('exchangeCD', ''), '')
                    bar.open = d.get('openPrice', 0)
                    bar.high = d.get('highestPrice', 0)
                    bar.low = d.get('lowestPrice', 0)
                    bar.close = d.get('closePrice', 0)
                    bar.date = d.get('tradeDate', '').replace('-', '')
                    bar.time = ''
                    bar.datetime = datetime.strptime(bar.date, '%Y%m%d')
                    bar.volume = d.get('turnoverVol', 0)
                    bar.openInterest = d.get('openInt', 0)
                except KeyError:
                    print d
                
                flt = {'datetime': bar.datetime}
                self.dbClient[DAILY_DB_NAME][symbol].update_one(flt, {'$set':bar.__dict__}, upsert=True)            
            
                print u'%s下载完成' %symbol
        else:
            print u'找不到合约%s' %symbol
开发者ID:BetabrainLEE,项目名称:vnpy,代码行数:65,代码来源:ctaHistoryData.py


示例16: onBar

 def onBar(self, bar):
     """收到Bar推送(必须由用户继承实现)"""
     # 如果当前是一个5分钟走完(分钟线的时间戳是当前分钟的开始时间戳,因此要+1)
     if (bar.datetime.minute + 1) % 5 == 0:
         # 如果已经有聚合5分钟K线
         if self.fiveBar:
             # 将最新分钟的数据更新到目前5分钟线中
             fiveBar = self.fiveBar
             fiveBar.high = max(fiveBar.high, bar.high)
             fiveBar.low = min(fiveBar.low, bar.low)
             fiveBar.close = bar.close
             
             # 推送5分钟线数据
             self.onFiveBar(fiveBar)
             
             # 清空5分钟线数据缓存
             self.fiveBar = None
     else:
         # 如果没有缓存则新建
         if not self.fiveBar:
             fiveBar = VtBarData()
             
             fiveBar.vtSymbol = bar.vtSymbol
             fiveBar.symbol = bar.symbol
             fiveBar.exchange = bar.exchange
         
             fiveBar.open = bar.open
             fiveBar.high = bar.high
             fiveBar.low = bar.low
             fiveBar.close = bar.close
         
             fiveBar.date = bar.date
             fiveBar.time = bar.time
             fiveBar.datetime = bar.datetime 
             
             self.fiveBar = fiveBar
         else:
             fiveBar = self.fiveBar
             fiveBar.high = max(fiveBar.high, bar.high)
             fiveBar.low = min(fiveBar.low, bar.low)
             fiveBar.close = bar.close
开发者ID:QuantFeng,项目名称:vnpy,代码行数:41,代码来源:strategyKingKeltner.py


示例17: onTick

    def onTick(self, tick):
        """收到行情TICK推送(必须由用户继承实现)"""
        # 计算K线
        tickMinute = tick.datetime.minute

        if tickMinute != self.barMinute:    
            if self.bar:
                self.onBar(self.bar)

            bar = VtBarData()              
            bar.vtSymbol = tick.vtSymbol
            bar.symbol = tick.symbol
            bar.exchange = tick.exchange

            bar.open = tick.lastPrice
            bar.high = tick.lastPrice
            bar.low = tick.lastPrice
            bar.close = tick.lastPrice

            bar.date = tick.date
            bar.time = tick.time
            bar.datetime = tick.datetime    # K线的时间设为第一个Tick的时间

            self.bar = bar                  # 这种写法为了减少一层访问,加快速度
            self.barMinute = tickMinute     # 更新当前的分钟
        else:                               # 否则继续累加新的K线
            bar = self.bar                  # 写法同样为了加快速度

            bar.high = max(bar.high, tick.lastPrice)
            bar.low = min(bar.low, tick.lastPrice)
            bar.close = tick.lastPrice
开发者ID:QuantFeng,项目名称:vnpy,代码行数:31,代码来源:strategyDualThrust.py


示例18: generateVtBar

def generateVtBar(d):
    """生成K线"""
    bar = VtBarData()
    
    bar.symbol = d['symbol']
    bar.vtSymbol = d['symbol']
    bar.date = d['date']
    bar.time = ':'.join([d['time'][:2], d['time'][2:]])
    bar.open = d['open']
    bar.high = d['high']
    bar.low = d['low']
    bar.close = d['close']
    bar.volume = d['volume']
    bar.openInterest = d['openInterest']
    bar.datetime = datetime.datetime.strptime(' '.join([bar.date, bar.time]), '%Y%m%d %H:%M')    
    
    return bar
开发者ID:GenesisOrg,项目名称:vnpy,代码行数:17,代码来源:dataService.py


示例19: onBar

    def onBar(self, bar):
        """收到Bar推送(必须由用户继承实现)"""
        # 如果当前是一个5分钟走完
        if bar.datetime.minute % 5 == 0:
            # 如果已经有聚合5分钟K线
            if self.min5Bar:
                # 将最新分钟的数据更新到目前5分钟线中
                min5Bar = self.min5Bar
                min5Bar.high = max(min5Bar.high, bar.high)
                min5Bar.low = min(min5Bar.low, bar.low)
                min5Bar.close = bar.close

                # 推送5分钟线数据
                self.onFiveBar(min5Bar)

                # 清空5分钟线数据缓存
                self.min5Bar = None
        else:
            # 如果没有缓存则新建
            if not self.min5Bar:
                min5Bar = VtBarData()

                min5Bar.vtSymbol = bar.vtSymbol
                min5Bar.symbol = bar.symbol
                min5Bar.exchange = bar.exchange

                min5Bar.open = bar.open
                min5Bar.high = bar.high
                min5Bar.low = bar.low
                min5Bar.close = bar.close

                min5Bar.date = bar.date
                min5Bar.time = bar.time
                min5Bar.datetime = bar.datetime

                self.min5Bar = min5Bar
            else:
                min5Bar = self.min5Bar
                min5Bar.high = max(min5Bar.high, bar.high)
                min5Bar.low = min(min5Bar.low, bar.low)
                min5Bar.close = bar.close

        # ----------------------------------------------------------------------

        if bar.datetime.minute % 15 == 0:
            # 如果已经有聚合15分钟K线
            if self.min15Bar:
                # 将最新分钟的数据更新到目前5分钟线中
                min15Bar = self.min15Bar
                min15Bar.high = max(min15Bar.high, bar.high)
                min15Bar.low = min(min15Bar.low, bar.low)
                min15Bar.close = bar.close

                # 推送5分钟线数据
                self.onFifteenBar(min15Bar)

                # 清空5分钟线数据缓存
                self.min15Bar = None
        else:
            # 如果没有缓存则新建
            if not self.min15Bar:
                min15Bar = VtBarData()

                min15Bar.vtSymbol = bar.vtSymbol
                min15Bar.symbol = bar.symbol
                min15Bar.exchange = bar.exchange

                min15Bar.open = bar.open
                min15Bar.high = bar.high
                min15Bar.low = bar.low
                min15Bar.close = bar.close

                min15Bar.date = bar.date
                min15Bar.time = bar.time
                min15Bar.datetime = bar.datetime

                self.min15Bar = min15Bar
            else:
                min15Bar = self.min15Bar
                min15Bar.high = max(min15Bar.high, bar.high)
                min15Bar.low = min(min15Bar.low, bar.low)
                min15Bar.close = bar.close

        # ----------------------------------------------------------------------
        # 如果当前是一个30分钟走完
        if bar.datetime.minute % 30 == 0:
            # 如果已经有聚合30分钟K线
            if self.min30Bar:
                # 将最新分钟的数据更新到目前5分钟线中
                min30Bar = self.min30Bar
                min30Bar.high = max(min30Bar.high, bar.high)
                min30Bar.low = min(min30Bar.low, bar.low)
                min30Bar.close = bar.close

                # 推送5分钟线数据
                self.onThirtyBar(min30Bar)

                # 清空5分钟线数据缓存
                self.min30Bar = None
        else:
#.........这里部分代码省略.........
开发者ID:porfavor,项目名称:vnpy,代码行数:101,代码来源:strategyBaseMultiFreq.py


示例20: loadTdxCsv

def loadTdxCsv(fileName, dbName, symbol):
    """将通达信导出的csv格式的历史分钟数据插入到Mongo数据库中"""
    import csv
    
    start = time()
    date_correct = ""
    print u'开始读取CSV文件%s中的数据插入到%s的%s中' %(fileName, dbName, symbol)
    
    # 锁定集合,并创建索引
    client = pymongo.MongoClient(globalSetting['mongoHost'], globalSetting['mongoPort'])
    collection = client[dbName][symbol]
    collection.ensure_index([('datetime', pymongo.ASCENDING)], unique=True)   
    
    # 读取数据和插入到数据库
    reader = csv.reader(file(fileName, 'r'))
    for d in reader:
        bar = VtBarData()
        bar.vtSymbol = symbol
        bar.symbol = symbol
        bar.open = float(d[1])
        bar.high = float(d[2])
        bar.low = float(d[3])
        bar.close = float(d[4])
        #通达信的夜盘时间按照新的一天计算,此处将其按照当天日期统计,方便后续查阅
        date_temp,time_temp = d[0].strip(' ').replace('\xef\xbb\xbf','').split('-',1)
        if time_temp == '15:00':
            date_correct = date_temp
        if time_temp[:2] == "21" or time_temp[:2] == "22" or time_temp[:2] == "23":
            date_temp = date_correct
            
        bar.date = datetime.strptime(date_temp, '%Y/%m/%d').strftime('%Y%m%d')
        bar.time = time_temp[:2]+':'+time_temp[3:5]+':00'
        bar.datetime = datetime.strptime(bar.date + ' ' + bar.time, '%Y%m%d %H:%M:%S')
        bar.volume = d[5]

        flt = {'datetime': bar.datetime}
        collection.update_one(flt, {'$set':bar.__dict__}, upsert=True)  
    
    print u'插入完毕,耗时:%s' % (time()-start)
开发者ID:KobeZhao,项目名称:vnpy,代码行数:39,代码来源:ctaHistoryData.py



注:本文中的vnpy.trader.vtObject.VtBarData类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python vobject.iCalendar函数代码示例发布时间:2022-05-26
下一篇:
Python vtFunction.getJsonPath函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap