sbd-npm 1.4.94 → 1.4.96

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
@@ -174,33 +174,33 @@ let Stock = {
174
174
  Stock.hist_end_date = Util.seconds_to_format(item["latest_date"], "%Y-%m-%d");
175
175
  Stock.hist_start_date = Util.seconds_to_format(item["latest_date"] - 60 * Util.one_day_second, "%Y-%m-%d");
176
176
  }
177
- item["price"] = (item["price"] && item["price"] > 0) ? item["price"] : parseFloat($("#price").html());
178
- Stock.price = item["price"];
179
- $("#price").html(Util.digit_compare_trend(item["price"], item["pre_close"]));
180
- $("#year_price").html(Util.year_price_rate(item["price"], item["year_price"]));
177
+ item.price = (item.price && item.price > 0) ? item.price : parseFloat($("#price").html());
178
+ Stock.price = item.price;
179
+ $("#price").html(Util.digit_compare_trend(item.price, item.pre_close));
180
+ $("#year_price").html(Util.year_price_rate(item.price, item.year_price));
181
181
  let high_52week = $("#high_52week");
182
- high_52week.html(Util.digit_compare_trend(high_52week.text(), item["price"]));
182
+ high_52week.html(Util.digit_compare_trend(high_52week.text(), item.price));
183
183
  let low_52week = $("#low_52week");
184
- low_52week.html(Util.digit_compare_trend(low_52week.text(), item["price"]));
184
+ low_52week.html(Util.digit_compare_trend(low_52week.text(), item.price));
185
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"]));
187
+ high_history.html(Util.digit_compare_trend(item["high_history"]["close"], item.price));
188
188
  high_history.attr("title", Util.seconds_to_format(item["high_history"]["date"], "%Y-%m-%d"))
189
189
  }
