当前位置: 首页>>代码示例>>Python>>正文


Python TickType.TickType类代码示例

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


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

示例1: fieldTypes

def fieldTypes():
    """ Creates mapping of ticker data fields to field names.

    @return field to field name mapping
    """
    items = [(k, getattr(TickType, k)) for k in dir(TickType)]
    items = [(k, v) for k, v in items if isinstance(v, int)]
    unknown = TickType.getField(-1)
    items = [(v, TickType.getField(v)) for k, v in items]
    return dict([(k, v) for k, v in items if v != unknown])
开发者ID:InfiniteAlpha,项目名称:profitpy,代码行数:10,代码来源:main.py

示例2: setupTree

    def setupTree(self):
        """ Configure the model and initial items for this instance.

        @return None
        """
        tree = self.controlsTree
        self.controlsTreeModel = model = QStandardItemModel(self)
        tree.setModel(model)
        model.setHorizontalHeaderLabels(['Line', 'Value'])
        tree.sortByColumn(0, Qt.AscendingOrder)
        try:
            ticker = self.collection[self.key]
        except (KeyError, TypeError, ):
            pass
        else:
            for field, series in ticker.series.items():
                self.addSeries(TickType.getField(field), series)
        self.connect(model, Signals.standardItemChanged,
                     self.on_controlsTree_itemChanged)
        for col in range(model.columnCount()):
            tree.resizeColumnToContents(col)
        tree.addActions(
            [self.actionChangeCurveStyle,
             self.actionChangeDataMarker,
             self.actionChangeCurveAxisX,
             self.actionChangeCurveAxisY,])
        tree.expandAll()
开发者ID:InfiniteAlpha,项目名称:profitpy,代码行数:27,代码来源:plot.py

示例3: tickEFP

 def tickEFP(cls, tickerId, tickType, basisPoints, formattedBasisPoints, impliedFuture, holdDays, futureExpiry, dividendImpact, dividendsToExpiry):
     """ generated source for method tickEFP """
     return "id=" + str(tickerId) + "  " + TickType.getField(tickType) \
            + ": basisPoints = " + str(basisPoints) + "/" + formattedBasisPoints \
            + " impliedFuture = " + str(impliedFuture) + " holdDays = " + str(holdDays) \
            + " futureExpiry = " + futureExpiry + " dividendImpact = " + str(dividendImpact) \
            + " dividends to expiry = " + str(dividendsToExpiry)
开发者ID:CarterBain,项目名称:Medici,代码行数:7,代码来源:EWrapperMsgGenerator.py

示例4: fieldSpecs

def fieldSpecs(maxValue=10):
    """ Yields one description dictionary for every TickType field.

    """
    values = [getattr(TickType, k) for k in dir(TickType)]
    for value in [v for v in values if isinstance(v, int) and v < maxValue]:
        title = tickFieldTitle(TickType.getField(value))
        yield dict(value=value, title=title)
开发者ID:InfiniteAlpha,项目名称:profitpy,代码行数:8,代码来源:tickers.py

示例5: fieldSpecs

def fieldSpecs():
    """ Yields one description dictionary for every TickType field.

    """
    values = [getattr(TickType, k) for k in dir(TickType)]
    for value in [v for v in values if isinstance(v, int)]:
        name = TickType.getField(value)
        title = tickFieldTitle(name)
        yield dict(sort=value, value=value, name=name, title=title)
开发者ID:InfiniteAlpha,项目名称:profitpy,代码行数:9,代码来源:tickfieldselect.py

示例6: tickEFP

 def tickEFP(cls, tickerId,
                  tickType,
                  basisPoints,
                  formattedBasisPoints,
                  impliedFuture,
                  holdDays,
                  futureExpiry,
                  dividendImpact,
                  dividendsToExpiry):
     return "id=" + tickerId + "  " + TickType.getField(tickType) + ": basisPoints = " + basisPoints + "/" + formattedBasisPoints + " impliedFuture = " + impliedFuture + " holdDays = " + holdDays + " futureExpiry = " + futureExpiry + " dividendImpact = " + dividendImpact + " dividends to expiry = " + dividendsToExpiry
开发者ID:Mark1988huang,项目名称:IbPy,代码行数:10,代码来源:EWrapperMsgGenerator.py

示例7: on_session_createdSeries

    def on_session_createdSeries(self, key, field):
        """ Signal handler called when new Series objects are created.

        @param key id of ticker with new series
        @param field series field
        """
        if key != self.key:
            return
        series = self.collection[self.key].series[field]
        self.addSeries(TickType.getField(field), series)
        self.controlsTree.sortByColumn(0, Qt.AscendingOrder)
开发者ID:InfiniteAlpha,项目名称:profitpy,代码行数:11,代码来源:plot.py

示例8: tickSizeHandler

 def tickSizeHandler(self, msg):
     """Handle TickSize messages from IB.
     Store tick data in db
     @param msg ib.opt.message.TickSize Message sent by IB
     """
     symb = self.getSymbolFromId(msg.tickerId)
     if symb:
         #print "[{1}] {0}: {2}".format(symb, fieldType[msg.field], msg.size)
         db.tickers.update({"symbol": symb},
                           {"$set": {TickType.getField(msg.field): msg.size}},
                           upsert = True)
开发者ID:547872495,项目名称:ibweb,代码行数:11,代码来源:AppIB.py

