Ejemplo n.º 1
0
 def position(cls, account, contract, position, avgCost):
     """ generated source for method position """
     msg = " ---- Position begin ----\n" \
           + "account = " + str(account) + "\n" \
           + cls.contractMsg(contract) \
           + "position = " + Util.IntMaxString(position) + "\n" \
           + "avgCost = " + Util.DoubleMaxString(avgCost) + "\n" + \
           " ---- Position end ----\n"
     return msg
Ejemplo n.º 2
0
 def commissionReport(cls, commissionReport):
     """ generated source for method commissionReport """
     msg = "commission report:" \
           + " execId=" + str(commissionReport.m_execId) \
           + " commission=" + Util.DoubleMaxString(commissionReport.m_commission) \
           + " currency=" + str(commissionReport.m_currency) \
           + " realizedPNL=" + Util.DoubleMaxString(commissionReport.m_realizedPNL) \
           + " yield=" + Util.DoubleMaxString(commissionReport.m_yield) \
           + " yieldRedemptionDate=" \
           + Util.IntMaxString(commissionReport.m_yieldRedemptionDate)
     return msg
Ejemplo n.º 3
0
 def openOrder(cls, orderId, contract, order, orderState):
     """ generated source for method openOrder """
     msg = "open order: orderId=" + orderId + " action=" + order.m_action + " quantity=" + order.m_totalQuantity + " symbol=" + contract.m_symbol + " exchange=" + contract.m_exchange + " secType=" + contract.m_secType + " type=" + order.m_orderType + " lmtPrice=" + Util.DoubleMaxString(order.m_lmtPrice) + " auxPrice=" + Util.DoubleMaxString(order.m_auxPrice) + " TIF=" + order.m_tif + " localSymbol=" + contract.m_localSymbol + " client Id=" + order.m_clientId + " parent Id=" + order.m_parentId + " permId=" + order.m_permId + " outsideRth=" + order.m_outsideRth + " hidden=" + order.m_hidden + " discretionaryAmt=" + order.m_discretionaryAmt + " displaySize=" + order.m_displaySize + " triggerMethod=" + order.m_triggerMethod + " goodAfterTime=" + order.m_goodAfterTime + " goodTillDate=" + order.m_goodTillDate + " faGroup=" + order.m_faGroup + " faMethod=" + order.m_faMethod + " faPercentage=" + order.m_faPercentage + " faProfile=" + order.m_faProfile + " shortSaleSlot=" + order.m_shortSaleSlot + " designatedLocation=" + order.m_designatedLocation + " exemptCode=" + order.m_exemptCode + " ocaGroup=" + order.m_ocaGroup + " ocaType=" + order.m_ocaType + " rule80A=" + order.m_rule80A + " allOrNone=" + order.m_allOrNone + " minQty=" + Util.IntMaxString(order.m_minQty) + " percentOffset=" + Util.DoubleMaxString(order.m_percentOffset) + " eTradeOnly=" + order.m_eTradeOnly + " firmQuoteOnly=" + order.m_firmQuoteOnly + " nbboPriceCap=" + Util.DoubleMaxString(order.m_nbboPriceCap) + " optOutSmartRouting=" + order.m_optOutSmartRouting + " auctionStrategy=" + order.m_auctionStrategy + " startingPrice=" + Util.DoubleMaxString(order.m_startingPrice) + " stockRefPrice=" + Util.DoubleMaxString(order.m_stockRefPrice) + " delta=" + Util.DoubleMaxString(order.m_delta) + " stockRangeLower=" + Util.DoubleMaxString(order.m_stockRangeLower) + " stockRangeUpper=" + Util.DoubleMaxString(order.m_stockRangeUpper) + " volatility=" + Util.DoubleMaxString(order.m_volatility) + " volatilityType=" + order.m_volatilityType + " deltaNeutralOrderType=" + order.m_deltaNeutralOrderType + " deltaNeutralAuxPrice=" + Util.DoubleMaxString(order.m_deltaNeutralAuxPrice) + " deltaNeutralConId=" + order.m_deltaNeutralConId + " deltaNeutralSettlingFirm=" + order.m_deltaNeutralSettlingFirm + " deltaNeutralClearingAccount=" + order.m_deltaNeutralClearingAccount + " deltaNeutralClearingIntent=" + order.m_deltaNeutralClearingIntent + " continuousUpdate=" + order.m_continuousUpdate + " referencePriceType=" + order.m_referencePriceType + " trailStopPrice=" + Util.DoubleMaxString(order.m_trailStopPrice) + " trailingPercent=" + Util.DoubleMaxString(order.m_trailingPercent) + " scaleInitLevelSize=" + Util.IntMaxString(order.m_scaleInitLevelSize) + " scaleSubsLevelSize=" + Util.IntMaxString(order.m_scaleSubsLevelSize) + " scalePriceIncrement=" + Util.DoubleMaxString(order.m_scalePriceIncrement) + " scalePriceAdjustValue=" + Util.DoubleMaxString(order.m_scalePriceAdjustValue) + " scalePriceAdjustInterval=" + Util.IntMaxString(order.m_scalePriceAdjustInterval) + " scaleProfitOffset=" + Util.DoubleMaxString(order.m_scaleProfitOffset) + " scaleAutoReset=" + order.m_scaleAutoReset + " scaleInitPosition=" + Util.IntMaxString(order.m_scaleInitPosition) + " scaleInitFillQty=" + Util.IntMaxString(order.m_scaleInitFillQty) + " scaleRandomPercent=" + order.m_scaleRandomPercent + " hedgeType=" + order.m_hedgeType + " hedgeParam=" + order.m_hedgeParam + " account=" + order.m_account + " settlingFirm=" + order.m_settlingFirm + " clearingAccount=" + order.m_clearingAccount + " clearingIntent=" + order.m_clearingIntent + " notHeld=" + order.m_notHeld + " whatIf=" + order.m_whatIf
     if "BAG" == contract.m_secType:
         if contract.m_comboLegsDescrip != None:
             msg += " comboLegsDescrip=" + contract.m_comboLegsDescrip
         msg += " comboLegs={"
         if contract.m_comboLegs != None:
             while i < len(contract.m_comboLegs):
                 msg += " leg " + (i + 1) + ": "
                 msg += "conId=" + comboLeg.m_conId
                 msg += " ratio=" + comboLeg.m_ratio
                 msg += " action=" + comboLeg.m_action
                 msg += " exchange=" + comboLeg.m_exchange
                 msg += " openClose=" + comboLeg.m_openClose
                 msg += " shortSaleSlot=" + comboLeg.m_shortSaleSlot
                 msg += " designatedLocation=" + comboLeg.m_designatedLocation
                 msg += " exemptCode=" + comboLeg.m_exemptCode
                 if order.m_orderComboLegs != None and len(contract.m_comboLegs) == len(order.m_orderComboLegs):
                     msg += " price=" + Util.DoubleMaxString(orderComboLeg.m_price)
                 msg += ";"
                 i += 1
         msg += "}"
         if order.m_basisPoints != Double.MAX_VALUE:
             msg += " basisPoints=" + Util.DoubleMaxString(order.m_basisPoints)
             msg += " basisPointsType=" + Util.IntMaxString(order.m_basisPointsType)
     if contract.m_underComp != None:
         msg += " underComp.conId =" + underComp.m_conId + " underComp.delta =" + underComp.m_delta + " underComp.price =" + underComp.m_price
     if not Util.StringIsEmpty(order.m_algoStrategy):
         msg += " algoStrategy=" + order.m_algoStrategy
         msg += " algoParams={"
         if order.m_algoParams != None:
             while i < len(algoParams):
                 if i > 0:
                     msg += ","
                 msg += param.m_tag + "=" + param.m_value
                 i += 1
         msg += "}"
     if "BAG" == contract.m_secType:
         msg += " smartComboRoutingParams={"
         if order.m_smartComboRoutingParams != None:
             while i < len(smartComboRoutingParams):
                 if i > 0:
                     msg += ","
                 msg += param.m_tag + "=" + param.m_value
                 i += 1
         msg += "}"
     orderStateMsg = " status=" + orderState.m_status + " initMargin=" + orderState.m_initMargin + " maintMargin=" + orderState.m_maintMargin + " equityWithLoan=" + orderState.m_equityWithLoan + " commission=" + Util.DoubleMaxString(orderState.m_commission) + " minCommission=" + Util.DoubleMaxString(orderState.m_minCommission) + " maxCommission=" + Util.DoubleMaxString(orderState.m_maxCommission) + " commissionCurrency=" + orderState.m_commissionCurrency + " warningText=" + orderState.m_warningText
     return msg + orderStateMsg
