sbd-npm 1.3.50 → 1.3.52
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/constant.js +1 -1
- package/package.json +1 -1
- package/stock_basics.js +34 -26
- package/util.js +20 -2
package/constant.js
CHANGED
@@ -52,9 +52,9 @@ const MenuList = [
|
|
52
52
|
{'key': 'daily_price_limit_up', 'name': '每日涨停', 'url': '/0x7e05ba643accb5fc6fb4ed5962e560182bfbe782'},
|
53
53
|
{'key': 'daily_margin', 'name': '融资融券', 'url': '/0x346eb98b16e29800315ad99545be9d391d0bdcf1'},
|
54
54
|
{'key': 'daily_volume', 'name': '成交量(大量)', 'url': '/0xd92468b610939a0a904069b4293afd7f2e8c4411'},
|
55
|
+
{'key': 'daily_amount', 'name': '成交额', 'url': '/0x52f628266cf952dcde3c51720f69d4cf3179282d'},
|
55
56
|
{'key': 'daily_gap', 'name': '缺口', 'url': '/0xc09193d6aa6e30481598783ef22d3bf5d0f79aad'},
|
56
57
|
{'key': 'daily_turnover', 'name': '换手率', 'url': '/0xdf9b75b31bba10c011bbaf48799d8420f192cfa6'},
|
57
|
-
{'key': 'daily_amount', 'name': '成交额', 'url': '/0x52f628266cf952dcde3c51720f69d4cf3179282d'},
|
58
58
|
{'key': 'daily_buy_sell', 'name': '买入卖出', 'url': '/0x79d1721e939806b2ee507762ade8104bb9320cf7'},
|
59
59
|
{'key': 'daily_big_deal', 'name': '大单交易', 'url': '/0x0ecbe70538ea87c664889e763faecb4a0b080104'},
|
60
60
|
{'key': 'daily_block', 'name': '大宗交易', 'url': '/0x591119baf53f3cda6c34fd9025a5a2b5d68342ce'},
|
package/package.json
CHANGED
package/stock_basics.js
CHANGED
@@ -28,7 +28,7 @@ let Stock = {
|
|
28
28
|
hist_start_date: "",
|
29
29
|
hist_end_date: "",
|
30
30
|
data: {},
|
31
|
-
|
31
|
+
income_statement_data: [], // 利润表数据
|
32
32
|
|
33
33
|
fetch_data: function () {
|
34
34
|
let active_div = localStorage[Stock.tab_token];
|
@@ -604,23 +604,23 @@ let Stock = {
|
|
604
604
|
Util.init_table_skeleton({
|
605
605
|
"element_id": "profit_table",
|
606
606
|
"head_cols": [
|
607
|
-
{"name": "
|
608
|
-
{"name": "净利率
|
607
|
+
{"name": "年份-季度"},
|
608
|
+
{"name": "净利率"},
|
609
609
|
{"name": "毛利率"},
|
610
610
|
{"name": "EPS", "tooltip": "每股收益(Earnings Per Share)"},
|
611
611
|
{"name": "ROE", "tooltip": "净资产收益率(Return On Equity)"},
|
612
612
|
{"name": "营业收入"},
|
613
|
+
{"name": "营收同比", "tooltip": "(当前营业收入 - 去年同期的营业收入) / 去年同期的营业收入 × 100%"},
|
614
|
+
{"name": "营收环比", "tooltip": "(当前营业收入 - 上一季度的营业收入) / 上一季度的营业收入 × 100%"},
|
613
615
|
{"name": "净利润"},
|
614
|
-
{"name": "
|
616
|
+
{"name": "净利同比", "tooltip": "(当前净利润 - 去年同期的净利润) / 去年同期的净利润 × 100%"},
|
617
|
+
{"name": "净利环比", "tooltip": "(当前净利润 - 上一季度的净利润) / 上一季度的净利润 × 100%"},
|
618
|
+
{"name": "扣非净利润"},
|
615
619
|
]
|
616
620
|
});
|
617
621
|
Util.post("/stock/" + Stock["code"], {action: "finance"}, function (j) {
|
618
|
-
//
|
619
|
-
let _html = [];
|
620
|
-
let total_ncf_from_oa = 0;
|
621
|
-
let total_cash_paid_for_assets = 0;
|
622
|
-
let total_free_cash_flow = 0;
|
623
|
-
let total_ncf_from_fa = 0;
|
622
|
+
// 现金流量表
|
623
|
+
let _html = [], total_ncf_from_oa = 0, total_cash_paid_for_assets = 0, total_free_cash_flow = 0, total_ncf_from_fa = 0;
|
624
624
|
j["cash_flow_data"].forEach(function (item) {
|
625
625
|
total_ncf_from_oa += item["ncf_from_oa"];
|
626
626
|
total_cash_paid_for_assets += item["cash_paid_for_assets"];
|
@@ -641,7 +641,7 @@ let Stock = {
|
|
641
641
|
total_ncf_from_fa = total_ncf_from_fa >= 0 ? (Util.to_hundred_million(total_ncf_from_fa) + "亿") : ("<b class='text-danger'>" + Util.to_hundred_million(total_ncf_from_fa) + "亿</b>");
|
642
642
|
_html.push("<tr><td>总计</td><td>" + total_ncf_from_oa + "</td><td>" + total_cash_paid_for_assets + "</td><td>" + total_free_cash_flow + "</td><td>" + total_ncf_from_fa + "</td></tr>");
|
643
643
|
Util.render_table_html("cash_flow_table_body", _html);
|
644
|
-
//
|
644
|
+
// 资产负债表
|
645
645
|
_html = [];
|
646
646
|
j["assets_liabilities_data"].forEach(function (item) {
|
647
647
|
let net_assets = item["total_assets"] - item["total_liabilities"];
|
@@ -675,30 +675,38 @@ let Stock = {
|
|
675
675
|
_html.push("</tr>");
|
676
676
|
});
|
677
677
|
Util.render_table_html("assets_liabilities_table_body", _html);
|
678
|
-
Stock.
|
679
|
-
Stock.
|
678
|
+
Stock.income_statement_data = j["income_statement_data"] ? j["income_statement_data"] : [];
|
679
|
+
Stock.render_income_statement_data();
|
680
680
|
$("#quarter").change(function () {
|
681
|
-
Stock.
|
681
|
+
Stock.render_income_statement_data();
|
682
682
|
});
|
683
683
|
Util.hide_tips();
|
684
684
|
});
|
685
685
|
},
|
686
686
|
|
687
|
-
|
687
|
+
/**
|
688
|
+
* 利润表
|
689
|
+
*/
|
690
|
+
render_income_statement_data: function () {
|
688
691
|
let _html = [];
|
689
692
|
let quarter = parseInt($("#quarter").val());
|
690
|
-
Stock["
|
693
|
+
Stock["income_statement_data"].forEach(function (item) {
|
694
|
+
item["quarter"] = Util.get_quarter(item["date"]);
|
691
695
|
if (quarter === 0 || quarter === item["quarter"]) {
|
692
696
|
let tr_cls = (quarter === 0 && item["quarter"] === 4) ? "success" : "";
|
693
697
|
_html.push("<tr class='", tr_cls, "'>");
|
694
|
-
_html.push("<td>", item["
|
695
|
-
_html.push("<td>", item["
|
698
|
+
_html.push("<td>", Util.get_year(item["date"]), "-", item["quarter"], "</td>");
|
699
|
+
_html.push("<td>", item["net_profit_rate"], "%</td>");
|
696
700
|
_html.push("<td>", Util.to_float(item["gross_profit_rate"], 2), "%</td>");
|
697
701
|
_html.push("<td>", Util.to_float(item["eps"], 2), "元</td>");
|
698
702
|
_html.push("<td>", item["roe"], "%</td>");
|
699
|
-
_html.push("<td>", Util.to_unit(item["
|
700
|
-
_html.push("<td>", Util.
|
701
|
-
_html.push("<td>", Util.
|
703
|
+
_html.push("<td>", Util.to_unit(item["total_revenue"], 3), "</td>");
|
704
|
+
_html.push("<td>", (item["total_revenue_yoy"] ? Util.parse_ratio(item["total_revenue_yoy"]) : "--"), "</td>");
|
705
|
+
_html.push("<td>", (item["total_revenue_qoq"] ? Util.parse_ratio(item["total_revenue_qoq"]) : "--"), "</td>");
|
706
|
+
_html.push("<td>", Util.to_unit(item["net_profit"], 3), "</td>");
|
707
|
+
_html.push("<td>", (item["net_profit_yoy"] ? Util.parse_ratio(item["net_profit_yoy"]) : "--"), "</td>");
|
708
|
+
_html.push("<td>", (item["net_profit_qoq"] ? Util.parse_ratio(item["net_profit_qoq"]) : "--"), "</td>");
|
709
|
+
_html.push("<td>", Util.to_unit(item["adjusted_net_profit"], 3), "</td>");
|
702
710
|
_html.push("</tr>");
|
703
711
|
}
|
704
712
|
});
|
@@ -1077,17 +1085,17 @@ let Stock = {
|
|
1077
1085
|
}
|
1078
1086
|
date = Util.format_to_second(year + "-" + month + "-01");
|
1079
1087
|
Stock.hist_end_date = Util.seconds_to_format(date - 1, "%Y-%m-%d");
|
1080
|
-
} else if (date_type === "
|
1088
|
+
} else if (date_type === "quarter") {
|
1081
1089
|
let d_arr = date.split("-");
|
1082
1090
|
let year = parseInt(d_arr[0]);
|
1083
|
-
let
|
1084
|
-
if (
|
1091
|
+
let quarter = d_arr[1];
|
1092
|
+
if (quarter === "S1") {
|
1085
1093
|
Stock.hist_start_date = year + "-01-01";
|
1086
1094
|
date = year + "-04-01";
|
1087
|
-
} else if (
|
1095
|
+
} else if (quarter === "S2") {
|
1088
1096
|
Stock.hist_start_date = year + "-04-01";
|
1089
1097
|
date = year + "-07-01";
|
1090
|
-
} else if (
|
1098
|
+
} else if (quarter === "S3") {
|
1091
1099
|
Stock.hist_start_date = year + "-07-01";
|
1092
1100
|
date = year + "-10-01";
|
1093
1101
|
} else {
|
package/util.js
CHANGED
@@ -1791,6 +1791,24 @@ const Util = {
|
|
1791
1791
|
return Util.format_to_second(year + "-01-01");
|
1792
1792
|
},
|
1793
1793
|
|
1794
|
+
/**
|
1795
|
+
* 获取指定的时间戳是哪个季度
|
1796
|
+
* @param seconds
|
1797
|
+
* @returns {*|number}
|
1798
|
+
*/
|
1799
|
+
get_quarter: function(seconds = 0) {
|
1800
|
+
seconds = seconds > 0 ? seconds : Util.now();
|
1801
|
+
let month = Util.get_month(seconds);
|
1802
|
+
if (month >= 1 && month <= 3) {
|
1803
|
+
return 1;
|
1804
|
+
} else if (month >= 4 && month <= 6) {
|
1805
|
+
return 2;
|
1806
|
+
} else if (month >= 7 && month <= 9) {
|
1807
|
+
return 3;
|
1808
|
+
}
|
1809
|
+
return 4;
|
1810
|
+
},
|
1811
|
+
|
1794
1812
|
/**
|
1795
1813
|
* 一周的哪一天(1-7,星期一:1,星期二:2,...星期日:7)
|
1796
1814
|
* @returns {*|number}
|
@@ -3355,7 +3373,7 @@ const Util = {
|
|
3355
3373
|
Util.init_time_drop_down(metrics, metrics_drop_down_id, "daily", callback_func);
|
3356
3374
|
Util.init_time_drop_down(metrics, metrics_drop_down_id, "week", callback_func);
|
3357
3375
|
Util.init_time_drop_down(metrics, metrics_drop_down_id, "month", callback_func);
|
3358
|
-
Util.init_time_drop_down(metrics, metrics_drop_down_id, "
|
3376
|
+
Util.init_time_drop_down(metrics, metrics_drop_down_id, "quarter", callback_func);
|
3359
3377
|
}
|
3360
3378
|
callback_func(metrics, "week");
|
3361
3379
|
},
|
@@ -3366,7 +3384,7 @@ const Util = {
|
|
3366
3384
|
let time_arr = ["30周", "52周", "100周", "150周", "200周", "300周"];
|
3367
3385
|
if (date_type === "month") {
|
3368
3386
|
time_arr = ["30月", "40月", "50月", "60月", "100月", "120月"];
|
3369
|
-
} else if (date_type === "
|
3387
|
+
} else if (date_type === "quarter") {
|
3370
3388
|
time_arr = ["30季", "40季", "50季"];
|
3371
3389
|
} else if (date_type === "daily") {
|
3372
3390
|
time_arr = ["20日", "60日", "120日", "200日"];
|