aboutsummaryrefslogtreecommitdiffstats
path: root/python/ops
diff options
context:
space:
mode:
Diffstat (limited to 'python/ops')
-rw-r--r--python/ops/funds.py114
-rw-r--r--python/ops/headers.py911
2 files changed, 1025 insertions, 0 deletions
diff --git a/python/ops/funds.py b/python/ops/funds.py
new file mode 100644
index 00000000..bfc3750d
--- /dev/null
+++ b/python/ops/funds.py
@@ -0,0 +1,114 @@
+import csv
+import datetime
+import pathlib
+from serenitas.utils.remote import FtpClient, SftpClient
+from serenitas.utils.exchange import ExchangeMessage, FileAttachment
+from io import StringIO
+from typing import Tuple, Union
+
+
+class Fund:
+ staged_queue = []
+ _registry = {}
+ filepath_pattern = None
+
+ def __class_getitem__(cls, fund_name: str):
+ return cls._registry[fund_name]
+
+ def __init_subclass_(cls, fund_name: str):
+ cls.name = fund_name
+ cls._registry[fund_name] = cls
+
+ @classmethod
+ def build_buffer(cls, trade_type):
+ buf = StringIO()
+ csvwriter = csv.writer(buf)
+ csvwriter.writerow(get_headers(trade_type, cls.name))
+ csvwriter.writerows(cls.staged_queue)
+ buf = buf.getvalue().encode()
+ dest = cls.get_filepath(DAILY_DIR, trade_type)
+ dest.parent.mkdir(exist_ok=True)
+ dest.write_bytes(buf)
+ return buf, dest
+
+ @classmethod
+ def set_headers(cls, trade_type):
+ cls.headers = get_headers(trade_type, cls.name)
+
+ @classmethod
+ def stage(cls, trade, trade_type):
+ cls.staged_queue.append(build_line(trade, trade_type, cls.name))
+
+ @classmethod
+ def get_filepath(
+ cls,
+ base_dir: pathlib.Path,
+ trade_type: Union[str, Tuple[str, str]],
+ ) -> pathlib.Path:
+ d = {
+ "bond": "Mortgages",
+ "cds": "CreditDefaultSwapDeal",
+ "swaption": "SwaptionDeal",
+ "future": "Future",
+ "wire": "CashFlowDeal",
+ "spot": "SpotDeal",
+ "fx_swap": "FxSwapDeal",
+ "capfloor": "CapFloor",
+ "repo": "RepoDeal",
+ }
+ trade_tag: str
+ if isinstance(trade_type, tuple):
+ trade_tag = d[trade_type[0]] + trade_type[1]
+ else:
+ trade_tag = d[trade_type]
+
+ timestamp = datetime.datetime.now()
+ return (
+ base_dir
+ / str(timestamp.date())
+ / cls.filepath_pattern.format(timestamp, trade_tag)
+ )
+
+
+class Serenitas(Fund, fund_name="SERCGMAST"):
+ filepath_pattern = "Serenitas.ALL.{timestamp:%Y%m%d.%H%M%S}.{trade_tag}.csv"
+
+ @staticmethod
+ def upload(buf, dest):
+ ftp = FtpClient.from_creds("serenitas")
+ ftp.client.cwd("incoming")
+ ftp.client.put(buf, dest)
+
+
+class Brinker(Fund, fund_name="BRINKER"):
+ filepath_pattern = "LMCG_BBH_SWAP_TRADES_P.{timestamp:%Y%m%d%H%M%S}.csv"
+
+ @staticmethod
+ def upload(buf, dest):
+ sftp = SftpClient.from_creds("bbh")
+ sftp.put(buf, dest)
+
+
+class Bowdst(Fund, fund_name="BOWDST"):
+ filepath_pattern = "Bowdst.ALL.{timestamp:%Y%m%d.%H%M%S}.{trade_tag}.csv"
+
+ @staticmethod
+ def upload(buf, dest):
+ sftp = SftpClient.from_creds("hm_globeop")
+ sftp.client.chdir("incoming")
+ sftp.put(buf, dest)
+ em = ExchangeMessage()
+ recipients = ("hm-operations@bnymellon.com",)
+ em.send_email(
+ "Trade file",
+ "",
+ to_recipients=recipients,
+ cc_recipients=("bowdoin-ops@lmcg.com",),
+ attach=(FileAttachment(name=dest, content=buf),),
+ )
+
+
+class Selene(Fund, fund_name="ISOSEL"):
+ @classmethod
+ def stage(cls, trade, action="NEW"):
+ cls.staged_queue.append(trade.to_citco(action))
diff --git a/python/ops/headers.py b/python/ops/headers.py
new file mode 100644
index 00000000..88126628
--- /dev/null
+++ b/python/ops/headers.py
@@ -0,0 +1,911 @@
+from enum import Enum
+
+
+class DealType(Enum):
+ Bond = "BOND"
+ CDS = "CDX"
+ Swaption = "SWAPTION"
+ Termination = "TERM"
+ Spot = "SPOT"
+ FxSwap = "FXSWAP"
+ Fx = "FX"
+ TRS = "TRS"
+ IRS = "IRS"
+ TrancheProduct = "TRANCHEPRODUCT"
+ SwaptionProduct = "SWAPTIONPRODUCT"
+ IRSProduct = "IRSPRODUCT"
+ TRSProduct = "TRSPRODUCT"
+
+
+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",
+ ],
+ "trs": HEADERS_PRE
+ + [
+ "Reserved",
+ "Reserved",
+ "ReceiveLegRateType",
+ "ReceiveUnderlyingType",
+ "ReceiveUnderlyingSecurity",
+ "ReceiveUnderlyingDescription",
+ "ReceiveFloatRate",
+ "ReceiveFirstCouponDate",
+ "ReceiveFirstCouponRate",
+ "ReceiveFixedRate",
+ "ReceiveDaycount",
+ "ReceiveFrequency",
+ "ReceivePaymentBDC",
+ "ReceiveEffectiveDate",
+ "ReceiveMaturityDate",
+ "ReceiveNotional",
+ "ReceivePrice",
+ "ReceiveArrears",
+ "Reserved",
+ "Reserved",
+ "ReceiveCurrency",
+ "Reserved",
+ "ReceiveSpread",
+ "PayLegRateType",
+ "PayUnderlyingType",
+ "PayUnderlyingSecurity",
+ "PayUnderlyingDescription",
+ "PayFloatRate",
+ "PayFirstCouponDate",
+ "PayFirstCouponRate",
+ "PayFixedRate",
+ "PayDaycount",
+ "PayFrequency",
+ "PayPaymentBDC",
+ "PayEffectiveDate",
+ "PayMaturityDate",
+ "PayNotional",
+ "PayPrice",
+ "PayArrears",
+ "Reserved",
+ "Reserved",
+ "PayCurrency",
+ "Reserved",
+ "PaySpread",
+ "Reserved",
+ "InitialMargin",
+ "InitialMarginPercent",
+ "InitialMarginCurrency",
+ "ClientReference",
+ "CcpTradeRef",
+ "BlockId",
+ "BlockAmount",
+ "Netting Id",
+ "ExchangeRate",
+ "ReceiveQuantity",
+ "PayQuantity",
+ "ReceiveAccrued",
+ "PayAccrued",
+ "ReceiveNotionalExchange",
+ "PayNotionalExchange",
+ "ReceiveResetLag",
+ "PayResetLag",
+ "Reserved",
+ "Reserved",
+ "Reserved",
+ "Reserved",
+ "ReceiveCalendar",
+ "PayCalendar",
+ "ReceiveInterestCalcMethod",
+ "PayInterestCalcMethod",
+ "ReceiveCompoundAverageFrequency",
+ "PayCompoundAverageFrequency",
+ "ReceiveFixingFrequency",
+ "PayFixingFrequency",
+ "ReceiveStubLocation",
+ "ReceiveBeginFloatRate1",
+ "ReceiveBeginFloatRate2",
+ "ReceiveEndFloatRate1",
+ "ReceiveEndFloatRate2",
+ "PayStubLocation",
+ "PayBeginFloatRate1",
+ "PayBeginFloatRate2",
+ "PayEndFloatRate1",
+ "PayEndFloatRate2",
+ "Fees",
+ "Fee Payment Dates",
+ "Fee Comments",
+ "ExecutionDateTimeStamp",
+ "FeeTypes",
+ "FeeCurrencies",
+ "ReceivePaymentAt",
+ "PayPaymentAt",
+ "SwapType",
+ "Reserved1",
+ "ReceiveAccrualBDC",
+ "PayAccrualBDC",
+ "ReceiveMaturityBDC",
+ "PayMaturityBDC",
+ "ReceiveRollConvention",
+ "PayRollConvention",
+ "ReceivePaymentLag",
+ "PayPaymentLag",
+ "ReceiveSettlementCurrency",
+ "PaySettlementCurrency",
+ "Collateralized",
+ "TradeDateFX",
+ ],
+ "irs": HEADERS_PRE
+ + [
+ "Reserved",
+ "Reserved",
+ "ReceiveLegRateType",
+ "ReceiveFloatRate",
+ "ReceiveFirstCouponDate",
+ "ReceiveFirstCouponRate",
+ "ReceiveFixedRate",
+ "ReceiveDaycount",
+ "ReceiveFrequency",
+ "ReceivePaymentBDC",
+ "ReceiveEffectiveDate",
+ "ReceiveMaturityDate",
+ "ReceiveNotional",
+ "ReceiveResetArrears",
+ "Reserved",
+ "Reserved",
+ "ReceiveCurrency",
+ "Reserved",
+ "PayLegRateType",
+ "PayFloatRate",
+ "PayFirstCouponDate",
+ "PayFirstCouponRate",
+ "PayFixedRate",
+ "PayDaycount",
+ "PayFrequency",
+ "PayPaymentBDC",
+ "PayEffectiveDate",
+ "PayMaturityDate",
+ "PayNotional",
+ "PayResetArrears",
+ "Reserved",
+ "Reserved",
+ "PayCurrency",
+ "Reserved",
+ "InitialMargin",
+ "InitialMarginPercentage",
+ "InitialMarginCurrency",
+ "CalendarPay",
+ "CalendarReceive",
+ "Reserved",
+ "ReceiveSpread",
+ "ReceiveFixingFrequency",
+ "ReceiveInterestCalcMethod",
+ "Reserved",
+ "PaySpread",
+ "PayFixingFrequency",
+ "PayInterestCalcMethod",
+ "Reserved",
+ "GiveUpCounterparty",
+ "ReceiveStubLocation",
+ "ReceiveBeginFloatRate1",
+ "ReceiveBeginFloatRate2",
+ "ReceiveEndFloatRate1",
+ "ReceiveEndFloatRate2",
+ "PayStubLocation",
+ "PayBeginFloatRate1",
+ "PayBeginFloatRate2",
+ "PayEndFloatRate1",
+ "PayEndFloatRate2",
+ "Reserved",
+ "Reserved",
+ "SwapType",
+ "Reserved",
+ "ClientReference",
+ "Reserved",
+ "Reserved",
+ "Reserved",
+ "Reserved",
+ "Reserved",
+ "Reserved",
+ "ReceiveResetLag",
+ "PayResetLag",
+ "ReceiveExchangeAmount",
+ "PayExchangeAmount",
+ "AssociatedDealType",
+ "AssociatedDealId",
+ "ClearingFacility",
+ "CcpTradeRef",
+ "BreakClauseFrequency",
+ "BlockId",
+ "BlockAmount",
+ "UpfrontFee",
+ "UpfrontFeePaydate",
+ "UpFrontFeeComments",
+ "UpfrontFeeCurrency ",
+ "Netting Id",
+ "BreakClauseDate",
+ "CashFlowStubType",
+ "IndexLevel",
+ "ExecutionDateTimeStamp",
+ "ReceivePaymentLag",
+ "PayPaymentLag",
+ "ReceiveRateMultiplier",
+ "PayRateMultiplier",
+ "ReceiveRateCap",
+ "PayRateCap",
+ "ReceiveRateFloor",
+ "PayRateFloor",
+ "ReceiveRollConvention",
+ "PayRollConvention",
+ "ReceiveAccrualBDC",
+ "PayAccrualBDC",
+ "ReceiveMaturityBDC",
+ "PayMaturityBDC",
+ "ReceivePaymentAt",
+ "PayPaymentAt",
+ "ReceiveClientMargin",
+ "PayClientMargin",
+ "Reserved1",
+ "ReceiveRateCutOff",
+ "PayRateCutOff",
+ "InflationLag",
+ "InflationReference",
+ "ReceiveSettlementCurrency",
+ "PaySettlementCurrency",
+ "CounterpartyReference",
+ "ReceiveInflationReference",
+ "PayInflationReference",
+ "Collateralized",
+ "InitialFXRate",
+ "TradeDateFX",
+ ],
+}
+
+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",
+ ],
+ DealType.TRS: [
+ "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",
+ "Initial Payment",
+ "Initial Payment Currency",
+ "Original Issue Date",
+ "Interest Payment Method Description",
+ "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",
+ "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 Type",
+ "Master Document Version",
+ "",
+ "",
+ "Annex Date",
+ "Supplement Date",
+ "Documentation Type",
+ "Calculation Agent Business Center",
+ "",
+ "Strategy",
+ "Electronic Consent Ineligible",
+ "External OMS ID",
+ "Traded Rate/Price",
+ "Independent Amount Currency",
+ "Independent Amount Payer",
+ "Trade Revision",
+ "Alternate Swap ID",
+ "Alternate Trade ID",
+ "Definitions Type",
+ "Initial Fixing Amount",
+ "2nd Leg Index",
+ "2nd Leg Spread",
+ "2nd Leg Initial Floating Rate",
+ ],
+}
+
+
+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