aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/process_queue.py27
1 files changed, 24 insertions, 3 deletions
diff --git a/python/process_queue.py b/python/process_queue.py
index 224ece94..fac46cac 100644
--- a/python/process_queue.py
+++ b/python/process_queue.py
@@ -94,7 +94,17 @@ HEADERS = {'bond_trades': [
"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"]
+ "Ccp Trade Ref", "Margin Type", "Block Id", "Block Amount"],
+ 'spot_trades': [
+ "Deal Type", "Deal Id", "Action", "Client", "Reserved", "Reserved",
+ "Folder", "Custodian", "Cash Account", "Counterparty", "Comments",
+ "State", "Trade Date", "Settlement Date", "Dealt Currency",
+ "Spot Rate", "Reserved", "Buy Currency", "Buy Amount",
+ "Sell Currency", "Sell Amount", "ClearingFees", "BlockId",
+ "BlockAmount", "Commission Currency", "Commission", "Reserved",
+ "AssociatedDealType", "AssociatedDealId", "BrokerShortName",
+ "ClientReference"]
+
}
def get_effective_date(d, swaption_type):
@@ -282,6 +292,15 @@ def build_line(obj, queue_name='bond_trades'):
obj['Instrument Type'] = 'Cashflow'
obj['Settlement Date'] = obj['Trade Date']
rename_keys(obj, {'amount': 'Amount'})
+ elif queue_name == 'spot_trades':
+ obj['Deal Type'] = 'SpotDeal'
+ rename_keys(obj, {'commission': 'Commission',
+ 'commission_currency': 'Commission Currency',
+ 'sell_currency': 'Sell Currency',
+ 'sell_amount': 'Sell Amount',
+ 'buy_currency': 'Buy Currency',
+ 'buy_amount': 'Buy Amount',
+ 'spot_rate': 'Spot Rate'})
return [obj.get(h, None) for h in HEADERS[queue_name]]
@@ -405,7 +424,8 @@ def get_filename(timestamp, queue_name):
'cds_trades': 'CreditDefaultSwapDeal',
'swaption_trades': 'SwaptionDeal',
'future_trades': 'Future',
- 'wires': 'CashFlowDeal'}
+ 'wires': 'CashFlowDeal',
+ 'spot_trades': 'SpotDeal'}
return f'Serenitas.ALL.{timestamp:%Y%m%d.%H%M%S}.{d[queue_name]}.csv'
@@ -452,7 +472,8 @@ if __name__ == "__main__":
q = get_redis_queue()
serenitasdb = dbconn('serenitasdb')
dawndb = dbconn('dawndb')
- for queue_name in ['bond_trades', 'cds_trades', 'swaption_trades', 'future_trades', 'wires']:
+ for queue_name in ['bond_trades', 'cds_trades', 'swaption_trades', 'future_trades', 'wires',
+ 'spot_trades']:
list_trades = get_trades(q, queue_name)
if list_trades:
if queue_name == 'bond_trades':