190
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"]));
192
+ low_history.html(Util.digit_compare_trend(item["low_history"]["close"], item.price));
193
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 = [];
197
- if (item["is_bull_trend"]) {
197
+ if (item.is_bull_trend) {
198
198
  remark_html.push("<a class='btn btn-xs btn-danger' href='" + Util.get_url("trend_bull_trend") + "'>多头趋势</a>");
199
199
  }
200
- if (item["is_kdj_cross"]) {
200
+ if (item.is_kdj_cross) {
201
201
  remark_html.push("<a class='btn btn-xs btn-danger' href='" + Util.get_url("trend_kdj") + "'>KDJ金叉</a>");
202
202
  }
203
- if (item["is_macd_cross"]) {
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
206
  if (item["is_margin_minimum"]) {
@@ -210,8 +210,8 @@ let Stock = {
210
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>");
@@ -314,28 +314,28 @@ let Stock = {
314
314
  }
315
315
  Stock.hist_type = "";
316
316
  let html = [], hist_low_price = 0, hist_high_price = 0, total_amount = 0, total_volume = 0;
317
- j["data"].forEach(function (item) {
318
- if (hist_low_price === 0 || hist_low_price > item["low"]) {
319
- hist_low_price = item["low"];
317
+ j.data.forEach(function (item) {
318
+ if (hist_low_price === 0 || hist_low_price > item.low) {
319
+ hist_low_price = item.low;
320
320
  }
321
- hist_high_price = Math.max(hist_high_price, item["high"]);
322
- total_amount += item["amount"];
323
- total_volume += item["volume"] * 100;
321
+ hist_high_price = Math.max(hist_high_price, item.high);
322
+ total_amount += item.amount;
323
+ total_volume += item.volume * 100;
324
324
  html.push("<tr>");
325
- let tick_time = Util.seconds_to_format(item["date"], "%Y%m%d");
325
+ let tick_time = Util.seconds_to_format(item.date, "%Y%m%d");
326
326
  let tick_url = "/tick?c=" + Stock.code + "&s=" + tick_time + "&e=" + tick_time;
327
- html.push("<td><a href='", tick_url, "'>", Util.seconds_to_format(item["date"], "%Y-%m-%d"), "</a></td>");
328
- html.push("<td>", item["open"], "</td>");
329
- html.push("<td class='price_low'>", item["low"], "</td>");
330
- html.push("<td class='price_high'>", item["high"], "</td>");
331
- let cls = Util.text_color(item["p_change"]);
332
- html.push("<td><b class='", cls, "'>", item["close"], "</b></td>");
333
- html.push("<td><b class='", cls, "'>", item["p_change"], "%</b></td>");
334
- html.push("<td>", Util.to_float(item["amount"] / (item["volume"] * 100), 2), "</td>");
335
- html.push("<td class='volume-td'>", Util.to_float(item["volume"] / 10000, 2), "万手</td>");
336
- html.push("<td class='volume_ratio-td'>", item["volume_ratio"], "</td>");
327
+ html.push("<td><a href='", tick_url, "'>", Util.seconds_to_format(item.date, "%Y-%m-%d"), "</a></td>");
328
+ html.push("<td>", item.open, "</td>");
329
+ html.push("<td class='price_low'>", item.low, "</td>");
330
+ html.push("<td class='price_high'>", item.high, "</td>");
331
+ let cls = Util.text_color(item.p_change);
332
+ html.push("<td><b class='", cls, "'>", item.close, "</b></td>");
333
+ html.push("<td><b class='", cls, "'>", item.p_change, "%</b></td>");
334
+ html.push("<td>", Util.to_float(item.amount / (item.volume * 100), 2), "</td>");
335
+ html.push("<td class='volume-td'>", Util.to_float(item.volume / 10000, 2), "万手</td>");
336
+ html.push("<td class='volume_ratio-td'>", item.volume_ratio, "</td>");
337
337
  html.push("<td class='volume_ratio30-td'>", (item["volume_ratio30"] ? item["volume_ratio30"] : "--"), "</td>");
338
- html.push("<td class='amount-td'>", Util.to_hundred_million(item["amount"]), "亿</td>");
338
+ html.push("<td class='amount-td'>", Util.to_hundred_million(item.amount), "亿</td>");
339
339
  html.push("<td>", (item["turnover"] > 0 ? (item["turnover"] + "%") : "--"), "</td>");
340
340
  html.push("</tr>");
341
341
  });
@@ -411,9 +411,9 @@ let Stock = {
411
411
  ]
412
412
  });
413
413
  Util.post("/stock/" + Stock.code, {action: "big_deal"}, function (j) {
414
- if (j["data"] && j["data"]["date"]) {
415
- let date = j["data"]["date"];
416
- //Stock.pack_big_deal("big_deal1", j["data"], "最近一天", date, date);
414
+ if (j.data && j.data["date"]) {
415
+ let date = j.data["date"];
416
+ //Stock.pack_big_deal("big_deal1", j.data, "最近一天", date, date);
417
417
  }
418
418
  if (j["money_net_inflow"]) {
419
419
  let html = [], i = 0, total_net_inflow = 0;
@@ -437,15 +437,15 @@ let Stock = {
437
437
  day60_net_inflow += item["main_net_inflow"];
438
438
  }
439
439
  html.push("<tr>");
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>");
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
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
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
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
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
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
- html.push("<td class='volume-td'>", Util.to_float(item["volume"] / 10000, 2), "万手</td>");
448
- html.push("<td class='amount-td'>", Util.to_hundred_million(item["amount"]), "亿</td>");
447
+ html.push("<td class='volume-td'>", Util.to_float(item.volume / 10000, 2), "万手</td>");
448
+ html.push("<td class='amount-td'>", Util.to_hundred_million(item.amount), "亿</td>");
449
449
  html.push("</tr>");
450
450
  });
451
451
  Util.render_table_html("big_deal_table_body", html);
@@ -503,12 +503,12 @@ let Stock = {
503
503
  let payload = {action: "top_holder"};
504
504
  let date = $("#holder_top_date").val();
505
505
  if (date) {
506
- payload["date"] = date;
506
+ payload.date = date;
507
507
  }
508
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
- j["data"].forEach(function (item) {
511
+ j.data.forEach(function (item) {
512
512
  let change = item["change"];
513
513
  if (change === "None") {
514
514
  change = "<b class='text-danger'>新增</b>";
@@ -519,33 +519,33 @@ let Stock = {
519
519
  } else if (parseFloat(change) < 0) {
520
520
  change = "<b class='text-success'>" + change + "%</b>";
521
521
  }
522
- if (parseInt(item["type"]) === 1) {
523
- main_volume += item["volume"];
522
+ if (parseInt(item.type) === 1) {
523
+ main_volume += item.volume;
524
524
  main_html.push("<tr>");
525
- main_html.push("<td>", item["rank"], "</td>");
525
+ main_html.push("<td>", item.rank, "</td>");
526
526
  main_html.push("<td>", item["holder_name"], "</td>");
527
- main_html.push("<td>", Util.to_unit(item["volume"]), "</td>");
528
- main_html.push("<td>", Util.to_unit(item["volume"] * Stock.price), "</td>");
527
+ main_html.push("<td>", Util.to_unit(item.volume), "</td>");
528
+ main_html.push("<td>", Util.to_unit(item.volume * Stock.price), "</td>");
529
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
- circulation_volume += item["volume"];
533
+ circulation_volume += item.volume;
534
534
  circulation_html.push("<tr>");
535
- circulation_html.push("<td>", item["rank"], "</td>");
535
+ circulation_html.push("<td>", item.rank, "</td>");
536
536
  circulation_html.push("<td>", item["holder_name"], "</td>");
537
- circulation_html.push("<td>", Util.to_unit(item["volume"]), "</td>");
538
- circulation_html.push("<td>", Util.to_unit(item["volume"] * Stock.price), "</td>");
537
+ circulation_html.push("<td>", Util.to_unit(item.volume), "</td>");
538
+ circulation_html.push("<td>", Util.to_unit(item.volume * Stock.price), "</td>");
539
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
544
  j["pre_data"].forEach(function (item) {
545
- if (parseInt(item["type"]) === 1) {
546
- pre_main_volume += item["volume"];
545
+ if (parseInt(item.type) === 1) {
546
+ pre_main_volume += item.volume;
547
547
  } else {
548
- pre_circulation_volume += item["volume"];
548
+ pre_circulation_volume += item.volume;
549
549
  }
550
550
  });
551
551
  let circulation_tips = "", main_tips = "";
@@ -659,7 +659,7 @@ let Stock = {
659
659
  total_free_cash_flow += free_cash_flow;
660
660
  total_ncf_from_fa += item["ncf_from_fa"];
661
661
  html.push("<tr>");
662
- html.push("<td>", Util.seconds_to_format(item["date"], "%Y"), "</td>");
662
+ html.push("<td>", Util.seconds_to_format(item.date, "%Y"), "</td>");
663
663
  html.push("<td>", Util.to_unit(item["ncf_from_oa"]), "</td>");
664
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>");
@@ -675,12 +675,12 @@ let Stock = {
675
675
  // 资产负债表
676
676
  html = [];
677
677
  j["assets_liabilities_data"].forEach(function (item) {
678
- let net_assets = item["total_assets"] - item["total_liabilities"];
678
+ let net_assets = item.total_assets - item.total_liabilities;
679
679
  let goodwill = "--";
680
680
  let goodwill_rate = "--";
681
- if (item["goodwill"] > 0) {
682
- goodwill = Util.to_unit(item["goodwill"]);
683
- goodwill_rate = Util.to_float((item["goodwill"] / net_assets) * 100, 2) + "%";
681
+ if (item.goodwill > 0) {
682
+ goodwill = Util.to_unit(item.goodwill);
683
+ goodwill_rate = Util.to_float((item.goodwill / net_assets) * 100, 2) + "%";
684
684
  }
685
685
  let debt_asset_ratio = "--";
686
686
  if (item["debt_asset_ratio"] > 0) {
@@ -688,8 +688,8 @@ let Stock = {
688
688
  }
689
689
  html.push("<tr>");
690
690
  html.push("<td>", item["year"], "(", item["quarter"], ")</td>");
691
- html.push("<td>", Util.to_unit(item["total_assets"]), "</td>");
692
- html.push("<td>", Util.to_unit(item["total_liabilities"]), "</td>");
691
+ html.push("<td>", Util.to_unit(item.total_assets), "</td>");
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
695
  html.push("<td>", Util.to_unit(item["currency_funds"]), "</td>");
@@ -722,21 +722,21 @@ 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"]);
725
+ item["quarter"] = Util.get_quarter(item.date);
726
726
  if (quarter === 0 || quarter === item["quarter"]) {
727
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>");
730
- html.push("<td>", item["net_profit_rate"], "%</td>");
731
- html.push("<td>", Util.to_float(item["gross_profit_rate"], 2), "%</td>");
729
+ html.push("<td>", Util.get_year(item.date), "-", item["quarter"], "</td>");
730
+ html.push("<td>", item.net_profit_rate, "%</td>");
731
+ html.push("<td>", Util.to_float(item.gross_profit_rate, 2), "%</td>");
732
732
  html.push("<td>", Util.to_float(item["eps"], 2), "元</td>");
733
- html.push("<td>", item["roe"], "%</td>");
734
- let total_revenue = Util.to_unit(item["total_revenue"], 3);
733
+ html.push("<td>", item.roe, "%</td>");
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
737
  if (item["yoy_total_revenue"]) {
738
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);
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>");
@@ -747,12 +747,12 @@ let Stock = {
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
- let net_profit = Util.to_unit(item["net_profit"], 3);
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
753
  if (item["yoy_net_profit"]) {
754
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);
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>");
@@ -763,12 +763,12 @@ let Stock = {
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
- let adjusted_net_profit = Util.to_unit(item["adjusted_net_profit"], 3);
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
769
  if (item["yoy_adjusted_net_profit"]) {
770
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);
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>");
@@ -801,32 +801,32 @@ let Stock = {
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;
804
- j["data"].forEach(function (item) {
805
- let date_format = Util.seconds_to_format(item["date"], "%Y-%m-%d");
806
- latest_date = Math.max(latest_date, item["date"]);
807
- if (item["holder_num"] > max_holder_num) {
808
- max_holder_num = item["holder_num"];
804
+ j.data.forEach(function (item) {
805
+ let date_format = Util.seconds_to_format(item.date, "%Y-%m-%d");
806
+ latest_date = Math.max(latest_date, item.date);
807
+ if (item.holder_num > max_holder_num) {
808
+ max_holder_num = item.holder_num;
809
809
  max_holder_num_date = date_format;
810
810
  }
811
- if (item["holder_num"] < min_holder_num) {
812
- min_holder_num = item["holder_num"];
811
+ if (item.holder_num < min_holder_num) {
812
+ min_holder_num = item.holder_num;
813
813
  min_holder_num_date = date_format;
814
814
  }
815
815
  date_data.push(date_format);
816
- holder_data.push(item["holder_num"]);
817
- price_data.push(item["price"]);
816
+ holder_data.push(item.holder_num);
817
+ price_data.push(item.price);
818
818
  html.push("<tr>");
819
819
  html.push("<td>", date_format, "</td>");
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>");
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
822
  html.push("<td>", item["avg_num"], "</td>");
823
- html.push("<td>", Util.to_unit(item["avg_num"] * item["price"]), "</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 = "";
827
- if (j["latest_date"]) {
828
- let latest_date_format = Util.seconds_to_format(j["latest_date"], "%Y-%m-%d");
829
- if (j["latest_date"] > latest_date) {
827
+ if (j.latest_date) {
828
+ let latest_date_format = Util.seconds_to_format(j.latest_date, "%Y-%m-%d");
829
+ if (j.latest_date > latest_date) {
830
830
  latest_date = latest_date_format;
831
831
  date_data.unshift(latest_date);
832
832
  holder_data.unshift(j["latest_holder_num"]);
@@ -873,11 +873,11 @@ let Stock = {
873
873
  $("#notice_url").attr("href", "https://vip.stock.finance.sina.com.cn/corp/view/vCB_BulletinGather.php?stock_str=" + symbol);
874
874
  Util.post("/stock/" + Stock["code"], {action: "notice"}, function (j) {
875
875
  let html = [];
876
- j["data"].forEach(function (item, index) {
877
- html.push("<tr title='", item["title"], "'>");
876
+ j.data.forEach(function (item, index) {
877
+ html.push("<tr title='", item.title, "'>");
878
878
  html.push("<td>", (index + 1), "</td>");
879
- html.push("<td>", Util.pack_html_link(item["url"], Util.substring(item["title"], 70)), "</td>");
880
- html.push("<td>", Util.seconds_to_format(item["date"], "%Y-%m-%d"), "</td>");
879
+ html.push("<td>", Util.pack_html_link(item.url, Util.substring(item.title, 70)), "</td>");
880
+ html.push("<td>", Util.seconds_to_format(item.date, "%Y-%m-%d"), "</td>");
881
881
  html.push("</tr>");
882
882
  });
883
883
  Util.render_table_html("notice_table_body", html);
@@ -888,8 +888,8 @@ let Stock = {
888
888
  Util.post(Util.get_url("notice_report_annual"), {action: "report", code: Stock.code}, function (j) {
889
889
  let html = [];
890
890
  html.push("<option value=''>年度报告</option>");
891
- j["data"].forEach(function (item) {
892
- html.push("<option value='", item["url"], "'>", item["year"], "年度报告</option>");
891
+ j.data.forEach(function (item) {
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(""));
@@ -921,13 +921,13 @@ let Stock = {
921
921
  });
922
922
  Util.post("/stock/" + Stock["code"], {action: "report_organization"}, function (j) {
923
923
  let html = [];
924
- j["data"].forEach(function (item, i) {
925
- html.push("<tr title='", item["title"], "'>");
924
+ j.data.forEach(function (item, i) {
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>");
928
- html.push("<td>", item["organization"], "</td>");
929
- html.push("<td>", item["analysts"], "</td>");
930
- html.push("<td>", Util.seconds_to_format(item["ctime"], "%Y-%m-%d"), "</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
+ html.push("<td>", item.organization, "</td>");
929
+ html.push("<td>", item.analysts, "</td>");
930
+ html.push("<td>", Util.seconds_to_format(item.ctime, "%Y-%m-%d"), "</td>");
931
931
  html.push("<td>", Util.digit_compare_trend1(Stock["price"], item["day_price"]), "</td>");
932
932
  html.push("</tr>");
933
933
  });
@@ -960,10 +960,10 @@ let Stock = {
960
960
  let value_data = [];
961
961
  let price_data = [];
962
962
  let color_data = [];
963
- j["data"].forEach(function (item) {
964
- date_data.push(item["date"]);
965
- value_data.push(item["value"]);
966
- price_data.push(item["price"]);
963
+ j.data.forEach(function (item) {
964
+ date_data.push(item.date);
965
+ value_data.push(item.value);
966
+ price_data.push(item.price);
967
967
  color_data.push("#E74C3C");
968
968
  });
969
969
  if (j["current"] && j["current"]["value"] && j["current"]["value"] > 0) {
@@ -1040,18 +1040,18 @@ let Stock = {
1040
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
- j["data"].forEach(function (item) {
1044
- if (item["date"] > current_date) {
1045
- current_date = item["date"];
1043
+ j.data.forEach(function (item) {
1044
+ if (item.date > current_date) {
1045
+ current_date = item.date;
1046
1046
  current_bias20 = item["bias20"];
1047
1047
  current_bias60 = item["bias60"];
1048
1048
  current_bias120 = item["bias120"];
1049
1049
  }
1050
- date_data.push(Util.seconds_to_format(item["date"], "%Y-%m-%d"));
1050
+ date_data.push(Util.seconds_to_format(item.date, "%Y-%m-%d"));
1051
1051
  bias20_data.push(item["bias20"]);
1052
1052
  bias60_data.push(item["bias60"]);
1053
1053
  bias120_data.push(item["bias120"]);
1054
- price_data.push(item["price"]);
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);
@@ -1078,16 +1078,16 @@ let Stock = {
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
- j["data"].forEach(function (item) {
1082
- latest_date = Math.max(latest_date, item["date"]);
1083
- date_data.push(Util.seconds_to_format(item["date"], "%Y-%m-%d"));
1081
+ j.data.forEach(function (item) {
1082
+ latest_date = Math.max(latest_date, item.date);
1083
+ date_data.push(Util.seconds_to_format(item.date, "%Y-%m-%d"));
1084
1084
  rzye_low = Math.min(rzye_low, item["rzye"]);
1085
1085
  rzye_high = Math.max(rzye_high, item["rzye"]);
1086
1086
  rzye_data.push(Util.to_hundred_million(item["rzye"], 3));
1087
1087
  rqye_low = Math.min(rqye_low, item["rqye"]);
1088
1088
  rqye_high = Math.max(rqye_high, item["rqye"]);
1089
1089
  rqye_data.push(Util.to_ten_thousand(item["rqye"], 3));
1090
- price_data.push(item["price"]);
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");
@@ -1138,10 +1138,10 @@ let Stock = {
1138
1138
  let flow_data = [], color_data = [];
1139
1139
  date_data = [];
1140
1140
  j["flow_data"].forEach(function (item) {
1141
- if (item["value"] !== 0) {
1142
- date_data.push(item["date"]);
1143
- flow_data.push(Util.to_ten_thousand(item["value"], 2));
1144
- color_data.push(item["value"] > 0 ? "#E74C3C" : "#1ABB9C");
1141
+ if (item.value !== 0) {
1142
+ date_data.push(item.date);
1143
+ flow_data.push(Util.to_ten_thousand(item.value, 2));
1144
+ color_data.push(item.value > 0 ? "#E74C3C" : "#1ABB9C");
1145
1145
  }
1146
1146
  });
1147
1147
  Stock["margin_month_flow_chart"] = Util.chart_basic_bar(Stock["margin_month_flow_chart"], "margin_month_flow_bar_chart", date_data, flow_data, "增幅(单位:万)", color_data);
@@ -1176,15 +1176,15 @@ let Stock = {
1176
1176
  });
1177
1177
  Util.post("/stock/" + Stock["code"], {action: "margin_detail"}, function (j) {
1178
1178
  let html = [];
1179
- j["data"].forEach(function (item, index) {
1179
+ j.data.forEach(function (item, index) {
1180
1180
  html.push("<tr>");
1181
- html.push("<td>", Util.seconds_to_format(item["date"], "%Y-%m-%d"), "</td>");
1181
+ html.push("<td>", Util.seconds_to_format(item.date, "%Y-%m-%d"), "</td>");
1182
1182
  html.push("<td title='", item["rzye"], "' data-val='", item["rzye"], "'>", Util.to_unit(item["rzye"], 3), "</td>");
1183
1183
  html.push("<td title='", item["rzmre"], "' data-val='", item["rzmre"], "'>", Util.to_unit(item["rzmre"], 3), "</td>");
1184
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
- if (j["data"][index + 1] && j["data"][index + 1]["rzye"]) {
1187
- gap_rzye = item["rzye"] - j["data"][index + 1]["rzye"];
1186
+ if (j.data[index + 1] && 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) {
@@ -1194,16 +1194,16 @@ let Stock = {
1194
1194
  html.push("<td title='", gap_rzye, "' data-val='", gap_rzye, "'>", net_rzye, "</td>");
1195
1195
  html.push("<td title='", item["rqye"], "' data-val='", item["rqye"], "'>", (item["rqye"] > 0 ? Util.to_unit(item["rqye"], 3) : "--"), "</td>");
1196
1196
  html.push("<td title='", item["rqyl"], "' data-val='", item["rqyl"], "'>", Util.to_unit(item["rqyl"], 3), "</td>");
1197
- let text_color = Util.text_color(item["p_change"]);
1198
- html.push("<td><b class='", text_color, "'>", item["close"], "</b></td>");
1199
- item["p_change"] = item["p_change"] > 0 ? ("+" + Util.to_float(item["p_change"], 2)) : Util.to_float(item["p_change"], 2);
1200
- html.push("<td><b class='", text_color, "'>", item["p_change"], "%</b></td>");
1197
+ let text_color = Util.text_color(item.p_change);
1198
+ html.push("<td><b class='", text_color, "'>", item.close, "</b></td>");
1199
+ item.p_change = item.p_change > 0 ? ("+" + Util.to_float(item.p_change, 2)) : Util.to_float(item.p_change, 2);
1200
+ html.push("<td><b class='", text_color, "'>", item.p_change, "%</b></td>");
1201
1201
  html.push("</tr>");
1202
1202
  });
1203
1203
  Util.render_table_html("margin_modal_body_body", html);
1204
- if (j["data"].length > 1) {
1205
- let margin_modal_summary = " [当前最新(" + Util.seconds_to_format(j["data"][0]["date"], "%Y-%m-%d") + ")的融资余额: <b class='text-info'>" + Util.to_unit(j["data"][0]["rzye"]) + "</b>";
1206
- let gap_rzye = j["data"][0]["rzye"] - j["data"][1]["rzye"];
1204
+ if (j.data.length > 1) {
1205
+ let margin_modal_summary = " [当前最新(" + Util.seconds_to_format(j.data[0]["date"], "%Y-%m-%d") + ")的融资余额: <b class='text-info'>" + Util.to_unit(j.data[0]["rzye"]) + "</b>";
1206
+ let gap_rzye = j.data[0]["rzye"] - j.data[1]["rzye"];
1207
1207
  if (gap_rzye > 0) {
1208
1208
  margin_modal_summary += ",相对于前一天余额增加 <b class='text-danger'>+" + Util.to_unit(gap_rzye) + "</b>";
1209
1209
  } else if (gap_rzye < 0) {
@@ -1232,10 +1232,10 @@ let Stock = {
1232
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
- j["data"].forEach(function (item) {
1236
- date_data.push(Util.seconds_to_format(item["date"], "%Y-%m-%d"));
1237
- volume_data.push(item["volume"]);
1238
- price_data.push(item["price"]);
1235
+ j.data.forEach(function (item) {
1236
+ date_data.push(Util.seconds_to_format(item.date, "%Y-%m-%d"));
1237
+ volume_data.push(item.volume);
1238
+ price_data.push(item.price);
1239
1239
  });
1240
1240
  let hkex_holding_summary = "[" + Util.pack_html_link(j["url"] + "&code=" + Stock["code"] + "&name=" + Stock["name"], Stock["name"]) + "]";
1241
1241
  if (j["latest"].length > 0) {
@@ -1260,9 +1260,9 @@ let Stock = {
1260
1260
  let flow_data = [], color_data = [];
1261
1261
  date_data = [];
1262
1262
  j["flow_data"].forEach(function (item) {
1263
- date_data.push(item["date"]);
1264
- flow_data.push(item["value"]);
1265
- color_data.push(item["value"] > 0 ? "#E74C3C" : "#1ABB9C");
1263
+ date_data.push(item.date);
1264
+ flow_data.push(item.value);
1265
+ color_data.push(item.value > 0 ? "#E74C3C" : "#1ABB9C");
1266
1266
  });
1267
1267
  Stock["hkex_holding_month_flow_chart"] = Util.chart_basic_bar(Stock["hkex_holding_month_flow_chart"], "hkex_holding_month_flow_chart", date_data, flow_data, "增幅", color_data);
1268
1268
  if ($("#hkex_holding_modal_body").length === 0) {
@@ -1293,13 +1293,13 @@ let Stock = {
1293
1293
  });
1294
1294
  Util.post("/stock/" + Stock["code"], {action: "hk_mutual"}, function (j) {
1295
1295
  let html = [];
1296
- j["data"].forEach(function (item, index) {
1296
+ j.data.forEach(function (item, index) {
1297
1297
  html.push("<tr>");
1298
- html.push("<td>", Util.seconds_to_format(item["date"], "%Y-%m-%d"), "</td>");
1299
- html.push("<td title='", item["volume"], "' data-val='", item["volume"], "'>", Util.to_ten_thousand(item["volume"], 4), "万股</td>");
1298
+ html.push("<td>", Util.seconds_to_format(item.date, "%Y-%m-%d"), "</td>");
1299
+ html.push("<td title='", item.volume, "' data-val='", item.volume, "'>", Util.to_ten_thousand(item.volume, 4), "万股</td>");
1300
1300
  let net_volume = "--", gap_volume = 0;
1301
- if (j["data"][index + 1] && j["data"][index + 1]["volume"]) {
1302
- gap_volume = item["volume"] - j["data"][index + 1]["volume"];
1301
+ if (j.data[index + 1] && j.data[index + 1]["volume"]) {
1302
+ gap_volume = item.volume - j.data[index + 1]["volume"];
1303
1303
  if (gap_volume > 0) {
1304
1304
  net_volume = "<b class='text-danger'>+" + Util.to_ten_thousand(gap_volume, 4) + "万股</b>";
1305
1305
  } else if (gap_volume < 0) {
@@ -1307,16 +1307,16 @@ let Stock = {
1307
1307
  }
1308
1308
  }
1309
1309
  html.push("<td data-val='", gap_volume, "'>", net_volume, "</td>");
1310
- let text_color = Util.text_color(item["p_change"]);
1311
- html.push("<td><b class='", text_color, "'>", item["close"], "</b></td>");
1312
- item["p_change"] = item["p_change"] > 0 ? ("+" + item["p_change"]) : item["p_change"];
1313
- html.push("<td><b class='", text_color, "'>", item["p_change"], "%</b></td>");
1314
- html.push("<td>", item["ratio"], "%</td>");
1310
+ let text_color = Util.text_color(item.p_change);
1311
+ html.push("<td><b class='", text_color, "'>", item.close, "</b></td>");
1312
+ item.p_change = item.p_change > 0 ? ("+" + item.p_change) : item.p_change;
1313
+ html.push("<td><b class='", text_color, "'>", item.p_change, "%</b></td>");
1314
+ html.push("<td>", item.ratio, "%</td>");
1315
1315
  html.push("</tr>");
1316
1316
  });
1317
- if (j["data"].length > 1) {
1318
- let hkex_holding_modal_summary = " [当前最新(" + Util.seconds_to_format(j["data"][0]["date"], "%Y-%m-%d") + ")的持股比例: <b class='text-info'>" + j["data"][0]["ratio"] + "%</b>";
1319
- let gap_volume = j["data"][0]["volume"] - j["data"][1]["volume"];
1317
+ if (j.data.length > 1) {
1318
+ let hkex_holding_modal_summary = " [当前最新(" + Util.seconds_to_format(j.data[0]["date"], "%Y-%m-%d") + ")的持股比例: <b class='text-info'>" + j.data[0]["ratio"] + "%</b>";
1319
+ let gap_volume = j.data[0]["volume"] - j.data[1]["volume"];
1320
1320
  if (gap_volume > 0) {
1321
1321
  hkex_holding_modal_summary += ",相对于前一天持股增加 <b class='text-danger'>+" + Util.to_ten_thousand(gap_volume) + "万股</b>";
1322
1322
  } else if (gap_volume < 0) {