-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathsnowflake.forex_historical_real.view.lkml
245 lines (216 loc) · 5.52 KB
/
snowflake.forex_historical_real.view.lkml
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
view: sf_forex_historical_real {
derived_table: {
sql: SELECT
cast(forex.exchange_date as timestamp) AS forex_exchange_date,
forex.AUD_USD AS AUD_USD,
forex.CHF_JPY AS CHF_JPY,
forex.EUR_CHF AS EUR_CHF,
forex.EUR_GBP AS EUR_GBP,
forex.EUR_JPY AS EUR_JPY,
forex.EUR_USD AS EUR_USD,
forex.GBP_CHF AS GBP_CHF,
forex.GBP_JPY AS GBP_JPY,
forex.GBP_USD AS GBP_USD,
forex.NZD_USD AS NZD_USD,
forex.USD_CAD AS USD_CAD,
forex.USD_CHF AS USD_CHF,
forex.USD_JPY AS USD_JPY
FROM exchangerate.forex AS forex
UNION ALL
SELECT
cast(forex_real.exchange_date as timestamp) AS forex_exchange_date,
1/(forex_real.AUD*(1/forex_real.USD)) AS AUD_USD,
1/(forex_real.CHF*(1/forex_real.JPY)) AS CHF_JPY ,
forex_real.CHF AS EUR_CHF,
forex_real.GBP AS EUR_GBP,
forex_real.JPY AS EUR_JPY,
forex_real.USD AS EUR_USD,
forex_real.CHF*(1/forex_real.GBP) AS GBP_CHF,
forex_real.JPY*(1/forex_real.GBP) AS GBP_JPY,
forex_real.USD*(1/forex_real.GBP) AS GBP_USD,
1/(forex_real.NZD*(1/forex_real.USD)) AS NZD_USD,
forex_real.CAD *(1/forex_real.USD) AS USD_CAD,
forex_real.CHF *(1/forex_real.USD) AS USD_CHF,
forex_real.JPY *(1/forex_real.USD) AS USD_JPY
FROM exchangerate.forex_real AS forex_real
;;
datagroup_trigger: default
}
dimension_group: forex_exchange {
type: time
timeframes: [date, week, month, year]
sql: ${TABLE}.forex_exchange_date ;;
}
dimension: aud_usd {
label: "AUD/USD"
description: "1 Australian Dollar = X US Dollars"
value_format_name: decimal_4
type: number
sql: ${TABLE}.AUD_USD ;;
hidden: yes
}
dimension: chf_jpy {
label: "CHF/JPY"
description: "1 Swiss Franc = X Japanese Yen"
type: number
sql: ${TABLE}.CHF_JPY ;;
hidden: yes
}
dimension: eur_chf {
label: "EUR/CHF"
description: "1 Euro = X Swiss Francs"
type: number
sql: ${TABLE}.EUR_CHF ;;
hidden: yes
}
dimension: eur_gbp {
label: "EUR/GBP"
description: "1 Euro = X Great British Pounds"
type: number
sql: ${TABLE}.EUR_GBP ;;
hidden: yes
}
dimension: eur_jpy {
label: "EUR/JPY"
description: "1 Euro = X Japanese Yen"
type: number
sql: ${TABLE}.EUR_JPY ;;
hidden: yes
}
dimension: eur_usd {
label: "EUR/USD"
description: "1 Euro = X US Dollars"
type: number
sql: ${TABLE}.EUR_USD ;;
hidden: yes
}
dimension: gbp_chf {
label: "GBP/CHF"
description: "1 Great British Pound = X Swiss Francs"
type: number
sql: ${TABLE}.GBP_CHF ;;
hidden: yes
}
dimension: gbp_jpy {
label: "GBP/JPY"
description: "1 Great British Pound = X Japanese Yen"
type: number
sql: ${TABLE}.GBP_JPY ;;
hidden: yes
}
dimension: gbp_usd {
label: "GBP/USD"
description: "1 Great British Pound = X US dollars"
type: number
sql: ${TABLE}.GBP_USD ;;
hidden: yes
}
dimension: nzd_usd {
label: "NZD/USD"
description: "1 New Zealand Dollar = X US dollars"
type: number
sql: ${TABLE}.NZD_USD ;;
hidden: yes
}
dimension: usd_cad {
label: "USD/CAD"
description: "1 US dollar = X Canadian dollars"
type: number
sql: ${TABLE}.USD_CAD ;;
hidden: yes
}
dimension: usd_chf {
label: "USD/CHF"
description: "1 US dollar = X Swiss Francs"
type: number
sql: ${TABLE}.USD_CHF ;;
hidden: yes
}
dimension: usd_jpy {
label: "USD/JPY"
description: "1 US dollar = X Japanese Yen"
type: number
sql: ${TABLE}.USD_JPY ;;
hidden: yes
}
################################### measures to plot on graph ###################################
measure: audusd {
label: "AUD/USD"
description: "1 Australian Dollar = X US Dollars"
value_format_name: decimal_4
type: max
sql: ${aud_usd} ;;
}
measure: chfjpy {
label: "CHF/JPY"
description: "1 Swiss Franc = X Japanese Yen"
type: max
sql: ${chf_jpy};;
}
measure: eurchf {
label: "EUR/CHF"
description: "1 Euro = X Swiss Francs"
type: max
sql: ${eur_chf} ;;
}
measure: eurgbp {
label: "EUR/GBP"
description: "1 Euro = X Great British Pounds"
type: max
sql: ${eur_gbp} ;;
}
measure: eurjpy {
label: "EUR/JPY"
description: "1 Euro = X Japanese Yen"
type: max
sql: ${eur_jpy};;
}
measure: eurusd {
label: "EUR/USD"
description: "1 Euro = X US Dollars"
type: max
sql: ${eur_usd} ;;
}
measure: gbpchf {
label: "GBP/CHF"
description: "1 Great British Pound = X Swiss Francs"
type: max
sql: ${gbp_chf};;
}
measure: gbpjpy {
label: "GBP/JPY"
description: "1 Great British Pound = X Japanese Yen"
type: max
sql: ${gbp_jpy} ;;
}
measure: gbpusd {
label: "GBP/USD"
description: "1 Great British Pound = X US dollars"
type: max
sql: ${gbp_usd} ;;
}
measure: nzdusd {
label: "NZD/USD"
description: "1 New Zealand Dollar = X US dollars"
type: max
sql: ${nzd_usd};;
}
measure: usdcad {
label: "USD/CAD"
description: "1 US dollar = X Canadian dollars"
type: max
sql: ${usd_cad} ;;
}
measure: usdchf {
label: "USD/CHF"
description: "1 US dollar = X Swiss Francs"
type: number
sql: ${usd_chf} ;;
}
measure: usdjpy {
label: "USD/JPY"
description: "1 US dollar = X Japanese Yen"
type: max
sql: ${usd_jpy} ;;
}
}