-
Notifications
You must be signed in to change notification settings - Fork 14
/
6-set-holdings.sql
52 lines (39 loc) · 1.1 KB
/
6-set-holdings.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
-----------
Set Holding
-----------
Description:
- In this query, we add new holdings to the portfolio
- The example assumes we have a holdings file in LUSID Drive
More details:
- https://support.lusid.com/knowledgebase/category/?id=CAT-01099
*/
-- Defining date of holding
@@file_date =
select strftime('20220301');
-- Defining scope and code variables
@@portfolioScope =
select 'luminesce-examples';
@@portfolioCode1 =
select 'UkEquity';
-- Loading in holdings data from Excel spreadsheet
@holdings_from_spreadsheet =
use Drive.Excel with @@file_date
--file=/luminesce-examples/equity_holdings_{@@file_date}.xlsx
--worksheet=lusid_holdings
--addFileName
enduse;
-- Create new table to store holding's data
@holding_data =
select
@@portfolioScope as PortfolioScope,
@@portfolioCode1 as PortfolioCode,
holding_date as EffectiveAt,
InstrumentId as ClientInternal,
currency as CostCurrency,
units as Units,
strategy as strategy,
'Set' as WriteAction
from @holdings_from_spreadsheet;
-- Write table to the portfolio
select * from Lusid.Portfolio.Holding.Writer where toWrite = @holding_data;