-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2024产业链视角看A股.R
More file actions
169 lines (131 loc) · 6.64 KB
/
Copy path2024产业链视角看A股.R
File metadata and controls
169 lines (131 loc) · 6.64 KB
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
Stocks_ZZ<-read_excel('//Users//wulixin//Desktop//中证股息率与市净率.xls',sheet="个股数据")
Stocks_C<-Stocks_ZZ%>%select("证券名称","一级行业名称","三级行业名称","四级行业名称")
colnames(Stocks_C)<-c("name","industry_1","industry_3","industry_4")
df_all<-stocks_names%>%left_join(Stocks_C)
colnames(stocks_names)
FDC_DD<-read_excel("//Users//wulixin//Desktop//2024短线操盘辟邪剑谱之六大产业链.xlsx",sheet="房地产产业链")
ZNQC_DD<-read_excel("//Users//wulixin//Desktop//2024短线操盘辟邪剑谱之六大产业链.xlsx",sheet="智能汽车产业链")
TGY_DD<-read_excel("//Users//wulixin//Desktop//2024短线操盘辟邪剑谱之六大产业链.xlsx",sheet="特高压产业链")
DZSW_DD<-read_excel("//Users//wulixin//Desktop//2024短线操盘辟邪剑谱之六大产业链.xlsx",sheet="电子商务产业链")
QYDC_DD<-read_excel("//Users//wulixin//Desktop//2024短线操盘辟邪剑谱之六大产业链.xlsx",sheet="区域地产")
XP_DD<-rbind(FDC_DD,ZNQC_DD,TGY_DD,DZSW_DD,QYDC_DD)
colnames(XP_DD)
colnames(ZNQC_DD)
unique(ZNQC_DD$区域)
###################################
# 智能汽车产业链研究
DF_ALL<-ZNQC_DD%>%filter()
#######################################
DF_ALL<-XP_DD%>%filter(区域 %in% c('广东','吉林','湖北','江苏','浙江','上海','天津','北京','陕西','四川','重庆','广西','海南','河北'))%>%left_join(Stocks_C)
####智能汽车产业链
DF_ALL<-df_all%>%filter(name %in% c('北斗星通','合众思壮','银江技术','金溢科技','德赛西威','华域汽车','广汽集团','中心通讯','东风汽车',
'兆易创新','北京君正','全志科技','四维图新','万通发展','亨通光电','信维通信','剑桥科技','创意信息',
'和而泰','共进股份','红相股份','金信诺','海特高新','盛路通信','国博电子','中瓷电子','探维科技',
'法雷奥','图达通','禾赛科技','唯捷创芯','协和电子','雷电微力','武汉凡谷','锐明技术','千方科技','华天科技',
'铖昌科技','欧菲光','信维通信','环旭电子','中英科技','雷科防务','保隆科技','亚太股份','威孚高科'))%>%left_join(Stocks_C)
DF_ALL
#df_all$Time<-as.numeric(today()-ymd(df_all$list_date))
DF_ALL$LIST_DAY<-ymd(today()-days(DF_ALL$上市时间))
##时间筛选 注册制以来的表现
head(DF_ALL$LIST_DAY)
ZCZ_DF_ALL<-DF_ALL%>%filter(LIST_DAY>ymd('20190612'))
## 智能汽车产业链研究
ZCZ_DF_ALL<-DF_ALL
#%>%filter(LIST_DAY>ymd('20190612'))
lvl_opts <- list(
list(
level = 1,
borderWidth = 2,
borderColor = "brown",
dataLabels = list(
enabled = TRUE,
align = "left",
verticalAlign = "top",
style = list(
fontSize = "25px",
textOutline = FALSE,
color = "red",
fontWeight = "bold"
)
)
),
list(
level = 2,
borderWidth = 2,
borderColor = "white",
colorVariation = list(key = "brightness", to = 0.250),
dataLabels = list(enabled = TRUE,align = "right",
verticalAlign = "bottom",
style = list(fontSize = "19px",
textOutline = FALSE,
color = "red",
fontWeight = "blod")
)
),
list(
level = 3,
borderWidth = 2,
borderColor = "brown",
colorVariation = list(key = "brightness", to = 0.50),
dataLabels = list(enabled = TRUE,
style = list(fontSize = "18px",
textOutline = FALSE,
color = "white",
fontWeight = "normal")
)
)
)
ZCZ_DF_ALL<-ZCZ_DF_ALL%>%left_join(dataprices)
treemap_data3 <- ZCZ_DF_ALL%>%
mutate(category = gsub(" ", "-",industry_3),
subcategory = gsub(" ", "-",industry_4),
ratio=as.numeric(游资偏好度),
Volume=as.numeric(爆发力)) %>%
select(category,subcategory,公司名称,Volume,ratio)
pkmn_min <- treemap_data3 %>%
select(category,subcategory,公司名称) %>%
mutate(category = stringr::str_to_title(category)) %>%
mutate(subcategory= ifelse(is.na(subcategory), category, paste(category, "智能汽车产业链", subcategory))) %>%
mutate(val = 1)
hchart(
data_to_hierarchical(treemap_data3,c("category","subcategory","公司名称"),
size=Volume, colors = rev(viridis(4))),type = "treemap",
allowDrillToNode = TRUE,tooltip = list(valueDecimals = FALSE),levels = lvl_opts) %>%
hc_chart(
style = list(fontFamily = "Gloria Hallelujah")) %>%
hc_title(text = "注册制以来小盘股产业链——行业分布",
style = list(fontFamily = "Gloria Hallelujah",fontSize = "50px", color = "red", fontWeight = "bold")) %>%
hc_size(height = 950,width = 1580)%>%
hc_add_theme(hc_theme_sandsignika())
hchart(
data_to_hierarchical(treemap_data3,c("category","subcategory","公司名称"),
size=Volume, colors = rev(viridis(4))),type = "treemap",
allowDrillToNode = TRUE,tooltip = list(valueDecimals = FALSE),levels = lvl_opts) %>%
hc_chart(
style = list(fontFamily = "Gloria Hallelujah")) %>%
hc_title(text = "智能汽车产业链区域——产业链上中下游",
style = list(fontFamily = "Gloria Hallelujah",fontSize = "50px", color = "red", fontWeight = "bold")) %>%
hc_size(height = 950,width = 1580)%>%
hc_add_theme(hc_theme_sandsignika())
###########汽车产业链
treemap_data3 <- ZCZ_DF_ALL%>%
mutate(category = gsub(" ", "-",industry_3),
subcategory = gsub(" ", "-",industry_4),
ratio=as.numeric(close),
Volume=as.numeric(amount)) %>%
select(category,subcategory,name,Volume,ratio)
pkmn_min <- treemap_data3 %>%
select(category,subcategory,name) %>%
mutate(category = stringr::str_to_title(category)) %>%
mutate(subcategory= ifelse(is.na(subcategory), category, paste(category, "智能汽车产业链", subcategory))) %>%
mutate(val = 1)
hchart(
data_to_hierarchical(treemap_data3,c("category","subcategory",name),
size=Volume, colors = rev(viridis(4))),type = "treemap",
allowDrillToNode = TRUE,tooltip = list(valueDecimals = FALSE),levels = lvl_opts) %>%
hc_chart(
style = list(fontFamily = "Gloria Hallelujah")) %>%
hc_title(text = "核心高利润零部件平台企业",
style = list(fontFamily = "Gloria Hallelujah",fontSize = "50px", color = "red", fontWeight = "bold")) %>%
hc_size(height = 950,width = 1580)%>%
hc_add_theme(hc_theme_sandsignika())