Skip to content
This repository was archived by the owner on May 29, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/use-cases/compliance/data/iag_allocations.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
instrument_name,client_internal,isin,figi,quantity,price,currency,allocation_id,originating_order,state,side,type
IAG group plc,EQ_1244,ES0177542018,BBG00J9WBYB9,500,1.48,USD,ALLOC001-for-ORD005,ORD005,partial allocation,buy,market
IAG group plc,EQ_1244,ES0177542018,BBG00J9WBYB9,500,1.48,USD,ALLOC001-for-ORD005,ORD005,partial allocation,Buy,market
621 changes: 621 additions & 0 deletions examples/use-cases/notifications/Conditional Email Notifications.ipynb

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
select * from Views.ManualEvent.Writer where OrderCode == '{{Body.code}}' and OrderScope == '{{Body.scope}}';
247 changes: 247 additions & 0 deletions examples/use-cases/notifications/HelperFiles/EmailTemplate.html

Large diffs are not rendered by default.

61 changes: 61 additions & 0 deletions examples/use-cases/notifications/HelperFiles/ExtraTableRows.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<tr style="border-collapse:collapse">
<td align="left" style="padding:0;Margin:0;padding-top:20px;padding-left:20px;padding-right:20px"><!--[if mso]><table style="width:560px" cellpadding="0" cellspacing="0"><tr><td style="width:188px" valign="top"><![endif]-->
<table cellpadding="0" cellspacing="0" class="es-left" align="left" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;float:left">
<tr style="border-collapse:collapse">
<td class="es-m-p0r es-m-p20b" align="center" style="padding:0;Margin:0;width:183px">
<table cellpadding="0" cellspacing="0" width="100%" bgcolor="#efefef" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;background-color:#efefef" role="presentation">
<tr style="border-collapse:collapse">
<td align="center" style="padding:0;Margin:0"><h3 style="Margin:0;line-height:19px;mso-line-height-rule:exactly;font-family:arial, 'helvetica neue', helvetica, sans-serif;font-size:16px;font-style:normal;font-weight:bold;color:#203443">{{subtitle1}}</h3></td>
</tr>
<tr style="border-collapse:collapse">
<td align="center" height="27" style="padding:0;Margin:0"></td>
</tr>
<tr style="border-collapse:collapse">
<td align="center" style="padding:0;Margin:0"><h3 style="Margin:0;line-height:14px;mso-line-height-rule:exactly;font-family:arial, 'helvetica neue', helvetica, sans-serif;font-size:12px;font-style:normal;font-weight:bold;color:#ff5200">{{description1}}</h3></td>
</tr>
<tr style="border-collapse:collapse">
<td align="center" height="25" style="padding:0;Margin:0"></td>
</tr>
</table></td>
<td class="es-hidden" style="padding:0;Margin:0;width:5px"></td>
</tr>
</table><!--[if mso]></td><td style="width:182px" valign="top"><![endif]-->
<table cellpadding="0" cellspacing="0" class="es-left" align="left" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;float:left">
<tr style="border-collapse:collapse">
<td class="es-m-p0r es-m-p20b" align="center" style="padding:0;Margin:0;width:182px">
<table cellpadding="0" cellspacing="0" width="100%" bgcolor="#efefef" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;background-color:#efefef" role="presentation">
<tr style="border-collapse:collapse">
<td align="center" style="padding:0;Margin:0"><h3 style="Margin:0;line-height:19px;mso-line-height-rule:exactly;font-family:arial, 'helvetica neue', helvetica, sans-serif;font-size:16px;font-style:normal;font-weight:bold;color:#203443">{{subtitle2}}</h3></td>
</tr>
<tr style="border-collapse:collapse">
<td align="center" height="27" style="padding:0;Margin:0"></td>
</tr>
<tr style="border-collapse:collapse">
<td align="center" style="padding:0;Margin:0"><h3 style="Margin:0;line-height:14px;mso-line-height-rule:exactly;font-family:arial, 'helvetica neue', helvetica, sans-serif;font-size:12px;font-style:normal;font-weight:bold;color:#ff5200">{{description2}}</h3></td>
</tr>
<tr style="border-collapse:collapse">
<td align="center" height="25" style="padding:0;Margin:0"></td>
</tr>
</table></td>
</tr>
</table><!--[if mso]></td><td style="width:5px"></td><td style="width:185px" valign="top"><![endif]-->
<table cellpadding="0" cellspacing="0" class="es-right" align="right" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;float:right">
<tr style="border-collapse:collapse">
<td class="es-m-p0r es-m-p20b" align="center" style="padding:0;Margin:0;width:185px">
<table cellpadding="0" cellspacing="0" width="100%" bgcolor="#efefef" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;background-color:#efefef" role="presentation">
<tr style="border-collapse:collapse">
<td align="center" style="padding:0;Margin:0"><h3 style="Margin:0;line-height:19px;mso-line-height-rule:exactly;font-family:arial, 'helvetica neue', helvetica, sans-serif;font-size:16px;font-style:normal;font-weight:bold;color:#203443">{{subtitle3}}</h3></td>
</tr>
<tr style="border-collapse:collapse">
<td align="center" height="27" style="padding:0;Margin:0"></td>
</tr>
<tr style="border-collapse:collapse">
<td align="center" style="padding:0;Margin:0"><h3 style="Margin:0;line-height:14px;mso-line-height-rule:exactly;font-family:arial, 'helvetica neue', helvetica, sans-serif;font-size:12px;font-style:normal;font-weight:bold;color:#ff5200">{{description3}}</h3></td>
</tr>
<tr style="border-collapse:collapse">
<td align="center" height="8" style="padding:0;Margin:0"></td>
</tr>
</table></td>
</tr>
</table><!--[if mso]></td></tr></table><![endif]--></td>
</tr>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
select * from Views.ConditionalEmailNotification where OrderCode = '{{Body.jsonMessage.OrderCode}}' and OrderScope = '{{Body.jsonMessage.OrderScope}}' and EmailBody = '"{{html_body}}"';
3 changes: 3 additions & 0 deletions examples/use-cases/notifications/HelperFiles/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
lusid-jam==0.1.2
lusid-notifications-sdk==2.1.35
lusidtools==1.0.14

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@keysToCatalog = values
('Order/FinbourneUniversity/ExpPct', 'ExpPct', False, 'A property representing the Exposure Percentage of an order');