Ejemplo n.º 4
0
 def openOrder(cls, orderId, contract, order, orderState):
     msg = "open order: orderId=" + orderId + " action=" + order.m_action + " quantity=" + order.m_totalQuantity + " symbol=" + contract.m_symbol + " exchange=" + contract.m_exchange + " secType=" + contract.m_secType + " type=" + order.m_orderType + " lmtPrice=" + order.m_lmtPrice + " auxPrice=" + order.m_auxPrice + " TIF=" + order.m_tif + " localSymbol=" + contract.m_localSymbol + " client Id=" + order.m_clientId + " parent Id=" + order.m_parentId + " permId=" + order.m_permId + " outsideRth=" + order.m_outsideRth + " hidden=" + order.m_hidden + " discretionaryAmt=" + order.m_discretionaryAmt + " triggerMethod=" + order.m_triggerMethod + " goodAfterTime=" + order.m_goodAfterTime + " goodTillDate=" + order.m_goodTillDate + " faGroup=" + order.m_faGroup + " faMethod=" + order.m_faMethod + " faPercentage=" + order.m_faPercentage + " faProfile=" + order.m_faProfile + " shortSaleSlot=" + order.m_shortSaleSlot + " designatedLocation=" + order.m_designatedLocation + " ocaGroup=" + order.m_ocaGroup + " ocaType=" + order.m_ocaType + " rule80A=" + order.m_rule80A + " allOrNone=" + order.m_allOrNone + " minQty=" + order.m_minQty + " percentOffset=" + order.m_percentOffset + " eTradeOnly=" + order.m_eTradeOnly + " firmQuoteOnly=" + order.m_firmQuoteOnly + " nbboPriceCap=" + order.m_nbboPriceCap + " auctionStrategy=" + order.m_auctionStrategy + " startingPrice=" + order.m_startingPrice + " stockRefPrice=" + order.m_stockRefPrice + " delta=" + order.m_delta + " stockRangeLower=" + order.m_stockRangeLower + " stockRangeUpper=" + order.m_stockRangeUpper + " volatility=" + order.m_volatility + " volatilityType=" + order.m_volatilityType + " deltaNeutralOrderType=" + order.m_deltaNeutralOrderType + " deltaNeutralAuxPrice=" + order.m_deltaNeutralAuxPrice + " continuousUpdate=" + order.m_continuousUpdate + " referencePriceType=" + order.m_referencePriceType + " trailStopPrice=" + order.m_trailStopPrice + " scaleInitLevelSize=" + Util.IntMaxString(
         order.m_scaleInitLevelSize
     ) + " scaleSubsLevelSize=" + Util.IntMaxString(
         order.m_scaleSubsLevelSize
     ) + " scalePriceIncrement=" + Util.DoubleMaxString(
         order.m_scalePriceIncrement
     ) + " account=" + order.m_account + " settlingFirm=" + order.m_settlingFirm + " clearingAccount=" + order.m_clearingAccount + " clearingIntent=" + order.m_clearingIntent + " notHeld=" + order.m_notHeld + " whatIf=" + order.m_whatIf
     if "BAG" == contract.m_secType:
         if contract.m_comboLegsDescrip is not None:
             msg += " comboLegsDescrip=" + contract.m_comboLegsDescrip
         if (order.m_basisPoints != Double.MAX_VALUE):
             msg += " basisPoints=" + order.m_basisPoints
             msg += " basisPointsType=" + order.m_basisPointsType
     if contract.m_underComp is not None:
         underComp = contract.m_underComp
         msg += " underComp.conId =" + underComp.m_conId + " underComp.delta =" + underComp.m_delta + " underComp.price =" + underComp.m_price
     if not Util.StringIsEmpty(order.m_algoStrategy):
         msg += " algoStrategy=" + order.m_algoStrategy
         msg += " algoParams={"
         if order.m_algoParams is not None:
             algoParams = order.m_algoParams
             ## for-while
             i = 0
             while i < len(algoParams):
                 param = algoParams.elementAt(i)
                 if i > 0:
                     msg += ","
                 msg += param.m_tag + "=" + param.m_value
                 i += 1
         msg += "}"
     orderStateMsg = " status=" + orderState.m_status + " initMargin=" + orderState.m_initMargin + " maintMargin=" + orderState.m_maintMargin + " equityWithLoan=" + orderState.m_equityWithLoan + " commission=" + Util.DoubleMaxString(
         orderState.m_commission
     ) + " minCommission=" + Util.DoubleMaxString(
         orderState.m_minCommission
     ) + " maxCommission=" + Util.DoubleMaxString(
         orderState.m_maxCommission
     ) + " commissionCurrency=" + orderState.m_commissionCurrency + " warningText=" + orderState.m_warningText
     return msg + orderStateMsg
