from enum import Enum from typing import Literal class DealType(Enum): Bond = "BOND" CDS = "CDX" Swaption = "SWAPTION" Termination = "TERM" Spot = "SPOT" FxSwap = "FXSWAP" Fx = "FX" HEADERS_PRE = [ "Deal Type", "Deal Id", "Action", "Client", "Fund", "Portfolio", "Folder", "Custodian", "Cash Account", "Counterparty", "Comments", "State", "Trade Date", ] HEADERS = { "bond": HEADERS_PRE + [ "Settlement Date", "BrokerShortName", "GlopeOp Security Identifier", "CUSIP", "ISIN", "Sedol", "Reserved", "Reserved", "Security Description", "Transaction Indicator", "SubTransaction Indicator", "Quantity", "Price", "Commission", "Tax", "BlockId", "BlockAmount", "Reserved", "Reserved", "Accrued", "ClearingMode", "FaceAmount", "Reserved", "SettlementCurrency", "Reserved", "CrossCurrencyRate", "ClientReference", "Reserved", "SettlementAmount", "Yield", "TradeDateTimeStamp", "CpiRefRatio", "SettlementCurrencyHedge", "TradeDateFx", ], "cds": HEADERS_PRE + [ "Reserved", "Reserved", "EffectiveDate", "MaturityDate", "Currency", "Notional", "FixedRate", "PaymentRollDateConvention", "DayCount", "PaymentFrequency", "FirstCouponRate", "FirstCouponDate", "ResetLag", "Liquidation", "LiquidationDate", "Protection", "UnderlyingSecurityId", "UnderlyingSecurityDescription", "CreditSpreadCurve", "CreditEvents", "RecoveryRate", "Settlement", "InitialMargin", "InitialMarginPercentage", "InitialMarginCurrency", "DiscountCurve", "ClientReference", "UpfrontFee", "UpfrontFeePayDate", "RegenerateCashFlow", "UpfrontFeeComment", "Executing Broker", "SwapType", "OnPrice", "OffPrice", "AttachmentPoint", "ExhaustionPoint", "Fees", "Fee Payment Dates", "Fee Comments", "Credit Event Occurred", "Calendar", "Clearing Facility", "Adjusted", "CcpTradeRef", "BlockId", "BlockAmount", "NettingId", "AnnouncementDate", "ExecTS", "DefaultProbability", "ClientMargin", "Factor", "ISDADefinition", ], "swaption": HEADERS_PRE + [ "Reserved", "Reserved", "Reserved", "Notional", "PremiumSettlementDate", "ExpirationDate", "PremiumCurrency", "PercentageOfPremium", "ExerciseType", "Reserved", "SettlementMode", "SettlementRate", "Transaction Indicator", "InitialMargin", "InitialMarginPercentage", "InitialMarginCurrency", "ReceiveLegRateType", "ReceiveFloatRate", "ReceiveFirstCouponDate", "ReceiveFirstCouponRate", "ReceiveFixedRate", "ReceiveDaycount", "ReceiveFrequency", "ReceivePaymentRollConvention", "ReceiveEffectiveDate", "ReceiveMaturityDate", "ReceiveNotional", "ReceiveArrears", "ReceiveAdjusted", "ReceiveCompound", "ReceiveCurrency", "PayLegRateType", "PayFloatRate", "PayFirstCouponDate", "PayFirstCouponRate", "PayFixedRate", "PayDaycount", "PayFrequency", "PayPaymentRollConvention", "PayEffectiveDate", "PayMaturityDate", "PayNotional", "PayArrears", "PayAdjusted", "PayCompound", "PayCurrency", "RegenerateCashFlow", "GiveUpBroker", "ClientReference", "ReceiveDiscountCurve", "ReceiveForwardCurve", "PayDiscountCurve", "PayForwardCurve", "ReceiveFixingFrequency", "ReceiveInterestCalcMethod", "ReceiveCompoundAverageFrequency", "PayFixingFrequency", "PayInterestCalcMethod", "PayCompoundAverageFrequency", "SwapType", "AttachmentPoint", "ExhaustionPoint", "UnderlyingInstrument", "AssociatedDealType", "AssociatedDealId", "CounterpartyReference", "PremiumSettlementCurrency", "PremiumSettlementAmount", "ReceiveIMM Period", "PayIMMPeriod", "Reserved", "ClearingFacility", "Strike", "CcpTradeRef", "BreakClauseFrequency", "BlockId", "BlockAmount", "Cross Currency Premium Payment", "Premium Payment Amount", "Netting Id", "BreakClauseDate", ], "future": HEADERS_PRE + [ "Settlement Date", "Reserved", "GlopeOp Security Identifier", "Reserved", "Reserved", "Reserved", "Bloomberg Ticker", "RIC", "Security Description", "Transaction Indicator", "SubTransaction Indicator", "Quantity", "Price", "Commission", "Tax", "VAT", "Trade Currency", "Reserved", "Reserved", "Broker Short Name", "MaturityDate", "Exchange", "Client Reference", "Swap Type", "Initial Margin", "Initial Margin Currency", "Future Event", "Commission Entries", "BlockId", "Block Amount", ], "wire": HEADERS_PRE + [ "Settlement Date", "Reserved", "Reserved", "Currency", "Amount", "Associated Deal Type", "Associated Deal Id", "Transaction Type", "Instrument Type", "Yield", "Client Reference", "ClearingFacility", "Deal Function", "Reset Price", "Reset Date", "Ccp Trade Ref", "Margin Type", "Block Id", "Block Amount", ], "spot": HEADERS_PRE + [ "Settlement Date", "Dealt Currency", "Spot Rate", "Forward Rate", "Buy Currency", "Buy Amount", "Sell Currency", "Sell Amount", "ClearingFees", "BlockId", "BlockAmount", "Commission Currency", "Commission", "Reserved", "AssociatedDealType", "AssociatedDealId", "BrokerShortName", "ClientReference", ], "fx_swap": HEADERS_PRE + [ "Reserved", "Dealt Currency", "Currency Pair", "Near Side Currency Rate", "Near Side Settlement Date", "Near Side Buy Currency", "Near Side Buy Amount", "Near Side Sell Currency", "Near Side Sell Amount", "Reserved", "Far Side Rate", "Far Side Settlement Date", "Far Side Point", "Far Side Buy Currency", "Far Side Buy Amount", "Far Side Sell Currency", "Far Side Sell Amount", "Client Reference", "BrokerShortName", "CcpTradeRef", "BlockId", "BlockAmount", ], "repo": HEADERS_PRE + [ "Settlement Date", "Broker", "GlopeOp Security Identifier", "CUSIP", "ISIN", "Sedol", "Reserved", "Reserved", "Security Description", "TransactionIndicator", "CurrentFactor", "Quantity", "Price", "Reserved", "Reserved", "Reserved", "Currency", "ExchangeRate", "Comments", "Reserved", "ExpirationDate", "Reserved", "WeightedAmount", "InterestCalcMethod", "DirtyPrice", "Haircut", "RepoRate", "OpenRepo", "CallNotice", "FaceAmount", "AccruedInterest", "Yield", "CouponTo", "DayCount", "ClearingMode", "SecurityType", "BrokerShortName", "ClientReference", "DateTimeStamp", ], "capfloor": HEADERS_PRE + [ "Reserved", "Reserved", "FloatingRateIndex", "FloatingRateIndexDescription", "TransactionIndicator", "Reserved", "CapOrFloor", "Notional", "Strike", "ValueDate", "ExpirationDate", "PremiumPercent", "PremiumDate", "PricingType", "PaymentFrequency", "FixingFrequency", "DayCountConvention", "PaymentBDC", "Reserved", "PaymentAtBeginningOrEnd", "Commission", "FirstCouponDate", "InitialMargin", "InitialMarginPercent", "InitialMarginCurrency", "Reserved", "Reserved", "Reserved", "ResetLag", "Adjusted", "CashType", "BinaryFixedAmount", "BarrierPaymentAt", "KnockPeriod", "UpperBarrier", "LowerBarrier", "RebateUp", "RebateDown", "RebateSettlementLag", "ClientReference", "BrokerShortName", "CptyReference", "SwapType", "ClearingFacility", "CcpTradeRef", "BlockId", "BlockAmount", "Netting Id", "TradeDateTimeStamp", "AccrualBDC", "MaturityBDC", "RollConvention", "Calendar", "Arrears", "PaymentLag", "Reserved1", "InflationLag", "InflationReference", "SettlementCurrency", "Collateralized", "TradeDateFX", ], "termination": [ "DealType", "DealId", "Action", "Client", "SubAction", "PartialTermination", "TerminationAmount", "TerminationDate", "FeesPaid", "FeesReceived", "DealFunction", "Reserved", "ClientReference", "TradeDate", "EffectiveDate", "FirstCouponDate", "FeePaymentDate", "SpecialInstructions", "AssignedCounterparty", "AssignmentFee", "AssignedFeeTradeDate", "AssignedFeeValueDate", "AssignedCustodian", "AssignedCashAccount", "Reserved", "FeeCurrency", "GoTradeId", "FeeComments", "ZeroOutInterestCashFlows", "Reserved", "Reserved", "Reserved", "Reserved", "Reserved", "Reserved", "Reserved", "InitialMargin", "InitialMarginCurrency", ], } MTM_HEADERS = { DealType.CDS: [ "Swap ID", "Allocation ID", "Description", "Broker Id", "DTCC CounterParty ID", "Trade ID", "Trade Date", "Effective Date", "Settle Date", "Maturity Date", "Account Abbreviation", "1st Leg Notional", "Currency Code", "1st Leg Rate", "Initial Payment", "Initial Payment Currency", "Original Issue Date", "Interest Payment Method Description", "First Payment Date", "Product Type", "Product Sub Type", "Transaction Type", "Protection", "Transaction Code", "Remaining Party", "DTCC Remaining CounterParty ID", "Independent Amount (%)", "Independent Amount ($)", "RED", "Issuer Name", "Settlement Amount", "Trader", "Executing Broker", "Dealer Trade ID", "Notes", "Parent Transaction Code", "Parent Trade Date", "Parent Notional", "Parent Currency Code", "Parent Net Amount", "Parent Effective Date", "Parent First Payment Date", "Parent Settle Date", "ComplianceHubAction", "DTCC Ineligible", "Master Document Date", "Master Document Version", "Include Contractual Supplement", "Contractual Supplement", "Supplement Date", "Entity Matrix", "Entity Matrix Date", "Modified Equity Delivery", "Calculation Agent Business Center", "Calculation Agent", "Attachment Point", "Exhaustion Point", "Strategy", "First Payment Period Accrual Start Date", "TieOut Ineligible", "Electronic Consent Ineligible", "External OMS ID", "Independent Amount Currency", "Independent Amount Payer", "Trade Revision", "Alternate Swap ID", "Alternate Trade ID", "Definitions Type", ], DealType.Swaption: [ "Swap ID", "Broker Id", "Trade ID", "Trade Date", "Settle Date", "Supplement Date", "Supplement 2 Date", "Maturity Date", "Account Abbreviation", "1st Leg Notional", "Currency Code", "1st Leg Rate", "Initial Payment Currency", "Initial Payment", "Product Type", "Transaction Type", "Transaction Code", "Independent Amount (%)", "RED", "Issuer Name", "Entity Matrix", "Definitions Type", "Swaption Expiration Date", "Strike Price", "Swaption Settlement Type", "Master Document Date", "OptionBuySellIndicator", "Clearing House", "Protection", "Swaption Quotation Rate Type", "Effective Date", ], DealType.Termination: [ "Swap ID", "Allocation ID", "Description", "Broker Id", "DTCC CounterParty ID", "Trade ID", "Trade Date", "Effective Date", "Settle Date", "Maturity Date", "Account Abbreviation", "1st Leg Notional", "Currency Code", "1st Leg Rate", "Initial Payment", "Initial Payment Currency", "Payment Frequency Description", "Original Issue Date", "Interest Payment Method Description", "First Payment Date", "Product Type", "Product Sub Type", "Transaction Type", "Protection", "Transaction Code", "Remaining Party", "DTCC Remaining CounterParty ID", ], } def get_headers(trade_type, fund): headers = HEADERS[trade_type] if fund == "BOWDST": if trade_type == "bond": return headers + ["PrincipalPayment", "AccruedPayment", "CurrentFace"] elif trade_type == "swaption": return headers + ["OptionType"] else: return headers else: return headers