sbd-npm 1.1.61 → 1.1.65

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.
Files changed (4) hide show
  1. package/.npmignore +1 -0
  2. package/menu.js +1 -0
  3. package/package.json +1 -1
  4. package/util.js +70 -39
package/.npmignore ADDED
@@ -0,0 +1 @@
1
+ sbd-npm.md
package/menu.js CHANGED
@@ -50,6 +50,7 @@ const MenuList = [
50
50
  {'key': 'trend_doji', 'name': '十字星', 'url': '/718eac2cccaef1c7968f2d121b5f3070'},
51
51
  {'key': 'trend_ma510', 'name': '突破5、10日均线', 'url': '/4d6d7ee173c87b1f939fa454093a63c7'},
52
52
  {'key': 'trend_holder_minimum', 'name': '股东数历史最少', 'url': '/a9e45d918bc565afd76047cafea25824'},
53
+ {'key': 'trend_fund_hold', 'name': '基金持股变化', 'url': '/067740976f85ec14ddae02b51829ce35'},
53
54
  {'key': 'trend_week_minimum', 'name': '周成交低点', 'url': '/722d94429b8e689fe78dca1cf67a4c67'},
54
55
  {'key': 'trend_margin', 'name': '融资融券余额涨幅', 'url': '/1964a6bc56dc3ce6825b23667c7fb588'},
55
56
  {'key': 'trend_price', 'name': '股价升跌幅度', 'url': '/43ef6aeb36475f8f8f44d477b1990390'},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.1.61",
3
+ "version": "1.1.65",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/util.js CHANGED
@@ -364,9 +364,6 @@ const Util = {
364
364
  $(this).html(Util.year_price_rate(item["price"], item["high_52week"]));
365
365
  });
366
366
  }
367
- $(".holder_" + code).each(function () {
368
- $(this).html(Util.pack_holder_num(item));
369
- });
370
367
  }
371
368
  if (item["high"]) {
372
369
  let high_price = Util.digit_compare_trend(item["high"], item["previous_price"]);
@@ -1173,7 +1170,7 @@ const Util = {
1173
1170
  * 一周的哪一天(1-7,星期一:1,星期二:2,...星期日:7)
1174
1171
  * @returns {*|number}
1175
1172
  */
1176
- get_weekday: function() {
1173
+ get_weekday: function () {
1177
1174
  let date = new Date();
1178
1175
  let weekday = date.getDay();
1179
1176
  weekday = weekday > 0 ? weekday : 7; // 星期天是0
@@ -1840,7 +1837,14 @@ const Util = {
1840
1837
  obj.tooltip();
1841
1838
  },
1842
1839
 
1843
- init_stock_stuff: function (element_id, index_list, is_us = 0) {
1840
+ /**
1841
+ * 初始一些数据
1842
+ * @param element_id
1843
+ * @param index_list
1844
+ * @param is_us
1845
+ * @param is_refresh 开市时是否定时刷新,1是0否
1846
+ */
1847
+ init_stock_stuff: function (element_id, index_list, is_us = 0, is_refresh = 1) {
1844
1848
  let code_list = Util.get_code_list(element_id);
1845
1849
  if (code_list.length > 0) {
1846
1850
  Util.show_tips("Loading...");
@@ -1848,6 +1852,11 @@ const Util = {
1848
1852
  Util.post("/action", {action: "code_detail", code_list: code_list.join("-")}, function (j) {
1849
1853
  $.each(j, function (code, item) {
1850
1854
  Util.render_price(item);
1855
+ if (item["holder_num"] && item["holder_num"] > 0) {
1856
+ $(".holder_" + code).each(function () {
1857
+ $(this).html(Util.pack_holder_num(item));
1858
+ });
1859
+ }
1851
1860
  if ($("#remark_" + code).length) {
1852
1861
  let remark = "";
1853
1862
  if (parseInt(item["down_day"]) > 0) {
@@ -1875,37 +1884,24 @@ const Util = {
1875
1884
  $("#remark_" + code).html(remark);
1876
1885
  }
1877
1886
  });
1878
- Util.refresh_index_price(element_id, index_list.join("-"), is_us);
1887
+ if (is_refresh === 1) {
1888
+ Util.refresh_index_price(element_id, index_list.join("-"), is_us);
1889
+ } else {
1890
+ Util.refresh_index_price(element_id, index_list.join("-"), is_us, 0);
1891
+ }
1879
1892
  Util.hide_tips();
1880
1893
  });
1881
1894
  }
1882
1895
  },
1883
1896
 
1884
- countdown_func: function (interval, tips_id, callback_func) {
1885
- if (interval > 0) {
1886
- $("#" + tips_id).html("交易中, " + interval + " 秒后刷新");
1887
- setTimeout(function () {
1888
- Util.countdown_func(interval - 1, tips_id, callback_func);
1889
- }, 1000);
1890
- } else {
1891
- $("#" + tips_id).html("刷新中...");
1892
- callback_func();
1893
- }
1894
- },
1895
-
1896
- countdown_refresh_index_price: function (interval, element_id, index_list, is_us, us_market_status) {
1897
- if (interval > 0) {
1898
- $("#" + element_id + "_tips").html("交易中, " + interval + " 秒后刷新");
1899
- setTimeout(function () {
1900
- Util.countdown_refresh_index_price(interval - 1, element_id, index_list, is_us, us_market_status);
1901
- }, 1000);
1902
- } else {
1903
- $("#" + element_id + "_tips").html("刷新中...");
1904
- Util.refresh_index_price(element_id, index_list, is_us, us_market_status);
1905
- }
1906
- },
1907
-
1908
- refresh_index_price: function (element_id, index_list, is_us = 0, us_market_status = -1) {
1897
+ /**
1898
+ * 刷新指数和价格数据
1899
+ * @param element_id
1900
+ * @param index_list
1901
+ * @param is_us
1902
+ * @param is_refresh 1刷新,0不刷新,-1美股开市则刷新
1903
+ */
1904
+ refresh_index_price: function (element_id, index_list, is_us = 0, is_refresh = -1) {
1909
1905
  let code_list = Util.get_code_list(element_id);
1910
1906
  if (code_list.length > 0) {
1911
1907
  let payload = {action: "index_price", index_list: index_list, code_list: code_list.join("-")};
@@ -1929,9 +1925,9 @@ const Util = {
1929
1925
  }
1930
1926
  });
1931
1927
  if (is_us === 1) {
1932
- if (us_market_status === 1) {
1933
- Util.countdown_refresh_index_price(5, element_id, index_list, is_us, us_market_status);
1934
- } else if (us_market_status === -1) {
1928
+ if (is_refresh === 1) {
1929
+ Util.countdown_refresh_index_price(5, element_id, index_list, is_us, is_refresh);
1930
+ } else if (is_refresh === -1) { // 美股开市则刷新
1935
1931
  Util.post("/action", {action: "us_market_status"}, function (ums) {
1936
1932
  if (ums === "1") {
1937
1933
  Util.countdown_refresh_index_price(5, element_id, index_list, is_us, 1);
@@ -1939,14 +1935,48 @@ const Util = {
1939
1935
  }, "text");
1940
1936
  }
1941
1937
  } else {
1942
- if (j["is_holiday"] === 0 && Util.is_trade_time()) {
1943
- Util.countdown_refresh_index_price(5, element_id, index_list, is_us, us_market_status);
1938
+ if (is_refresh !== 0 && j["is_holiday"] === 0) {
1939
+ if (Util.is_trade_time()) {
1940
+ Util.countdown_refresh_index_price(5, element_id, index_list, is_us, is_refresh);
1941
+ }
1944
1942
  }
1945
1943
  }
1946
1944
  });
1947
1945
  }
1948
1946
  },
1949
1947
 
1948
+ /**
1949
+ * 指数和价格数据刷新的倒计时
1950
+ * @param interval
1951
+ * @param element_id
1952
+ * @param index_list
1953
+ * @param is_us
1954
+ * @param is_refresh
1955
+ */
1956
+ countdown_refresh_index_price: function (interval, element_id, index_list, is_us, is_refresh) {
1957
+ if (interval > 0) {
1958
+ $("#" + element_id + "_tips").html("交易中, " + interval + " 秒后刷新");
1959
+ setTimeout(function () {
1960
+ Util.countdown_refresh_index_price(interval - 1, element_id, index_list, is_us, is_refresh);
1961
+ }, 1000);
1962
+ } else {
1963
+ $("#" + element_id + "_tips").html("刷新中...");
1964
+ Util.refresh_index_price(element_id, index_list, is_us, is_refresh);
1965
+ }
1966
+ },
1967
+
1968
+ countdown_func: function (interval, tips_id, callback_func) {
1969
+ if (interval > 0) {
1970
+ $("#" + tips_id).html("交易中, " + interval + " 秒后刷新");
1971
+ setTimeout(function () {
1972
+ Util.countdown_func(interval - 1, tips_id, callback_func);
1973
+ }, 1000);
1974
+ } else {
1975
+ $("#" + tips_id).html("刷新中...");
1976
+ callback_func();
1977
+ }
1978
+ },
1979
+
1950
1980
  /**
1951
1981
  * 获取页面标题
1952
1982
  * @returns {string}
@@ -2079,10 +2109,11 @@ const Util = {
2079
2109
  * @param item
2080
2110
  * @returns {string}
2081
2111
  */
2082
- pack_holder_num: function(item) {
2083
- if (item["holder_num"] && item["holder_num"] > 0 && item["pre_holder_num"]) {
2112
+ pack_holder_num: function (item) {
2113
+ if (item["holder_num"] && item["holder_num"] > 0) {
2084
2114
  let url = Util.get_url("holder_num") + "?code=" + item["code"];
2085
- return Util.pack_html_link(url, Util.digit_compare_trend(item["holder_num"], item["pre_holder_num"]));
2115
+ le pre_holder_num = item["pre_holder_num"] ? item["pre_holder_num"] : 0;
2116
+ return Util.pack_html_link(url, Util.digit_compare_trend(item["holder_num"], pre_holder_num));
2086
2117
  }
2087
2118
  return "--";
2088
2119
  },