补充结构体以及enum

This commit is contained in:
chenxy123 2016-10-20 22:14:59 +08:00
parent 5869b45dd4
commit ced504defd

View File

@ -10,6 +10,7 @@
#include "CommissionReport.h"
#include "ScannerSubscription.h"
#include "TagValue.h"
#include "Order.h"
///-------------------------------------------------------------------------------------
@ -577,10 +578,7 @@ BOOST_PYTHON_MODULE(vnib)
//class_<TagValueList>("TagValueList")
.def(vector_indexing_suite<TagValueList, true>()); //Õâ¸ötrue·Ç³£ÖØÒª
//register_ptr_to_python<TagValueSPtr>();
//register_ptr_to_python<TagValueListSPtr>();
class_<ComboLeg>("ComboLeg")
class_<ComboLeg, ComboLegSPtr>("ComboLeg")
.def_readwrite("conId", &ComboLeg::conId)
.def_readwrite("ratio", &ComboLeg::ratio)
.def_readwrite("action", &ComboLeg::action)
@ -590,5 +588,289 @@ BOOST_PYTHON_MODULE(vnib)
.def_readwrite("designatedLocation", &ComboLeg::designatedLocation)
.def_readwrite("exemptCode", &ComboLeg::exemptCode)
;
class_<Contract::ComboLegList, Contract::ComboLegListSPtr>("ComboLegList")
.def(vector_indexing_suite<Contract::ComboLegList, true>());
class_<Contract>("Contract")
.def_readwrite("conId", &Contract::conId)
.def_readwrite("symbol", &Contract::symbol)
.def_readwrite("secType", &Contract::secType)
.def_readwrite("lastTradeDateOrContractMonth", &Contract::lastTradeDateOrContractMonth)
.def_readwrite("strike", &Contract::strike)
.def_readwrite("right", &Contract::right)
.def_readwrite("multiplier", &Contract::multiplier)
.def_readwrite("exchange", &Contract::exchange)
.def_readwrite("primaryExchange", &Contract::primaryExchange)
.def_readwrite("currency", &Contract::currency)
.def_readwrite("localSymbol", &Contract::localSymbol)
.def_readwrite("tradingClass", &Contract::tradingClass)
.def_readwrite("includeExpired", &Contract::includeExpired)
.def_readwrite("secIdType", &Contract::secIdType)
.def_readwrite("secId", &Contract::secId)
.def_readwrite("comboLegsDescrip", &Contract::comboLegsDescrip)
.def_readwrite("comboLegs", &Contract::comboLegs)
.def_readwrite("underComp", &Contract::underComp)
;
class_<ContractDetails>("ContractDetails")
.def_readwrite("summary", &ContractDetails::summary)
.def_readwrite("marketName", &ContractDetails::marketName)
.def_readwrite("minTick", &ContractDetails::minTick)
.def_readwrite("orderTypes", &ContractDetails::orderTypes)
.def_readwrite("validExchanges", &ContractDetails::validExchanges)
.def_readwrite("priceMagnifier", &ContractDetails::priceMagnifier)
.def_readwrite("underConId", &ContractDetails::underConId)
.def_readwrite("longName", &ContractDetails::longName)
.def_readwrite("contractMonth", &ContractDetails::contractMonth)
.def_readwrite("industry", &ContractDetails::industry)
.def_readwrite("category", &ContractDetails::category)
.def_readwrite("subcategory", &ContractDetails::subcategory)
.def_readwrite("timeZoneId", &ContractDetails::timeZoneId)
.def_readwrite("tradingHours", &ContractDetails::tradingHours)
.def_readwrite("liquidHours", &ContractDetails::liquidHours)
.def_readwrite("evRule", &ContractDetails::evRule)
.def_readwrite("evMultiplier", &ContractDetails::evMultiplier)
.def_readwrite("secIdList", &ContractDetails::secIdList)
.def_readwrite("cusip", &ContractDetails::cusip)
.def_readwrite("ratings", &ContractDetails::ratings)
.def_readwrite("descAppend", &ContractDetails::descAppend)
.def_readwrite("bondType", &ContractDetails::bondType)
.def_readwrite("couponType", &ContractDetails::couponType)
.def_readwrite("callable", &ContractDetails::callable)
.def_readwrite("putable", &ContractDetails::putable)
.def_readwrite("coupon", &ContractDetails::coupon)
.def_readwrite("convertible", &ContractDetails::convertible)
.def_readwrite("maturity", &ContractDetails::maturity)
.def_readwrite("issueDate", &ContractDetails::issueDate)
.def_readwrite("nextOptionDate", &ContractDetails::nextOptionDate)
.def_readwrite("nextOptionType", &ContractDetails::nextOptionType)
.def_readwrite("nextOptionPartial", &ContractDetails::nextOptionPartial)
.def_readwrite("notes", &ContractDetails::notes)
;
enum_<OrderCondition::OrderConditionType>("OrderConditionType")
.value("Price", OrderCondition::Price)
.value("Time", OrderCondition::Time)
.value("Margin", OrderCondition::Margin)
.value("Execution", OrderCondition::Execution)
.value("Volume", OrderCondition::Volume)
.value("PercentChange", OrderCondition::PercentChange)
;
//实现不完全,暂时不清楚作用
class_<OrderCondition>("OrderCondition")
.def("toString", &OrderCondition::toString)
.def("type", &OrderCondition::type)
;
class_<OrderComboLeg, OrderComboLegSPtr>("OrderComboLeg")
.def_readwrite("price", &OrderComboLeg::price)
;
class_<Order::OrderComboLegList, Order::OrderComboLegListSPtr>("OrderComboLegList")
.def(vector_indexing_suite<Order::OrderComboLegList, true>());
class_<std::vector<ibapi::shared_ptr<OrderCondition>>>("OrderConditionList")
.def(vector_indexing_suite<std::vector<ibapi::shared_ptr<OrderCondition>>, true>());
class_<Order>("Order")
.def_readwrite("orderId", &Order::orderId)
.def_readwrite("clientId", &Order::clientId)
.def_readwrite("permId", &Order::permId)
.def_readwrite("action", &Order::action)
.def_readwrite("totalQuantity", &Order::totalQuantity)
.def_readwrite("orderType", &Order::orderType)
.def_readwrite("lmtPrice", &Order::lmtPrice)
.def_readwrite("auxPrice", &Order::auxPrice)
.def_readwrite("tif", &Order::tif)
.def_readwrite("activeStartTime", &Order::activeStartTime)
.def_readwrite("activeStopTime", &Order::activeStopTime)
.def_readwrite("ocaGroup", &Order::ocaGroup)
.def_readwrite("ocaType", &Order::ocaType)
.def_readwrite("orderRef", &Order::orderRef)
.def_readwrite("transmit", &Order::transmit)
.def_readwrite("parentId", &Order::parentId)
.def_readwrite("blockOrder", &Order::blockOrder)
.def_readwrite("sweepToFill", &Order::sweepToFill)
.def_readwrite("displaySize", &Order::displaySize)
.def_readwrite("triggerMethod", &Order::triggerMethod)
.def_readwrite("outsideRth", &Order::outsideRth)
.def_readwrite("hidden", &Order::hidden)
.def_readwrite("goodAfterTime", &Order::goodAfterTime)
.def_readwrite("goodTillDate", &Order::goodTillDate)
.def_readwrite("rule80A", &Order::rule80A)
.def_readwrite("allOrNone", &Order::allOrNone)
.def_readwrite("minQty", &Order::minQty)
.def_readwrite("percentOffset", &Order::percentOffset)
.def_readwrite("overridePercentageConstraints", &Order::overridePercentageConstraints)
.def_readwrite("trailStopPrice", &Order::trailStopPrice)
.def_readwrite("trailingPercent", &Order::trailingPercent)
.def_readwrite("faGroup", &Order::faGroup)
.def_readwrite("faProfile", &Order::faProfile)
.def_readwrite("faMethod", &Order::faMethod)
.def_readwrite("faPercentage", &Order::faPercentage)
.def_readwrite("openClose", &Order::openClose)
.def_readwrite("origin", &Order::origin)
.def_readwrite("shortSaleSlot", &Order::shortSaleSlot)
.def_readwrite("designatedLocation", &Order::designatedLocation)
.def_readwrite("exemptCode", &Order::exemptCode)
.def_readwrite("discretionaryAmt", &Order::discretionaryAmt)
.def_readwrite("eTradeOnly", &Order::eTradeOnly)
.def_readwrite("firmQuoteOnly", &Order::firmQuoteOnly)
.def_readwrite("nbboPriceCap", &Order::nbboPriceCap)
.def_readwrite("optOutSmartRouting", &Order::optOutSmartRouting)
.def_readwrite("auctionStrategy", &Order::auctionStrategy)
.def_readwrite("startingPrice", &Order::startingPrice)
.def_readwrite("stockRefPrice", &Order::stockRefPrice)
.def_readwrite("delta", &Order::delta)
.def_readwrite("stockRangeLower", &Order::stockRangeLower)
.def_readwrite("stockRangeUpper", &Order::stockRangeUpper)
.def_readwrite("randomizeSize", &Order::randomizeSize)
.def_readwrite("randomizePrice", &Order::randomizePrice)
.def_readwrite("volatility", &Order::volatility)
.def_readwrite("volatilityType", &Order::volatilityType)
.def_readwrite("deltaNeutralOrderType", &Order::deltaNeutralOrderType)
.def_readwrite("deltaNeutralAuxPrice", &Order::deltaNeutralAuxPrice)
.def_readwrite("deltaNeutralConId", &Order::deltaNeutralConId)
.def_readwrite("deltaNeutralSettlingFirm", &Order::deltaNeutralSettlingFirm)
.def_readwrite("deltaNeutralClearingAccount", &Order::deltaNeutralClearingAccount)
.def_readwrite("deltaNeutralClearingIntent", &Order::deltaNeutralClearingIntent)
.def_readwrite("deltaNeutralOpenClose", &Order::deltaNeutralOpenClose)
.def_readwrite("deltaNeutralShortSale", &Order::deltaNeutralShortSale)
.def_readwrite("deltaNeutralShortSaleSlot", &Order::deltaNeutralShortSaleSlot)
.def_readwrite("deltaNeutralDesignatedLocation", &Order::deltaNeutralDesignatedLocation)
.def_readwrite("continuousUpdate", &Order::continuousUpdate)
.def_readwrite("referencePriceType", &Order::referencePriceType)
.def_readwrite("basisPoints", &Order::basisPoints)
.def_readwrite("basisPointsType", &Order::basisPointsType)
.def_readwrite("scaleInitLevelSize", &Order::scaleInitLevelSize)
.def_readwrite("scaleSubsLevelSize", &Order::scaleSubsLevelSize)
.def_readwrite("scalePriceIncrement", &Order::scalePriceIncrement)
.def_readwrite("scalePriceAdjustValue", &Order::scalePriceAdjustValue)
.def_readwrite("scalePriceAdjustInterval", &Order::scalePriceAdjustInterval)
.def_readwrite("scaleProfitOffset", &Order::scaleProfitOffset)
.def_readwrite("scaleAutoReset", &Order::scaleAutoReset)
.def_readwrite("scaleInitPosition", &Order::scaleInitPosition)
.def_readwrite("scaleInitFillQty", &Order::scaleInitFillQty)
.def_readwrite("scaleRandomPercent", &Order::scaleRandomPercent)
.def_readwrite("scaleTable", &Order::scaleTable)
.def_readwrite("hedgeType", &Order::hedgeType)
.def_readwrite("hedgeParam", &Order::hedgeParam)
.def_readwrite("account", &Order::account)
.def_readwrite("settlingFirm", &Order::settlingFirm)
.def_readwrite("clearingAccount", &Order::clearingAccount)
.def_readwrite("clearingIntent", &Order::clearingIntent)
.def_readwrite("algoStrategy", &Order::algoStrategy)
.def_readwrite("algoParams", &Order::algoParams)
.def_readwrite("smartComboRoutingParams", &Order::smartComboRoutingParams)
.def_readwrite("algoId", &Order::algoId)
.def_readwrite("whatIf", &Order::whatIf)
.def_readwrite("notHeld", &Order::notHeld)
.def_readwrite("solicited", &Order::solicited)
.def_readwrite("modelCode", &Order::modelCode)
.def_readwrite("orderComboLegs", &Order::orderComboLegs)
.def_readwrite("orderMiscOptions", &Order::orderMiscOptions)
.def_readwrite("referenceContractId", &Order::referenceContractId)
.def_readwrite("peggedChangeAmount", &Order::peggedChangeAmount)
.def_readwrite("isPeggedChangeAmountDecrease", &Order::isPeggedChangeAmountDecrease)
.def_readwrite("referenceChangeAmount", &Order::referenceChangeAmount)
.def_readwrite("referenceExchangeId", &Order::referenceExchangeId)
.def_readwrite("adjustedOrderType", &Order::adjustedOrderType)
.def_readwrite("triggerPrice", &Order::triggerPrice)
.def_readwrite("adjustedStopPrice", &Order::adjustedStopPrice)
.def_readwrite("adjustedStopLimitPrice", &Order::adjustedStopLimitPrice)
.def_readwrite("adjustedTrailingAmount", &Order::adjustedTrailingAmount)
.def_readwrite("adjustableTrailingUnit", &Order::adjustableTrailingUnit)
.def_readwrite("lmtPriceOffset", &Order::lmtPriceOffset)
.def_readwrite("conditions", &Order::conditions)
.def_readwrite("conditionsCancelOrder", &Order::conditionsCancelOrder)
.def_readwrite("conditionsIgnoreRth", &Order::conditionsIgnoreRth)
.def_readwrite("extOperator", &Order::extOperator)
;
//register_ptr_to_python<TagValueSPtr>();
//register_ptr_to_python<TagValueListSPtr>();
//register_ptr_to_python<OrderComboLegSPtr>();
enum_<TickType>("TickType")
.value("BID_SIZE", BID_SIZE)
.value("BID", BID)
.value("ASK", ASK)
.value("ASK_SIZE", ASK_SIZE)
.value("LAST", LAST)
.value("LAST_SIZE", LAST_SIZE)
.value("HIGH", HIGH)
.value("BID_OPTION_COMPUTATION", BID_OPTION_COMPUTATION)
.value("ASK_OPTION_COMPUTATION", ASK_OPTION_COMPUTATION)
.value("LAST_OPTION_COMPUTATION", LAST_OPTION_COMPUTATION)
.value("MODEL_OPTION", MODEL_OPTION)
.value("OPEN", OPEN)
.value("LOW_13_WEEK", LOW_13_WEEK)
.value("HIGH_13_WEEK", HIGH_13_WEEK)
.value("LOW_26_WEEK", LOW_26_WEEK)
.value("HIGH_26_WEEK", HIGH_26_WEEK)
.value("LOW_52_WEEK", LOW_52_WEEK)
.value("HIGH_52_WEEK", HIGH_52_WEEK)
.value("AVG_VOLUME", AVG_VOLUME)
.value("OPEN_INTEREST", OPEN_INTEREST)
.value("OPTION_HISTORICAL_VOL", OPTION_HISTORICAL_VOL)
.value("OPTION_IMPLIED_VOL", OPTION_IMPLIED_VOL)
.value("OPTION_BID_EXCH", OPTION_BID_EXCH)
.value("OPTION_ASK_EXCH", OPTION_ASK_EXCH)
.value("OPTION_CALL_OPEN_INTEREST", OPTION_CALL_OPEN_INTEREST)
.value("OPTION_PUT_OPEN_INTEREST", OPTION_PUT_OPEN_INTEREST)
.value("OPTION_CALL_VOLUME", OPTION_CALL_VOLUME)
.value("OPTION_PUT_VOLUME", OPTION_PUT_VOLUME)
.value("INDEX_FUTURE_PREMIUM", INDEX_FUTURE_PREMIUM)
.value("BID_EXCH", BID_EXCH)
.value("ASK_EXCH", ASK_EXCH)
.value("AUCTION_VOLUME", AUCTION_VOLUME)
.value("AUCTION_PRICE", AUCTION_PRICE)
.value("AUCTION_IMBALANCE", AUCTION_IMBALANCE)
.value("MARK_PRICE", MARK_PRICE)
.value("BID_EFP_COMPUTATION", BID_EFP_COMPUTATION)
.value("ASK_EFP_COMPUTATION", ASK_EFP_COMPUTATION)
.value("LAST_EFP_COMPUTATION", LAST_EFP_COMPUTATION)
.value("OPEN_EFP_COMPUTATION", OPEN_EFP_COMPUTATION)
.value("HIGH_EFP_COMPUTATION", HIGH_EFP_COMPUTATION)
.value("LOW_EFP_COMPUTATION", LOW_EFP_COMPUTATION)
.value("CLOSE_EFP_COMPUTATION", CLOSE_EFP_COMPUTATION)
.value("LAST_TIMESTAMP", LAST_TIMESTAMP)
.value("SHORTABLE", SHORTABLE)
.value("FUNDAMENTAL_RATIOS", FUNDAMENTAL_RATIOS)
.value("RT_VOLUME", RT_VOLUME)
.value("HALTED", HALTED)
.value("BID_YIELD", BID_YIELD)
.value("ASK_YIELD", ASK_YIELD)
.value("LAST_YIELD", LAST_YIELD)
.value("CUST_OPTION_COMPUTATION", CUST_OPTION_COMPUTATION)
.value("TRADE_COUNT", TRADE_COUNT)
.value("TRADE_RATE", TRADE_RATE)
.value("VOLUME_RATE", VOLUME_RATE)
.value("LAST_RTH_TRADE", LAST_RTH_TRADE)
.value("RT_HISTORICAL_VOL", RT_HISTORICAL_VOL)
.value("IB_DIVIDENDS", IB_DIVIDENDS)
.value("BOND_FACTOR_MULTIPLIER", BOND_FACTOR_MULTIPLIER)
.value("REGULATORY_IMBALANCE", REGULATORY_IMBALANCE)
.value("NEWS_TICK", NEWS_TICK)
.value("SHORT_TERM_VOLUME_3_MIN", SHORT_TERM_VOLUME_3_MIN)
.value("SHORT_TERM_VOLUME_5_MIN", SHORT_TERM_VOLUME_5_MIN)
.value("SHORT_TERM_VOLUME_10_MIN", SHORT_TERM_VOLUME_10_MIN)
.value("DELAYED_BID", DELAYED_BID)
.value("DELAYED_ASK", DELAYED_ASK)
.value("DELAYED_LAST", DELAYED_LAST)
.value("DELAYED_BID_SIZE", DELAYED_BID_SIZE)
.value("DELAYED_ASK_SIZE", DELAYED_ASK_SIZE)
.value("DELAYED_LAST_SIZE", DELAYED_LAST_SIZE)
.value("DELAYED_HIGH", DELAYED_HIGH)
.value("DELAYED_LOW", DELAYED_LOW)
.value("DELAYED_VOLUME", DELAYED_VOLUME)
.value("DELAYED_CLOSE", DELAYED_CLOSE)
.value("DELAYED_OPEN", DELAYED_OPEN)
.value("NOT_SET", NOT_SET)
;
};