sbd-npm 1.4.96 → 1.4.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/stock_basics.js CHANGED
@@ -86,10 +86,10 @@ let Stock = {
86
86
  Stock.fetch_report_organization();
87
87
  break;
88
88
  case "public_fund":
89
- Util.fetch_public_fund(Stock["code"]);
89
+ Util.fetch_public_fund(Stock.code);
90
90
  break;
91
91
  case "public_fund_change":
92
- Util.fetch_public_fund_change(Stock["code"]);
92
+ Util.fetch_public_fund_change(Stock.code);
93
93
  break;
94
94
  case "big_deal":
95
95
  Stock.fetch_big_deal();
@@ -168,11 +168,11 @@ let Stock = {
168
168
  let cf_obj = $("#currency_funds");
169
169
  cf_obj.html(Util.to_unit(cf_obj.attr("title"), 2, 0));
170
170
  //获取股票详情数据
171
- Util.post("/stock/" + Stock["code"], {action: "code_detail"}, function (item) {
172
- Util.init_profile_component("profile", item["intro"]);
173
- if (item["latest_date"] && !Stock.hist_end_date) {
174
- Stock.hist_end_date = Util.seconds_to_format(item["latest_date"], "%Y-%m-%d");
175
- Stock.hist_start_date = Util.seconds_to_format(item["latest_date"] - 60 * Util.one_day_second, "%Y-%m-%d");
171
+ Util.post("/stock/" + Stock.code, {action: "code_detail"}, function (item) {
172
+ Util.init_profile_component("profile", item.intro);
173
+ if (item.latest_date && !Stock.hist_end_date) {
174
+ Stock.hist_end_date = Util.seconds_to_format(item.latest_date, "%Y-%m-%d");
175
+ Stock.hist_start_date = Util.seconds_to_format(item.latest_date - 60 * Util.one_day_second, "%Y-%m-%d");
176
176
  }
177
177
  item.price = (item.price && item.price > 0) ? item.price : parseFloat($("#price").html());
178
178
  Stock.price = item.price;
@@ -182,15 +182,15 @@ let Stock = {
182
182
  high_52week.html(Util.digit_compare_trend(high_52week.text(), item.price));
183
183
  let low_52week = $("#low_52week");
184
184
  low_52week.html(Util.digit_compare_trend(low_52week.text(), item.price));
185
- if (item["high_history"]["close"]) {
185
+ if (item.high_history.close) {
186
186
  let high_history = $("#high_history");
187
- high_history.html(Util.digit_compare_trend(item["high_history"]["close"], item.price));
188
- high_history.attr("title", Util.seconds_to_format(item["high_history"]["date"], "%Y-%m-%d"))
187
+ high_history.html(Util.digit_compare_trend(item.high_history.close, item.price));
188
+ high_history.attr("title", Util.seconds_to_format(item.high_history.date, "%Y-%m-%d"))
189
189
  }
190
- if (item["low_history"]["close"]) {
190
+ if (item.low_history.close) {
191
191
  let low_history = $("#low_history");
192
- low_history.html(Util.digit_compare_trend(item["low_history"]["close"], item.price));
193
- low_history.attr("title", Util.seconds_to_format(item["low_history"]["date"], "%Y-%m-%d"))
192
+ low_history.html(Util.digit_compare_trend(item.low_history.close, item.price));
193
+ low_history.attr("title", Util.seconds_to_format(item.low_history.date, "%Y-%m-%d"))
194
194
  }
195
195
  // 备注
196
196
  let remark_html = [];
@@ -203,56 +203,56 @@ let Stock = {
203
203
  if (item.is_macd_cross) {
204
204
  remark_html.push("<a class='btn btn-xs btn-danger' href='" + Util.get_url("trend_macd_cross") + "'>MACD金叉</a>");
205
205
  }
206
- if (item["is_margin_minimum"]) {
206
+ if (item.is_margin_minimum) {
207
207
  remark_html.push("<a class='btn btn-xs btn-danger' href='" + Util.get_url("rank_margin_minimum") + "'>融资余额创新低</a>");
208
208
  }
209
- if (item["xsg_date"] > 0) {
210
- let xsg_date = Util.seconds_to_format(item["xsg_date"], "%Y-%m-%d");
209
+ if (item.xsg_date > 0) {
210
+ let xsg_date = Util.seconds_to_format(item.xsg_date, "%Y-%m-%d");
211
211
  remark_html.push("<b class='text-success'>最近解禁<a href='" + Util.get_url("holder_restricted") + "?tab=xsg_list&date=" + xsg_date + "'>" + xsg_date + "</a></b>, ");
212
212
  }
213
- if (item.price > 0 && item.price < item["block_trade_price"]) {
214
- remark_html.push("<b class='text-danger'>当前价小于最近<a href='" + Util.get_url("daily_block") + "?code=" + item.code + "&start_date=" + Util.seconds_to_format(Stock.ttm_second, "%Y-%m-%d") + "'>大宗交易价(" + item["block_trade_price"] + ")</a></b>, ");
213
+ if (item.price > 0 && item.price < item.block_trade_price) {
214
+ remark_html.push("<b class='text-danger'>当前价小于最近<a href='" + Util.get_url("daily_block") + "?code=" + item.code + "&start_date=" + Util.seconds_to_format(Stock.ttm_second, "%Y-%m-%d") + "'>大宗交易价(" + item.block_trade_price + ")</a></b>, ");
215
215
  }
216
216
  if (remark_html.length > 0) {
217
217
  remark_html.push("<br>");
218
218
  }
219
- if (item["description"]) {
220
- remark_html.push("<br><p>" + item["description"] + "</p>");
219
+ if (item.description) {
220
+ remark_html.push("<br><p>" + item.description + "</p>");
221
221
  }
222
222
  remark_html = remark_html.join("");
223
223
  // 同花顺|申万行业板块数据
224
- if (item["industry_data"] && item["industry_data"].length > 0) {
224
+ if (item.industry_data && item.industry_data.length > 0) {
225
225
  if (remark_html.length > 0) {
226
226
  remark_html += "<br>";
227
227
  }
228
228
  remark_html += "&nbsp;&nbsp;<b>行业板块:</b> ";
229
- item["industry_data"].forEach(function (i_d) {
229
+ item.industry_data.forEach(function (i_d) {
230
230
  let url = Util.get_url("summary_industry") + "?code=" + i_d["code"] + "&industry_type=" + i_d["industry_type"];
231
231
  remark_html += " <a href='" + url + "' class='btn btn-xs btn-warning'>" + i_d["name"] + "</a>";
232
232
  });
233
233
  }
234
- if (item["is_sh50"]) {
234
+ if (item.is_sh50) {
235
235
  remark_html += " <a href='" + (Util.get_url("summary_index") + "?index_code=SH000016") + "' class='btn btn-xs btn-warning'>上证50</a>";
236
236
  }
237
- if (item["is_star50"]) {
237
+ if (item.is_star50) {
238
238
  remark_html += " <a href='" + (Util.get_url("summary_index") + "?index_code=SH000688") + "' class='btn btn-xs btn-warning'>科创50</a>";
239
239
  }
240
- if (item["is_gem50"]) {
240
+ if (item.is_gem50) {
241
241
  remark_html += " <a href='" + (Util.get_url("summary_index") + "?index_code=SZ399673") + "' class='btn btn-xs btn-warning'>创业板50</a>";
242
242
  }
243
- if (item["is_hs300"]) {
243
+ if (item.is_hs300) {
244
244
  remark_html += " <a href='" + (Util.get_url("summary_index") + "?index_code=SH000300") + "' class='btn btn-xs btn-warning'>沪深300</a>";
245
245
  }
246
- if (item["etf_data"]) {
247
- item["etf_data"].forEach(function (etf) {
246
+ if (item.etf_data) {
247
+ item.etf_data.forEach(function (etf) {
248
248
  remark_html += " <a class='btn btn-xs btn-warning' data-toggle='modal' data-target='.public_fund_modal' data-val='" + etf["etf_code"] + "'>" + etf["etf_name"] + "</a>";
249
249
  });
250
250
  }
251
- if (item["links"]) {
251
+ if (item.links) {
252
252
  if (remark_html.length > 0) {
253
253
  remark_html += "<br>";
254
254
  }
255
- remark_html += item["links"];
255
+ remark_html += item.links;
256
256
  }
257
257
  let remark_obj = $("#remark");
258
258
  remark_obj.html(remark_html);
@@ -262,12 +262,12 @@ let Stock = {
262
262
  });
263
263
  // 日均线/抵扣价数据
264
264
  Util.render_ma_deduction(item, "ma_deduction");
265
- if (item["boll_up"] && item["boll_up"] > 0 && item["boll_down"] && item["boll_down"] > 0) {
266
- $("#boll").html("<a title='当前上轨线 / 当前下轨线' target='_blank' rel='noopener noreferrer nofollow' href='" + Util.get_url("trend_boll_lower_band") + "'><b class='text-danger'>" + Util.to_float(item["boll_up"], 2) + "</b> / <b class='text-success'>" + Util.to_float(item["boll_down"], 2) + "</b></a>");
265
+ if (item.boll_up && item.boll_up > 0 && item.boll_down && item.boll_down > 0) {
266
+ $("#boll").html("<a title='当前上轨线 / 当前下轨线' target='_blank' rel='noopener noreferrer nofollow' href='" + Util.get_url("trend_boll_lower_band") + "'><b class='text-danger'>" + Util.to_float(item.boll_up, 2) + "</b> / <b class='text-success'>" + Util.to_float(item.boll_down, 2) + "</b></a>");
267
267
  }
268
- if (item["usd_exchange_rate"] && item["usd_exchange_rate"] > 0) {
268
+ if (item.usd_exchange_rate && item.usd_exchange_rate > 0) {
269
269
  let market_capital = $("#market_capital").attr("data-val");
270
- let usd_exchange_rate = Util.to_float((market_capital * 100) / item["usd_exchange_rate"], 2);
270
+ let usd_exchange_rate = Util.to_float((market_capital * 100) / item.usd_exchange_rate, 2);
271
271
  $("#usd_market_capital").html("($" + usd_exchange_rate + "亿)");
272
272
  }
273
273
  // 雪球人数关注排名数据
@@ -275,12 +275,12 @@ let Stock = {
275
275
  // 股东户数
276
276
  let holder_num_url = Util.get_url("holder_num");
277
277
  Util.post(holder_num_url, {action: "holder_num_info", code: Stock.code}, function (j) {
278
- if (j["holder_num"] > 0 && j["pre_holder_num"]) {
279
- let holder_num = Util.digit_compare_trend(j["holder_num"], j["pre_holder_num"]);
278
+ if (j.holder_num > 0 && j.pre_holder_num) {
279
+ let holder_num = Util.digit_compare_trend(j.holder_num, j.pre_holder_num);
280
280
  $("#holder_num").html(Util.pack_html_link(holder_num_url + "?code=" + Stock.code, holder_num));
281
281
  }
282
282
  });
283
- if (item["is_retire"] && item["is_retire"] === 1) {
283
+ if (item.is_retire && item.is_retire === 1) {
284
284
  let code_a_obj = $('#code a').first();
285
285
  if (!code_a_obj.hasClass('label-default')) {
286
286
  code_a_obj.addClass('label label-default');
@@ -303,13 +303,13 @@ let Stock = {
303
303
  hist_type: hist_type,
304
304
  is_init: Stock.data.hasOwnProperty(localStorage[Stock.tab_token]) ? 1 : 0
305
305
  };
306
- Util.post("/stock/" + Stock["code"], payload, function (j) {
307
- if (j["init_start_date"]) {
308
- let init_start_date = Util.seconds_to_format(j["init_start_date"], "%Y-%m-%d");
306
+ Util.post("/stock/" + Stock.code, payload, function (j) {
307
+ if (j.init_start_date) {
308
+ let init_start_date = Util.seconds_to_format(j.init_start_date, "%Y-%m-%d");
309
309
  $("#hist_start_date").val(init_start_date).data('daterangepicker').setStartDate(init_start_date);
310
310
  }
311
- if (j["init_end_date"]) {
312
- let init_end_date = Util.seconds_to_format(j["init_end_date"], "%Y-%m-%d");
311
+ if (j.init_end_date) {
312
+ let init_end_date = Util.seconds_to_format(j.init_end_date, "%Y-%m-%d");
313
313
  $("#hist_end_date").val(init_end_date).data('daterangepicker').setStartDate(init_end_date);
314
314
  }
315
315
  Stock.hist_type = "";
@@ -334,9 +334,9 @@ let Stock = {
334
334
  html.push("<td>", Util.to_float(item.amount / (item.volume * 100), 2), "</td>");
335
335
  html.push("<td class='volume-td'>", Util.to_float(item.volume / 10000, 2), "万手</td>");
336
336
  html.push("<td class='volume_ratio-td'>", item.volume_ratio, "</td>");
337
- html.push("<td class='volume_ratio30-td'>", (item["volume_ratio30"] ? item["volume_ratio30"] : "--"), "</td>");
337
+ html.push("<td class='volume_ratio30-td'>", (item.volume_ratio30 ? item.volume_ratio30 : "--"), "</td>");
338
338
  html.push("<td class='amount-td'>", Util.to_hundred_million(item.amount), "亿</td>");
339
- html.push("<td>", (item["turnover"] > 0 ? (item["turnover"] + "%") : "--"), "</td>");
339
+ html.push("<td>", (item.turnover > 0 ? (item.turnover + "%") : "--"), "</td>");
340
340
  html.push("</tr>");
341
341
  });
342
342
  Util.render_table_html("hist_table_body", html);
@@ -359,11 +359,11 @@ let Stock = {
359
359
  Util.parse_value_trend("rzmre-td");
360
360
  Util.parse_value_trend("rzye-td");
361
361
  let stock_hist_summary = "";
362
- if (j["high_amount"] && j["high_amount"] > 0) {
363
- stock_hist_summary += "<b>历史最高成交额(<a class='hist_summary_link' href='#'>" + Util.seconds_to_format(j["high_amount_date"], "%Y-%m-%d") + "</a>):<span class='label label-danger'>" + Util.to_unit(j["high_amount"]) + "</span></b>,";
362
+ if (j.high_amount && j.high_amount > 0) {
363
+ stock_hist_summary += "<b>历史最高成交额(<a class='hist_summary_link' href='#'>" + Util.seconds_to_format(j.high_amount_date, "%Y-%m-%d") + "</a>):<span class='label label-danger'>" + Util.to_unit(j.high_amount) + "</span></b>,";
364
364
  }
365
- if (j["high_volume"] && j["high_volume"] > 0) {
366
- stock_hist_summary += "<b>历史最高成交量(<a class='hist_summary_link' href='#'>" + Util.seconds_to_format(j["high_volume_date"], "%Y-%m-%d") + "</a>):<span class='label label-danger'>" + Util.to_unit(j["high_volume"]) + "手</span></b>,";
365
+ if (j.high_volume && j.high_volume > 0) {
366
+ stock_hist_summary += "<b>历史最高成交量(<a class='hist_summary_link' href='#'>" + Util.seconds_to_format(j.high_volume_date, "%Y-%m-%d") + "</a>):<span class='label label-danger'>" + Util.to_unit(j.high_volume) + "手</span></b>,";
367
367
  }
368
368
  stock_hist_summary += "<b>时间区间内总成交额: <span class='label label-info'>" + Util.to_unit(total_amount) + "</span>,总成交量: <span class='label label-info'>" + Util.to_unit(total_volume) + "</span> 股,平均成交价: <span class='label label-warning'>" + Util.to_float(total_amount / total_volume, 2) + "</span></b>";
369
369
  $("#stock_hist_summary").html(stock_hist_summary);
@@ -415,35 +415,35 @@ let Stock = {
415
415
  let date = j.data["date"];
416
416
  //Stock.pack_big_deal("big_deal1", j.data, "最近一天", date, date);
417
417
  }
418
- if (j["money_net_inflow"]) {
418
+ if (j.money_net_inflow) {
419
419
  let html = [], i = 0, total_net_inflow = 0;
420
420
  let day3_net_inflow = 0, day5_net_inflow = 0, day10_net_inflow = 0, day20_net_inflow = 0, day60_net_inflow = 0;
421
- j["money_net_inflow"].forEach(function (item) {
421
+ j.money_net_inflow.forEach(function (item) {
422
422
  i++;
423
- total_net_inflow += item["main_net_inflow"];
423
+ total_net_inflow += item.main_net_inflow;
424
424
  if (i <= 3) {
425
- day3_net_inflow += item["main_net_inflow"];
425
+ day3_net_inflow += item.main_net_inflow;
426
426
  }
427
427
  if (i <= 5) {
428
- day5_net_inflow += item["main_net_inflow"];
428
+ day5_net_inflow += item.main_net_inflow;
429
429
  }
430
430
  if (i <= 10) {
431
- day10_net_inflow += item["main_net_inflow"];
431
+ day10_net_inflow += item.main_net_inflow;
432
432
  }
433
433
  if (i <= 20) {
434
- day20_net_inflow += item["main_net_inflow"];
434
+ day20_net_inflow += item.main_net_inflow;
435
435
  }
436
436
  if (i <= 60) {
437
- day60_net_inflow += item["main_net_inflow"];
437
+ day60_net_inflow += item.main_net_inflow;
438
438
  }
439
439
  html.push("<tr>");
440
440
  html.push("<td>", Util.seconds_to_format(item.date, "%Y-%m-%d"), "</td>");
441
- html.push("<td><b class='", Util.text_color(item["price_change"]), "'>", item.price, "(", item["price_change"], "%)</b></td>");
442
- html.push("<td data-val='", item["main_net_inflow"], "'><b class='", Util.text_color(item["main_net_inflow"]), "'>", Util.to_unit(item["main_net_inflow"]), "</b></td>");
443
- html.push("<td data-val='", item["large_net_inflow"], "'><b class='", Util.text_color(item["large_net_inflow"]), "'>", Util.to_unit(item["large_net_inflow"]), "</b></td>");
444
- html.push("<td data-val='", item["big_net_inflow"], "'><b class='", Util.text_color(item["big_net_inflow"]), "'>", Util.to_unit(item["big_net_inflow"]), "</b></td>");
445
- html.push("<td data-val='", item["middle_net_inflow"], "'><b class='", Util.text_color(item["middle_net_inflow"]), "'>", Util.to_unit(item["middle_net_inflow"]), "</b></td>");
446
- html.push("<td data-val='", item["small_net_inflow"], "'><b class='", Util.text_color(item["small_net_inflow"]), "'>", Util.to_unit(item["small_net_inflow"]), "</b></td>");
441
+ html.push("<td><b class='", Util.text_color(item.price_change), "'>", item.price, "(", item.price_change, "%)</b></td>");
442
+ html.push("<td data-val='", item.main_net_inflow, "'><b class='", Util.text_color(item.main_net_inflow), "'>", Util.to_unit(item.main_net_inflow), "</b></td>");
443
+ html.push("<td data-val='", item.large_net_inflow, "'><b class='", Util.text_color(item.large_net_inflow), "'>", Util.to_unit(item.large_net_inflow), "</b></td>");
444
+ html.push("<td data-val='", item.big_net_inflow, "'><b class='", Util.text_color(item.big_net_inflow), "'>", Util.to_unit(item.big_net_inflow), "</b></td>");
445
+ html.push("<td data-val='", item.middle_net_inflow, "'><b class='", Util.text_color(item.middle_net_inflow), "'>", Util.to_unit(item.middle_net_inflow), "</b></td>");
446
+ html.push("<td data-val='", item.small_net_inflow, "'><b class='", Util.text_color(item.small_net_inflow), "'>", Util.to_unit(item.small_net_inflow), "</b></td>");
447
447
  html.push("<td class='volume-td'>", Util.to_float(item.volume / 10000, 2), "万手</td>");
448
448
  html.push("<td class='amount-td'>", Util.to_hundred_million(item.amount), "亿</td>");
449
449
  html.push("</tr>");
@@ -505,11 +505,11 @@ let Stock = {
505
505
  if (date) {
506
506
  payload.date = date;
507
507
  }
508
- Util.post("/stock/" + Stock["code"], payload, function (j) {
508
+ Util.post("/stock/" + Stock.code, payload, function (j) {
509
509
  let main_html = [], circulation_html = [];
510
510
  let main_volume = 0, pre_main_volume = 0, circulation_volume = 0, pre_circulation_volume = 0;
511
511
  j.data.forEach(function (item) {
512
- let change = item["change"];
512
+ let change = item.change;
513
513
  if (change === "None") {
514
514
  change = "<b class='text-danger'>新增</b>";
515
515
  } else if (parseInt(change) === 0) {
@@ -523,25 +523,25 @@ let Stock = {
523
523
  main_volume += item.volume;
524
524
  main_html.push("<tr>");
525
525
  main_html.push("<td>", item.rank, "</td>");
526
- main_html.push("<td>", item["holder_name"], "</td>");
526
+ main_html.push("<td>", item.holder_name, "</td>");
527
527
  main_html.push("<td>", Util.to_unit(item.volume), "</td>");
528
528
  main_html.push("<td>", Util.to_unit(item.volume * Stock.price), "</td>");
529
- main_html.push("<td>", item["holder_ratio"], "%</td>");
529
+ main_html.push("<td>", item.holder_ratio, "%</td>");
530
530
  main_html.push("<td>", change, "</td>");
531
531
  main_html.push("</tr>");
532
532
  } else {
533
533
  circulation_volume += item.volume;
534
534
  circulation_html.push("<tr>");
535
535
  circulation_html.push("<td>", item.rank, "</td>");
536
- circulation_html.push("<td>", item["holder_name"], "</td>");
536
+ circulation_html.push("<td>", item.holder_name, "</td>");
537
537
  circulation_html.push("<td>", Util.to_unit(item.volume), "</td>");
538
538
  circulation_html.push("<td>", Util.to_unit(item.volume * Stock.price), "</td>");
539
- circulation_html.push("<td>", item["holder_ratio"], "%</td>");
539
+ circulation_html.push("<td>", item.holder_ratio, "%</td>");
540
540
  circulation_html.push("<td>", change, "</td>");
541
541
  circulation_html.push("</tr>");
542
542
  }
543
543
  });
544
- j["pre_data"].forEach(function (item) {
544
+ j.pre_data.forEach(function (item) {
545
545
  if (parseInt(item.type) === 1) {
546
546
  pre_main_volume += item.volume;
547
547
  } else {
@@ -555,8 +555,8 @@ let Stock = {
555
555
  circulation_tips += ", 上一季度是: <span class='label label-info'>" + Util.to_unit(pre_circulation_volume, 3) + "</span>,";
556
556
  circulation_tips += " 持股数环比: " + Util.year_price_rate(circulation_volume, pre_circulation_volume, 1);
557
557
  }
558
- if (j["date_price"]) {
559
- circulation_tips += ", 当时价: " + Util.digit_compare_trend1(Stock["price"], j["date_price"]);
558
+ if (j.date_price) {
559
+ circulation_tips += ", 当时价: " + Util.digit_compare_trend1(Stock.price, j.date_price);
560
560
  }
561
561
  circulation_tips += " ]";
562
562
  }
@@ -575,9 +575,9 @@ let Stock = {
575
575
  $("#circulation_holder_url").attr("href", "https://xueqiu.com/snowman/S/" + symbol + "/detail#/LTGD");
576
576
  Util.render_table_html("main_holder_table_body", main_html);
577
577
  $("#main_holder_url").attr("href", "https://xueqiu.com/snowman/S/" + symbol + "/detail#/SDGD");
578
- if (j["date_list"]) {
578
+ if (j.date_list) {
579
579
  let date_html = [];
580
- j["date_list"].forEach(function (date) {
580
+ j.date_list.forEach(function (date) {
581
581
  date = Util.seconds_to_format(date, "%Y-%m-%d");
582
582
  date_html.push("<option value='", date, "'>", date, "</option>");
583
583
  });
@@ -649,21 +649,21 @@ let Stock = {
649
649
  {"name": "扣净环比", "tooltip": "(当前扣非净利润 - 上一季度的扣非净利润) / 上一季度的扣非净利润 × 100%"},
650
650
  ]
651
651
  });
652
- Util.post("/stock/" + Stock["code"], {action: "finance"}, function (j) {
652
+ Util.post("/stock/" + Stock.code, {action: "finance"}, function (j) {
653
653
  // 现金流量表
654
654
  let html = [], total_ncf_from_oa = 0, total_cash_paid_for_assets = 0, total_free_cash_flow = 0, total_ncf_from_fa = 0;
655
- j["cash_flow_data"].forEach(function (item) {
656
- total_ncf_from_oa += item["ncf_from_oa"];
657
- total_cash_paid_for_assets += item["cash_paid_for_assets"];
658
- let free_cash_flow = item["ncf_from_oa"] - item["cash_paid_for_assets"];
655
+ j.cash_flow_data.forEach(function (item) {
656
+ total_ncf_from_oa += item.ncf_from_oa;
657
+ total_cash_paid_for_assets += item.cash_paid_for_assets;
658
+ let free_cash_flow = item.ncf_from_oa - item.cash_paid_for_assets;
659
659
  total_free_cash_flow += free_cash_flow;
660
- total_ncf_from_fa += item["ncf_from_fa"];
660
+ total_ncf_from_fa += item.ncf_from_fa;
661
661
  html.push("<tr>");
662
662
  html.push("<td>", Util.seconds_to_format(item.date, "%Y"), "</td>");
663
- html.push("<td>", Util.to_unit(item["ncf_from_oa"]), "</td>");
664
- html.push("<td>", Util.to_unit(item["cash_paid_for_assets"]), "</td>");
663
+ html.push("<td>", Util.to_unit(item.ncf_from_oa), "</td>");
664
+ html.push("<td>", Util.to_unit(item.cash_paid_for_assets), "</td>");
665
665
  html.push("<td>", Util.to_unit(free_cash_flow), "</td>");
666
- html.push("<td>", Util.to_unit(item["ncf_from_fa"]), "</td>");
666
+ html.push("<td>", Util.to_unit(item.ncf_from_fa), "</td>");
667
667
  html.push("</tr>");
668
668
  });
669
669
  total_ncf_from_oa = total_ncf_from_oa >= 0 ? (Util.to_hundred_million(total_ncf_from_oa) + "亿") : ("<b class='text-danger'>" + Util.to_hundred_million(total_ncf_from_oa) + "亿</b>");
@@ -674,7 +674,7 @@ let Stock = {
674
674
  Util.render_table_html("cash_flow_table_body", html);
675
675
  // 资产负债表
676
676
  html = [];
677
- j["assets_liabilities_data"].forEach(function (item) {
677
+ j.assets_liabilities_data.forEach(function (item) {
678
678
  let net_assets = item.total_assets - item.total_liabilities;
679
679
  let goodwill = "--";
680
680
  let goodwill_rate = "--";
@@ -683,21 +683,21 @@ let Stock = {
683
683
  goodwill_rate = Util.to_float((item.goodwill / net_assets) * 100, 2) + "%";
684
684
  }
685
685
  let debt_asset_ratio = "--";
686
- if (item["debt_asset_ratio"] > 0) {
687
- debt_asset_ratio = Util.to_float(item["debt_asset_ratio"], 2) + "%";
686
+ if (item.debt_asset_ratio > 0) {
687
+ debt_asset_ratio = Util.to_float(item.debt_asset_ratio, 2) + "%";
688
688
  }
689
689
  html.push("<tr>");
690
- html.push("<td>", item["year"], "(", item["quarter"], ")</td>");
690
+ html.push("<td>", item.year, "(", item.quarter, ")</td>");
691
691
  html.push("<td>", Util.to_unit(item.total_assets), "</td>");
692
692
  html.push("<td>", Util.to_unit(item.total_liabilities), "</td>");
693
693
  html.push("<td>", Util.to_unit(net_assets), "</td>");
694
694
  html.push("<td>", debt_asset_ratio, "</td>");
695
- html.push("<td>", Util.to_unit(item["currency_funds"]), "</td>");
696
- html.push("<td>", Util.to_unit(item["short_term_loan"]), "</td>");
697
- html.push("<td>", Util.to_unit(item["noncurrent_liab_due_in1y"]), "</td>");
695
+ html.push("<td>", Util.to_unit(item.currency_funds), "</td>");
696
+ html.push("<td>", Util.to_unit(item.short_term_loan), "</td>");
697
+ html.push("<td>", Util.to_unit(item.noncurrent_liab_due_in1y), "</td>");
698
698
  let flr = "--";
699
- if (item["short_term_loan"] > 0 && item["noncurrent_liab_due_in1y"] > 0) {
700
- flr = Util.to_float(item["currency_funds"] / (item["short_term_loan"] + item["noncurrent_liab_due_in1y"]), 2);
699
+ if (item.short_term_loan > 0 && item.noncurrent_liab_due_in1y > 0) {
700
+ flr = Util.to_float(item.currency_funds / (item.short_term_loan + item.noncurrent_liab_due_in1y), 2);
701
701
  flr = flr >= 1 ? flr : ("<b class='text-danger'>" + flr + "</br>");
702
702
  }
703
703
  html.push("<td>", flr, "</td>");
@@ -706,7 +706,7 @@ let Stock = {
706
706
  html.push("</tr>");
707
707
  });
708
708
  Util.render_table_html("assets_liabilities_table_body", html);
709
- Stock.income_statement_data = j["income_statement_data"] ? j["income_statement_data"] : [];
709
+ Stock.income_statement_data = j.income_statement_data ? j.income_statement_data : [];
710
710
  Stock.render_income_statement_data();
711
711
  $("#quarter").change(function () {
712
712
  Stock.render_income_statement_data();
@@ -722,60 +722,60 @@ let Stock = {
722
722
  let html = [];
723
723
  let quarter = parseInt($("#quarter").val());
724
724
  Stock["income_statement_data"].forEach(function (item) {
725
- item["quarter"] = Util.get_quarter(item.date);
726
- if (quarter === 0 || quarter === item["quarter"]) {
727
- let tr_cls = (quarter === 0 && item["quarter"] === 4) ? "success" : "";
725
+ item.quarter = Util.get_quarter(item.date);
726
+ if (quarter === 0 || quarter === item.quarter) {
727
+ let tr_cls = (quarter === 0 && item.quarter === 4) ? "success" : "";
728
728
  html.push("<tr class='", tr_cls, "'>");
729
- html.push("<td>", Util.get_year(item.date), "-", item["quarter"], "</td>");
729
+ html.push("<td>", Util.get_year(item.date), "-", item.quarter, "</td>");
730
730
  html.push("<td>", item.net_profit_rate, "%</td>");
731
731
  html.push("<td>", Util.to_float(item.gross_profit_rate, 2), "%</td>");
732
- html.push("<td>", Util.to_float(item["eps"], 2), "元</td>");
732
+ html.push("<td>", Util.to_float(item.eps, 2), "元</td>");
733
733
  html.push("<td>", item.roe, "%</td>");
734
734
  let total_revenue = Util.to_unit(item.total_revenue, 3);
735
735
  html.push("<td>", total_revenue, "</td>");
736
736
  let total_revenue_yoy_title = "", total_revenue_yoy_ratio = "--";
737
- if (item["yoy_total_revenue"]) {
738
- total_revenue_yoy_title = " title='" + Util.to_unit(item["yoy_total_revenue"], 2, 0) + " - " + Util.strip_html(total_revenue) + "'";
739
- total_revenue_yoy_ratio = Util.to_float(((item.total_revenue - item["yoy_total_revenue"]) / item["yoy_total_revenue"]) * 100, 2);
737
+ if (item.yoy_total_revenue) {
738
+ total_revenue_yoy_title = " title='" + Util.to_unit(item.yoy_total_revenue, 2, 0) + " - " + Util.strip_html(total_revenue) + "'";
739
+ total_revenue_yoy_ratio = Util.to_float(((item.total_revenue - item.yoy_total_revenue) / item.yoy_total_revenue) * 100, 2);
740
740
  total_revenue_yoy_ratio = Util.parse_ratio(total_revenue_yoy_ratio);
741
741
  }
742
742
  html.push("<td", total_revenue_yoy_title, ">", total_revenue_yoy_ratio, "</td>");
743
743
  let total_revenue_qoq_title = "", total_revenue_qoq_ratio = "--";
744
- if (item["qoq_total_revenue"]) {
745
- total_revenue_qoq_title = " title='" + Util.to_unit(item["qoq_total_revenue"], 2, 0) + " - " + Util.to_unit(item["total_revenue_add"], 2, 0) + "'";
746
- total_revenue_qoq_ratio = Util.to_float(((item["total_revenue_add"] - item["qoq_total_revenue"]) / item["qoq_total_revenue"]) * 100, 2);
744
+ if (item.qoq_total_revenue) {
745
+ total_revenue_qoq_title = " title='" + Util.to_unit(item.qoq_total_revenue, 2, 0) + " - " + Util.to_unit(item.total_revenue_add, 2, 0) + "'";
746
+ total_revenue_qoq_ratio = Util.to_float(((item.total_revenue_add - item.qoq_total_revenue) / item.qoq_total_revenue) * 100, 2);
747
747
  total_revenue_qoq_ratio = Util.parse_ratio(total_revenue_qoq_ratio);
748
748
  }
749
749
  html.push("<td", total_revenue_qoq_title, ">", total_revenue_qoq_ratio, "</td>");
750
750
  let net_profit = Util.to_unit(item.net_profit, 3);
751
751
  html.push("<td>", net_profit, "</td>");
752
752
  let net_profit_yoy_title = "", net_profit_yoy_ratio = "--";
753
- if (item["yoy_net_profit"]) {
754
- net_profit_yoy_title = " title='" + Util.to_unit(item["yoy_net_profit"], 2, 0) + " - " + Util.strip_html(net_profit) + "'";
755
- net_profit_yoy_ratio = Util.to_float(((item.net_profit - item["yoy_net_profit"]) / item["yoy_net_profit"]) * 100, 2);
753
+ if (item.yoy_net_profit) {
754
+ net_profit_yoy_title = " title='" + Util.to_unit(item.yoy_net_profit, 2, 0) + " - " + Util.strip_html(net_profit) + "'";
755
+ net_profit_yoy_ratio = Util.to_float(((item.net_profit - item.yoy_net_profit) / item.yoy_net_profit) * 100, 2);
756
756
  net_profit_yoy_ratio = Util.parse_ratio(net_profit_yoy_ratio);
757
757
  }
758
758
  html.push("<td", net_profit_yoy_title, ">", net_profit_yoy_ratio, "</td>");
759
759
  let net_profit_qoq_title = "", net_profit_qoq_ratio = "--";
760
- if (item["qoq_net_profit"]) {
761
- net_profit_qoq_title = " title='" + Util.to_unit(item["qoq_net_profit"], 2, 0) + " - " + Util.to_unit(item["net_profit_add"], 2, 0) + "'";
762
- net_profit_qoq_ratio = Util.to_float(((item["net_profit_add"] - item["qoq_net_profit"]) / item["qoq_net_profit"]) * 100, 2);
760
+ if (item.qoq_net_profit) {
761
+ net_profit_qoq_title = " title='" + Util.to_unit(item.qoq_net_profit, 2, 0) + " - " + Util.to_unit(item.net_profit_add, 2, 0) + "'";
762
+ net_profit_qoq_ratio = Util.to_float(((item.net_profit_add - item.qoq_net_profit) / item.qoq_net_profit) * 100, 2);
763
763
  net_profit_qoq_ratio = Util.parse_ratio(net_profit_qoq_ratio);
764
764
  }
765
765
  html.push("<td", net_profit_qoq_title, ">", net_profit_qoq_ratio, "</td>");
766
766
  let adjusted_net_profit = Util.to_unit(item.adjusted_net_profit, 3);
767
767
  html.push("<td>", adjusted_net_profit, "</td>");
768
768
  let adjusted_net_profit_yoy_title = "", adjusted_net_profit_yoy_ratio = "--";
769
- if (item["yoy_adjusted_net_profit"]) {
770
- adjusted_net_profit_yoy_title = " title='" + Util.to_unit(item["yoy_adjusted_net_profit"], 2, 0) + " - " + Util.strip_html(adjusted_net_profit) + "'";
771
- adjusted_net_profit_yoy_ratio = Util.to_float(((item.adjusted_net_profit - item["yoy_adjusted_net_profit"]) / item["yoy_adjusted_net_profit"]) * 100, 2);
769
+ if (item.yoy_adjusted_net_profit) {
770
+ adjusted_net_profit_yoy_title = " title='" + Util.to_unit(item.yoy_adjusted_net_profit, 2, 0) + " - " + Util.strip_html(adjusted_net_profit) + "'";
771
+ adjusted_net_profit_yoy_ratio = Util.to_float(((item.adjusted_net_profit - item.yoy_adjusted_net_profit) / item.yoy_adjusted_net_profit) * 100, 2);
772
772
  adjusted_net_profit_yoy_ratio = Util.parse_ratio(adjusted_net_profit_yoy_ratio);
773
773
  }
774
774
  html.push("<td", adjusted_net_profit_yoy_title, ">", adjusted_net_profit_yoy_ratio, "</td>");
775
775
  let adjusted_net_profit_qoq_title = "", adjusted_net_profit_qoq_ratio = "--";
776
- if (item["qoq_adjusted_net_profit"]) {
777
- adjusted_net_profit_qoq_title = " title='" + Util.to_unit(item["qoq_adjusted_net_profit"], 2, 0) + " - " + Util.to_unit(item["adjusted_net_profit_add"], 2, 0) + "'";
778
- adjusted_net_profit_qoq_ratio = Util.to_float(((item["adjusted_net_profit_add"] - item["qoq_adjusted_net_profit"]) / item["qoq_adjusted_net_profit"]) * 100, 2);
776
+ if (item.qoq_adjusted_net_profit) {
777
+ adjusted_net_profit_qoq_title = " title='" + Util.to_unit(item.qoq_adjusted_net_profit, 2, 0) + " - " + Util.to_unit(item.adjusted_net_profit_add, 2, 0) + "'";
778
+ adjusted_net_profit_qoq_ratio = Util.to_float(((item.adjusted_net_profit_add - item.qoq_adjusted_net_profit) / item.qoq_adjusted_net_profit) * 100, 2);
779
779
  adjusted_net_profit_qoq_ratio = Util.parse_ratio(adjusted_net_profit_qoq_ratio);
780
780
  }
781
781
  html.push("<td", adjusted_net_profit_qoq_title, ">", adjusted_net_profit_qoq_ratio, "</td>");
@@ -797,7 +797,7 @@ let Stock = {
797
797
  {"name": "人均持股市值", "table_sort": 1},
798
798
  ]
799
799
  });
800
- Util.post("/stock/" + Stock["code"], {action: "holder_num"}, function (j) {
800
+ Util.post("/stock/" + Stock.code, {action: "holder_num"}, function (j) {
801
801
  Stock["holder_chart"].hideLoading();
802
802
  let html = [], date_data = [], holder_data = [], price_data = [];
803
803
  let latest_date = 0, max_holder_num = 0, max_holder_num_date = 0, min_holder_num = Util.max_32bit_integer, min_holder_num_date = 0;
@@ -818,9 +818,9 @@ let Stock = {
818
818
  html.push("<tr>");
819
819
  html.push("<td>", date_format, "</td>");
820
820
  html.push("<td>", Util.digit_compare_trend(item.holder_num, item.pre_holder_num), "</td>");
821
- html.push("<td><b class='", Util.text_color(item["price_change"]), "'>", item.price, "(", item["price_change"], "%)</b></td>");
822
- html.push("<td>", item["avg_num"], "</td>");
823
- html.push("<td>", Util.to_unit(item["avg_num"] * item.price), "</td>");
821
+ html.push("<td><b class='", Util.text_color(item.price_change), "'>", item.price, "(", item.price_change, "%)</b></td>");
822
+ html.push("<td>", item.avg_num, "</td>");
823
+ html.push("<td>", Util.to_unit(item.avg_num * item.price), "</td>");
824
824
  html.push("</tr>");
825
825
  });
826
826
  let holder_num_summary = "";
@@ -829,22 +829,22 @@ let Stock = {
829
829
  if (j.latest_date > latest_date) {
830
830
  latest_date = latest_date_format;
831
831
  date_data.unshift(latest_date);
832
- holder_data.unshift(j["latest_holder_num"]);
833
- price_data.unshift(j["latest_day_price"]);
832
+ holder_data.unshift(j.latest_holder_num);
833
+ price_data.unshift(j.latest_day_price);
834
834
  } else {
835
835
  latest_date = Util.seconds_to_format(latest_date, "%Y-%m-%d");
836
836
  }
837
- if (j["latest_holder_num"] > max_holder_num) {
838
- max_holder_num = j["latest_holder_num"];
837
+ if (j.latest_holder_num > max_holder_num) {
838
+ max_holder_num = j.latest_holder_num;
839
839
  max_holder_num_date = latest_date_format;
840
840
  }
841
- if (j["latest_holder_num"] < min_holder_num) {
842
- min_holder_num = j["latest_holder_num"];
841
+ if (j.latest_holder_num < min_holder_num) {
842
+ min_holder_num = j.latest_holder_num;
843
843
  min_holder_num_date = latest_date_format;
844
844
  }
845
- max_holder_num = Math.max(max_holder_num, j["latest_holder_num"]);
846
- min_holder_num = Math.min(min_holder_num, j["latest_holder_num"]);
847
- holder_num_summary += "最新(" + latest_date + "):" + Util.digit_compare_trend(j["latest_holder_num"], j["previous_holder_num"]);
845
+ max_holder_num = Math.max(max_holder_num, j.latest_holder_num);
846
+ min_holder_num = Math.min(min_holder_num, j.latest_holder_num);
847
+ holder_num_summary += "最新(" + latest_date + "):" + Util.digit_compare_trend(j.latest_holder_num, j.previous_holder_num);
848
848
  }
849
849
  if (max_holder_num > 0) {
850
850
  holder_num_summary += "&nbsp;&nbsp;历史最多(" + max_holder_num_date + "):<b class='text-success'>" + max_holder_num + "</b>&nbsp;&nbsp;历史最少(" + min_holder_num_date + "):<b class='text-danger'>" + min_holder_num + "<b>";
@@ -871,7 +871,7 @@ let Stock = {
871
871
  });
872
872
  let symbol = Util.code_to_symbol(Stock.code).toLowerCase();
873
873
  $("#notice_url").attr("href", "https://vip.stock.finance.sina.com.cn/corp/view/vCB_BulletinGather.php?stock_str=" + symbol);
874
- Util.post("/stock/" + Stock["code"], {action: "notice"}, function (j) {
874
+ Util.post("/stock/" + Stock.code, {action: "notice"}, function (j) {
875
875
  let html = [];
876
876
  j.data.forEach(function (item, index) {
877
877
  html.push("<tr title='", item.title, "'>");
@@ -889,7 +889,7 @@ let Stock = {
889
889
  let html = [];
890
890
  html.push("<option value=''>年度报告</option>");
891
891
  j.data.forEach(function (item) {
892
- html.push("<option value='", item.url, "'>", item["year"], "年度报告</option>");
892
+ html.push("<option value='", item.url, "'>", item.year, "年度报告</option>");
893
893
  });
894
894
  let report_obj = $("#report");
895
895
  report_obj.html(html.join(""));
@@ -919,16 +919,16 @@ let Stock = {
919
919
  {"name": "价格变化", "table_sort": 1},
920
920
  ]
921
921
  });
922
- Util.post("/stock/" + Stock["code"], {action: "report_organization"}, function (j) {
922
+ Util.post("/stock/" + Stock.code, {action: "report_organization"}, function (j) {
923
923
  let html = [];
924
924
  j.data.forEach(function (item, i) {
925
925
  html.push("<tr title='", item.title, "'>");
926
926
  html.push("<td>", i + 1, "</td>");
927
- html.push("<td>", Util.pack_html_link("https://data.eastmoney.com/report/info/" + item["id"] + ".html", Util.substring(item.title, 70)), "</td>");
927
+ html.push("<td>", Util.pack_html_link("https://data.eastmoney.com/report/info/" + item.id + ".html", Util.substring(item.title, 70)), "</td>");
928
928
  html.push("<td>", item.organization, "</td>");
929
929
  html.push("<td>", item.analysts, "</td>");
930
930
  html.push("<td>", Util.seconds_to_format(item.ctime, "%Y-%m-%d"), "</td>");
931
- html.push("<td>", Util.digit_compare_trend1(Stock["price"], item["day_price"]), "</td>");
931
+ html.push("<td>", Util.digit_compare_trend1(Stock.price, item.day_price), "</td>");
932
932
  html.push("</tr>");
933
933
  });
934
934
  Util.render_table_html("report_organization_table_body", html);
@@ -949,7 +949,7 @@ let Stock = {
949
949
  }
950
950
  let metrics_drop_down_btn_id = metrics + "_btn_" + date_type;
951
951
  let interval = parseInt($("#" + metrics_drop_down_btn_id).text());
952
- Util.post("/stock/" + Stock["code"], {
952
+ Util.post("/stock/" + Stock.code, {
953
953
  action: "metrics_statistics",
954
954
  metrics: metrics,
955
955
  date_type: date_type,
@@ -966,10 +966,10 @@ let Stock = {
966
966
  price_data.push(item.price);
967
967
  color_data.push("#E74C3C");
968
968
  });
969
- if (j["current"] && j["current"]["value"] && j["current"]["value"] > 0) {
970
- date_data.push(j["current"]["date"]);
971
- value_data.push(j["current"]["value"]);
972
- price_data.push(j["current"]["price"]);
969
+ if (j.current && j.current.value && j.current.value > 0) {
970
+ date_data.push(j.current.date);
971
+ value_data.push(j.current.value);
972
+ price_data.push(j.current.price);
973
973
  color_data.push("#C9CBCF");
974
974
  }
975
975
  let title = Util.strip_bracket_string($("#" + metrics + "_title").text());
@@ -1028,8 +1028,8 @@ let Stock = {
1028
1028
  }
1029
1029
  });
1030
1030
  }
1031
- if (j["interval_week"]) {
1032
- $("#" + metrics + "_tips").html("<b class='text-success'>(创连续" + j["interval_week"] + "周成交额最低)<b>");
1031
+ if (j.interval_week) {
1032
+ $("#" + metrics + "_tips").html("<b class='text-success'>(创连续" + j.interval_week + "周成交额最低)<b>");
1033
1033
  }
1034
1034
  Util.hide_tips();
1035
1035
  });
@@ -1037,25 +1037,25 @@ let Stock = {
1037
1037
 
1038
1038
  fetch_bias_data: function () {
1039
1039
  Util.show_loading();
1040
- Util.post("/stock/" + Stock["code"], {action: "bias"}, function (j) {
1040
+ Util.post("/stock/" + Stock.code, {action: "bias"}, function (j) {
1041
1041
  let date_data = [], bias20_data = [], bias60_data = [], bias120_data = [], price_data = [], color_data = [];
1042
1042
  let current_date = 0, current_bias20 = 0, current_bias60 = 0, current_bias120 = 0;
1043
1043
  j.data.forEach(function (item) {
1044
1044
  if (item.date > current_date) {
1045
1045
  current_date = item.date;
1046
- current_bias20 = item["bias20"];
1047
- current_bias60 = item["bias60"];
1048
- current_bias120 = item["bias120"];
1046
+ current_bias20 = item.bias20;
1047
+ current_bias60 = item.bias60;
1048
+ current_bias120 = item.bias120;
1049
1049
  }
1050
1050
  date_data.push(Util.seconds_to_format(item.date, "%Y-%m-%d"));
1051
- bias20_data.push(item["bias20"]);
1052
- bias60_data.push(item["bias60"]);
1053
- bias120_data.push(item["bias120"]);
1051
+ bias20_data.push(item.bias20);
1052
+ bias60_data.push(item.bias60);
1053
+ bias120_data.push(item.bias120);
1054
1054
  price_data.push(item.price);
1055
1055
  color_data.push("#C9CBCF");
1056
1056
  });
1057
1057
  Stock["bias_chart"] = Util.bias_bar_line(Stock["bias_chart"], "bias_line_chart", date_data, bias120_data, color_data, bias20_data, bias60_data, price_data);
1058
- $("#bias_summary").html("当前120日乖离率:" + Util.label_text_color(current_bias120) + ", 60日乖离率:" + Util.label_text_color(current_bias60) + ", 20日乖离率:" + Util.label_text_color(current_bias20) + ",20日最高乖离率:" + Util.label_text_color(j["max_bias20"]) + "(" + Util.seconds_to_format(j["max_bias20_date"], "%Y-%m-%d") + "),20日最低乖离率:" + Util.label_text_color(j["min_bias20"]) + "(" + Util.seconds_to_format(j["min_bias20_date"], "%Y-%m-%d") + ")");
1058
+ $("#bias_summary").html("当前120日乖离率:" + Util.label_text_color(current_bias120) + ", 60日乖离率:" + Util.label_text_color(current_bias60) + ", 20日乖离率:" + Util.label_text_color(current_bias20) + ",20日最高乖离率:" + Util.label_text_color(j.max_bias20) + "(" + Util.seconds_to_format(j.max_bias20_date, "%Y-%m-%d") + "),20日最低乖离率:" + Util.label_text_color(j.min_bias20) + "(" + Util.seconds_to_format(j.min_bias20_date, "%Y-%m-%d") + ")");
1059
1059
  Util.hide_tips();
1060
1060
  });
1061
1061
  },
@@ -1066,7 +1066,7 @@ let Stock = {
1066
1066
  */
1067
1067
  fetch_margin: function () {
1068
1068
  Stock["rzye_chart"] = Util.show_chart_loading(Stock["rzye_chart"], "rzye_line_canvas");
1069
- let margin_url = "https://data.10jqka.com.cn/market/rzrqgg/code/" + Stock["code"];
1069
+ let margin_url = "https://data.10jqka.com.cn/market/rzrqgg/code/" + Stock.code;
1070
1070
  $("#margin_panel_title").html(Util.pack_html_link(margin_url, "[" + Stock.name + "]融资余额"));
1071
1071
  let payload = {
1072
1072
  action: "margin",
@@ -1074,30 +1074,30 @@ let Stock = {
1074
1074
  start_date: $("#margin_start_date").val(),
1075
1075
  end_date: $("#margin_end_date").val()
1076
1076
  };
1077
- Util.post("/stock/" + Stock["code"], payload, function (j) {
1077
+ Util.post("/stock/" + Stock.code, payload, function (j) {
1078
1078
  Stock["rzye_chart"].hideLoading();
1079
1079
  let date_data = [], rzye_data = [], rqye_data = [], price_data = [], rqye_color_data = [], rzye_low = Number.MAX_SAFE_INTEGER, rzye_high = 0, rqye_low = Number.MAX_SAFE_INTEGER, rqye_high = 0;
1080
1080
  let latest_date = 0, margin_summary = "", rqye_summary = "";
1081
1081
  j.data.forEach(function (item) {
1082
1082
  latest_date = Math.max(latest_date, item.date);
1083
1083
  date_data.push(Util.seconds_to_format(item.date, "%Y-%m-%d"));
1084
- rzye_low = Math.min(rzye_low, item["rzye"]);
1085
- rzye_high = Math.max(rzye_high, item["rzye"]);
1086
- rzye_data.push(Util.to_hundred_million(item["rzye"], 3));
1087
- rqye_low = Math.min(rqye_low, item["rqye"]);
1088
- rqye_high = Math.max(rqye_high, item["rqye"]);
1089
- rqye_data.push(Util.to_ten_thousand(item["rqye"], 3));
1084
+ rzye_low = Math.min(rzye_low, item.rzye);
1085
+ rzye_high = Math.max(rzye_high, item.rzye);
1086
+ rzye_data.push(Util.to_hundred_million(item.rzye, 3));
1087
+ rqye_low = Math.min(rqye_low, item.rqye);
1088
+ rqye_high = Math.max(rqye_high, item.rqye);
1089
+ rqye_data.push(Util.to_ten_thousand(item.rqye, 3));
1090
1090
  price_data.push(item.price);
1091
1091
  rqye_color_data.push("#E74C3C");
1092
1092
  });
1093
1093
  latest_date = Util.seconds_to_format(latest_date, "%Y-%m-%d");
1094
1094
  $("#stock_margin_url").attr("href", Util.get_url("trend_margin") + "?start_date=" + latest_date + "&end_date=" + latest_date);
1095
- if (j["latest"].length > 0) {
1096
- if (j["latest"].length === 1) {
1097
- margin_summary = " 最新融资余额(" + Util.seconds_to_format(j["latest"][0]["date"], "%Y-%m-%d") + "): " + Util.to_unit(j["latest"][0]["rzye"], 3);
1098
- rqye_summary = " 最新融券余额(" + Util.seconds_to_format(j["latest"][0]["date"], "%Y-%m-%d") + "): " + Util.to_unit(j["latest"][0]["rqye"], 3);
1099
- } else if (j["latest"].length === 2) {
1100
- let d1 = j["latest"][0], d2 = j["latest"][1], rzye_dist_tips = "", rqye_dist_tips = "";
1095
+ if (j.latest.length > 0) {
1096
+ if (j.latest.length === 1) {
1097
+ margin_summary = " 最新融资余额(" + Util.seconds_to_format(j.latest[0]["date"], "%Y-%m-%d") + "): " + Util.to_unit(j.latest[0]["rzye"], 3);
1098
+ rqye_summary = " 最新融券余额(" + Util.seconds_to_format(j.latest[0]["date"], "%Y-%m-%d") + "): " + Util.to_unit(j.latest[0]["rqye"], 3);
1099
+ } else if (j.latest.length === 2) {
1100
+ let d1 = j.latest[0], d2 = j.latest[1], rzye_dist_tips = "", rqye_dist_tips = "";
1101
1101
  let rzye_difference = d1["rzye"] - d2["rzye"];
1102
1102
  if (rzye_difference > 0) {
1103
1103
  rzye_dist_tips = "(<b title='" + Util.to_unit(d2["rzye"], 3, 0) + "' style='color: #a94442;'>+" + Util.to_unit(rzye_difference, 3, 0) + "</b>)";
@@ -1115,29 +1115,29 @@ let Stock = {
1115
1115
  }
1116
1116
  }
1117
1117
  margin_summary += ' 当前最高: <span style="color: #FFF;" class="label label-danger">' + Util.to_unit(rzye_high, 3, 0) + '</span> 当前最低: <span style="color: #FFF;" class="label label-success">' + Util.to_unit(rzye_low, 3, 0) + "</span>";
1118
- if (j["rzye_high"] && j["rzye_high"]["date"] && j["rzye_high"]["date"] > 0) {
1119
- margin_summary += ' 历史最高: <span style="color: #FFF;" class="label label-danger">' + Util.to_unit(j["rzye_high"]["rzye"], 3, 0) + '</span>(' + Util.seconds_to_format(j["rzye_high"]["date"], "%Y-%m-%d") + ')';
1118
+ if (j.rzye_high && j.rzye_high.date && j.rzye_high.date > 0) {
1119
+ margin_summary += ' 历史最高: <span style="color: #FFF;" class="label label-danger">' + Util.to_unit(j.rzye_high.rzye, 3, 0) + '</span>(' + Util.seconds_to_format(j.rzye_high.date, "%Y-%m-%d") + ')';
1120
1120
  }
1121
- if (j["rzye_low"] && j["rzye_low"]["date"] && j["rzye_low"]["date"] > 0) {
1122
- margin_summary += ' 历史最低: <span style="color: #FFF;" class="label label-success">' + Util.to_unit(j["rzye_low"]["rzye"], 3, 0) + '</span>(' + Util.seconds_to_format(j["rzye_low"]["date"], "%Y-%m-%d") + ')';
1121
+ if (j.rzye_low && j.rzye_low.date && j.rzye_low.date > 0) {
1122
+ margin_summary += ' 历史最低: <span style="color: #FFF;" class="label label-success">' + Util.to_unit(j.rzye_low.rzye, 3, 0) + '</span>(' + Util.seconds_to_format(j.rzye_low.date, "%Y-%m-%d") + ')';
1123
1123
  }
1124
- if (j["less_rate"]) {
1125
- margin_summary += '&nbsp;&nbsp;当前最新融资余额超过历史 <span style="color: #FFF;" class="label label-info">' + j["less_rate"] + '%</span> 分位水平';
1124
+ if (j.less_rate) {
1125
+ margin_summary += '&nbsp;&nbsp;当前最新融资余额超过历史 <span style="color: #FFF;" class="label label-info">' + j.less_rate + '%</span> 分位水平';
1126
1126
  }
1127
1127
  $("#margin_summary").html(margin_summary);
1128
1128
  Stock["rzye_chart"] = Util.multi_axis_line(Stock["rzye_chart"], "rzye_line_canvas", date_data, '融资余额(单位:亿)', rzye_data, '股价', price_data);
1129
1129
  rqye_summary += ' 当前最高: <span style="color: #FFF;" class="label label-danger">' + Util.to_unit(rqye_high, 3, 0) + '</span> 当前最低: <span style="color: #FFF;" class="label label-success">' + Util.to_unit(rqye_low, 3, 0) + "</span>";
1130
- if (j["rqye_high"] && j["rqye_high"]["date"] && j["rqye_high"]["date"] > 0) {
1131
- rqye_summary += ' 历史最高: <span style="color: #FFF;" class="label label-danger">' + Util.to_unit(j["rqye_high"]["rqye"], 3, 0) + '</span>(' + Util.seconds_to_format(j["rqye_high"]["date"], "%Y-%m-%d") + ')';
1130
+ if (j.rqye_high && j.rqye_high.date && j.rqye_high.date > 0) {
1131
+ rqye_summary += ' 历史最高: <span style="color: #FFF;" class="label label-danger">' + Util.to_unit(j.rqye_high.rqye, 3, 0) + '</span>(' + Util.seconds_to_format(j.rqye_high.date, "%Y-%m-%d") + ')';
1132
1132
  }
1133
- if (j["rqye_low"] && j["rqye_low"]["date"] && j["rqye_low"]["date"] > 0) {
1134
- rqye_summary += ' 历史最低: <span style="color: #FFF;" class="label label-success">' + Util.to_unit(j["rqye_low"]["rqye"], 3, 0) + '</span>(' + Util.seconds_to_format(j["rqye_low"]["date"], "%Y-%m-%d") + ')';
1133
+ if (j.rqye_low && j.rqye_low.date && j.rqye_low.date > 0) {
1134
+ rqye_summary += ' 历史最低: <span style="color: #FFF;" class="label label-success">' + Util.to_unit(j.rqye_low.rqye, 3, 0) + '</span>(' + Util.seconds_to_format(j.rqye_low.date, "%Y-%m-%d") + ')';
1135
1135
  }
1136
1136
  $("#rqye_summary").html(" [" + rqye_summary + " ]");
1137
1137
  Stock["rqye_chart"] = Util.chart_bar_line(Stock["rqye_chart"], "rqye_line_canvas", date_data, rqye_data, '融券余额(单位:万)', rqye_color_data, price_data, '股价');
1138
1138
  let flow_data = [], color_data = [];
1139
1139
  date_data = [];
1140
- j["flow_data"].forEach(function (item) {
1140
+ j.flow_data.forEach(function (item) {
1141
1141
  if (item.value !== 0) {
1142
1142
  date_data.push(item.date);
1143
1143
  flow_data.push(Util.to_ten_thousand(item.value, 2));
@@ -1174,17 +1174,17 @@ let Stock = {
1174
1174
  {"name": "涨跌", "table_sort": 1},
1175
1175
  ]
1176
1176
  });
1177
- Util.post("/stock/" + Stock["code"], {action: "margin_detail"}, function (j) {
1177
+ Util.post("/stock/" + Stock.code, {action: "margin_detail"}, function (j) {
1178
1178
  let html = [];
1179
1179
  j.data.forEach(function (item, index) {
1180
1180
  html.push("<tr>");
1181
1181
  html.push("<td>", Util.seconds_to_format(item.date, "%Y-%m-%d"), "</td>");
1182
- html.push("<td title='", item["rzye"], "' data-val='", item["rzye"], "'>", Util.to_unit(item["rzye"], 3), "</td>");
1183
- html.push("<td title='", item["rzmre"], "' data-val='", item["rzmre"], "'>", Util.to_unit(item["rzmre"], 3), "</td>");
1184
- html.push("<td title='", item["rzche"], "' data-val='", item["rzche"], "'>", Util.to_unit(item["rzche"], 3), "</td>");
1182
+ html.push("<td title='", item.rzye, "' data-val='", item.rzye, "'>", Util.to_unit(item.rzye, 3), "</td>");
1183
+ html.push("<td title='", item.rzmre, "' data-val='", item.rzmre, "'>", Util.to_unit(item.rzmre, 3), "</td>");
1184
+ html.push("<td title='", item.rzche, "' data-val='", item.rzche, "'>", Util.to_unit(item.rzche, 3), "</td>");
1185
1185
  let net_rzye = "--", gap_rzye = 0;
1186
1186
  if (j.data[index + 1] && j.data[index + 1]["rzye"]) {
1187
- gap_rzye = item["rzye"] - j.data[index + 1]["rzye"];
1187
+ gap_rzye = item.rzye - j.data[index + 1]["rzye"];
1188
1188
  if (gap_rzye > 0) {
1189
1189
  net_rzye = "<b class='text-danger'>+" + Util.to_unit(gap_rzye, 3) + "</b>";
1190
1190
  } else if (gap_rzye < 0) {
@@ -1192,8 +1192,8 @@ let Stock = {
1192
1192
  }
1193
1193
  }
1194
1194
  html.push("<td title='", gap_rzye, "' data-val='", gap_rzye, "'>", net_rzye, "</td>");
1195
- html.push("<td title='", item["rqye"], "' data-val='", item["rqye"], "'>", (item["rqye"] > 0 ? Util.to_unit(item["rqye"], 3) : "--"), "</td>");
1196
- html.push("<td title='", item["rqyl"], "' data-val='", item["rqyl"], "'>", Util.to_unit(item["rqyl"], 3), "</td>");
1195
+ html.push("<td title='", item.rqye, "' data-val='", item.rqye, "'>", (item.rqye > 0 ? Util.to_unit(item.rqye, 3) : "--"), "</td>");
1196
+ html.push("<td title='", item.rqyl, "' data-val='", item.rqyl, "'>", Util.to_unit(item.rqyl, 3), "</td>");
1197
1197
  let text_color = Util.text_color(item.p_change);
1198
1198
  html.push("<td><b class='", text_color, "'>", item.close, "</b></td>");
1199
1199
  item.p_change = item.p_change > 0 ? ("+" + Util.to_float(item.p_change, 2)) : Util.to_float(item.p_change, 2);
@@ -1229,7 +1229,7 @@ let Stock = {
1229
1229
  start_date: $("#hkex_start_date").val(),
1230
1230
  end_date: $("#hkex_end_date").val()
1231
1231
  };
1232
- Util.post("/stock/" + Stock["code"], payload, function (j) {
1232
+ Util.post("/stock/" + Stock.code, payload, function (j) {
1233
1233
  Stock["hkex_holding_chart"].hideLoading();
1234
1234
  let date_data = [], volume_data = [], price_data = [];
1235
1235
  j.data.forEach(function (item) {
@@ -1237,13 +1237,13 @@ let Stock = {
1237
1237
  volume_data.push(item.volume);
1238
1238
  price_data.push(item.price);
1239
1239
  });
1240
- let hkex_holding_summary = "[" + Util.pack_html_link(j["url"] + "&code=" + Stock["code"] + "&name=" + Stock["name"], Stock["name"]) + "]";
1241
- if (j["latest"].length > 0) {
1242
- let latest_html = "最新(" + Util.seconds_to_format(j["latest"][0]["date"], "%Y-%m-%d") + "): <span style='color: #FFF;' class='label label-info'>" + Util.to_hundred_million(j["latest"][0]["volume"], 4) + "</span>亿股";
1240
+ let hkex_holding_summary = "[" + Util.pack_html_link(j.url + "&code=" + Stock.code + "&name=" + Stock["name"], Stock["name"]) + "]";
1241
+ if (j.latest.length > 0) {
1242
+ let latest_html = "最新(" + Util.seconds_to_format(j.latest[0]["date"], "%Y-%m-%d") + "): <span style='color: #FFF;' class='label label-info'>" + Util.to_hundred_million(j.latest[0]["volume"], 4) + "</span>亿股";
1243
1243
  let dist_tips = "";
1244
- if (j["latest"].length === 2) {
1245
- let d1 = j["latest"][0];
1246
- let d2 = j["latest"][1];
1244
+ if (j.latest.length === 2) {
1245
+ let d1 = j.latest[0];
1246
+ let d2 = j.latest[1];
1247
1247
  let difference = d1["volume"] - d2["volume"];
1248
1248
  if (difference > 0) {
1249
1249
  dist_tips = "(<b title='" + Util.to_unit(d2["volume"], 2, 0) + "股' style='color: #a94442;'>+" + Util.to_unit(difference, 2, 0) + "股</b>)";
@@ -1251,15 +1251,15 @@ let Stock = {
1251
1251
  dist_tips = "(<b title='" + Util.to_unit(d2["volume"], 2, 0) + "股' style='color: #3c763d;'>" + Util.to_unit(difference, 2, 0) + "股</b>)";
1252
1252
  }
1253
1253
  }
1254
- latest_html += dist_tips + ", 占 <span style='color: #FFF;' class='label label-info'>" + j["latest"][0]["ratio"] + "%</span> 流通股, ";
1255
- hkex_holding_summary += (latest_html + ' 最高: <span style="color: #FFF;" class="label label-danger">' + Util.to_unit(j["high"]["volume"], 2, 0) + '股</span>(' + Util.seconds_to_format(j["high"]["date"], "%Y-%m-%d") +
1256
- ') 最低: <span style="color: #FFF;" class="label label-success">' + Util.to_unit(j["low"]["volume"], 2, 0) + '股</span>(' + Util.seconds_to_format(j["low"]["date"], "%Y-%m-%d") + ')');
1254
+ latest_html += dist_tips + ", 占 <span style='color: #FFF;' class='label label-info'>" + j.latest[0]["ratio"] + "%</span> 流通股, ";
1255
+ hkex_holding_summary += (latest_html + ' 最高: <span style="color: #FFF;" class="label label-danger">' + Util.to_unit(j.high.volume, 2, 0) + '股</span>(' + Util.seconds_to_format(j.high.date, "%Y-%m-%d") +
1256
+ ') 最低: <span style="color: #FFF;" class="label label-success">' + Util.to_unit(j.low.volume, 2, 0) + '股</span>(' + Util.seconds_to_format(j.low.date, "%Y-%m-%d") + ')');
1257
1257
  }
1258
1258
  $("#hkex_holding_summary").html(hkex_holding_summary);
1259
1259
  Stock["hkex_holding_chart"] = Util.multi_axis_line(Stock["hkex_holding_chart"], "hkex_holding_line_canvas", date_data, '持股数', volume_data, '股价', price_data);
1260
1260
  let flow_data = [], color_data = [];
1261
1261
  date_data = [];
1262
- j["flow_data"].forEach(function (item) {
1262
+ j.flow_data.forEach(function (item) {
1263
1263
  date_data.push(item.date);
1264
1264
  flow_data.push(item.value);
1265
1265
  color_data.push(item.value > 0 ? "#E74C3C" : "#1ABB9C");
@@ -1291,7 +1291,7 @@ let Stock = {
1291
1291
  {"name": "持股比例", "table_sort": 1, "title": "内地港股通账户持仓股数 / 流通股本数"},
1292
1292
  ]
1293
1293
  });
1294
- Util.post("/stock/" + Stock["code"], {action: "hk_mutual"}, function (j) {
1294
+ Util.post("/stock/" + Stock.code, {action: "hk_mutual"}, function (j) {
1295
1295
  let html = [];
1296
1296
  j.data.forEach(function (item, index) {
1297
1297
  html.push("<tr>");