aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/Dawn/models.py27
-rw-r--r--python/Dawn/templates/base.html2
-rw-r--r--python/Dawn/views.py19
3 files changed, 46 insertions, 2 deletions
diff --git a/python/Dawn/models.py b/python/Dawn/models.py
index b46b96f8..2c4acb27 100644
--- a/python/Dawn/models.py
+++ b/python/Dawn/models.py
@@ -59,6 +59,9 @@ CASH_STRAT = ENUM('M_CSH_CASH', 'MBSCDSCSH', 'SER_IGCVECSH', 'SER_ITRXCVCSH', 'C
'IRDEVCSH',
name='cash_strat')
+SPOT_STRAT = ENUM('M_STR_MAV', 'M_STR_MEZZ', 'SER_ITRXCURVE', 'M_CSH_CASH',
+ name='spot_strat')
+
OPTION_TYPE = ENUM('PAYER', 'RECEIVER',
name='option_type')
@@ -303,6 +306,30 @@ class CashFlowDeal(db.Model):
trade_date = db.Column(db.Date, nullable=False)
account = db.relationship(Accounts)
+
+class SpotDeal(db.Model):
+ __tablename__ = "spots"
+ id = db.Column('id', db.Integer, primary_key=True)
+ dealid = db.Column(db.String(28))
+ lastupdate = db.Column(db.DateTime, server_default=db.func.now(), onupdate=db.func.now())
+ action = db.Column(ACTION)
+ folder = db.Column(SPOT_STRAT, nullable=False)
+ custodian = db.Column(db.String(12), default='INTBR', nullable=False)
+ cashaccount = db.Column(db.String(10), default='IANSCLMAFU', nullable=False)
+ cp_code = db.Column(db.String(12), db.ForeignKey('counterparties.code'),
+ info={'choices': [('IBKRNY', 'Interactive Brokers')],
+ 'label': 'counterparty'}, nullable=False)
+ trade_date = db.Column(db.Date, nullable=False)
+ settlement_date = db.Column(db.Date, nullable=False)
+ spot_rate = db.Column(db.Float, nullable=False)
+ buy_currency = db.Column(CCY, nullable=False)
+ 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)
+ counterparty = db.relationship(Counterparties)
+
class CapFloorDeal(db.Model):
__tablename__ = 'capfloors'
id = db.Column('id', db.Integer, primary_key=True)
diff --git a/python/Dawn/templates/base.html b/python/Dawn/templates/base.html
index 97ba4e3d..0af075eb 100644
--- a/python/Dawn/templates/base.html
+++ b/python/Dawn/templates/base.html
@@ -28,6 +28,7 @@
<li><a href="{{url_for('list_trades', kind='cds')}}">CDS</a></li>
<li><a href="{{url_for('list_trades', kind='swaption')}}">Swaptions</a></li>
<li><a href="{{url_for('list_trades', kind='future')}}">Futures</a></li>
+ <li><a href="{{url_for('list_trades', kind='spot')}}">Spot</a></li>
<li><a href="{{url_for('list_trades', kind='wire')}}">Wires</a></li>
<li><a href="{{url_for('list_trades', kind='capfloor')}}">Caps and Floors</a></li>
</ul>
@@ -44,6 +45,7 @@
<li><a href="{{url_for('trade_manage', kind='cds')}}">CDS</a></li>
<li><a href="{{url_for('trade_manage', kind='swaption')}}">Swaptions</a></li>
<li><a href="{{url_for('trade_manage', kind='future')}}">Futures</a></li>
+ <li><a href="{{url_for('trade_manage', kind='spot')}}">Spot</a></li>
<li><a href="{{url_for('wire_manage')}}">Wires</a></li>
<li><a href="{{url_for('trade_manage', kind='capfloor')}}">Caps and Floors</a></li>
</ul>
diff --git a/python/Dawn/views.py b/python/Dawn/views.py
index 97873eaf..3cecf2b5 100644
--- a/python/Dawn/views.py
+++ b/python/Dawn/views.py
@@ -10,7 +10,7 @@ from flask import (abort, request, render_template, redirect,
from .models import (ModelForm, CASH_STRAT, CCY,
BondDeal, CDSDeal, SwaptionDeal, FutureDeal, CashFlowDeal,
- CapFloorDeal, Counterparties, Accounts)
+ CapFloorDeal, SpotDeal, Counterparties, Accounts)
from sqlalchemy.exc import IntegrityError
from wtforms.fields import BooleanField
@@ -34,7 +34,7 @@ def cp_choices(kind='bond'):
if kind == 'bond':
return (Counterparties.query.order_by('name').
with_entities(Counterparties.code, Counterparties.name))
- elif kind == 'future':
+ elif kind in ['future', 'spot']:
return []
elif kind in ['cds', 'swaption', 'capfloor']:
return (Counterparties.query.
@@ -123,6 +123,14 @@ class FutureForm(ModelForm):
include_foreign_keys = True
exclude = ['dealid', 'lastupdate']
+class SpotForm(ModelForm):
+ upload_globeop = BooleanField(label="Upload to globeop?")
+
+ class Meta:
+ model = SpotDeal
+ include_foreign_keys = True
+ exclude = ['dealid', 'lastupdate']
+
class CapFloorForm(ModelForm):
upload_globeop = BooleanField(label="Upload to globeop?")
@@ -147,6 +155,8 @@ def get_deal(kind):
return CashFlowDeal
elif kind == 'capfloor':
return CapFloorDeal
+ elif kind == 'spot':
+ return SpotDeal
else:
raise RuntimeError(f'Unknown Deal type: {kind}')
@@ -162,6 +172,8 @@ def _get_form(kind):
return FutureForm
elif kind == 'capfloor':
return CapFloorForm
+ elif kind == 'spot':
+ return SpotForm
else:
raise RuntimeError('Unknown Deal type')
@@ -179,6 +191,9 @@ def get_form(trade, kind):
upfront_settle_date=today.date() + 3 * bus_day)
if kind == 'cds':
form.account_code.choices = fcm_accounts()
+ elif kind == 'spot':
+ form = Form(trade_date=today.date(),
+ settlement_date=today.date() + 2 * bus_day)
else:
form = Form(trade_date=today.date(),
settle_date=today.date() + 2 * bus_day)