使用汇率更新表数据:匹配货币并将qty与对应汇率相乘
KDB+ 按汇率更新表中数量字段
现有两个KDB+格式的表table1和table2,需实现以下逻辑:检查table1的currencyStr字段值是否存在于table2中,若存在,则将table1对应行的qty值乘以table2中匹配到的exchangeRate,完成qty字段的更新。
示例代码
table1:([] qty: 100 200 150 130 200 230 300; currencyStr: ("USD"; "EUR"; "GBP"; "JPY"; "AUD"; "USD"; "GBP")) table2:([] currencyStr: ("USD"; "EUR"; "GBP"; "AUD"; "JPY"); exchangeRate: (1.0; 0.85; 0.75; 0.95; 0.5))
更新后的qty字段结果
| qty |
|---|
| 100 |
| 170 |
| 112.5 |
| 65 |
| 190 |
| 225 |
| 300 |
内容的提问来源于stack exchange,提问作者Dhanuushri
相关产品推荐
相关产品推荐

