Skip to content

Instantly share code, notes, and snippets.

@BaksiLi
Created November 19, 2023 21:12
Show Gist options
  • Save BaksiLi/cd1baf1f109d30ad0b56fb2e63c64d54 to your computer and use it in GitHub Desktop.
Save BaksiLi/cd1baf1f109d30ad0b56fb2e63c64d54 to your computer and use it in GitHub Desktop.
Visualise Shanghai Composite Index since Covid-19
(*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]
@BaksiLi
Copy link
Author

BaksiLi commented Nov 19, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment