Skip to content

Instantly share code, notes, and snippets.

@AlessandraSozzi
Last active August 30, 2016 03:14
Show Gist options
  • Save AlessandraSozzi/68056df2d5bd393fc92a to your computer and use it in GitHub Desktop.
Save AlessandraSozzi/68056df2d5bd393fc92a to your computer and use it in GitHub Desktop.
Liability Instrument Asset Y2006 Y2007 Y2008 Y2009 Y2010 Y2011 Y2012 Y2013 Y2014
MFI Currency PC 0.58 0.63 0.53 0.54 0.57 0.57 0.49 0.55 0.55
MFI Currency RoW 1.35 1.4 1.37 1.25 1.3 1.31 1.38 1.43 1.51
MFI Currency unknown 47.03 47.99 50.44 56.88 58.8 62 65.33 67.45 71.01
CG Currency PC 0.06 0.07 0.06 0.06 0.06 0.06 0.05 0.06 0.06
CG Currency RoW 0.15 0.16 0.15 0.14 0.14 0.15 0.15 0.16 0.17
CG Currency unknown 3.58 3.63 3.74 3.8 3.87 3.9 4.06 4.08 4.26
RoW Currency PNFC 0.54 0.59 0.56 0.48 0.5 0.5 0.51 0.48 0.56
RoW Currency MFI 0.16 0.19 0.38 0.31 0.15 0.12 0.12 0.15 0.19
unknown Currency PNFC 3.28 3.49 3.76 4.09 4.26 4.48 4.72 4.94 5.22
unknown Currency MFI 9.82 8.38 7.63 12.41 10.12 10.64 11.18 10.72 11.19
unknown Currency OFI 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08 0.08
unknown Currency HH+NPISH 37.43 39.66 42.71 44.09 48.21 50.69 53.41 55.78 58.78
MFI Deposits PC 6 3.9 2.64 2.6 2.44 3.51 2.35 2.91 2.78
MFI Deposits PNFC 247.44 269.97 263.27 278.38 299.34 293.32 312.84 331.32 357.69
MFI Deposits MFI 1282.15 842.74 924.62 1142.17 938.49 1066.79 1150.13 1220.35 916.81
MFI Deposits OFI 483.91 606.41 881.85 909.54 982.69 900.31 860.85 810.83 697.45
MFI Deposits ICPF 67.58 84.35 82.09 89.74 79.3 82.41 82.78 95.37 94.66
MFI Deposits CG 7.84 10.19 29.94 37.35 20.09 22.02 25.07 20.23 18.11
MFI Deposits LG 26.88 31.2 28.91 22.01 22.99 21.6 26.15 25.78 25.95
MFI Deposits HH+NPISH 836.01 903.47 951 971.48 998.71 1024.83 1082.29 1123.66 1169.34
MFI Deposits RoW 2370.68 3143.43 3597.19 2926.3 3018.63 3224.53 2976.96 2688.03 2678.2
CG Deposits PC 2.42 2.47 2.29 2.37 1.72 2.37 2.47 2.14 1.82
CG Deposits PNFC 5.45 5.51 5.46 5.11 4.03 3.32 2.89 2.86 3.3
CG Deposits MFI 0.04 0.03 0.03 0.03 0.03 0.03 0.03 0.03 0.03
CG Deposits OFI 1.46 3.73 11.5 16.88 10.55 15.11 14.52 6.94 17.41
CG Deposits CG 0 0 0 0 5.17 4.1 4.83 3.15 2.66
CG Deposits LG 0.01 0.06 1.86 3.09 0.91 2.04 2.04 1.23 0.96
CG Deposits HH+NPISH 79 84.83 96.79 98.47 101.1 104.75 103.09 106.36 113.01
CG Deposits RoW 1.41 1.11 0.83 1.03 1.32 1.89 1.37 0.53 1.3
RoW Deposits PNFC 102.72 113.99 138.14 132.85 138.21 136.81 152.55 159.7 144.78
RoW Deposits MFI 1285.97 1714.13 2092.65 1779.28 1876.26 2072.01 1860.65 1585.83 1620.52
RoW Deposits OFI 698.96 768.19 630.34 518.62 623.23 668.89 604.27 659.54 680.74
RoW Deposits ICPF 37.36 39.23 49.85 36.75 42.35 49.84 50.36 53.38 52.61
RoW Deposits CG 1.19 1.02 4.6 4.9 5.95 7.99 7.99 7.48 7.05
RoW Deposits LG 0.72 1.01 1.22 0.39 0.43 0.48 0.37 0.51 0.99
RoW Deposits HH+NPISH 63.32 69.43 78.43 59.3 62.41 67.84 67.25 71.29 71.97
PNFC Short term debt securities PNFC 0.36 1 0.4 0 0.02 0.08 0 0.51 0.49
PNFC Short term debt securities MFI 3.23 0.98 0.31 0.04 0 0 0.03 0.12 0.11
PNFC Short term debt securities OFI 0.06 0.05 0.03 0.1 0.59 0.11 0.15 0.65 0.49
PNFC Short term debt securities CG 1.22 0.08 0.08 0.96 2.31 5.64 2.24 3.7 2.56
PNFC Short term debt securities RoW 13.19 17.39 27.95 20.44 24.16 27.74 24.77 25.35 27.35
PNFC Short term debt securities unknown 1.88 2.43 2.36 0.99 0.64 1.93 1.05 0.21 0.68
MFI Short term debt securities PC 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39 0.39
MFI Short term debt securities PNFC 6.57 9.38 11.63 11.12 10.02 7.24 7.4 7.78 9.05
MFI Short term debt securities MFI 98.4 88.72 72.5 31.96 20.97 14.15 8.88 9.68 5.24
MFI Short term debt securities OFI 22.91 28.7 38 29.12 24.76 17.68 25.67 25.33 34.68
MFI Short term debt securities ICPF 29.12 30.65 25.43 12.45 11.65 13.5 9.06 8.01 8.94
MFI Short term debt securities CG 2.7 0.76 2.55 0.41 0.01 0.01 0.01 0.01 0.01
MFI Short term debt securities LG 2.52 1.56 1.34 1.16 0.99 0.68 0.67 0.75 1.6
MFI Short term debt securities HH+NPISH 3.13 4.61 6.18 5.65 4.61 3.1 4.62 4.23 5.93
MFI Short term debt securities RoW 161.95 183.7 202.31 267.81 204.95 124.08 128.66 117.46 130.45
OFI Short term debt securities PC 0.64 0.34 0.21 0.14 0.14 0.15 0.1 0.1 0.1
OFI Short term debt securities PNFC 3.81 2.92 6.93 5.71 7.52 7.66 7.66 7.51 4.82
OFI Short term debt securities MFI 0.17 0.05 0.02 0 0 0 0 0.01 0.01
OFI Short term debt securities OFI 0 0 0 0 0.01 0 0 0.02 0.01
OFI Short term debt securities LG 0.09 0.11 0.15 0.06 0.06 0.1 0.08 0.03 0.04
OFI Short term debt securities HH+NPISH 0.49 0.41 0.34 0 0.07 0.07 0.13 0.26 0.45
OFI Short term debt securities RoW 0.5 0.72 1.21 0.84 1.03 1.22 1.07 1.11 1.2
OFI Short term debt securities unknown 7.32 8.07 3.85 3.42 1.63 2.16 2.67 3.14 6.79
CG Short term debt securities PC 0 0.4 0.4 0.32 0.33 0.35 0.31 0.27 0.27
CG Short term debt securities PNFC 0.29 0.05 0.17 0.01 0.02 0.03 0.45 0.71 0.74
CG Short term debt securities MFI 12.35 5.58 3.07 22.82 10.73 13.68 8.41 4.95 6.68
CG Short term debt securities OFI 3.02 4.13 5.71 11.58 14.26 21.86 16.42 11.7 20.7
CG Short term debt securities ICPF 0.86 0.71 1.05 3.16 1.18 1.6 1.73 2.56 4.78
CG Short term debt securities LG 0.1 0.05 0.07 0.15 0.94 0.51 1.3 1.53 2.27
CG Short term debt securities HH+NPISH 0.04 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01
CG Short term debt securities RoW 4.4 7.38 21 19.41 27.91 31.79 22.49 15.08 27.18
HH+NPISH Short term debt securities LG 0.76 1.17 1.28 0.43 0.46 0.53 0.45 0.76 1.3
RoW Short term debt securities PNFC 16.21 6.39 1.33 2.95 4.84 6.69 2.05 1.1 2.94
RoW Short term debt securities MFI 42.78 53.83 57.12 65.4 65.45 57.48 59.76 48.58 43.79
RoW Short term debt securities OFI 10.51 7.56 4.58 7.3 7.85 13.56 12.41 8.73 8.23
RoW Short term debt securities ICPF 2.97 3.12 3.82 3.97 2.97 4.66 3.42 4.14 5.49
RoW Short term debt securities CG 3.05 5.47 5.31 5.6 6.09 6.39 5.33 2.86 3.16
unknown Short term debt securities PC 1.26 1.4 0.66 0.03 0.03 0.03 0.03 0.03 0.03
unknown Short term debt securities OFI 1.47 2.18 0.18 0.16 0.09 1.09 0.68 0.7 3.46
unknown Short term debt securities ICPF 3.42 5.82 4.4 3.99 1.97 2.08 2.11 1.42 2.11
unknown Short term debt securities RoW 1.71 0.83 0.77 0.22 0.18 0.5 0.56 0.79 0.52
PC Long term debt securities MFI 0.07 0.09 0.06 0.1 0.04 0.02 0.05 0.01 0.07
PC Long term debt securities OFI 0.25 1.06 2.16 11.76 6.2 8.24 10.6 20.68 20.67
PC Long term debt securities ICPF 0.81 0.67 0.93 1.68 3.12 3.5 3.17 4.45 4.98
PC Long term debt securities CG 0.25 0.23 0.2 0 0 0 0 0 0
PC Long term debt securities unknown 5.17 5.13 4.06 3.75 3.75 3.75 0 0 0
PNFC Long term debt securities RoW 16.44 14.25 20.44 22.69 25.57 28.33 23.74 28.11 30.24
PNFC Long term debt securities unknown 204.14 209.72 199.98 245.79 239.16 257.96 294.75 298.03 279.69
MFI Long term debt securities PNFC 1.95 2.53 3.6 4.78 4.61 2.82 1.47 1.62 1.15
MFI Long term debt securities MFI 29.22 30 47.1 55.8 58.65 37.06 23.29 20.35 18.91
MFI Long term debt securities OFI 16.62 23.19 28.28 31.15 30.36 26.98 20.33 17.3 16.06
MFI Long term debt securities ICPF 47.93 67.48 82.55 90.98 88.44 78.11 58 48.72 44.81
MFI Long term debt securities CG 0 0 5 0 0 0 0 0 0
MFI Long term debt securities unknown 359.73 458.17 554.13 611.22 650.54 698.45 678.21 580.55 608
OFI Long term debt securities RoW 11.45 6.62 1.64 3.82 2.99 4.83 7.97 10.51 13.59
OFI Long term debt securities unknown 468.88 588 750.79 877.74 823.18 838.14 821.18 784.08 910.23
ICPF Long term debt securities RoW 0.77 1.66 1.98 0.62 0.43 0.9 1.11 1.23 3
ICPF Long term debt securities unknown 17.27 18.83 20.81 25.49 23.69 23.16 24.55 22.03 26.2
CG Long term debt securities PC 0.5 0.71 1.2 1.3 1.3 1.25 0.5 0.5 0.5
CG Long term debt securities PNFC 0.23 0.6 0.86 1.33 2.11 2.32 2.47 2.24 2.77
CG Long term debt securities MFI 4.21 1.38 30.74 234.45 295.31 401.32 499.63 508.51 562.86
CG Long term debt securities OFI 43.85 59.69 114.68 55.61 64.8 54.33 23.15 32.77 124.13
CG Long term debt securities ICPF 244.42 243.87 241.43 253.37 289.02 357.8 371.49 385.05 476.04
CG Long term debt securities LG 0.25 0.12 0.17 0.2 0.22 0.43 0.39 1.66 1.13
CG Long term debt securities HH+NPISH 38.93 38.86 38.48 40.44 46.27 57.28 59.29 61.42 76.01
CG Long term debt securities RoW 145.08 171.02 217.75 235.33 375.09 446.78 470.47 456.39 441.34
LG Long term debt securities OFI 0.02 0.02 0.01 0 0 0 0 0 0
LG Long term debt securities ICPF 0.49 0.31 0.23 0.55 0.6 1.45 2.57 2.8 2.65
LG Long term debt securities HH+NPISH 0.68 0.86 0.86 0.48 0.41 0.16 0.31 0.86 1.52
HH+NPISH Long term debt securities unknown 0.64 0.61 0.56 0.87 0.85 0.87 0.93 0.91 0.93
RoW Long term debt securities PC 0 0.01 0.01 0.1 0.14 0.14 0.14 0.15 0.14
RoW Long term debt securities PNFC 12.08 11.03 15.98 17.86 22.8 27.55 26.57 16.08 36.18
RoW Long term debt securities MFI 479.08 555.63 568.47 504.01 488.98 474.72 460.97 402 416.54
RoW Long term debt securities OFI 71.48 53.05 172.15 291.48 372.6 413.84 476.77 540.87 583.6
RoW Long term debt securities ICPF 166.26 197.85 223.59 250.14 267.76 280.33 308.38 307.05 317.21
RoW Long term debt securities CG 15.27 18.23 24.43 21.12 36.73 40.3 43.92 39.96 45.32
RoW Long term debt securities HH+NPISH 7.53 7.6 8.45 8.16 8.32 8.38 8.17 7.97 7.9
unknown Long term debt securities PNFC 1.58 5.2 7.43 3.54 4.7 8.58 9.83 13.11 31.02
unknown Long term debt securities MFI 181.12 200.49 221.28 311.5 315.98 296.82 287.96 311.6 287.18
unknown Long term debt securities OFI 68.47 110.72 193.31 238.28 266.31 292.64 300.7 264.18 281.01
unknown Long term debt securities ICPF 174.1 158.56 140.63 160.94 153.91 170.5 209.78 205.99 234.43
unknown Long term debt securities CG 0 0 0 0 0 0 1.16 0.83 0.83
unknown Long term debt securities LG 0.22 0.22 0.22 0.22 0.22 0.22 0.22 0.22 0.22
unknown Long term debt securities HH+NPISH 5.25 5.44 5.62 5.84 6.05 6.22 6.4 6.58 6.77
unknown Long term debt securities RoW 625.1 799.83 961.87 1044.55 993.98 1047.35 1003.58 883.11 983.58
PC Loans PC 1.2 1.4 0.8 0.8 0.8 0.8 0.8 0.8 0.8
PC Loans PNFC 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1
PC Loans CG 3.9 6.4 6.4 0.1 0.1 0.1 0.1 0.1 0.1
PC Loans LG 0.5 0.4 0.4 0.4 0.5 0.4 0.4 0.4 0.5
PC Loans HH+NPISH 0 0 0 0 0 0 0 0 0
PC Loans RoW 1.5 1.3 1.4 1.2 1.1 1.1 1 1 0.9
PNFC Loans PC 2.7 3.6 3.5 3.5 1.8 1 0.8 0.8 0.7
PNFC Loans OFI 43.5 46.8 74.7 62.7 118.5 85 65.3 51.7 47.8
PNFC Loans CG 4 4.4 4.5 4.5 4.7 4.7 4.7 4.7 4.7
PNFC Loans LG 0.1 0.1 0.1 0.3 0.6 0.6 0.6 0.6 0.7
PNFC Loans HH+NPISH 0.6 0.5 0.4 0.3 0 0 0 0 0.1
PNFC Loans RoW 201.4 246.7 349.4 243.2 242.9 220.2 242.3 272.5 276.9
MFI Loans PC 0.7 0.8 0.7 0.6 0.5 0.6 0.4 0.2 0.2
MFI Loans PNFC 425.8 510 575.6 522.5 481.2 452.3 427.6 406 390
MFI Loans OFI 629.9 864.6 1087 919.4 869.8 784.8 811.2 752.9 628.1
MFI Loans ICPF 12.9 13.3 7.6 5.7 3.7 5.6 9.2 17.1 15.7
MFI Loans CG 25 24.5 31.3 6.2 3.9 4.9 3.1 4.4 3.5
MFI Loans LG 9.1 10.3 10.9 11 11.7 11.8 11.2 10.7 10.6
MFI Loans HH+NPISH 954.6 990.5 952 1061.5 1180.3 1178.4 1186.2 1192.2 1224.8
MFI Loans RoW 712.4 959.1 1132.1 907.6 975.8 1005.9 927.4 898.8 935
OFI Loans PNFC 44.6 53.3 55.8 60.6 58.2 72.5 63.5 44.7 47.6
OFI Loans OFI 2.9 3.2 3.4 3.4 3.6 3.5 3.6 3.6 3.7
OFI Loans LG 0.6 0.7 0.5 0.5 0.2 0.1 0 0.2 0.2
OFI Loans HH+NPISH 292 364.7 438.6 326.1 119.8 125 132.6 140.9 151.9
OFI Loans RoW 17.9 20.2 21.9 15.9 18.3 16.7 43.1 54 11.6
ICPF Loans PNFC 56.1 61.2 45.5 46.2 56.9 66.1 67.8 77.1 79.1
ICPF Loans OFI 20.7 16.8 11.5 11.4 43.6 49.6 56.2 71.1 71.4
ICPF Loans LG 1.4 0.9 0.9 0.3 0.6 0.2 0.3 2.4 4
ICPF Loans HH+NPISH 22.9 23.1 28.9 21.7 20.4 22.3 24.8 28.4 25.5
ICPF Loans RoW 5.3 3.4 6 6.9 6.6 6.6 27.5 26.7 9.9
CG Loans PC 2.1 2 2.2 1.9 1.3 1.3 1.3 1.3 1.4
CG Loans PNFC 6.1 5.7 5.2 5 4.9 4.6 4.8 5.5 6.6
CG Loans LG 47.3 48.6 52 50.5 53.7 54.9 63.8 64.2 64.8
CG Loans HH+NPISH 20.1 24.9 28.2 33.6 125.4 120.6 121.3 119.7 120.7
CG Loans RoW 0.1 0.1 0.1 0 0 0.5 2.2 3.3 3.2
LG Loans PC 0.7 1.2 1.6 2.2 2.6 3.3 3.8 4.1 4.4
LG Loans PNFC 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1
LG Loans CG 0 0 0 0 0 0 0.2 0.4 0.1
LG Loans HH+NPISH 1.6 2.1 3.2 4.4 4.8 5.4 7.3 7.7 8.7
HH+NPISH Loans PNFC 2.3 2.3 2.3 2.3 2.3 2.3 2.3 2.3 2.3
HH+NPISH Loans OFI 2.1 4.7 13.1 13.2 13.3 13.2 13.3 13.5 13.6
HH+NPISH Loans ICPF 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5
HH+NPISH Loans LG 0.1 0.1 0.1 0 0 0 0 0.1 0
HH+NPISH Loans HH+NPISH 2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4 2.4
RoW Loans PC 0.7 0.5 0.6 0.9 1.1 1.1 1.1 1.1 1.1
RoW Loans PNFC 412.6 387.7 524.8 459.6 462.1 451.4 538 478.6 463.4
RoW Loans OFI 577.3 585.5 510.9 474.5 677.2 767.9 895.5 974.5 972.6
RoW Loans ICPF 32.2 32.4 37.2 33.5 31.5 37.7 56.5 55.1 41.4
RoW Loans CG 2.6 2.5 3.5 1.7 1.5 1.1 1.5 0.3 1.3
RoW Loans LG 2.1 2.1 2.4 3 3.2 3.6 5.1 5.4 5.9
RoW Loans HH+NPISH 15.4 16.4 21.6 22.6 22.5 31.2 33.3 32.6 30.9
PC Equity and investment fund shares PNFC 0.2 0.2 0.2 0.2 0.2 0.2 0 0 0
PC Equity and investment fund shares CG 10.7 8.6 9.9 4.5 3.4 3.2 3.3 3.2 3.3
PC Equity and investment fund shares LG 111.6 112.1 114.2 114.6 116.9 118.4 120.5 121.5 123.9
PNFC Equity and investment fund shares PNFC 60.8 62.8 42 55.4 62.9 57.8 57.9 65.7 61.6
PNFC Equity and investment fund shares MFI 0.2 0.2 0 0 0 0 0 0 0
PNFC Equity and investment fund shares CG 0.3 0.3 0.3 0.3 0.3 0.3 0.3 1.3 1.3
PNFC Equity and investment fund shares HH+NPISH 14.4 14.4 38.4 1.4 1.4 1.4 1.4 1.7 1.7
PNFC Equity and investment fund shares RoW 291.8 344.7 378.1 355 395.3 408.3 514.5 503.1 694.9
PNFC Equity and investment fund shares unknown 1558.1 1611.3 1077.7 1421.7 1612.5 1482.7 1486.1 1635 1527.8
MFI Equity and investment fund shares MFI 0.1 1.7 3.5 7.7 3.3 1 0.8 1.1 1.8
MFI Equity and investment fund shares OFI 73 75.9 83.7 86.6 89.4 94.3 94.6 102 105.8
MFI Equity and investment fund shares CG 0 0 4 7.7 15.5 23.5 35 7 8.4
MFI Equity and investment fund shares HH+NPISH 24.3 25.3 27.9 28.9 29.8 31.4 31.5 34 35.3
MFI Equity and investment fund shares RoW 30.6 33 36.3 39.7 39.5 61.5 67 79.5 85.7
MFI Equity and investment fund shares unknown 13.6 6.7 3.4 7.6 3.2 0.9 0.8 1.1 1.8
OFI Equity and investment fund shares PNFC 0.6 0.6 0.3 0.4 0.5 0.4 0.5 0.6 0.6
OFI Equity and investment fund shares MFI 5.6 3.9 1.2 1.5 1.8 1.5 1.4 1.7 1.9
OFI Equity and investment fund shares OFI 29.8 36.5 30.1 39.2 46.7 49.8 63.1 82.8 82
OFI Equity and investment fund shares ICPF 274.6 326.1 292.2 397.8 478.2 489.9 578.5 613.1 620.3
OFI Equity and investment fund shares CG 0 0 14 43.2 56.3 28.1 45.3 51.7 51.9
OFI Equity and investment fund shares HH+NPISH 260.3 245.7 208.5 298 342.9 308.3 259.2 291 355
OFI Equity and investment fund shares RoW 115.6 134.8 162.5 205.5 207.6 213.6 239.7 242 229
OFI Equity and investment fund shares unknown 454.2 407.9 219.4 344.2 369.5 273.7 314.6 362.3 358.3
ICPF Equity and investment fund shares CG 0 0 0 0 0 0 2.7 1.3 1.3
ICPF Equity and investment fund shares RoW 18.4 13.4 17.6 14.6 16.7 15.3 16.2 22.3 41.1
ICPF Equity and investment fund shares unknown 73.1 67.3 39.6 43.9 47.9 40.2 51.6 68.4 82.1
RoW Equity and investment fund shares PC 0.5 0.5 0.3 0.4 0.6 0.6 1.2 1.3 1.4
RoW Equity and investment fund shares PNFC 604.8 656.7 782.3 693.7 749.7 785.8 769.6 678.6 635.5
RoW Equity and investment fund shares MFI 156.3 177.5 100.7 117.8 130.5 130.7 161.2 169.1 176.6
RoW Equity and investment fund shares OFI 229.7 295 286.9 342 411.6 398.3 440.7 503.4 498.6
RoW Equity and investment fund shares ICPF 451.1 484.4 419.9 498.2 564 535.1 610.1 640.9 650.8
RoW Equity and investment fund shares CG 2.8 3.1 3.3 3.5 3.6 3.9 4.1 5.5 5.8
RoW Equity and investment fund shares HH+NPISH 51.1 59.6 57.5 54.4 52.8 47.7 49.4 53.4 53.2
unknown Equity and investment fund shares PC 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3 0.3
unknown Equity and investment fund shares PNFC 32.9 35.1 51.7 61.8 48.1 43.5 44.2 44.8 41.9
unknown Equity and investment fund shares MFI 171.8 148.5 132.5 127.8 154.1 159.3 171.1 172.2 115.8
unknown Equity and investment fund shares OFI 393 378.7 248.1 386.7 497.1 482.2 521.1 592.5 573.7
unknown Equity and investment fund shares ICPF 496.5 479.3 300.5 291.8 244.9 189.7 171.3 158.6 134.2
unknown Equity and investment fund shares CG 0.7 0.8 0.5 0.5 0.5 0.5 0.5 0.5 0.5
unknown Equity and investment fund shares LG 1 0.9 0.3 0.5 0.8 1.2 1.3 2.6 3.5
unknown Equity and investment fund shares HH+NPISH 266.6 271.9 72.3 188.4 231 171.2 160.5 195.9 215.2
unknown Equity and investment fund shares RoW 736 777.6 527 744.5 850.1 747.7 781.2 897.2 881.3
PNFC Insurance, pension and standardised guarantee schemes ICPF 385.4 426.9 538.7 458.9 444.3 697.4 693.8 501.6 655.7
MFI Insurance, pension and standardised guarantee schemes ICPF 20.5 23.7 26 21.7 29.3 45 41.1 28.7 37.5
OFI Insurance, pension and standardised guarantee schemes ICPF 14.3 16.5 18.1 15.2 19.6 23.2 21.3 16.6 22.6
ICPF Insurance, pension and standardised guarantee schemes PNFC 16.4 12.9 13.2 11 7.2 4.7 4.2 4 4
ICPF Insurance, pension and standardised guarantee schemes MFI 0.5 0.4 0.4 0.3 0.2 0.1 0.1 0.1 0.1
ICPF Insurance, pension and standardised guarantee schemes OFI 0.4 0.3 0.3 0.2 0.2 0.1 0.1 0.1 0.1
ICPF Insurance, pension and standardised guarantee schemes ICPF 7.1 7.8 9.1 7.7 7.6 12.5 11.4 8.5 10.3
ICPF Insurance, pension and standardised guarantee schemes LG 0.8 0.9 0.9 0.7 0.7 0.7 0.7 0.7 0.7
ICPF Insurance, pension and standardised guarantee schemes HH+NPISH 2401.8 2478.3 2373.3 2442.1 2595.8 3000 3131.8 2999.2 3510.2
ICPF Insurance, pension and standardised guarantee schemes RoW 26.1 21.7 16.8 13.8 12.9 12.3 15.4 15.1 15
LG Insurance, pension and standardised guarantee schemes ICPF 74.1 68.6 100.9 92 74.2 85 73.4 63.3 56.9
HH+NPISH Insurance, pension and standardised guarantee schemes ICPF 22.8 24.5 31.3 27.4 27.6 54 45.3 32.8 42.8
PC Financial derivatives MFI 0 0.1 0.8 0.2 0.1 0.3 0.2 0.2 0.1
PNFC Financial derivatives MFI 22.2 20.8 50.7 32.7 34.6 45.5 39.9 32.9 39.8
PNFC Financial derivatives OFI 0 0 0 0 1.1 2.1 2.4 3 6.4
MFI Financial derivatives PC 0.1 1.6 0.6 0.3 0.2 0.2 0.2 0.3 0.3
MFI Financial derivatives PNFC 18.9 15.4 45.1 24.3 24.6 28.8 27.7 24 25.9
MFI Financial derivatives MFI 363 511.6 1625.6 734.6 682.1 953.8 784.5 537.6 641.7
MFI Financial derivatives OFI 200.5 387.9 1782.9 1072.1 1210.8 1547.6 1327.4 1098.3 1085.2
MFI Financial derivatives ICPF 25 48.8 148.5 96.6 89.6 129.5 117.3 118.3 134.6
MFI Financial derivatives CG 1.7 6.1 5.1 3.5 2.9 2.1 2.3 2.3 3.6
MFI Financial derivatives HH+NPISH 0.6 1.3 2.5 2.6 2.7 4.4 0.4 3.6 1.7
MFI Financial derivatives RoW 890.5 1392.2 3915.3 2096.8 2194.2 2723 2382.3 1595.2 1883.1
OFI Financial derivatives PNFC 0 0 0 0 0.6 0.9 0.9 1.6 4.1
OFI Financial derivatives MFI 214.8 405.4 1767.2 1038.4 1181.7 1519.7 1313.1 1084.7 1061.2
OFI Financial derivatives OFI 0 0 0 0 110.2 111.2 89.1 50.1 112.9
OFI Financial derivatives ICPF 0 0 0 0 5.5 11.6 9 7.9 11.8
OFI Financial derivatives CG 0 0 0 0 1.9 2.3 1.7 0.7 0.2
OFI Financial derivatives RoW 0 0 0 0 700.8 831.9 649.9 781.6 923.4
ICPF Financial derivatives MFI 26.8 51 147.2 93.6 87.5 127.2 116.1 116.8 131.6
ICPF Financial derivatives OFI 0 0 0 0 4.5 8.5 8.7 7.9 11.9
CG Financial derivatives MFI 1.5 3.1 5.6 1.8 2.7 2 1.4 1 2.9
CG Financial derivatives OFI 0 0 0 0 1.9 2.2 1.6 0.6 0.2
HH+NPISH Financial derivatives MFI 0.7 1.2 3.4 3.5 3.1 5.5 1.8 4.2 2.8
RoW Financial derivatives MFI 853.7 1378.1 4040.2 2176.4 2252.1 2759.9 2394.5 1629.4 1900.3
RoW Financial derivatives OFI 0 0 0 0 710.7 857.9 665.6 795 928.3
RoW Financial derivatives CG 0 0.1 0 0 0.1 0 0.1 0 0.1
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Sankey Diagram</title>
<style>
body {
font-family:"Calibri";
}
#selector {
width: 150px;
text-align: center;
font-family:"Calibri";
font-size: 16px;
}
#item {
font-family:"Calibri";
}
/* #chart {
display: block;
margin-left: auto;
margin-right: auto;
width: 960px;
height: 600px;
} */
.row {
width: 100%;
margin: 0 auto;
}
#Legend {
margin-top: 0px;
display: inline-block;
width: 20%;
height: 100%;
vertical-align: top;
font-family:"Calibri";
font-size: 12px;
}
#chart {
margin-top: 0px;
display: inline-block;
width: 75%;
height: 100%;
}
.node rect {
fill-opacity: .9;
shape-rendering: crispEdges;
}
.link {
fill: none;
stroke-opacity: .1;
}
/* .link:hover {
stroke-opacity: .7;
}*/
text {
font-family:"Calibri";
font-size: 12px;
}
title {
text-align: center;
}
</style>
</head>
<body>
<div class ="description">
<h2> YEAR 2014 </h2>
</div>
<br>
<div class= "row">
<div id="Legend">
<div class = "description">
<br>
<p style = "font-size: 16px;"> asset/liability Legend: </p>
<table style = "border-spacing: 5px;">
<tr>
<td style = "background-color: #A6CEE3; text-align: center;">PC</td>
<td>Public Corporation</td>
</tr>
<tr>
<td style = "background-color: #99CCFF; text-align: center;">PNFC</td>
<td>Private Non-Financial Corporation</td>
</tr>
<tr>
<td style = "background-color: #B2DF8A; text-align: center;">MFI</td>
<td>Monetary Financial Institutions</td>
</tr>
<tr>
<td style = "background-color: #33A02C; text-align: center;">OFI</td>
<td>Other Financial Intermediaries and Financial Auxiliaries</td>
</tr>
<tr>
<td style = "background-color: #FB9A99; text-align: center;">ICPF</td>
<td>Insurance Corporations and Pension Funds</td>
</tr>
<tr>
<td style = "background-color: #E31A1C; text-align: center;">CG</td>
<td>Central Government</td>
</tr>
<tr>
<td style = "background-color: #FFFF00; text-align: center;">LG</td>
<td>Local Government</td>
</tr>
<tr>
<td style = "background-color: #FF7F00; text-align: center;">HH+NPISH</td>
<td>Households and Non-Profit Institutions Serving Households</td>
</tr>
<tr>
<td style = "background-color: #CAB2D6; text-align: center;">RoW</td>
<td>Rest of the World</td>
</tr>
<tr>
<td style = "background-color: #6A3D9A; text-align: center;">unknown</td>
<td>unknown</td>
</tr>
</table>
</div>
</div>
<div id="chart"></div>
</div>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src='http://timelyportfolio.github.io/rCharts_d3_sankey/js/sankey.js' type='text/javascript'></script>
<script>
var margin = {top: 10, right: 10, bottom: 10, left: 10};
var width = 1000 - margin.left - margin.right;
var height = 600 - margin.top - margin.bottom;
var colors = d3.scale.ordinal()
.domain(["PC", "PNFC", "MFI", "OFI", "ICPF", "CG", "LG", "HH+NPISH", "RoW", "unknown", "Currency", "Deposits", "Short term debt securities", "Long term debt securities", "Loans", "Equity and investment fund shares", "Insurance, pension and standardised guarantee schemes", "Financial derivatives"])
.range(["#A6CEE3", "#99CCFF", "#B2DF8A", "#33A02C", "#FB9A99", "#E31A1C", "#FFFF00", "#FF7F00", "#CAB2D6", "#6A3D9A", "#D0DCF0", "#D0DCF0", "#D0DCF0", "#D0DCF0", "#D0DCF0", "#D0DCF0", "#D0DCF0", "#D0DCF0", "#D0DCF0"]);
var legend = d3.scale.ordinal()
.domain(["PC", "PNFC", "MFI", "OFI", "ICPF", "CG", "LG", "HH+NPISH", "RoW", "unknown"])
.range(["Public Corporation", "Private Non-Financial Corporation", "Monetary Financial Institutions", "Other Financial Intermediaries and Financial Auxiliaries", "Insurance Corporations and Pension Funds", "Central Government", "Local Government", "Households and None-Profit Institutions Serving Households", "Rest of the World", "unknown"])
var formatNumber = d3.format("0,.0f"), // zero decimal places
format = function(d) { return formatNumber(d) + " £ million"; };
var svg = d3.select("#chart")
.append("svg")
.attr({
"width": width + margin.left + margin.right,
"height": height + margin.top + margin.bottom
})
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
// Load the data
d3.csv("A_D3_v2.csv", function(error, csvData) {
csvData.forEach(function(d) {
d.Y2006 = parseFloat(d.Y2006);
d.Y2007 = parseFloat(d.Y2007);
d.Y2008 = parseFloat(d.Y2008);
d.Y2009 = parseFloat(d.Y2009);
d.Y2010 = parseFloat(d.Y2010);
d.Y2011 = parseFloat(d.Y2011);
d.Y2012 = parseFloat(d.Y2012);
d.Y2013 = parseFloat(d.Y2013);
d.Y2014 = parseFloat(d.Y2014);
});
// Liabilities subtotals
var liabilitySubTotals = d3.nest()
.key(function(d) { return d.Liability; })
.key(function(d) { return d.Instrument; })
.rollup(function(values) { return { "Y2006": d3.sum(values, function (d) {return d.Y2006;}),
"Y2007": d3.sum(values, function (d) {return d.Y2007;}),
"Y2008": d3.sum(values, function (d) {return d.Y2008;}),
"Y2009": d3.sum(values, function (d) {return d.Y2009;}),
"Y2010": d3.sum(values, function (d) {return d.Y2010;}),
"Y2011": d3.sum(values, function (d) {return d.Y2011;}),
"Y2012": d3.sum(values, function (d) {return d.Y2012;}),
"Y2013": d3.sum(values, function (d) {return d.Y2013;}),
"Y2014": d3.sum(values, function (d) {return d.Y2014;})} })
.entries(csvData);
// console.log(liabilitySubTotals);
var links = [],
nodes = [];
liabilitySubTotals.forEach(function (d) {
d.values.forEach(function (item) {
nodes.push({ "name": d.key + " liability"});
links.push({ "source": d.key + " liability", "target": item.key, "Y2006": item.values.Y2006, "Y2007": item.values.Y2007, "Y2008": item.values.Y2008, "Y2009": item.values.Y2009, "Y2010": item.values.Y2010, "Y2011": item.values.Y2011, "Y2012": item.values.Y2012, "Y2013": item.values.Y2013, "Y2014": item.values.Y2014, "liability": d.key + " liability", "instrument": item.key, "color": d.key});
})
});
// console.log(links);
//get all source and target into nodes
//will reduce to unique in the next step
//also get links in object form
csvData.forEach(function (d) {
nodes.push({ "name": d.Instrument });
nodes.push({ "name": d.Asset + " asset"});
links.push({ "source": d.Instrument, "target": d.Asset + " asset", "Y2006": d.Y2006, "Y2007": d.Y2007, "Y2008": d.Y2008, "Y2009": d.Y2009, "Y2010": d.Y2010, "Y2011": d.Y2011, "Y2012": d.Y2012, "Y2013": d.Y2013, "Y2014": d.Y2014, "liability": d.Liability + " liability", "instrument": d.Instrument, "color": d.Liability});
});
// Reduce to unique set of nodes
nodes = d3.keys(d3.nest()
.key(function (d) { return d.name; })
.map(nodes));
// console.log(nodes);
// Substitute source and target with node id
links.forEach(function (d) {
d.source = nodes.indexOf(d.source);
d.target = nodes.indexOf(d.target);
d.liability = nodes.indexOf(d.liability);
d.instrument = nodes.indexOf(d.instrument);
});
// console.log(links);
// Get back nodes as an array of objects
nodes.forEach(function (d, i) {
nodes[i] = { "name": d };
});
var linksX = [];
var year = "Y2014" // change this to change the year
links.forEach(function (d) {
if (d[year] != 0) {
linksX.push({
"source": d.source,
"target": d.target,
"value": d[year],
"color": d.color,
"liaIns": "L" + d.liability + d.instrument,
});
}
});
// console.log(linksX);
// Sankey default params
var sankey = d3.sankey()
.nodeWidth(30)
.nodePadding(12)
.size([width, height])
.nodes(nodes)
.links(linksX)
.layout(32);
// Path data generator.
var path = sankey.link();
var link = svg.append("g")
.selectAll(".link")
.data(linksX)
.enter()
.append("path")
.attr("class", function (d) {
return "link" + " " + d.liaIns;
})
.attr({"d": path })
.style("stroke-width", function (d) {
return Math.max(1, d.dy);
})
.style("stroke", function (d) {
return colors(d.color);
})
.sort(function(a, b) { return b.dy - a.dy; })
.on('mouseover',function() {
d3.select(this)
.style("stroke-opacity", function (d) {
// console.log(d.liaIns);
d3.selectAll(".link").filter("." + d.liaIns)
.style("stroke-opacity", function (d) {
var sel = d3.select(this);
sel.moveToFront();
return 0.9;
});
var sel = d3.select(this);
sel.moveToFront();
return 0.9;
});
})
.on('mouseout',function() {
d3.select(this)
.style("stroke-opacity", function (d) {
// console.log(d.liaIns);
d3.selectAll(".link").filter("." + d.liaIns)
.style("stroke-opacity", function (d) {
return .1;
});
return .1;
});
});
link.append("title")
.html(function (d) { return d.source.name + " <p>&#8594;</p> " + d.target.name + "\n" + format(d.value); });
var node = svg.append("g").selectAll(".node")
.data(nodes)
.enter()
.append("g")
.attr({
"class": "node",
transform: function (d) {
return "translate(" + d.x + "," + d.y + ")";
}
})
.call(d3.behavior.drag()
.origin(function (d) { return d; })
.on("dragstart", function () { this.parentNode.appendChild(this); })
.on("drag", dragmove));
node.append("rect")
.attr({
"height": function (d) {
return d.dy;
},
"width": sankey.nodeWidth()
})
.style({ fill: function (d) {
var name = d.name.replace(/ liability| asset|/gi, "");
return d.color = colors(name);
},
stroke: function (d) {
return d3.rgb(d.color).darker(.5);
}
})
.style("stroke-width", 0.1)
.append("title")
.text(function (d) {
return "Total " + d.name + "\n" + format(d.value);
});
node.append("text")
.attr("x", -6)
.attr("y", function (d) { return d.dy / 2; })
.attr("dy", ".35em")
.attr("text-anchor", "end")
.attr("transform", null)
.text(function (d) { return d.name; })
.filter(function (d) { return d.x < width / 2; })
.attr("x", 6 + sankey.nodeWidth())
.attr("text-anchor", "start");
// the function for moving the nodes
function dragmove(d) {
d3.select(this).attr("transform",
"translate(" + (
d.x = Math.max(0, Math.min(width - d.dx, d3.event.x))
) + "," + (
d.y = Math.max(0, Math.min(height - d.dy, d3.event.y))
) + ")");
sankey.relayout();
link.attr("d", path);
}
d3.selection.prototype.moveToFront = function() {
return this.each(function(){
this.parentNode.appendChild(this);
});
};
}) // close csv reader
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment