sbd-npm 1.1.24 → 1.1.28

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.1.24",
3
+ "version": "1.1.28",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/summary_daily.js CHANGED
@@ -6,6 +6,7 @@ $(document).ready(function () {
6
6
  is_trade_time: "{{ is_trade_time }}",
7
7
  big_deal: {},
8
8
  hsmf_data: {},
9
+ hsgt_money_flow_chart: false,
9
10
  mo_total_chart: false,
10
11
  mo_sh_chart: false,
11
12
  mo_szm_chart: false,
@@ -30,6 +31,8 @@ $(document).ready(function () {
30
31
  },
31
32
 
32
33
  load_cache: function () {
34
+ DailySummary["hsgt_money_flow_chart"] = Util.init_echarts_handle("hsgt_money_flow_line");
35
+ DailySummary["hsgt_money_flow_chart"].showLoading();
33
36
  try {
34
37
  let cache = DailySummary.get_cache();
35
38
  if (cache.hasOwnProperty("market_overview")) {
@@ -44,9 +47,6 @@ $(document).ready(function () {
44
47
  if (cache.hasOwnProperty("big_deal")) {
45
48
  DailySummary.pack_big_deal(cache["big_deal"], 0);
46
49
  }
47
- if (cache.hasOwnProperty("hmf")) {
48
- DailySummary.pack_hsgt_money_flow(cache["hmf"]);
49
- }
50
50
  if (cache.hasOwnProperty("news")) {
51
51
  DailySummary.pack_news_data(cache["news"]);
52
52
  }
@@ -167,6 +167,7 @@ $(document).ready(function () {
167
167
  */
168
168
  pack_hsgt_money_flow: function (hsgt_money_flow_data) {
169
169
  if ($("#hsgt_money_flow_line").length) {
170
+ DailySummary["hsgt_money_flow_chart"].hideLoading();
170
171
  let time_arr = [];
171
172
  let hsmf_data = [];
172
173
  let hmf_arr = [];
@@ -196,9 +197,9 @@ $(document).ready(function () {
196
197
  DailySummary.render_hsgt_val($("#total_mf_val"), tmf_val);
197
198
  DailySummary.render_hsgt_val($("#hmf_val"), hmf_val);
198
199
  DailySummary.render_hsgt_val($("#smf_val"), smf_val);
199
- let hmf_option = {
200
- color: ["#26B99A", "#34495E", "#BDC3C7", "#3498DB", "#9B59B6", "#8abb6f", "#759c6a", "#bfd3b7"],
200
+ DailySummary["hsgt_money_flow_chart"].setOption({
201
201
  tooltip: {
202
+ trigger: "axis",
202
203
  backgroundColor: "rgba(0,0,0,0.5)",
203
204
  axisPointer: {
204
205
  type: "cross",
@@ -207,33 +208,16 @@ $(document).ready(function () {
207
208
  shadowStyle: {color: "rgba(200,200,200,0.3)"}
208
209
  }
209
210
  },
210
- categoryAxis: {
211
- axisLine: {lineStyle: {color: "#408829"}},
212
- splitLine: {lineStyle: {color: ["#eee"]}}
213
- },
214
- valueAxis: {
215
- axisLine: {lineStyle: {color: "#408829"}},
216
- splitArea: {
217
- show: !0,
218
- areaStyle: {color: ["rgba(250,250,250,0.1)", "rgba(200,200,200,0.1)"]}
219
- },
220
- splitLine: {lineStyle: {color: ["#eee"]}}
221
- },
222
- textStyle: {fontFamily: "Arial, Verdana, sans-serif"}
223
- };
224
- let hmf = echarts.init(document.getElementById("hsgt_money_flow_line"), hmf_option);
225
- let series_item_style = {normal: {areaStyle: {type: "default"}}};
226
- hmf.setOption({
227
- tooltip: {trigger: "axis"},
228
211
  legend: {x: 20, y: 20, data: ["总流向", "沪股通", "深股通"]},
229
212
  "grid": {"x": 30, "y": 50, "x2": 5, "y2": 20},
230
213
  calculable: !0,
231
214
  xAxis: [{type: "category", boundaryGap: !1, data: time_arr}],
232
215
  yAxis: [{type: "value"}],
233
216
  series: [
234
- {name: "总流向", type: "line", smooth: !0, itemStyle: series_item_style, data: hsmf_data},
235
- {name: "沪股通", type: "line", smooth: !0, itemStyle: series_item_style, data: hmf_arr},
236
- {name: "深股通", type: "line", smooth: !0, itemStyle: series_item_style, data: smf_arr}]
217
+ {name: "总流向", type: "line", smooth: !0, itemStyle: {normal: {color: "#26B99A", areaStyle: {type: "default"}}}, data: hsmf_data},
218
+ {name: "沪股通", type: "line", smooth: !0, itemStyle: {normal: {color: "#34495E", areaStyle: {type: "default"}}}, data: hmf_arr},
219
+ {name: "深股通", type: "line", smooth: !0, itemStyle: {normal: {color: "#BDC3C7", areaStyle: {type: "default"}}}, data: smf_arr}
220
+ ]
237
221
  })
238
222
  }
239
223
  }
@@ -302,7 +286,11 @@ $(document).ready(function () {
302
286
  }
303
287
  let mo_amount_obj = $("#market_overview_amount");
304
288
  mo_amount_obj.attr("title", Util.to_float(previous_mo_amount, 3));
305
- mo_amount_obj.addClass(mo_amount_cls);
289
+ mo_amount_obj.removeClass("label-danger");
290
+ mo_amount_obj.removeClass("label-success");
291
+ if (mo_amount_cls.length > 0) {
292
+ mo_amount_obj.addClass(mo_amount_cls);
293
+ }
306
294
  mo_amount_obj.html(Util.to_float(mo_amount, 3) + "(" + mo_amount_sign + dist_amount + ")");
307
295
  DailySummary.set_cache("market_overview", market_overview_dict);
308
296
  },
@@ -331,8 +319,8 @@ $(document).ready(function () {
331
319
  fetch_statistics_daily: function () {
332
320
  let date = $("#trade_date").val();
333
321
  let news_type = $("#news_type").val();
334
- let data = {date: date, action: "statistics_daily", limit_num: DailySummary.limit_num(), news_type: news_type};
335
- Util.post(location.pathname, data, function (j) {
322
+ let payload = {date: date, action: "statistics_daily", limit_num: DailySummary.limit_num(), news_type: news_type};
323
+ Util.post(location.pathname, payload, function (j) {
336
324
  DailySummary.pack_index_data(j["index"]);
337
325
  DailySummary.pack_change_percent(j["change_percent"]);
338
326
  DailySummary.pack_big_deal(j["big_deal"], j["big_deal_date"]);
@@ -341,7 +329,6 @@ $(document).ready(function () {
341
329
  DailySummary.set_cache("index", j["index"]);
342
330
  DailySummary.set_cache("change_percent", j["change_percent"]);
343
331
  DailySummary.set_cache("big_deal", j["big_deal"]);
344
- DailySummary.set_cache("hmf", j["hmf"]);
345
332
  DailySummary.set_cache("news", j["news"]);
346
333
  DailySummary.hide_loaded();
347
334
  if (DailySummary.is_trade_time === 1) {
@@ -447,14 +434,14 @@ $(document).ready(function () {
447
434
  } else {
448
435
  Util.show_tips("Loading...");
449
436
  let data_type = $(obj).attr("id");
450
- let data = {
437
+ let payload = {
451
438
  date: $("#trade_date").val(),
452
439
  start_date: $("#mo_start_time").val(),
453
440
  end_date: $("#mo_end_time").val(),
454
441
  action: "market_overview_detail",
455
442
  data_type: data_type
456
443
  };
457
- Util.post(location.pathname, data, function (j) {
444
+ Util.post(location.pathname, payload, function (j) {
458
445
  Modal.data_type = data_type;
459
446
  $("#market_overview_load_status").html("");
460
447
  if (data_type === "amount") {
@@ -490,12 +477,12 @@ $(document).ready(function () {
490
477
  render_stock_rate_modal: function (obj) {
491
478
  Util.show_tips("Loading...");
492
479
  let cp = $(obj).attr("data-cp");
493
- let data = {date: $("#trade_date").val(), action: "p_change", p_change_type: $("#p_change_type").val()};
480
+ let payload = {date: $("#trade_date").val(), action: "p_change", p_change_type: $("#p_change_type").val()};
494
481
  if (cp) {
495
- data["cp_range"] = cp.replace(/\s/g,"").replace(/%/g, "").replace("~", "range");
482
+ payload["cp_range"] = cp.replace(/\s/g,"").replace(/%/g, "").replace("~", "range");
496
483
  $("#cp_val").html(cp);
497
484
  }
498
- Util.post(location.pathname, data, function (j) {
485
+ Util.post(location.pathname, payload, function (j) {
499
486
  Util.render_type_option($("#p_change_industry"), j["data"], "industry", Modal.render_stock_rate_html);
500
487
  Util.render_type_option($("#p_change_area"), j["data"], "area", Modal.render_stock_rate_html);
501
488
  let _html = [];
@@ -614,10 +601,10 @@ $(document).ready(function () {
614
601
  });
615
602
 
616
603
  $("#news_type").change(function () {
617
- let news_type = parseInt($("#news_type").val());
618
- let data = {action: "news", limit_num: DailySummary.limit_num(), news_type: news_type};
619
604
  Util.show_tips("Loading...");
620
- Util.post(location.pathname, data, function (j) {
605
+ let news_type = parseInt($("#news_type").val());
606
+ let payload = {action: "news", limit_num: DailySummary.limit_num(), news_type: news_type};
607
+ Util.post(location.pathname, payload, function (j) {
621
608
  DailySummary.pack_news_data(j["news_data"]);
622
609
  if (news_type === 2 && j["news_time"]) {
623
610
  $("#news_type").attr("title", Util.seconds_to_format(j["news_time"]));
package/util.js CHANGED
@@ -141,13 +141,14 @@ const Util = {
141
141
  * https://api.jquery.com/jquery.ajax/
142
142
  * @param url
143
143
  * @param payload
144
- * @param callback
144
+ * @param callback 回调函数
145
+ * @param data_type json | text
145
146
  */
146
- post: function (url, payload, callback) {
147
+ post: function (url, payload, callback, data_type = "json") {
147
148
  $.ajax({
148
149
  url: url,
149
150
  type: 'POST',
150
- dataType: "json",
151
+ dataType: data_type,
151
152
  //headers: {'X-CSRFToken': Util.get_cookie('csrftoken')},
152
153
  data: payload,
153
154
  success: callback,
@@ -2070,6 +2071,15 @@ const Util = {
2070
2071
  return echarts.init(element);
2071
2072
  },
2072
2073
 
2074
+ show_echarts_loading: function(chart_handle, element_id) {
2075
+ Util.show_tips("Loading...");
2076
+ if (!chart_handle) {
2077
+ chart_handle = Util.init_echarts_handle(element_id);
2078
+ }
2079
+ chart_handle.showLoading();
2080
+ return chart_handle;
2081
+ },
2082
+
2073
2083
  echarts_mark_point: {
2074
2084
  "symbol": "circle",
2075
2085
  "symbolSize": 8,
@@ -2590,8 +2600,8 @@ const Util = {
2590
2600
  {'url': '/27166fcfc5f01ab0321b5f5bb62dd0dc', 'name': '每周概要'},
2591
2601
  {'url': '/36bfa7608290cb24310a89b17fb04287', 'name': '市场概要'},
2592
2602
  {'url': '/da44721a4d3f7076da38ab105d99e10f', 'name': '市场宽度'},
2593
- {'url': '/cd0dba3c406c34b0a52c33ecd18a5555', 'name': 'ETF'},
2594
- {'url': '/8b011542774efb75f7c912dbfcc4eb6a', 'name': '行业涨跌幅'},
2603
+ {'url': '/cd0dba3c406c34b0a52c33ecd18a5555', 'name': 'ETF分析'},
2604
+ {'url': '/8b011542774efb75f7c912dbfcc4eb6a', 'name': '板块涨跌'},
2595
2605
  {'url': '/b8c96463bc69246f833f7e77f54aa7e8', 'name': '闲钱流向'},
2596
2606
  {'url': '/cd3b237255de2b89eff8b79a37a860c3', 'name': '融资杠杠率'},
2597
2607
  {'url': '/13a5f8cacb58863ad5ecefaf42641f8c', 'name': '板块动量'},