class PriceCondition(ContractCondition): TriggerMethodEnum = Enum( "Default", # = 0, "DoubleBidAsk", # = 1, "Last", # = 2, "DoubleLast", # = 3, "BidAsk", # = 4, "N/A1", "N/A2", "LastBidAsk", #= 7, "MidPoint") #= 8 def __init__(self, triggerMethod=None, conId=None, exch=None, isMore=None, price=None): ContractCondition.__init__(self, OrderCondition.Price, conId, exch, isMore) self.price = price self.triggerMethod = triggerMethod def decode(self, fields): ContractCondition.decode(self, fields) self.triggerMethod = decode(int, fields) def make_fields(self): flds = ContractCondition.make_fields(self) + \ [comm.make_field(self.triggerMethod), ] return flds def valueToString(self) -> str: return str(self.price) def setValueFromString(self, text: str) -> None: self.price = float(text) def __str__(self): return "%s price of %s " % (PriceCondition.TriggerMethodEnum.to_str( self.triggerMethod), ContractCondition.__str__(self))
from ibapi.enum_implem import Enum from ibapi.object_implem import Object NO_VALID_ID = -1 MAX_MSG_LEN = 0xFFFFFF # 16Mb - 1byte UNSET_INTEGER = 2 ** 31 - 1 UNSET_DOUBLE = sys.float_info.max TickerId = int OrderId = int TagValueList = list FaDataType = int FaDataTypeEnum = Enum("N/A", "GROUPS", "PROFILES", "ALIASES") MarketDataType = int MarketDataTypeEnum = Enum("N/A", "REALTIME", "FROZEN", "DELAYED", "DELAYED_FROZEN") Liquidities = int LiquiditiesEnum = Enum("None", "Added", "Remove", "RoudedOut") SetOfString = set SetOfFloat = set ListOfOrder = list ListOfFamilyCode = list ListOfContractDescription = list ListOfDepthExchanges = list ListOfNewsProviders = list SmartComponentMap = dict
def test_enum(self): e = Enum("ZERO", "ONE", "TWO") print(e.ZERO) print(e.to_str(e.ZERO))
from ibapi.enum_implem import Enum # TickType TickType = int TickTypeEnum = Enum( "BID_SIZE", "BID", "ASK", "ASK_SIZE", "LAST", "LAST_SIZE", "HIGH", "LOW", "VOLUME", "CLOSE", "BID_OPTION_COMPUTATION", "ASK_OPTION_COMPUTATION", "LAST_OPTION_COMPUTATION", "MODEL_OPTION", "OPEN", "LOW_13_WEEK", "HIGH_13_WEEK", "LOW_26_WEEK", "HIGH_26_WEEK", "LOW_52_WEEK", "HIGH_52_WEEK", "AVG_VOLUME", "OPEN_INTEREST", "OPTION_HISTORICAL_VOL", "OPTION_IMPLIED_VOL", "OPTION_BID_EXCH", "OPTION_ASK_EXCH", "OPTION_CALL_OPEN_INTEREST", "OPTION_PUT_OPEN_INTEREST", "OPTION_CALL_VOLUME", "OPTION_PUT_VOLUME", "INDEX_FUTURE_PREMIUM", "BID_EXCH", "ASK_EXCH", "AUCTION_VOLUME", "AUCTION_PRICE", "AUCTION_IMBALANCE", "MARK_PRICE", "BID_EFP_COMPUTATION", "ASK_EFP_COMPUTATION", "LAST_EFP_COMPUTATION", "OPEN_EFP_COMPUTATION", "HIGH_EFP_COMPUTATION", "LOW_EFP_COMPUTATION", "CLOSE_EFP_COMPUTATION", "LAST_TIMESTAMP", "SHORTABLE", "FUNDAMENTAL_RATIOS", "RT_VOLUME", "HALTED", "BID_YIELD", "ASK_YIELD", "LAST_YIELD", "CUST_OPTION_COMPUTATION", "TRADE_COUNT", "TRADE_RATE", "VOLUME_RATE", "LAST_RTH_TRADE", "RT_HISTORICAL_VOL", "IB_DIVIDENDS", "BOND_FACTOR_MULTIPLIER", "REGULATORY_IMBALANCE", "NEWS_TICK", "SHORT_TERM_VOLUME_3_MIN", "SHORT_TERM_VOLUME_5_MIN", "SHORT_TERM_VOLUME_10_MIN", "DELAYED_BID", "DELAYED_ASK", "DELAYED_LAST", "DELAYED_BID_SIZE", "DELAYED_ASK_SIZE", "DELAYED_LAST_SIZE", "DELAYED_HIGH", "DELAYED_LOW", "DELAYED_VOLUME", "DELAYED_CLOSE", "DELAYED_OPEN", "RT_TRD_VOLUME", "CREDITMAN_MARK_PRICE", "CREDITMAN_SLOW_MARK_PRICE", "DELAYED_BID_OPTION", "DELAYED_ASK_OPTION", "DELAYED_LAST_OPTION", "DELAYED_MODEL_OPTION", "LAST_EXCH", "LAST_REG_TIME", "FUTURES_OPEN_INTEREST", "AVG_OPT_VOLUME", "DELAYED_LAST_TIMESTAMP", "NOT_SET")
from ibapi.enum_implem import Enum from ibapi.object_implem import Object NO_VALID_ID = -1 MAX_MSG_LEN = 0xFFFFFF # 16Mb - 1byte UNSET_INTEGER = 2**31 - 1 UNSET_DOUBLE = sys.float_info.max TickerId = int OrderId = int TagValueList = list FaDataType = int FaDataTypeEnum = Enum("N/A", "GROUPS", "PROFILES", "ALIASES") MarketDataType = int MarketDataTypeEnum = Enum("N/A", "REALTIME", "FROZEN", "DELAYED", "DELAYED_FROZEN") SetOfString = set SetOfFloat = set ListOfOrder = list ListOfFamilyCode = list ListOfContractDescription = list ListOfDepthExchanges = list ListOfNewsProviders = list SmartComponentMap = dict HistogramData = list
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/3/2 14:19 # @Author : [email protected] # @Site : # @File : ttttt.py # @Software: PyCharm from ibapi.enum_implem import Enum TickTypeEnum = Enum("BID_SIZE", "BID", "ASK", "ASK_SIZE", "LAST", "LAST_SIZE") print('Done')