| 60 | |
| 61 | |
| 62 | class Contract(Object): |
| 63 | def __init__(self): |
| 64 | self.conId = 0 |
| 65 | self.symbol = "" |
| 66 | self.secType = "" |
| 67 | self.lastTradeDateOrContractMonth = "" |
| 68 | self.lastTradeDate = "" |
| 69 | self.strike = UNSET_DOUBLE # float !! |
| 70 | self.right = "" |
| 71 | self.multiplier = "" |
| 72 | self.exchange = "" |
| 73 | self.primaryExchange = "" # pick an actual (ie non-aggregate) exchange that the contract trades on. |
| 74 | # DO NOT SET TO SMART. |
| 75 | self.currency = "" |
| 76 | self.localSymbol = "" |
| 77 | self.tradingClass = "" |
| 78 | self.includeExpired = False |
| 79 | self.secIdType = "" # CUSIP;SEDOL;ISIN;RIC |
| 80 | self.secId = "" |
| 81 | self.description = "" |
| 82 | self.issuerId = "" |
| 83 | |
| 84 | # combos |
| 85 | self.comboLegsDescrip = ( |
| 86 | "" |
| 87 | ) # type: str #received in open order 14 and up for all combos |
| 88 | self.comboLegs = [] # type: list[ComboLeg] |
| 89 | self.deltaNeutralContract = None |
| 90 | |
| 91 | def __str__(self): |
| 92 | s = ( |
| 93 | "ConId: %s, Symbol: %s, SecType: %s, LastTradeDateOrContractMonth: %s, Strike: %s, Right: %s, Multiplier: %s, Exchange: %s, PrimaryExchange: %s, " |
| 94 | "Currency: %s, LocalSymbol: %s, TradingClass: %s, IncludeExpired: %s, SecIdType: %s, SecId: %s, Description: %s, " |
| 95 | "IssuerId: %s" |
| 96 | % ( |
| 97 | intMaxString(self.conId), |
| 98 | str(self.symbol), |
| 99 | str(self.secType), |
| 100 | str(self.lastTradeDateOrContractMonth), |
| 101 | floatMaxString(self.strike), |
| 102 | str(self.right), |
| 103 | str(self.multiplier), |
| 104 | str(self.exchange), |
| 105 | str(self.primaryExchange), |
| 106 | str(self.currency), |
| 107 | str(self.localSymbol), |
| 108 | str(self.tradingClass), |
| 109 | str(self.includeExpired), |
| 110 | str(self.secIdType), |
| 111 | str(self.secId), |
| 112 | str(self.description), |
| 113 | str(self.issuerId), |
| 114 | ) |
| 115 | ) |
| 116 | s += "Combo:" + self.comboLegsDescrip |
| 117 | |
| 118 | if self.comboLegs: |
| 119 | for leg in self.comboLegs: |
no outgoing calls
no test coverage detected