aboutsummaryrefslogtreecommitdiffstats
path: root/python/Dawn
diff options
context:
space:
mode:
Diffstat (limited to 'python/Dawn')
-rw-r--r--python/Dawn/models.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/python/Dawn/models.py b/python/Dawn/models.py
index 9766b476..7a124d9b 100644
--- a/python/Dawn/models.py
+++ b/python/Dawn/models.py
@@ -161,7 +161,8 @@ class CDSDeal(db.Model):
termination_cp = db.Column(db.String(12), db.ForeignKey('counterparties.code'),
info={'choices': [(None, '')],
'label': 'termination_counterparty'})
- counterparty = db.relationship(Counterparties)
+ counterparty = db.relationship(Counterparties, foreign_keys=[cp_code])
+ termination_counterparty = db.relationship(Counterparties, foreign_keys=[termination_cp])
__table_args__ = (db.CheckConstraint("swap_type!='CD_INDEX_TRANCHE' or " \
"(attach is not NULL and detach is not NULL AND " \
"clearing_facility is NULL)"),)
@@ -218,8 +219,8 @@ class SwaptionDeal(db.Model):
trade_date = db.Column(db.Date, nullable=False)
settle_date = db.Column(db.Date, nullable=False)
buysell = db.Column(db.Boolean, nullable=False, info={'choices':[(0, 'sell'), (1, 'buy')],
- 'coerce': lambda x: bool(int(x)) \
- if x is not None else x})
+ 'coerce': lambda x: bool(int(x))
+ if x is not None else x})
notional = db.Column(db.Float, nullable=False)
swaption_type = db.Column(SWAPTION_TYPE, nullable=False)
strike = db.Column(db.Float, nullable=False)
@@ -237,7 +238,8 @@ class SwaptionDeal(db.Model):
termination_cp = db.Column(db.String(12), db.ForeignKey('counterparties.code'),
info={'choices': [(None, '')],
'label': 'termination_counterparty'})
- counterparty = db.relationship(Counterparties)
+ counterparty = db.relationship(Counterparties, foreign_keys=[cp_code])
+ termination_counterparty = db.relationship(Counterparties, foreign_keys=[termination_cp])
class FutureDeal(db.Model):
__tablename__ = 'futures'