@config = select column1 as [Key], column2 as Name, column3 as IsMain, column4 as Description from @keysToCatalog;

select * from Sys.Admin.Lusid.Provider.Configure
where Provider = 'Lusid.PortfolioOrder'
and Configuration = @config
;
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
@x =
use Sys.Admin.SetupView
--provider=Views.ConditionalEmailNotification
--parameters
EmailBody,Text,This is an email,true
OrderCode,Text,NotificationTestOrder1,true
OrderScope,Text,FinbourneUniversity,true
----

@@sep = select '--' || '--' as x;

@mapping_table = use Drive.Csv
--file=/TrainingFiles/MappingTable.csv
enduse;

@users = select
EmailAddress,
UserId,
FirstName,
LastName
from Sys.User.Role;

@raw_event_data = select
PortfolioScope,
PortfolioCode,
OrderScope,
OrderCode,
Quantity,
Side,
Type,
LimitPrice,
UserIdModified,
ClientInternal,
Isin,
ExpPct
from Lusid.PortfolioOrder
where OrderCode == #PARAMETERVALUE(OrderCode) and OrderScope == #PARAMETERVALUE(OrderScope)
;

@event_data = select
*
from @raw_event_data r_e_d
inner join @users u on u.UserId = r_e_d.UserIdModified
;

@@portfolio = select PortfolioCode from @raw_event_data;
@@email = select Email from @mapping_table where Portfolio == @@portfolio;
@@name = select Name from @mapping_table where Portfolio == @@portfolio;

@@email_to = select '--addressTo="[' || @@name || '](' || @@email || ')"';

