aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/Dawn/models.py4
-rw-r--r--python/Dawn/static/dawn.js3
-rw-r--r--python/Dawn/templates/spot_blotter.html35
-rw-r--r--python/dawn_utils.py32
-rw-r--r--python/flask-run.py2
5 files changed, 73 insertions, 3 deletions
diff --git a/python/Dawn/models.py b/python/Dawn/models.py
index 2c4acb27..28d57990 100644
--- a/python/Dawn/models.py
+++ b/python/Dawn/models.py
@@ -326,8 +326,8 @@ class SpotDeal(db.Model):
buy_amount = db.Column(db.Float, nullable=False)
sell_currency = db.Column(CCY, nullable=False)
sell_amount = db.Column(db.Float, nullable=False)
- commission_currency = db.Column(CCY, nullable=False)
- commission = db.Column(db.Float, nullable=False)
+ commission_currency = db.Column(CCY)
+ commission = db.Column(db.Float)
counterparty = db.relationship(Counterparties)
class CapFloorDeal(db.Model):
diff --git a/python/Dawn/static/dawn.js b/python/Dawn/static/dawn.js
index 143947c8..cfcee999 100644
--- a/python/Dawn/static/dawn.js
+++ b/python/Dawn/static/dawn.js
@@ -105,4 +105,7 @@ $(function() {
$('#upfront').attr('data-toggle', 'tooltip');
$('#upfront').attr('title', 'This is Cash Amount on the bloomberg ticket, i.e. the net amount we receive.');
$('#upfront').tooltip();
+ $('#spot_rate').attr('data-toggle', 'tooltip');
+ $('#spot_rate').attr('title', 'Spot rate must be entered with pairs ordered by dominance. EUR > GBP > USD > CAD > CHF > YEN');
+ $('#spot_rate').tooltip();
});
diff --git a/python/Dawn/templates/spot_blotter.html b/python/Dawn/templates/spot_blotter.html
new file mode 100644
index 00000000..fbbd2545
--- /dev/null
+++ b/python/Dawn/templates/spot_blotter.html
@@ -0,0 +1,35 @@
+{% extends "base.html" %}
+{% block content %}
+<table class="table table-striped">
+ <thead>
+ <tr>
+ <td>Deal ID</td>
+ <td>Trade Date</td>
+ <td>Settle Date</td>
+ <td>Strategy</td>
+ <td>Spot Rate</td>
+ <td>Buy CCY</td>
+ <td>Buy Amount</td>
+ <td>Sell CCY</td>
+ <td>Sell Amount</td>
+ <td>Commission CCY</td>
+ <td>Commission Amount</td>
+ </tr>
+ </thead>
+ {% for trade in trades %}
+ <tr>
+ <td><a href="{{url_for('trade_manage', tradeid=trade.id, kind='spot')}}">{{trade.dealid}}</a></td>
+ <td>{{trade.trade_date}}</td>
+ <td>{{trade.settlement_date}}</td>
+ <td>{{trade.folder}}</td>
+ <td>{{trade.spot_rate}}</td>
+ <td>{{trade.buy_currency}}</td>
+ <td>{{trade.buy_amount}}</td>
+ <td>{{trade.sell_currency}}</td>
+ <td>{{trade.sell_amount}}</td>
+ <td>{{trade.commission_currency}}</td>
+ <td>{{trade.commission}}</td>
+ </tr>
+ {% endfor %}
+</table>
+{% endblock %}
diff --git a/python/dawn_utils.py b/python/dawn_utils.py
index 1ce4007d..bfa3d312 100644
--- a/python/dawn_utils.py
+++ b/python/dawn_utils.py
@@ -29,6 +29,8 @@ identifier = COALESCE(identifier, cusip, isin)', NEW.id);
stub := 'SCCSH';
WHEN 'capfloors' THEN
stub := 'CAP';
+ WHEN 'spots' THEN
+ stub := 'SCFX';
END CASE;
sqlstr := format(sqlstr, 'dealid = $1||id', NEW.id);
END IF;
@@ -155,6 +157,36 @@ def load_wires(engine, schema=None):
blotter.to_sql('wires', engine, if_exists='append', index=False, schema=schema)
return blotter
+def load_spots(engine, schema=None):
+ blotter = pd.read_excel("/home/serenitas/Daily/Blotter_gh.xlsm", 'FXSpot',
+ skiprows=[0, 1, 2, 3, 4])
+ blotter.dropna(axis=0, subset=['Deal ID'], inplace=True)
+ blotter = blotter.iloc[:,2:]
+ blotter.drop(['Deal Type', 'Asset Class', 'Client', 'State', "Counterparty",
+ "Custodian", "Cash Account", "Account"],
+ axis=1, inplace=True)
+ blotter.rename(columns= {'Date': 'trade_date',
+ 'Settlement Date': 'settlement_date',
+ 'Cash Account': 'cashaccount',
+ 'Strategy': 'folder',
+ 'Deal ID': 'id',
+ 'Action': 'action',
+ 'Sell Currency': 'sell_currency',
+ 'Sell Amount': 'sell_amount',
+ 'Buy Currency': 'buy_currency',
+ 'Buy Amount': 'buy_amount',
+ 'Spot - Buy/Sold Rate': 'spot_rate',
+ 'Commission Currency': 'commission_currency',
+ 'commission note': 'commission'}, inplace=True)
+ blotter.folder = blotter.folder.str.rstrip()
+ blotter['action'] = 'NEW'
+ blotter['id'] = blotter['id'].str.replace('[A-Z_]', '').astype('int')
+ blotter['custodian'] = 'INTBR'
+ blotter['cashaccount'] = 'IANSCLMAFU'
+ blotter['cp_code'] = 'IBKRNY'
+ blotter.to_sql('spots', engine, if_exists='append', index=False, schema=schema)
+ return blotter
+
if __name__ == "__main__":
""" This script will create the tables and triggers for the Dawn app.
If schema is not None, it will create it under a specific schema"""
diff --git a/python/flask-run.py b/python/flask-run.py
index 7fc1a02c..829da808 100644
--- a/python/flask-run.py
+++ b/python/flask-run.py
@@ -1,7 +1,7 @@
import sys
import importlib
-if len(sys.argv)<2:
+if len(sys.argv) < 2:
print("please enter the name of the Flask app")
print("currently Dawn, task_server or risk_insight")
else: