diff options
| -rw-r--r-- | python/Dawn/models.py | 6 | ||||
| -rw-r--r-- | python/Dawn/static/dawn.js | 19 | ||||
| -rw-r--r-- | sql/dawn.sql | 5 |
3 files changed, 25 insertions, 5 deletions
diff --git a/python/Dawn/models.py b/python/Dawn/models.py index 7e556f15..ab5a6fb7 100644 --- a/python/Dawn/models.py +++ b/python/Dawn/models.py @@ -37,7 +37,7 @@ BOND_STRAT = ENUM('M_STR_MAV', 'M_STR_MEZZ', 'CSO_TRANCH', CDS_STRAT = ENUM('HEDGE_CSO', 'HEDGE_CLO', 'HEDGE_MAC', 'HEDGE_MBS', 'SER_IGSNR', 'SER_IGMEZ', 'SER_IGEQY', 'SER_IGINX', 'SER_HYSNR', 'SER_HYMEZ', 'SER_HYEQY', 'SER_HYINX', 'SER_IGCURVE', 'MBSCDS', - 'IGOPTDEL', 'HYOPTDEL', name='cds_strat') + 'IGOPTDEL', 'HYOPTDEL', 'SER_ITRXCURVE', name='cds_strat') SWAPTION_STRAT = ENUM('IGPAYER', 'IGREC', 'HYPAYER', 'HYREC', name='swaption_strat') @@ -129,6 +129,7 @@ class CDSDeal(db.Model): security_desc = db.Column(db.String(32), nullable = False) upfront = db.Column(db.Float, nullable = False) upfront_settle_date = db.Column(db.Date, nullable = False) + initial_margin_percentage = db.Column(db.Float) swap_type = db.Column(SWAP_TYPE, nullable = False) attach = db.Column(db.SmallInteger, info={'min': 0, 'max':100}) detach = db.Column(db.SmallInteger, info={'min': 0, 'max':100}) @@ -136,7 +137,8 @@ class CDSDeal(db.Model): isda_definition = db.Column(ISDA) counterparty = db.relationship(Counterparties) __table_args__ = (db.CheckConstraint("swap_type!='CD_INDEX_TRANCHE' or " \ - "(attach is not NULL and detach is not NULL)"),) + "(attach is not NULL and detach is not NULL AND " \ + "clearing_facility is NULL)"),) class RepoDeal(db.Model): __tablename__ = 'repo' diff --git a/python/Dawn/static/dawn.js b/python/Dawn/static/dawn.js index e0034c03..95f371d4 100644 --- a/python/Dawn/static/dawn.js +++ b/python/Dawn/static/dawn.js @@ -26,12 +26,27 @@ $(function() { }); }); $('#swap_type').change(function(){ - if($(this).val()=='CD_INDEX_TRANCHE'){ + switch $(this).val() { + case 'CD_INDEX_TRANCHE': $('#attach').parent().parent().css('display','block'); $('#detach').parent().parent().css('display','block'); - }else{ + $('#clearing_facility').val(''); + break; + case 'CD_INDEX': $('#attach').parent().parent().css('display', 'none'); $('#detach').parent().parent().css('display', 'none'); + $('#clearing_facility').val('ICE-CREDIT'); + break; + case 'ABS_CDS': + $('#attach').parent().parent().css('display', 'none'); + $('#detach').parent().parent().css('display', 'none'); + $('#clearing_facility').val(''); + break; + case 'CD_BASKET_TRANCHE': + $('#attach').parent().parent().css('display','block'); + $('#detach').parent().parent().css('display','block'); + $('#clearing_facility').val(''); + break; } }); $('#swap_type').change(); diff --git a/sql/dawn.sql b/sql/dawn.sql index 6632f9db..678db4e4 100644 --- a/sql/dawn.sql +++ b/sql/dawn.sql @@ -116,8 +116,11 @@ CREATE TABLE cds(id serial primary key, isda_definition isda, termination_date date DEFAULT NULL, termination_amount float DEFAULT NULL, + initial_margin_percentage float DEFAULT NULL, CONSTRAINT tranche_check CHECK (swap_type != 'CD_INDEX_TRANCHE' OR - (attach IS NOT NULL AND detach IS NOT NULL))); + (attach IS NOT NULL AND detach IS NOT NULL AND + clearing_facility IS NULL)) + ); ALTER TABLE cds OWNER TO dawn_user; |