Ejemplo n.º 5
0
 def openOrder(cls, orderId, contract, order, orderState):
     """ generated source for method openOrder """
     msg = "open order: orderId=" + str(orderId) \
           + " action=" + str(order.m_action) \
           + " quantity=" + str(order.m_totalQuantity) \
           + " conid=" + str(contract.m_conId) \
           + " symbol=" + str(contract.m_symbol) \
           + " secType=" + str(contract.m_secType) \
           + " expiry=" + str(contract.m_expiry) \
           + " strike=" + str(contract.m_strike) \
           + " right=" + str(contract.m_right) \
           + " multiplier=" + str(contract.m_multiplier) \
           + " exchange=" + str(contract.m_exchange) \
           + " primaryExch=" + str(contract.m_primaryExch) \
           + " currency=" + str(contract.m_currency) \
           + " localSymbol=" + str(contract.m_localSymbol) \
           + " tradingClass=" + str(contract.m_tradingClass) \
           + " type=" + str(order.m_orderType) \
           + " lmtPrice=" + Util.DoubleMaxString(order.m_lmtPrice) \
           + " auxPrice=" + Util.DoubleMaxString(order.m_auxPrice) \
           + " TIF=" + str(order.m_tif) \
           + " localSymbol=" + str(contract.m_localSymbol) \
           + " client Id=" + str(order.m_clientId) \
           + " parent Id=" + str(order.m_parentId) \
           + " permId=" + str(order.m_permId) \
           + " outsideRth=" + str(order.m_outsideRth) \
           + " hidden=" + str(order.m_hidden) \
           + " discretionaryAmt=" + str(order.m_discretionaryAmt) \
           + " displaySize=" + str(order.m_displaySize) \
           + " triggerMethod=" + str(order.m_triggerMethod) \
           + " goodAfterTime=" + str(order.m_goodAfterTime) \
           + " goodTillDate=" + str(order.m_goodTillDate) \
           + " faGroup=" + str(order.m_faGroup) \
           + " faMethod=" + str(order.m_faMethod) \
           + " faPercentage=" + str(order.m_faPercentage) \
           + " faProfile=" + str(order.m_faProfile) \
           + " shortSaleSlot=" + str(order.m_shortSaleSlot) \
           + " designatedLocation=" + str(order.m_designatedLocation) \
           + " exemptCode=" + str(order.m_exemptCode) \
           + " ocaGroup=" + str(order.m_ocaGroup) \
           + " ocaType=" + str(order.m_ocaType) \
           + " rule80A=" + str(order.m_rule80A) \
           + " allOrNone=" + str(order.m_allOrNone) \
           + " minQty=" + Util.IntMaxString(order.m_minQty) \
           + " percentOffset=" + Util.DoubleMaxString(order.m_percentOffset) \
           + " eTradeOnly=" + order.m_eTradeOnly \
           + " firmQuoteOnly=" + str(order.m_firmQuoteOnly) \
           + " nbboPriceCap=" + Util.DoubleMaxString(order.m_nbboPriceCap) \
           + " optOutSmartRouting=" + str(order.m_optOutSmartRouting) \
           + " auctionStrategy=" + str(order.m_auctionStrategy) \
           + " startingPrice=" + Util.DoubleMaxString(order.m_startingPrice) \
           + " stockRefPrice=" + Util.DoubleMaxString(order.m_stockRefPrice) \
           + " delta=" + Util.DoubleMaxString(order.m_delta) \
           + " stockRangeLower=" + Util.DoubleMaxString(order.m_stockRangeLower) \
           + " stockRangeUpper=" + Util.DoubleMaxString(order.m_stockRangeUpper) \
           + " volatility=" + Util.DoubleMaxString(order.m_volatility) \
           + " volatilityType=" + str(order.m_volatilityType) \
           + " deltaNeutralOrderType=" + str(order.m_deltaNeutralOrderType) \
           + " deltaNeutralAuxPrice=" + Util.DoubleMaxString(order.m_deltaNeutralAuxPrice) \
           + " deltaNeutralConId=" + str(order.m_deltaNeutralConId) \
           + " deltaNeutralSettlingFirm=" + str(order.m_deltaNeutralSettlingFirm) \
           + " deltaNeutralClearingAccount=" + str(order.m_deltaNeutralClearingAccount) \
           + " deltaNeutralClearingIntent=" + str(order.m_deltaNeutralClearingIntent) \
           + " deltaNeutralOpenClose=" + str(order.m_deltaNeutralOpenClose) \
           + " deltaNeutralShortSale=" + str(order.m_deltaNeutralShortSale) \
           + " deltaNeutralShortSaleSlot=" + str(order.m_deltaNeutralShortSaleSlot) \
           + " deltaNeutralDesignatedLocation=" + str(order.m_deltaNeutralDesignatedLocation) \
           + " continuousUpdate=" + str(order.m_continuousUpdate) \
           + " referencePriceType=" + str(order.m_referencePriceType) \
           + " trailStopPrice=" + Util.DoubleMaxString(order.m_trailStopPrice) \
           + " trailingPercent=" + Util.DoubleMaxString(order.m_trailingPercent) \
           + " scaleInitLevelSize=" + Util.IntMaxString(order.m_scaleInitLevelSize) \
           + " scaleSubsLevelSize=" + Util.IntMaxString(order.m_scaleSubsLevelSize) \
           + " scalePriceIncrement=" + Util.DoubleMaxString(order.m_scalePriceIncrement) \
           + " scalePriceAdjustValue=" + Util.DoubleMaxString(order.m_scalePriceAdjustValue) \
           + " scalePriceAdjustInterval=" + Util.IntMaxString(order.m_scalePriceAdjustInterval) \
           + " scaleProfitOffset=" + Util.DoubleMaxString(order.m_scaleProfitOffset) \
           + " scaleAutoReset=" + str(order.m_scaleAutoReset) \
           + " scaleInitPosition=" + Util.IntMaxString(order.m_scaleInitPosition) \
           + " scaleInitFillQty=" + Util.IntMaxString(order.m_scaleInitFillQty) \
           + " scaleRandomPercent=" + str(order.m_scaleRandomPercent) \
           + " hedgeType=" + str(order.m_hedgeType) \
           + " hedgeParam=" + str(order.m_hedgeParam) \
           + " account=" + str(order.m_account) \
           + " settlingFirm=" + str(order.m_settlingFirm) \
           + " clearingAccount=" + str(order.m_clearingAccount) \
           + " clearingIntent=" + str(order.m_clearingIntent) \
           + " notHeld=" + str(order.m_notHeld) \
           + " whatIf=" + str(order.m_whatIf)
     if "BAG" == contract.m_secType:
         if contract.m_comboLegsDescrip is not None:
             msg += " comboLegsDescrip=" + str(contract.m_comboLegsDescrip)
         msg += " comboLegs={"
         if contract.m_comboLegs is not None:
             i = 0
             while i < len(contract.m_comboLegs):
                 comboLeg = contract.m_comboLegs[i]
                 msg += " leg " + str(i + 1) + ": "
                 msg += "conId=" + str(comboLeg.m_conId)
                 msg += " ratio=" + str(comboLeg.m_ratio)
                 msg += " action=" + str(comboLeg.m_action)
                 msg += " exchange=" + str(comboLeg.m_exchange)
                 msg += " openClose=" + str(comboLeg.m_openClose)
                 msg += " shortSaleSlot=" + str(comboLeg.m_shortSaleSlot)
                 msg += " designatedLocation=" + str(
                     comboLeg.m_designatedLocation)
                 msg += " exemptCode=" + str(comboLeg.m_exemptCode)
                 if order.m_orderComboLegs is not None and len(
                         contract.m_comboLegs) == len(
                             order.m_orderComboLegs):
                     orderComboLeg = order.m_orderComboLegs[i]
                     msg += " price=" + Util.DoubleMaxString(
                         orderComboLeg.m_price)
                 msg += ";"
                 i += 1
         msg += "}"
         if order.m_basisPoints != Double.MAX_VALUE:
             msg += " basisPoints=" + Util.DoubleMaxString(
                 order.m_basisPoints)
             msg += " basisPointsType=" + Util.IntMaxString(
                 order.m_basisPointsType)
     if contract.m_underComp is not None:
         underComp = contract.m_underComp
         msg += " underComp.conId =" + str(
             underComp.m_conId) + " underComp.delta =" + str(
                 underComp.m_delta) + " underComp.price =" + str(
                     underComp.m_price)
     if not Util.StringIsEmpty(order.m_algoStrategy):
         msg += " algoStrategy=" + str(order.m_algoStrategy)
         msg += " algoParams={"
         if order.m_algoParams is not None:
             algoParams = order.m_algoParams
             i = 0
             while i < len(algoParams):
                 param = algoParams[i]
                 if i > 0:
                     msg += ","
                 msg += str(param.m_tag) + "=" + str(param.m_value)
                 i += 1
         msg += "}"
     if "BAG" == contract.m_secType:
         msg += " smartComboRoutingParams={"
         if order.m_smartComboRoutingParams is not None:
             smartComboRoutingParams = order.m_smartComboRoutingParams
             i = 0
             while i < len(smartComboRoutingParams):
                 param = smartComboRoutingParams[i]
                 if i > 0:
                     msg += ","
                 msg += str(param.m_tag) + "=" + str(param.m_value)
                 i += 1
         msg += "}"
     orderStateMsg = " status=" + str(orderState.m_status) \
                     + " initMargin=" + str(orderState.m_initMargin) \
                     + " maintMargin=" + str(orderState.m_maintMargin) \
                     + " equityWithLoan=" + str(orderState.m_equityWithLoan) \
                     + " commission=" + Util.DoubleMaxString(orderState.m_commission) \
                     + " minCommission=" + Util.DoubleMaxString(orderState.m_minCommission) \
                     + " maxCommission=" + Util.DoubleMaxString(orderState.m_maxCommission) \
                     + " commissionCurrency=" + str(orderState.m_commissionCurrency) \
                     + " warningText=" + str(orderState.m_warningText)
     return msg + orderStateMsg