class TradeConfirmation(Schema, TradeMixin): """ Wrapped in <TradeConfirms> """ buySell = OneOf("BUY", "BUY (Ca.)", "SELL", "SELL (Ca.)") levelOfDetail = OneOf("SYMBOL_SUMMARY", "ORDER", "EXECUTION") commissionCurrency = OneOf(*CURRENCY_CODES) price = Decimal() thirdPartyClearingCommission = Decimal() orderID = Decimal() allocatedTo = String() thirdPartyRegulatoryCommission = Decimal() dateTime = DateTime() brokerExecutionCommission = Decimal() thirdPartyExecutionCommission = Decimal() amount = Decimal() otherCommission = Decimal() commission = Decimal() brokerClearingCommission = Decimal() ibOrderID = String() ibExecID = String() execID = String() brokerageOrderID = String() orderReference = String() volatilityOrderLink = String() exchOrderId = String() extExecID = String() # Despite the name, orderTime actually contains both date & time data. orderTime = DateTime() changeInPrice = Decimal() changeInQuantity = Decimal() orderType = OneOf("LMT", "MKT", "MOC") traderID = String() isAPIOrder = Boolean()
class OpenPosition(Schema, AccountMixin, CurrencyMixin, SecurityMixin): """ Wrapped in <OpenPositions> """ reportDate = Date() position = Decimal() markPrice = Decimal() positionValue = Decimal() openPrice = Decimal() costBasisPrice = Decimal() costBasisMoney = Decimal() percentOfNAV = Decimal() fifoPnlUnrealized = Decimal() side = OneOf('Long', 'Short') levelOfDetail = OneOf('LOT', 'SUMMARY') openDateTime = DateTime() holdingPeriodDateTime = DateTime() code = List() originatingOrderID = String() originatingTransactionID = String() accruedInt = String()
class TradeMixin(AccountMixin, CurrencyMixin, SecurityMixin): tradeID = String() reportDate = Date() tradeDate = Date() tradeTime = Time() settleDateTarget = Date() transactionType = OneOf("ExchTrade", "TradeCancel", "FracShare", "FracShareCancel", "TradeCorrect", "BookTrade", "DvpTrade") exchange = String() quantity = Decimal() tradePrice = Decimal() tradeMoney = Decimal() proceeds = Decimal() taxes = Decimal() ibCommission = Decimal() ibCommissionCurrency = OneOf(*CURRENCY_CODES) netCash = Decimal() closePrice = Decimal() openCloseIndicator = OneOf("O", "C", "C;O") notes = List(separator=';') cost = Decimal() fifoPnlRealized = Decimal() fxPnl = Decimal() mtmPnl = Decimal() origTradePrice = Decimal() origTradeDate = Date() origTradeID = String() origOrderID = String() clearingFirmID = String() transactionID = String() openDateTime = DateTime() holdingPeriodDateTime = DateTime() whenRealized = DateTime() whenReopened = DateTime() levelOfDetail = OneOf("EXECUTION", "ORDER", "CLOSED_LOT", "TRADE_TRANSFERS")
class CorporateAction(Schema, AccountMixin, CurrencyMixin, SecurityMixin): """ Wrapped in <CorporateActions> """ reportDate = Date() dateTime = DateTime() amount = Decimal() proceeds = Decimal() value = Decimal() quantity = Decimal() fifoPnlRealized = Decimal() mtmPnl = Decimal() code = List() type = OneOf("BC", "BM", "CA", "CC", "CD", "CH", "CI", "CO", "CP", "CS", "CT", "DI", "DW", "ED", "FA", "FI", "FS", "GV", "HD", "HI", "IC", "OR", "PI", "PV", "RI", "RS", "SD", "SO", "SR", "TC", "TI", "TO")
class FxLot(Schema, AccountMixin): """ Wrapped in <FxLots> """ assetCategory = String() reportDate = Date() functionalCurrency = OneOf(*CURRENCY_CODES) fxCurrency = OneOf(*CURRENCY_CODES) quantity = Decimal() costPrice = Decimal() costBasis = Decimal() closePrice = Decimal() value = Decimal() unrealizedPL = Decimal() code = List() lotDescription = String() lotOpenDateTime = DateTime() levelOfDetail = OneOf('LOT', 'SUMMARY')
class Trade(Schema, TradeMixin): """ Wrapped in <Trades> """ buySell = OneOf("BUY", "BUY (Ca.)", "SELL", "SELL (Ca.)") ibOrderID = String() ibExecID = String() brokerageOrderID = String() orderReference = String() volatilityOrderLink = String() exchOrderId = String() extExecID = String() # Despite the name, orderTime actually contains both date & time data. orderTime = DateTime() changeInPrice = Decimal() changeInQuantity = Decimal() orderType = OneOf("LMT", "MKT") traderID = String() isAPIOrder = Boolean()
class FlexStatement(Schema): accountId = String() fromDate = Date() toDate = Date() period = String() whenGenerated = DateTime()