Created
November 19, 2023 21:12
-
-
Save BaksiLi/cd1baf1f109d30ad0b56fb2e63c64d54 to your computer and use it in GitHub Desktop.
Visualise Shanghai Composite Index since Covid-19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(*Shanghai Composite Index*) | |
data1 = FinancialData[ | |
"^000001", {{2019, 12, 1}, {2021, 3, 22}, "Week"}]; | |
data2 = FinancialData[ | |
"^000001", {{2021, 3, 23}, {2022, 3, 5}, "Week"}]; | |
data3 = FinancialData[ | |
"^000001", {{2022, 3, 6}, {2022, 12, 4}, "Week"}]; | |
data4 = FinancialData[ | |
"^000001", {{2022, 12, 5}, {2023, 11, 1}, "Week"}]; | |
dataset = {data1, data2, data3, data4}; | |
avg = MovingAverage[ | |
data = FinancialData[ | |
"^000001", {{2019, 12, 1}, {2023, 11, 1}, "Week"}], 4]; | |
plot = DateListPlot[dataset, | |
PlotLegends -> {"First Outbreak", "Steady Period", "Second Wave", | |
"End of Zero-Covid Polocy"}, | |
PlotStyle -> {Pink, Brown, Orange, Gray}, | |
PlotMarkers -> None, | |
Filling -> Bottom, | |
Joined -> False]; | |
avgplot = | |
DateListPlot[avg, | |
PlotStyle -> {Nest[Lighter, Brown, 2], Dashed, Thick}]; | |
Show[avgplot, plot, | |
PlotLabel -> "Shanghai Composite Index since Covid-19", | |
PlotRange -> All] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Posted on https://x.com/baksili_/status/1726346016721629560.