From a223039f58e5140dd00ed2f62d8ace2ad7d67425 Mon Sep 17 00:00:00 2001 From: Lorenz Declercq Date: Mon, 19 Apr 2021 12:56:27 +0100 Subject: [PATCH 1/3] se-1119 add a comment to test out git --- sdk/tests/tutorials/instruments/test_complex_instruments.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdk/tests/tutorials/instruments/test_complex_instruments.py b/sdk/tests/tutorials/instruments/test_complex_instruments.py index 19a1096f4507..f57a50019947 100644 --- a/sdk/tests/tutorials/instruments/test_complex_instruments.py +++ b/sdk/tests/tutorials/instruments/test_complex_instruments.py @@ -106,3 +106,5 @@ def test_create_fx_option(self): self.assertEqual( saved_fx_option.is_delivery_not_cash, fx_option.is_delivery_not_cash ) + + # to be inserted here \ No newline at end of file From 94c2b801d565b1f0bb79eb39893dbc537f30fb0d Mon Sep 17 00:00:00 2001 From: Lorenz Declercq Date: Mon, 19 Apr 2021 14:39:26 +0100 Subject: [PATCH 2/3] SE-1119: Adding term deposit test --- .../instruments/test_complex_instruments.py | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/sdk/tests/tutorials/instruments/test_complex_instruments.py b/sdk/tests/tutorials/instruments/test_complex_instruments.py index f57a50019947..f7c6a53a8dfb 100644 --- a/sdk/tests/tutorials/instruments/test_complex_instruments.py +++ b/sdk/tests/tutorials/instruments/test_complex_instruments.py @@ -3,7 +3,7 @@ import lusid import lusid.models as models from datetime import datetime -from utilities import TestDataUtilities +#from utilities import TestDataUtilities class ComplexInstrumentTests(unittest.TestCase): @@ -107,4 +107,30 @@ def test_create_fx_option(self): saved_fx_option.is_delivery_not_cash, fx_option.is_delivery_not_cash ) - # to be inserted here \ No newline at end of file + # to be inserted here + def test_create_term_deposit(self): + + term_deposit = lusid.TermDeposit( + startDate=datetime(2020, 2, 5, 00, tzinfo=pytz.utc), + maturityDate=datetime(2020, 2, 8, 00, tzinfo=pytz.utc), + contractSize=1000000, + flowConvention=lusid.FlowConventions( + scope=None, + code=None, + currency="GBP", + paymentFrequency="6M", + rollConvention="MF", + dayCountConvention="Act365", + paymentCalendars=[], + resetCalendars=[], + settleDays=1, + resetDays=0 + ), + rate=0.03, + instrument_type="TermDeposit" + ) + + # Assert instrument was created + self.assertIsNotNone(term_deposit) + + From 638d2d025a19ca2b56fcde8e8f8ce925fb75068d Mon Sep 17 00:00:00 2001 From: Lorenz Declercq Date: Mon, 19 Apr 2021 17:45:56 +0100 Subject: [PATCH 3/3] SE-1119: Added Term Deposits --- .../instruments/test_complex_instruments.py | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/sdk/tests/tutorials/instruments/test_complex_instruments.py b/sdk/tests/tutorials/instruments/test_complex_instruments.py index f7c6a53a8dfb..b4f141e183aa 100644 --- a/sdk/tests/tutorials/instruments/test_complex_instruments.py +++ b/sdk/tests/tutorials/instruments/test_complex_instruments.py @@ -3,7 +3,7 @@ import lusid import lusid.models as models from datetime import datetime -#from utilities import TestDataUtilities +from utilities import TestDataUtilities class ComplexInstrumentTests(unittest.TestCase): @@ -107,30 +107,36 @@ def test_create_fx_option(self): saved_fx_option.is_delivery_not_cash, fx_option.is_delivery_not_cash ) - # to be inserted here def test_create_term_deposit(self): - term_deposit = lusid.TermDeposit( - startDate=datetime(2020, 2, 5, 00, tzinfo=pytz.utc), - maturityDate=datetime(2020, 2, 8, 00, tzinfo=pytz.utc), - contractSize=1000000, - flowConvention=lusid.FlowConventions( + term_deposit = models.TermDeposit( + start_date=datetime(2020, 2, 5, 00, tzinfo=pytz.utc), + maturity_date=datetime(2020, 2, 8, 00, tzinfo=pytz.utc), + contract_size=1000000, + flow_convention=models.FlowConventions( scope=None, code=None, currency="GBP", - paymentFrequency="6M", - rollConvention="MF", - dayCountConvention="Act365", - paymentCalendars=[], - resetCalendars=[], - settleDays=1, - resetDays=0 + payment_frequency="6M", + roll_convention="MF", + day_count_convention="Act365", + payment_calendars=[], + reset_calendars=[], + settle_days=1, + reset_days=0 ), rate=0.03, instrument_type="TermDeposit" ) - + upsert_term_deposit = self.instruments_api.upsert_instruments(request_body={ + "upsert_request_001": models.InstrumentDefinition( + name="Term Deposit Test3%", + identifiers={"ClientInternal": models.InstrumentIdValue("test_td")}, + definition=term_deposit + ) + }) # Assert instrument was created - self.assertIsNotNone(term_deposit) + self.assertIsNotNone(upsert_term_deposit.values["upsert_request_001"].instrument_definition) + self.assertIsNotNone(upsert_term_deposit.values["upsert_request_001"].lusid_instrument_id)