示例9: tickOptionComputation

 def tickOptionComputation(cls, tickerId, field, impliedVol, delta, optPrice, pvDividend, gamma, vega, theta, undPrice):
     """ generated source for method tickOptionComputation """
     toAdd = "id=" + str(tickerId) + "  " + TickType.getField(field) \
             + ": vol = " + (str(impliedVol) if (impliedVol >= 0 and impliedVol != Double.MAX_VALUE) else "N/A") \
             + " delta = " + (str(delta) if (abs(delta) <= 1) else "N/A") \
             + " gamma = " + (str(gamma) if (abs(gamma) <= 1) else "N/A") \
             + " vega = " + (str(vega) if (abs(vega) <= 1) else "N/A") \
             + " theta = " + (str(theta) if (abs(theta) <= 1) else "N/A") \
             + " optPrice = " + (str(optPrice) if (optPrice >= 0 and optPrice != Double.MAX_VALUE) else "N/A") \
             + " pvDividend = " + (str(pvDividend) if (pvDividend >= 0 and pvDividend != Double.MAX_VALUE) else "N/A") \
             + " undPrice = " + (str(undPrice) if (undPrice >= 0 and undPrice != Double.MAX_VALUE) else "N/A")
     return toAdd
开发者ID:CarterBain,项目名称:Medici,代码行数:12,代码来源:EWrapperMsgGenerator.py

示例10: tickOptionComputation

 def tickOptionComputation(cls, tickerId,
                                field,
                                impliedVol,
                                delta,
                                optPrice,
                                pvDividend,
                                gamma,
                                vega,
                                theta,
                                undPrice):
     toAdd = "id=" + tickerId + "  " + TickType.getField(field) + ": vol = " + (impliedVol if impliedVol >= 0 and (impliedVol != float('inf')) else "N/A") + " delta = " + (delta if abs(delta) <= 1 else "N/A") + " gamma = " + (gamma if abs(gamma) <= 1 else "N/A") + " vega = " + (vega if abs(vega) <= 1 else "N/A") + " theta = " + (theta if abs(theta) <= 1 else "N/A") + " optPrice = " + (optPrice if optPrice >= 0 and (optPrice != float('inf')) else "N/A") + " pvDividend = " + (pvDividend if pvDividend >= 0 and (pvDividend != float('inf')) else "N/A") + " undPrice = " + (undPrice if undPrice >= 0 and (undPrice != float('inf')) else "N/A")
     return toAdd
开发者ID:Mark1988huang,项目名称:IbPy,代码行数:12,代码来源:EWrapperMsgGenerator.py

示例11: tickPriceHandler

    def tickPriceHandler(self, msg):
        """Handle TickPrice messages from IB.
        Remove the globals and implement a Producer/Consumer
        @param msg ib.opt.message.TickPrice Message sent by IB
        """
        self.ticks[msg.tickerId] = msg

        symb = self.getSymbolFromId(msg.tickerId)
        if symb:
            db.tickers.update({"symbol": symb},
                              {"$set": {TickType.getField(msg.field): msg.price}},
                              upsert = True)
        self.event.set()
开发者ID:547872495,项目名称:ibweb,代码行数:13,代码来源:AppIB.py

示例12: my_callback_handler

def my_callback_handler(msg):
	#for reference on this /home/deep/development/IbPy/ib/ext/TickType
	#another class method tt.getField(msg.field)
	if msg.field in [tt.BID,tt.ASK,tt.LAST,tt.HIGH,tt.LOW,tt.OPEN,tt.CLOSE]:
		print tt.getField(msg.field), msg.price 
	elif msg.field in [tt.BID_SIZE,tt.ASK_SIZE,tt.LAST_SIZE,tt.VOLUME,tt.AVG_VOLUME]:
		print tt.getField(msg.field), msg.size 
	elif msg.field in [tt,LAST_TIMESTAMP]:
		print tt.getField(msg.field), msg.time
开发者ID:EugenRommel,项目名称:deep_trader,代码行数:9,代码来源:ticker_data.py

示例13: on_tick

    def on_tick(self, msg):
        ''' Callback for market data requests
        '''
        tick_id = msg.tickerId
        if msg.typeName == 'tickSize':
            field_name = TickType.getField(msg.field)
            value = msg.size
        elif msg.typeName == 'tickPrice':
            field_name = TickType.getField(msg.field)
            value = msg.price
        elif msg.typeName in ['tickGeneric', 'tickString']:
            field_name = TickType.getField(msg.tickType)
            value = msg.value

        if tick_id in self.print_once:
            if tick_id not in self.ticker_data:
                ticker_data = dict()
            else:
                ticker_data = self.ticker_data[tick_id]

            ticker_data[field_name] = value
            self.ticker_data[tick_id] = ticker_data
        elif tick_id in self.tick_callbacks:
            self.tick_callbacks[tick_id](field_name, value)
开发者ID:jgerardsimcock,项目名称:ml4t,代码行数:24,代码来源:interactive_broker_wrapper.py

示例14: tickSize

 def tickSize(cls, tickerId, field, size):
     return "id=" + tickerId + "  " + TickType.getField(field) + "=" + size
开发者ID:Mark1988huang,项目名称:IbPy,代码行数:2,代码来源:EWrapperMsgGenerator.py

示例15: tickString

 def tickString(cls, tickerId, tickType, value):
     """ generated source for method tickString """
     return "id=" + str(tickerId) + "  " + TickType.getField(tickType) + "=" + str(value)
开发者ID:CarterBain,项目名称:Medici,代码行数:3,代码来源:EWrapperMsgGenerator.py


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