@@email_body = select REPLACE(REPLACE(#PARAMETERVALUE(EmailBody),'""','"'),"''","'");

@resp =
use Email.Send with @@sep, @@email_to, @@portfolio, @@email_body
{@@email_to}
--subject="This is a subject"
{@@sep}

{@@email_body}

enduse;

select * from @resp where Ok = true;

enduse;

select * from @x
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
@x = use Sys.Admin.SetupView
--provider=Views.ManualEvent.Writer
--parameters
OrderCode,Text,NotificationTestOrder1,true
OrderScope,Text,FinbourneUniversity,true
----

@users = select
EmailAddress,
UserId,
FirstName,
LastName
from Sys.User.Role;

@raw_event_data = select
PortfolioScope,
PortfolioCode,
OrderScope,
OrderCode,
Quantity,
Side,
Type,
LimitPrice,
UserIdModified,
ClientInternal,
Isin,
ExpPct
from Lusid.PortfolioOrder
where OrderCode == #PARAMETERVALUE(OrderCode) and OrderScope == #PARAMETERVALUE(OrderScope)
;

@event_data = select
*
from @raw_event_data r_e_d
inner join @users u on u.UserId = r_e_d.UserIdModified
;

@@json_data = select
json_object(
'FirstName', FirstName,
'LastName', LastName,
'EmailAddress', EmailAddress,
'PortfolioScope', PortfolioScope,
'PortfolioCode', PortfolioCode,
'OrderScope', OrderScope,
'OrderCode', OrderCode,
'ClientInternal', ClientInternal,
'Isin', Isin,
'Quantity', Quantity,
'Side', Side,
'LimitPrice', LimitPrice,
'Type', Type,
'ExposurePercentage', ExpPct
) from @event_data;

@manual_event_data = select #SELECT_AGG{
{ JsonMessage: @@json_data },
{ Message: 'A placeholder event has been created to allow for additional information' },
{ Subject: 'AdditionalInfoEvent' },
{ EventTime: datetime('now') },
{ EventType: 'Manual' },
{ Id: 'ManualEventForNotificationTriggering' },
{ WriteError: 'Creation of the Manual Event has failed'},
};

select * from Notification.ManualEvent.Writer where toWrite = @manual_event_data;

enduse;
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
portfolio,instrument_name,client_internal,isin,figi,quantity,price,currency,allocation_id,originating_order,state,side,type
us_long,Amazon_Nasdaq_AMZN,imd_34634534,US0231351067,BBG000BVPXP1,777,102.7,USD,ALLOC001-for-ORD004,ORD004,partial allocation,buy,market
portfolio,instrument_name,client_internal,isin,figi,quantity,price,currency,allocation_id,originating_order,state,side,type
us_long,Amazon_Nasdaq_AMZN,imd_34634534,US0231351067,BBG000BVPXP1,777,102.7,USD,ALLOC001-for-ORD004,ORD004,partial allocation,Buy,market
14 changes: 7 additions & 7 deletions examples/use-cases/orders-management/data/live_orders.csv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
portfolio,instrument_name,client_internal,isin,figi,quantity,price,currency,order_id,side,type,state,limit_price,limit_currency,stop_price,stop_currency
us_long,Amazon_Nasdaq_AMZN,imd_34634534,US0231351067,BBG000BVPXP1,1000,100,USD,ORD001,sell,limit,new,100.50,USD
us_long,Amazon_Nasdaq_AMZN,imd_34634534,US0231351067,BBG000BVPXP1,1000,95,USD,ORD002,buy,limit,new,96.25,USD
us_long,Amazon_Nasdaq_AMZN,imd_34634534,US0231351067,BBG000BVPXP1,3000,,USD,ORD003,buy,stop,new,,,94,USD
us_long,Amazon_Nasdaq_AMZN,imd_34634534,US0231351067,BBG000BVPXP1,1000,,USD,ORD004,buy,market,new,,
us_long,Anglian_Water_40LV,imd_13579246,XS0089553282,,500,,USD,ORD005,buy,market,new,,
us_long,ICE_Silver_5000oz_Dec21,imd_12457801,,,5000,,USD,ORD006,buy,market,new,,
portfolio,instrument_name,client_internal,isin,figi,quantity,price,currency,order_id,side,type,state,limit_price,limit_currency,stop_price,stop_currency
us_long,Amazon_Nasdaq_AMZN,imd_34634534,US0231351067,BBG000BVPXP1,1000,100,USD,ORD001,Sell,limit,new,100.50,USD
us_long,Amazon_Nasdaq_AMZN,imd_34634534,US0231351067,BBG000BVPXP1,1000,95,USD,ORD002,Buy,limit,new,96.25,USD
us_long,Amazon_Nasdaq_AMZN,imd_34634534,US0231351067,BBG000BVPXP1,3000,,USD,ORD003,Buy,stop,new,,,94,USD
us_long,Amazon_Nasdaq_AMZN,imd_34634534,US0231351067,BBG000BVPXP1,1000,,USD,ORD004,Buy,market,new,,
us_long,Anglian_Water_40LV,imd_13579246,XS0089553282,,500,,USD,ORD005,Buy,market,new,,
us_long,ICE_Silver_5000oz_Dec21,imd_12457801,,,5000,,USD,ORD006,Buy,market,new,,