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" BBH_BOND_HEADERS = [ "Function of Instruction", "Client Reference Number", "Previous Reference Number", "Account Number", "Transaction Type", "Place of Settlement/Country", "Place of Safekeeping", "Trade Date", "Settlement Date", "Security ID", "Security Description", "Unit / Original Face Amount", "Currency", "Unit Price Amount", "Net Amount", "Trading Broker Type/ID", "Trading Broker Description", "Beneficiary of Securities Account", "Clearing Broker ID / Type", "Clearing Broker Description", "Clearing Agent Account", "Stamp Duty Code", "Stamp Duty Amount", "Special Settlement Type", "Special Indicator #1", "Special Indicator #2", "Registration Details", "Special Instruction", "Originator of Message", "Current Face/Amortize Value", "Principal Amount", "Interest Amount", "Other Fees Amount", "Commission Amount", "SEC Fees Amount", "Transaction Tax Amount", "Withholding Tax Amount", "Exchange Rate", "Resulting Currency", "Resulting Amount", "FX Currency", "Pool Reference Number", "Total Group Number", "Trade Number", "Repo Term Date (REPO only)", "Repo Amount (REPO only)", "Repo Reference Number (REPO only)", "Repo Rate (REPO Only)", "Ticker (CPF and CRF Only)", "Strike Price (CPF and CRF Only)", "Expiration Date (CPF and CRF Only)", "Broker Number (CPF and CRF Only)", "Broker Account (CPF and CRF Only)", "Contract Size (Option Contract and Future Contract Only)", "Place of Trade Narrative", "Common Reference", "Partial Settlement Allowed", "Partial Settlement Tolerance", "No Automatic Market Claim", "Corporate Action", "Coupon Option", "Triparty Collateral Segregation", "FX Cancel - For CANC instructions only", "Fund Accounting Only Trade (RPTO)", "Custody Only Trade (NACT)", "Research Fee (RSCH)", ] 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", ], } CITCO_HEADERS = { "GIL": [ "Command", "Group_Id", "Unique Identifier", "Instrument Type", "Underlying ID Source", "Underlying Security Id", "Underlying ISIN", "Underlying CUSIP", "Underlying SEDOL", "Underlying Bloomberg Code", "Underlying CINS", "Underlying RIC", "Underlying CDS", "Underlying CDSDN", "Underlying User ID", "Underlying TID", "Symbol", "(BLANK)", "Birth)date", "Death_date", "Active", "(Blank)", "(Blank)", "(Blank)", "Sec_Desc", "(Blank)", "LocalCcy", "Country", "SettleCal", "(Blank)", "Tick Size", "MarketID", "Price Base", "Price Factor", "FixRate", "ResetFreq", "(Blank)", "(Blank)", "1st Cpn Date", "Last Cpn Date", "Coupon Rate", "Cash Flow Freq_Id", "SettleDays", "DayCount_ID", "AccruMethodID", "AccruStartDate", "IssueAmount", "CreditEvent", "Counter Party", "Ctpy Abbrev", "Tier", "Ctpy Country", "Ctpy Country", "Ctpy moody", "Bond Class", "Bond Type", "Seris Code", "(Blank)", "Rate Set Date", "General Direction", "Principal Exch TypeID", "S_P_PaymentFreqID", "S_P_Currency Code", "S_P_RateIndexID", "S_P_AccrualMethodID", "S_P_Interest Rate", "S_P_Payment Calandar", "S_P_Day Convention", "S_P_ResetFreqID", "S_P_Notional Amt", "S_P_ResetCalandarID", "S_P_RateSourceID", "S_P_InitialResetRate", "(Blank)", "(Blank)", "(Blank)", "(Blank)", "S_R_PaymentFreqID", "S_R_CurrencyCode", "S_R_RateIndexID", "S_R_AccrualMethondID", "S_R_Interest Rate", "S_R_PaymentCalandarID", "S_R_DayConventionID", "S_R_ResetFreqID", "S_R_NotionalAmount", "S_R_ResetCalandarID", "S_R_RateSource", "S_R_InitialReset Rate", "(Blank)", "(Blank)", "(Blank)", "(Blank)", "Other Code 1", "Other Code 1-Value", "Other Code2", "Other Code 2-Value", "Attribute 1", "Attribute 1-Value", "Attribute 1-Type", "Attribute 2", "Attribute 2-Value", "Attribute 2-Type", "Attribute 3", "Attribute 3-Value", "Attribute 3-Type", "Attribute 4", "Attribute 4-Value", "Attribute 4-Type", "Attribute 5", "Attribute 5-Value", "Attribute 5-Type", "(Blank)", "Option Type", "Strike Month", "Strike Price", "Expiration Date", "Put/Call Flag", "Contract Size", "Cash Rebate", "Barrier 1", "Barrier 2", ], "GTL": [ "OrdStatus", "ExecTransType", "ClientOrderID", "Fill ID", "ID of Order Or Fill for Action", "Lot Number", "Symbol", "Security Type", "Security Currency", "Security Description", "Buy/Sell/ Short/ Cover", "Open Close", "ID Source", "Security Id", "ISIN", "CUSIP", "SEDOL", "Bloomberg", "CINS", "When Issued", "Issue Date", "Maturity Date", "Coupon %; \nRepo Rate in %", "Execution Interest Days", "Accrued Interest", "Face Value", "Repo Type", "Repo Currency", "Day Count Fraction / Repo Calendar", "Repo Loan Amount (in Unit of Settle Currency)", "Trader", "Order Qty", "Fill Qty", "Cum Qty", "Hair Cut", "Avg Price", "Fill Price", "Trade Date", "Trade Time", "Execution Date", "Execution Time", "Settlement Date", "Executing User", "Operations Notes/ Comment", "Account", "Fund", "SubFund", "Allocation Code", "Strategy Code", "Execution Broker", "Clearing Agent", "Contract Size", "Commission", "FX Rate", "FWD FX Points", "Fee", "Currency Traded", "Settle Currency", "FX/BASE Rate", "BASE/FX Rate", "Strike Price", "Put or Call", "Derivative Expiry", "Sub Strategy", "Order Group", "RepoPenalty", "Commission turn", "Alloc Rule", "Payment Freq", "Rate Source", "Spread", "Current Face", "Current Principal Factor", "Accrual Factor", "Tax Rate", "Expenses", "Fees", "PostCommAndFeesOnInit", "Implied Commission Flag", "Transaction Type", "Master Confirm Type", "Matrix Term", "EMInternalSeqNo", "ObjectivePrice", "MarketPrice", "StopPrice", "NetConsideration", "Fixing Date", "Delivery Instructions", "Force Match ID", "Force Match Type ", "Force Match Notes", "Commission Rate for Allocation", "Commission Amount for Fill", "Expense Amount for Fill", "Fee Amount for Fill", "Standard Strategy", "Strategy Link Name", "Strategy Group", "Fill FX Settle Amount", "Reserved ", "Reserved ", "Deal Attributes ", "Finance Leg", "Perfermance Leg", "Attributes", "Deal Symbol", "Initial Margin Type", "initial Margin Amount", "Initial Margin Currency", "Confirm Status", "CounterParty ", "Trader Notes", "Convert Price to Settle Ccy", "Bond Coupon Type", "Generic Fees Enabled", "Generic Fees Listing", "Order Level Attributes", "Settling/Sub", "Confirmation Time", "Confirmation Means", "Payment Date", ], } 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