hqchart
Version:
HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接
1,486 lines (1,283 loc) • 152 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _defineProperty2 = require("babel-runtime/helpers/defineProperty");
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _getIterator2 = require("babel-runtime/core-js/get-iterator");
var _getIterator3 = _interopRequireDefault(_getIterator2);
var _map = require("babel-runtime/core-js/map");
var _map2 = _interopRequireDefault(_map);
var _set = require("babel-runtime/core-js/set");
var _set2 = _interopRequireDefault(_set);
var _JSStockInit$STOCK_FI;
var _jquery = require("jquery");
var _jquery2 = _interopRequireDefault(_jquery);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/*
Copyright (c) 2018 jones
http://www.apache.org/licenses/LICENSE-2.0
开源项目 https://github.com/jones2000/HQChart
jones_2000@163.com
个股行情数据类
*/
////////////////////////////////////////////////////////////////////////////////////////
// 股票数据
//
///////////////////////////////////////////////////////////////////////////////////////
function JSStockResource() {
this.Domain = "http://127.0.0.1:8886"; //API域名
this.CacheDomain = "http://127.0.0.1:8886"; //缓存域名
}
var g_JSStockResource = new JSStockResource();
//领涨领跌
function IndexTopData() {
this.Stop; //停牌
this.Down; //下跌
this.Up; //上涨
this.Unchanged; //平盘
this.UpStock = { "Symbol": null, "Name": null }; //领涨
this.DownStock = { "Symbol": null, "Name": null }; //领跌
}
function IndexHeatData() {
this.Good; //健康度
//this.Date; //日期
this.GoodIncrease = { "Day1": null, 'Week1': null, "Week4": null }; //周涨幅
}
function SortData(field, order, tagID) {
this.arySymbol = new Array(); //成分
this.SortField = field; //排序字段
this.Order = order; //1 降, -1 升
this.TagID = new _set2.default([tagID]); //绑定的元素id
}
//财务数据
function FinanceData() {
this.ROE; //净资产收益率
this.Date; //报告日期,
this.PerSEarning; //每股收益
this.EPS; //滚动每股收益
this.PerNetAsset; //每股净资产
this.NProfit; //净利润
this.NProfitIncrease; //净利润涨幅 (当年净利润-上一年)/上一年*100
this.NnetProfit; //扣非净利润
this.NnProfitIncrease; //扣非净利润涨幅 (当年扣非净利润-上一年)/上一年*100
this.NnProfitSpeed; //扣非净利润涨速 (当前扣非净利润/上一年-1)/(上一年/上上年-1)
this.Benford; //财务粉饰
//TODO:财务数据要了后面再加
this.SetData = function (data) {
if (!isNaN(data.roe)) this.ROE = data.roe;
if (!isNaN(data.finance.date)) this.Date = data.finance.date;
if (!isNaN(data.finance.persearning)) this.PerSEarning = data.finance.persearning;
if (!isNaN(data.finance.eps)) this.EPS = data.finance.eps;
if (!isNaN(data.finance.pernetasset)) this.PerNetAsset = data.finance.pernetasset;
if (!isNaN(data.finance.nprofit)) this.NProfit = data.finance.nprofit;
if (!isNaN(data.finance.nprofitincrease)) this.NProfitIncrease = data.finance.nprofitincrease;
if (!isNaN(data.finance.nnetprofit)) this.NnetProfit = data.finance.nnetprofit;
if (!isNaN(data.finance.nnprofitincrease)) this.NnProfitIncrease = data.finance.nnprofitincrease;
if (!isNaN(data.finance.nnprofitspeed)) this.NnProfitSpeed = data.finance.nnprofitspeed;
if (!isNaN(data.finance.benford)) this.Benford = data.finance.benford;
};
}
//股本数据
function CapitalData() {
this.Date; //变动日期
this.A; //流通A股
this.Total; //总股本
this.ARate; //流通A股占比
this.SetData = function (data) {
if (!isNaN(data.capital.date)) this.Date = data.capital.date;
if (!isNaN(data.capital.a)) this.A = data.capital.a;
if (!isNaN(data.capital.total)) this.Total = data.capital.total;
if (!isNaN(data.capital.arate)) this.ARate = data.capital.arate;
};
}
//资金流(当日)
function CapitalFlowDayData() {
this.SuperIn; //超大单流入
this.SuperOut; //超大单流出
this.BigIn; //大单流入
this.BigOut; //大单流出
this.MidIn; //中单流入
this.MidOut; //中单流出
this.SmallIn; //小单流入
this.SmallOut; //小单流出
this.MainIn; //主力流入
this.MainOut; //主力流出
this.MainNetIn; //主力净流入
this.SetData = function (data) {
this.SuperIn = data.superin;
this.SuperOut = data.superout;
this.BigIn = data.bigin;
this.BigOut = data.bigout;
this.MidIn = data.midin;
this.MidOut = data.midout;
this.SmallIn = data.smallin; //小单流入
this.SmallOut = data.smallout; //小单流出
this.MainIn = data.mainin; //主力流入
this.MainOut = data.mainout; //主力流出
this.MainNetIn = data.mainnetin; //主力净流入
};
}
//资金流(多日)
function CapitalFlowDaysData() {
this.SuperIn; //超大单流入
this.SuperOut; //超大单流出
this.BigIn; //大单流入
this.BigOut; //大单流出
this.MidIn; //中单流入
this.MidOut; //中单流出
this.SmallIn; //小单流入
this.SmallOut; //小单流出
this.MainIn; //主力流入
this.MainOut; //主力流出
this.MainNetIn; //主力净流入
this.MainNetInRatio; //多日日主力净流占比
this.SetData = function (data) {
this.SuperIn = data.superin;
this.SuperOut = data.superout;
this.BigIn = data.bigin;
this.BigOut = data.bigout;
this.MidIn = data.midin;
this.MidOut = data.midout;
this.SmallIn = data.smallin; //小单流入
this.SmallOut = data.smallout; //小单流出
this.MainIn = data.mainin; //主力流入
this.MainOut = data.mainout; //主力流出
this.MainNetIn = data.mainnetin; //主力净流入
this.MainNetInRatio = data.mainnetinratio;
};
}
function DDEData() {
this.DDX;
this.DDY;
this.DDZ;
this.SetData = function (data) {
this.DDX = data.ddx;
this.DDY = data.ddy;
this.DDZ = data.ddz;
};
}
//个股资料
function CompanyData() {
this.Name;
this.Business; //主营业务
this.Vol; //发行量
this.Price; //发行价格
this.ReleaseDate; //上市日期
this.Competence; //核心竞争力
this.SetData = function (data) {
if (!data.company) return;
this.Name = data.company.name;
this.Business = data.company.business;
this.Vol = data.company.vol;
this.Price = data.company.price;
this.ReleaseDate = data.company.releasedate;
this.Competence = data.company.corecompetence;
};
}
//板块信息
function PlateData() {
this.Industry; //行业分类
this.Region; //地区
this.Concept; //概念
this.SetData = function (data) {
this.SetIndustryData(data);
this.SetRegionData(data);
this.SetConceptData(data);
};
this.SetIndustryData = function (data) {
if (!data.industry) return;
this.Industry = [];
for (var i in data.industry) {
var item = data.industry[i];
this.Industry.push({ Name: item.name, Symbol: item.symbol });
}
};
this.SetRegionData = function (data) {
if (!data.region) return;
this.Region = [];
for (var i in data.region) {
var item = data.region[i];
this.Region.push({ Name: item.name, Symbol: item.symbol });
}
};
this.SetConceptData = function (data) {
if (!data.concept) return;
this.Concept = [];
for (var i in data.concept) {
var item = data.concept[i];
this.Concept.push({ Name: item.name, Symbol: item.symbol });
}
};
}
//股票属性事件,属性
function EventData() {
this.IsMargin = false; //是否是融资融券标题
this.IsHK = false; //是否有港股
this.IsSHHK = false; //沪港通
this.IsSZHK = false; //深股通
this.STType = 0; //St标识(0:正常股票,1:st股票,2:*st股票)
this.HK; //港股信息 { Symbol:代码 Name:名称 }
this.SetData = function (data) {
if (!data.events) return;
if (!isNaN(data.events.margin)) this.IsMargin = data.events.margin == 1;
if (!isNaN(data.events.hk)) this.IsHK = data.events.hk == 1;
if (!isNaN(data.events.shhk)) this.IsSHHK = data.events.shhk == 1;
if (!isNaN(data.events.szhk)) this.IsSZHK = data.events.szhk == 1;
if (!isNaN(data.events.st)) this.STType = data.events.st;
if (this.IsHK && data.events.hksymbol && data.events.hkname) {
this.HK = { Symbol: data.events.hksymbol, Name: data.events.hkname };
}
};
}
//是否是指数代码(是一个单独的类,从umychart.js复制来的)
function IsIndexSymbol(symbol) {
var upperSymbol = symbol.toUpperCase();
if (upperSymbol.indexOf('.SH') > 0) {
upperSymbol = upperSymbol.replace('.SH', '');
if (upperSymbol.charAt(0) == '0' && parseInt(upperSymbol) <= 3000) return true;
} else if (upperSymbol.indexOf('.SZ') > 0) {
upperSymbol = upperSymbol.replace('.SZ', '');
if (upperSymbol.charAt(0) == '3' && upperSymbol.charAt(1) == '9') return true;
} else if (upperSymbol.indexOf('.CI') > 0) //自定义指数
{
return true;
}
return false;
}
function StockData(symbol) {
this.Symbol = symbol; //股票代码
this.Name; //股票名称
//基础数据
this.Open; //开盘
this.Price; //最新
this.High; //最高
this.Low; //最低
this.YClose; //前收盘
this.Vol; //成交量
this.Amount; //成交金额
this.Date; //交易日期
this.Time; //交易时间
this.ExchangeRate; //换手率
this.Amplitude; //振幅
this.VolRatio; //量比
this.Increase; //涨幅
this.MaxPrice; //涨停价
this.MinPrice; //跌停价
this.RFPrice; //涨跌额 (Price-YClose)
this.IndexTop; //涨跌家数
this.Week; //周涨幅
this.MinuteAmplitude = {}; //1,3,5,10,15, 振幅
this.RiseFallSpeed = {}; //1,3,5,10,15 分钟涨速
this.MAmount = {}; //1,3,5,10,15 分钟成交量
this.GetBaseData = function (tagID, field) {
this.BaseDataTagID.add(tagID);
switch (field) {
case STOCK_FIELD_NAME.SYMBOL:
return this.Symbol;
case STOCK_FIELD_NAME.NAME:
return this.Name;
case STOCK_FIELD_NAME.OPEN:
return this.Open;
case STOCK_FIELD_NAME.PRICE:
return this.Price;
case STOCK_FIELD_NAME.YCLOSE:
return this.YClose;
case STOCK_FIELD_NAME.HIGH:
return this.High;
case STOCK_FIELD_NAME.LOW:
return this.Low;
case STOCK_FIELD_NAME.VOL:
return this.Vol;
case STOCK_FIELD_NAME.AMOUNT:
return this.Amount;
case STOCK_FIELD_NAME.DATE:
return this.Date;
case STOCK_FIELD_NAME.TIME:
return this.Time;
case STOCK_FIELD_NAME.INCREASE:
return this.Increase;
case STOCK_FIELD_NAME.EXCHANGE_RATE:
return this.ExchangeRate;
case STOCK_FIELD_NAME.AMPLITUDE:
return this.Amplitude;
case STOCK_FIELD_NAME.MAX_PRICE:
return this.MaxPrice;
case STOCK_FIELD_NAME.MIN_PRICE:
return this.MinPrice;
case STOCK_FIELD_NAME.RISE_FALL_PRICE:
return this.RFPrice;
case STOCK_FIELD_NAME.VOLRATIO:
return this.VolRatio;
case STOCK_FIELD_NAME.INDEXTOP:
return this.IndexTop;
case STOCK_FIELD_NAME.WEEK:
return this.Week;
}
};
this.Heat; //热度
//获取热度数据,不要直接使用变量获取
this.GetHeatData = function (tagID) {
this.HeatTagID.add(tagID);
return this.Heat;
};
//成分排序
this.Sort = new _map2.default(); //key=排序字段-排序方式 value=SortData 一个控件之能有1个排序规则
this.GetSortData = function (tagID, field, order) {
var key = field.toString() + '-' + order.toString();
if (!this.Sort.has(key)) {
var data = new SortData(field, order, tagID);
this.Sort.set(key, data);
return data;
}
var data = this.Sort.get(key);
data.TagID.add(tagID);
return data;
};
this.Buy5; //五档买
this.GetBuy5 = function (tagID) {
this.BuySellTagID.add(tagID);
return this.Buy5;
};
this.Sell5; //五档卖
this.GetSell5 = function (tagID) {
this.BuySellTagID.add(tagID);
return this.Sell5;
};
this.Deal; //分笔 最新10条
this.GetDeal = function (tagID) {
this.DealTagID.add(tagID);
return this.Deal;
};
this.MarketValue; //总市值
this.FlowMarketValue; //流通市值
this.Bookrate; //委比
this.Bookdiffer; //委差
this.PE; //市盈率
this.PE2; //市盈率(TTM)
this.PE3; //市盈率(动)
this.PB;
this.GetDerivative = function (tagID, field) {
this.DerivativeTagID.add(tagID);
switch (field) {
case STOCK_FIELD_NAME.MARKET_VALUE:
return this.MarketValue;
case STOCK_FIELD_NAME.FLOW_MARKET_VALUE:
return this.FlowMarketValue;
case STOCK_FIELD_NAME.BOOK_RATE:
return this.Bookrate;
case STOCK_FIELD_NAME.BOOK_DIFFER:
return this.Bookdiffer;
case STOCK_FIELD_NAME.PE:
return this.PE;
case STOCK_FIELD_NAME.PE2:
return this.PE2;
case STOCK_FIELD_NAME.PE3:
return this.PE3;
case STOCK_FIELD_NAME.PB:
return this.PB;
}
};
this.Finance; //财务数据
this.GetFinance = function (tagID, field) {
if (!this.Finance) //只请求一次
{
this.FinanceTagID.add(tagID);
return null;
}
switch (field) {
case STOCK_FIELD_NAME.ROE:
return this.Finance.ROE;
case STOCK_FIELD_NAME.FINANCE_DATE:
return this.Finance.Date;
case STOCK_FIELD_NAME.FINANCE_PERSEARNING:
return this.Finance.PerSEarning;
case STOCK_FIELD_NAME.FINANCE_PERNETASSET:
return this.Finance.PerNetAsset;
case STOCK_FIELD_NAME.FINANCE_NPROFIT:
return this.Finance.NProfit;
case STOCK_FIELD_NAME.FINANCE_NPROFITINCREASE:
return this.Finance.NProfitIncrease;
case STOCK_FIELD_NAME.FINANCE_NNETPROFIT:
return this.Finance.NnetProfit;
case STOCK_FIELD_NAME.FINANCE_NNPROFITINCREASE:
return this.Finance.NnProfitIncrease;
case STOCK_FIELD_NAME.FINANCE_NNPROFITSPEED:
return this.Finance.NnProfitSpeed;
case STOCK_FIELD_NAME.FINANCE_EPS:
return this.Finance.EPS;
case STOCK_FIELD_NAME.FINANCE_BENFORD:
return this.Finance.Benford;
}
};
this.Capital; //股本
this.GetCapital = function (tagID, field) {
if (!this.Capital) //只请求一次
{
this.CapitalTagID.add(tagID);
return null;
}
switch (field) {
case STOCK_FIELD_NAME.CAPITAL_TOTAL:
return this.Capital.Total;
case STOCK_FIELD_NAME.CAPITAL_A:
return this.Capital.A;
case STOCK_FIELD_NAME.CAPTIAL_ARATE:
return this.Capital.ARate;
}
};
//资金流
this.CapitalFlowDay;
this.CapitalFlowDay3;
this.CapitalFlowDay5;
this.CapitalFlowDay10;
this.GetCapitalFlowDay = function (tagID, field) {
var data = null;
switch (field) {
case STOCK_FIELD_NAME.CAPITAL_FLOW_DAY:
this.CapitalFlowDayID.add(tagID);
if (this.CapitalFlowDay) data = this.CapitalFlowDay;
break;
case STOCK_FIELD_NAME.CAPITAL_FLOW_DAY3:
this.CapitalFlowDay3ID.add(tagID);
if (this.CapitalFlowDay3) data = this.CapitalFlowDay3;
break;
case STOCK_FIELD_NAME.CAPITAL_FLOW_DAY5:
this.CapitalFlowDay5ID.add(tagID);
if (this.CapitalFlowDay5) data = this.CapitalFlowDay5;
break;
case STOCK_FIELD_NAME.CAPITAL_FLOW_DAY10:
this.CapitalFlowDay10ID.add(tagID);
if (this.CapitalFlowDay10) data = this.CapitalFlowDay10;
break;
}
return data;
};
//资金流 DDE
this.DDE;
this.DDE3;
this.DDE5;
this.DDE10;
this.GetDDE = function (tagID, field) {
var data = null;
switch (field) {
case STOCK_FIELD_NAME.DDE:
this.DDEID.add(tagID);
if (this.DDE) data = this.DDE;
break;
case STOCK_FIELD_NAME.DDE3:
this.DDE3ID.add(tagID);
if (this.DDE3) data = this.DDE3;
break;
case STOCK_FIELD_NAME.DDE5:
this.DDE5ID.add(tagID);
if (this.DDE5) data = this.DDE5;
break;
case STOCK_FIELD_NAME.DDE10:
this.DDE10ID.add(tagID);
if (this.DDE10) data = this.DDE10;
break;
}
return data;
};
this.Event; //事件 属性
this.GetEvent = function (tagID, field) {
if (!this.Event) {
this.EventTagID.add(tagID);
return null;
}
return this.Event;
};
//个股资料
this.Company; //个股资料
this.GetCompany = function (tagID, field) {
if (!this.Company) //只请求一次
{
this.CompanyTagID.add(tagID);
return null;
}
switch (field) {
case STOCK_FIELD_NAME.COMPANY_NAME:
return this.Company.Name;
case STOCK_FIELD_NAME.COMPANY_BUSINESS:
return this.Company.Business;
case STOCK_FIELD_NAME.COMPANY_VOL:
return this.Company.Vol;
case STOCK_FIELD_NAME.COMPANY_PRICE:
return this.Company.Price;
case STOCK_FIELD_NAME.COMPANY_RELEASEDATE:
return this.Company.ReleaseDate;
case STOCK_FIELD_NAME.COMPANY_COMPETENCE:
return this.Company.Competence;
}
};
this.Plate; //板块
this.GetPlate = function (tagID, field) {
if (!this.Plate) //只请求一次
{
this.PlateTagID.add(tagID);
return null;
}
switch (field) {
case STOCK_FIELD_NAME.PLATE_INDUSTRY:
return this.Plate.Industry;
case STOCK_FIELD_NAME.PLATE_CONCEPT:
return this.Plate.Concept;
case STOCK_FIELD_NAME.PLATE_REGION:
return this.Plate.Region;
}
};
this.TagID = new _set2.default(); //绑定的控件id
this.BaseDataTagID = new _set2.default(); //基础数据的控件id
this.HeatTagID = new _set2.default(); //需要热度的控件id
this.BuySellTagID = new _set2.default(); //买卖盘的控件id
this.DealTagID = new _set2.default(); //分笔的控件id
this.DerivativeTagID = new _set2.default(); //衍生数据
this.FinanceTagID = new _set2.default(); //财务数据 (就请求1次)
this.CapitalTagID = new _set2.default(); //股本数据 (就请求1次)
this.CapitalFlowDayID = new _set2.default(); //当日资金流
this.CapitalFlowDay3ID = new _set2.default(); //3日资金流
this.CapitalFlowDay5ID = new _set2.default(); //5日资金流
this.CapitalFlowDay10ID = new _set2.default(); //10日资金流
this.DDEID = new _set2.default();
this.DDE3ID = new _set2.default();
this.DDE5ID = new _set2.default();
this.DDE10ID = new _set2.default();
this.EventTagID = new _set2.default(); //股票事件/属性
this.CompanyTagID = new _set2.default(); //个股资料 (就请求1次)
this.PlateTagID = new _set2.default(); //板块 概念 地区
this.AttachTagID = function (id) {
this.TagID.add(id);
};
this.ClearTagID = function () {
this.TagID.clear();
this.BaseDataTagID.clear();
this.HeatTagID.clear();
this.BuySellTagID.clear();
this.DealTagID.clear();
this.DerivativeTagID.clear();
this.FinanceTagID.clear();
this.CapitalTagID.clear();
this.CapitalFlowDayID.clear();
this.CapitalFlowDay3ID.clear();
this.CapitalFlowDay5ID.clear();
this.CapitalFlowDay10ID.clear();
this.DDEID.clear();
this.DDE3ID.clear();
this.DDE5ID.clear();
this.DDE10ID.clear();
this.EventTagID.clear();
this.CompanyTagID.clear();
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = (0, _getIterator3.default)(this.Sort), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var item = _step.value;
item[1].TagID.clear();
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
};
this.RemoveTagID = function (id) {
this.TagID.delete(id);
this.BaseDataTagID.delete(id);
this.HeatTagID.delete(id);
this.BuySellTagID.delete(id);
this.DealTagID.delete(id);
this.DerivativeTagID.delete(id);
this.FinanceTagID.delete(id);
this.CapitalTagID.delete(id);
this.CapitalFlowDayID.delete(id);
this.CapitalFlowDay3ID.delete(id);
this.CapitalFlowDay5ID.delete(id);
this.CapitalFlowDay10ID.delete(id);
this.DDEID.delete(id);
this.DDE3ID.delete(id);
this.DDE5ID.delete(id);
this.DDE10ID.delete(id);
this.EventTagID.delete(id);
this.CompanyTagID.delete(id);
var _iteratorNormalCompletion2 = true;
var _didIteratorError2 = false;
var _iteratorError2 = undefined;
try {
for (var _iterator2 = (0, _getIterator3.default)(this.Sort), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
var item = _step2.value;
item[1].TagID.delete(id);
}
} catch (err) {
_didIteratorError2 = true;
_iteratorError2 = err;
} finally {
try {
if (!_iteratorNormalCompletion2 && _iterator2.return) {
_iterator2.return();
}
} finally {
if (_didIteratorError2) {
throw _iteratorError2;
}
}
}
};
//设置基础数据
this.SetBaseData = function (data) {
this.Name = data.name;
this.YClose = data.yclose;
this.Price = data.price;
this.High = data.high;
this.Low = data.low;
this.Open = data.open;
this.Vol = data.vol;
this.Amount = data.amount;
this.Date = data.date;
this.Time = data.time;
this.Increase = data.increase;
if (!isNaN(data.exchangerate)) this.ExchangeRate = data.exchangerate;
if (!isNaN(data.amplitude)) this.Amplitude = data.amplitude;
if (!isNaN(data.volratio)) this.VolRatio = data.volratio;
if (this.Name.indexOf('ST') >= 0) {
this.MaxPrice = (1 + 0.05) * this.Open;
this.MinPrice = (1 - 0.05) * this.Open;
} else {
this.MaxPrice = (1 + 0.1) * this.Open;
this.MinPrice = (1 - 0.1) * this.Open;
}
if (this.Price && this.YClose) this.RFPrice = this.Price - this.YClose;
//周涨幅
if (data.week) {
this.Week = {};
this.Week.Week1 = data.week.week1;
this.Week.Week4 = data.week.week4;
this.Week.Week13 = data.week.week13;
this.Week.Week26 = data.week.week26;
this.Week.Week52 = data.week.week52;
}
};
this.SetDerivativeData = function (data) {
this.MarketValue = data.marketvalue; //总市值
this.FlowMarketValue = data.flowmarketvalue; //流通市值
this.Bookrate = data.bookrate; //委比
this.Bookdiffer = data.bookdiffer; //委差
this.PE = data.pe; //市盈率
this.PE2 = data.pe2; //市盈率
this.PE3 = data.pe3; //市盈率
this.PB = data.pb; //市净率
};
this.SetFinanceData = function (data) {
console.log(data);
if (!data.finance) return;
this.Finance = new FinanceData();
this.Finance.SetData(data);
};
this.SetCapitalData = function (data) {
if (!data.capital) return;
this.Capital = new CapitalData();
this.Capital.SetData(data);
};
//指数基础数据
this.SetIndexBaseData = function (data) {
this.SetBaseData(data);
var topData = new IndexTopData();
if (data.indextop) {
topData.Up = data.indextop.up;
topData.Down = data.indextop.down;
topData.Unchanged = data.indextop.unchanged;
topData.Stop = data.indextop.stop;
topData.UpStock.Symbol = data.indextop.upstock.symbol;
topData.UpStock.Name = data.indextop.upstock.name;
topData.DownStock.Symbol = data.indextop.downstock.symbol;
topData.DownStock.Name = data.indextop.downstock.name;
}
this.IndexTop = topData;
};
//五档买卖盘
this.SetBuySellData = function (data) {
this.SetBaseData(data);
this.Buy5 = new Array();
this.Sell5 = new Array();
for (var i in data.buy) {
var item = data.buy[i];
this.Buy5.push({ "Price": item.price, "Vol": item.vol });
}
for (var i in data.sell) {
var item = data.sell[i];
this.Sell5.push({ "Price": item.price, "Vol": item.vol });
}
};
//分笔
this.SetDealData = function (data) {
this.Price = data.price;
this.High = data.high;
this.Low = data.low;
this.Vol = data.vol;
this.Amount = data.amount;
this.Date = data.date;
this.Time = data.time;
this.Increase = data.increase;
this.Deal = new Array();
for (var i in data.deal) {
var item = data.deal[i];
if (isNaN(item.price) || isNaN(item.time)) continue;
var bs = '';
if (item.bs === 0) bs = 'B';else if (item.bs === 1) bs = 'S';
this.Deal.push({ "Price": item.price, "Amount": item.amount, "Vol": item.vol, "Time": item.time, 'BS': bs });
}
};
//热度
this.SetHeatData = function (data) {
var heatData = new IndexHeatData();
heatData.Good = data.quadrant.good;
heatData.GoodIncrease.Day1 = data.quadrant.gincrease.day1;
heatData.GoodIncrease.Week1 = data.quadrant.gincrease.week1;
heatData.GoodIncrease.Week4 = data.quadrant.gincrease.week4;
this.Heat = heatData;
};
this.SetCapitalFlowDayData = function (data, datatype) {
if (!data) return;
switch (datatype) {
case RECV_DATA_TYPE.CAPITAL_FLOW_DAY_DATA:
this.CapitalFlowDay = new CapitalFlowDayData();
this.CapitalFlowDay.SetData(data);
break;
case RECV_DATA_TYPE.CAPITAL_FLOW_DAY3_DATA:
this.CapitalFlowDay3 = new CapitalFlowDaysData();
this.CapitalFlowDay3.SetData(data);
break;
case RECV_DATA_TYPE.CAPITAL_FLOW_DAY5_DATA:
this.CapitalFlowDay5 = new CapitalFlowDaysData();
this.CapitalFlowDay5.SetData(data);
break;
case RECV_DATA_TYPE.CAPITAL_FLOW_DAY10_DATA:
this.CapitalFlowDay10 = new CapitalFlowDaysData();
this.CapitalFlowDay10.SetData(data);
break;
}
};
this.SetDDE = function (data, datatype) {
if (!data) return;
switch (datatype) {
case RECV_DATA_TYPE.DDE_DAY_DATA:
this.DDE = new DDEData();
this.DDE.SetData(data);
break;
case RECV_DATA_TYPE.DDE_DAY3_DATA:
this.DDE3 = new DDEData();
this.DDE3.SetData(data);
break;
case RECV_DATA_TYPE.DDE_DAY5_DATA:
this.DDE5 = new DDEData();
this.DDE5.SetData(data);
break;
case RECV_DATA_TYPE.DDE_DAY10_DATA:
this.DDE10 = new DDEData();
this.DDE10.SetData(data);
break;
}
return data;
};
this.SetEventData = function (data) {
if (!data.events) return;
this.Event = new EventData();
this.Event.SetData(data);
};
this.SetCompanyData = function (data) {
if (!data.company) return;
this.Company = new CompanyData();
this.Company.SetData(data);
};
this.SetPlateData = function (data) {
if (!data.industry && !data.region && !data.concept) return;
this.Plate = new PlateData();
this.Plate.SetData(data);
};
//所有数据
this.SetData = function (data) {
if (data.name) this.Name = data.name;
if (!isNaN(data.yclose)) this.YClose = data.yclose;
if (!isNaN(data.price)) this.Price = data.price;
if (!isNaN(data.high)) this.High = data.high;
if (!isNaN(data.low)) this.Low = data.low;
if (!isNaN(data.vol)) this.Vol = data.vol;
if (!isNaN(data.amount)) this.Amount = data.amount;
if (!isNaN(data.date)) this.Date = data.date;
if (!isNaN(data.time)) this.Time = data.time;
if (!isNaN(data.increase)) this.Increase = data.increase;
if (!isNaN(data.marketvalue)) this.MarketValue = data.marketvalue; //总市值
if (!isNaN(data.flowmarketvalue)) this.FlowMarketValue = data.flowmarketvalue; //流通市值
if (!isNaN(data.bookrate)) this.Bookrate = data.bookrate; //委比
if (!isNaN(data.bookdiffer)) this.Bookdiffer = data.bookdiffer; //委差
if (!isNaN(data.pe)) this.PE = data.pe;
if (!isNaN(data.pb)) this.PB = data.pb;
if (data.finance) this.SetFinanceData(data);
if (data.finance) this.SetFinanceDetailData(data);
if (data.capital) this.SetCapitalData(data);
if (data.mamplitude) {
if (!isNaN(data.mamplitude[1])) this.MinuteAmplitude.M1 = data.mamplitude[1];
if (!isNaN(data.mamplitude[3])) this.MinuteAmplitude.M3 = data.mamplitude[3];
if (!isNaN(data.mamplitude[5])) this.MinuteAmplitude.M5 = data.mamplitude[5];
if (!isNaN(data.mamplitude[10])) this.MinuteAmplitude.M10 = data.mamplitude[10];
if (!isNaN(data.mamplitude[15])) this.MinuteAmplitude.M15 = data.mamplitude[15];
}
if (data.risefallspeed) {
if (!isNaN(data.risefallspeed[1])) this.RiseFallSpeed.M1 = data.risefallspeed[1];
if (!isNaN(data.risefallspeed[3])) this.RiseFallSpeed.M3 = data.risefallspeed[3];
if (!isNaN(data.risefallspeed[5])) this.RiseFallSpeed.M5 = data.risefallspeed[5];
if (!isNaN(data.risefallspeed[10])) this.RiseFallSpeed.M10 = data.risefallspeed[10];
if (!isNaN(data.risefallspeed[15])) this.RiseFallSpeed.M15 = data.risefallspeed[15];
}
if (data.mamount) {
if (!isNaN(data.mamount[1])) this.MAmount.M1 = data.mamount[1];
if (!isNaN(data.mamount[3])) this.MAmount.M5 = data.mamount[3];
if (!isNaN(data.mamount[5])) this.MAmount.M5 = data.mamount[5];
if (!isNaN(data.mamount[10])) this.MAmount.M10 = data.mamount[10];
if (!isNaN(data.mamount[15])) this.MAmount.M15 = data.mamount[15];
}
//if (data.pledge) this.SetPledgeData(data);
//if (data.year) this.SetYearData(data);
};
}
/////////////////////////////////////////////////////////////////////////////////////
//
//
//股票字段枚举
var STOCK_FIELD_NAME = {
SYMBOL: 0,
NAME: 1,
OPEN: 2,
PRICE: 3,
HIGH: 4,
LOW: 5,
YCLOSE: 6,
VOL: 7, //成交量
AMOUNT: 8, //成交金额
DATE: 9,
TIME: 10,
INCREASE: 11,
BUY5: 12, //5档买
SELL5: 13, //5挡卖
DEAL: 14, //分笔
AMPLITUDE: 15, //振幅
MARKET_VALUE: 16, //总市值
FLOW_MARKET_VALUE: 17, //流通市值
BOOK_RATE: 18, //委比
BOOK_DIFFER: 19, //委差
PE: 20, //市盈率=股价/滚动EPS
PB: 21, //市净率=股价/每股净资产
EXCHANGE_RATE: 23, //换手率
//财务数据
ROE: 24, //净资产收益率
FINANCE_DATE: 25, //报告日期
FINANCE_PERSEARNING: 26, //每股收益
FINANCE_PERNETASSET: 27, //每股净资产
FINANCE_NPROFIT: 28, //净利润
FINANCE_NPROFITINCREASE: 29, //净利润涨幅 (当年净利润-上一年)/上一年*100
FINANCE_NNETPROFIT: 30, //扣非净利润
FINANCE_NNPROFITINCREASE: 31, //扣非净利润涨幅 (当年扣非净利润-上一年)/上一年*100
FINANCE_NNPROFITSPEED: 32, //扣非净利润涨速(当前扣非净利润/上一年-1)/(上一年/上上年-1)
FINANCE_EPS: 33, //滚动EPS
MAX_PRICE: 34, //涨停价
MIN_PRICE: 35, //跌停价
RISE_FALL_PRICE: 36, //涨跌额
FINANCE_BENFORD: 37, //财务粉饰
//1,3,5 ,10,15 分钟涨速
RISEFALLSPEED_1: 38,
RISEFALLSPEED_3: 39,
RISEFALLSPEED_5: 40,
RISEFALLSPEED_10: 41,
RISEFALLSPEED_15: 42,
//1,3,5 ,10,15 振幅
MINUTE_AMPLITUDE_1: 43,
MINUTE_AMPLITUDE_3: 44,
MINUTE_AMPLITUDE_5: 45,
MINUTE_AMPLITUDE_10: 46,
MINUTE_AMPLITUDE_15: 47,
//1,3,5 ,10,15 分钟 成交金额
MINUTE_AMOUNT_1: 48,
MINUTE_AMOUNT_3: 49,
MINUTE_AMOUNT_5: 50,
MINUTE_AMOUNT_10: 51,
MINUTE_AMOUNT_15: 52,
//个股资料
COMPANY_NAME: 53, //公司全称
PLATE_INDUSTRY: 54, //所属行业
PLATE_CONCEPT: 55, //概念
PLATE_REGION: 56, //地区
COMPANY_BUSINESS: 57,
COMPANY_VOL: 58,
COMPANY_PRICE: 59,
COMPANY_RELEASEDATE: 60,
COMPANY_COMPETENCE: 61,
CAPITAL_FLOW_DAY: 67, //当日资金流
CAPITAL_FLOW_DAY3: 68, //3日资金流
CAPITAL_FLOW_DAY5: 69, //5日资金流
CAPITAL_FLOW_DAY10: 70, //10日资金流
DDE: 71,
DDE3: 72,
DDE5: 73,
DDE10: 74,
//股票属性|事件 包含
// 融资融券标,
// 港股,
// 沪港通,
// St标识 0:正常股票,1:st股票,2:*st股票
EVENTS: 75,
CAPITAL_A: 76, //流通A股
CAPITAL_TOTAL: 77, //总股本
CAPTIAL_ARATE: 78, //流通A股占比
VOLRATIO: 79, //量比
PE2: 80, //市盈率(TTM)
PE3: 81, //市盈率(动)
INDEXTOP: 100,
WEEK: 101,
HEAT: 102
};
var StockDataFieldName = {
m_mapFiled: new _map2.default([[STOCK_FIELD_NAME.NAME, "name"], [STOCK_FIELD_NAME.SYMBOL, 'symbol'], [STOCK_FIELD_NAME.PRICE, 'price'], [STOCK_FIELD_NAME.INCREASE, 'increase'], [STOCK_FIELD_NAME.PE, 'pe'], [STOCK_FIELD_NAME.FINANCE_BENFORD, 'finance.benford'], [STOCK_FIELD_NAME.YCLOSE, 'yclose'],
//1,3,5 ,10,15 分钟涨速
[STOCK_FIELD_NAME.RISEFALLSPEED_1, 'risefallspeed.1'], [STOCK_FIELD_NAME.RISEFALLSPEED_3, 'risefallspeed.3'], [STOCK_FIELD_NAME.RISEFALLSPEED_5, 'risefallspeed.5'], [STOCK_FIELD_NAME.RISEFALLSPEED_10, 'risefallspeed.10'], [STOCK_FIELD_NAME.RISEFALLSPEED_15, 'risefallspeed.15'],
//1,3,5 ,10,15 振幅
[STOCK_FIELD_NAME.MINUTE_AMPLITUDE_1, 'mamplitude.1'], [STOCK_FIELD_NAME.MINUTE_AMPLITUDE_3, 'mamplitude.3'], [STOCK_FIELD_NAME.MINUTE_AMPLITUDE_5, 'mamplitude.5'], [STOCK_FIELD_NAME.MINUTE_AMPLITUDE_10, 'mamplitude.10'], [STOCK_FIELD_NAME.MINUTE_AMPLITUDE_15, 'mamplitude.15'],
//1,3,5 ,10,15 分钟 成交金额
[STOCK_FIELD_NAME.MINUTE_AMOUNT_1, 'mamount.1'], [STOCK_FIELD_NAME.MINUTE_AMOUNT_3, 'mamount.3'], [STOCK_FIELD_NAME.MINUTE_AMOUNT_5, 'mamount.5'], [STOCK_FIELD_NAME.MINUTE_AMOUNT_10, 'mamount.10'], [STOCK_FIELD_NAME.MINUTE_AMOUNT_15, 'mamount.15']]),
GetFieldName: function GetFieldName(fieldID) {
if (!this.m_mapFiled.has(fieldID)) return null;
return this.m_mapFiled.get(fieldID);
}
};
function StockRead(stock, tagID) {
this.JSStock = stock;
this.TagID = tagID;
this.Get = function (symbol, field) {
var data = stock.Get(symbol, this.TagID);
if (!data) return null;
switch (field) {
case STOCK_FIELD_NAME.SYMBOL:
case STOCK_FIELD_NAME.NAME:
case STOCK_FIELD_NAME.OPEN:
case STOCK_FIELD_NAME.PRICE:
case STOCK_FIELD_NAME.YCLOSE:
case STOCK_FIELD_NAME.HIGH:
case STOCK_FIELD_NAME.LOW:
case STOCK_FIELD_NAME.VOL:
case STOCK_FIELD_NAME.AMOUNT:
case STOCK_FIELD_NAME.DATE:
case STOCK_FIELD_NAME.TIME:
case STOCK_FIELD_NAME.INCREASE:
case STOCK_FIELD_NAME.EXCHANGE_RATE:
case STOCK_FIELD_NAME.AMPLITUDE:
case STOCK_FIELD_NAME.MAX_PRICE:
case STOCK_FIELD_NAME.MIN_PRICE:
case STOCK_FIELD_NAME.RISE_FALL_PRICE:
case STOCK_FIELD_NAME.INDEXTOP:
case STOCK_FIELD_NAME.WEEK:
case STOCK_FIELD_NAME.VOLRATIO:
return data.GetBaseData(this.TagID, field);
case STOCK_FIELD_NAME.HEAT:
return data.GetHeatData(this.TagID);
case STOCK_FIELD_NAME.BUY5:
return data.GetBuy5(this.TagID);
case STOCK_FIELD_NAME.SELL5:
return data.GetSell5(this.TagID);
case STOCK_FIELD_NAME.DEAL:
return data.GetDeal(this.TagID);
//实时计算的衍生数据
case STOCK_FIELD_NAME.MARKET_VALUE:
case STOCK_FIELD_NAME.FLOW_MARKET_VALUE:
case STOCK_FIELD_NAME.BOOK_RATE:
case STOCK_FIELD_NAME.BOOK_DIFFER:
case STOCK_FIELD_NAME.PE:
case STOCK_FIELD_NAME.PE2:
case STOCK_FIELD_NAME.PE3:
case STOCK_FIELD_NAME.PB:
return data.GetDerivative(this.TagID, field);
//财务数据
case STOCK_FIELD_NAME.ROE:
case STOCK_FIELD_NAME.FINANCE_DATE:
case STOCK_FIELD_NAME.FINANCE_PERSEARNING:
case STOCK_FIELD_NAME.FINANCE_PERNETASSET:
case STOCK_FIELD_NAME.FINANCE_NPROFIT:
case STOCK_FIELD_NAME.FINANCE_NPROFITINCREASE:
case STOCK_FIELD_NAME.FINANCE_NNETPROFIT:
case STOCK_FIELD_NAME.FINANCE_NNPROFITINCREASE:
case STOCK_FIELD_NAME.FINANCE_NNPROFITSPEED:
case STOCK_FIELD_NAME.FINANCE_EPS:
case STOCK_FIELD_NAME.FINANCE_BENFORD:
return data.GetFinance(this.TagID, field);
//行业分类
case STOCK_FIELD_NAME.PLATE_INDUSTRY:
case STOCK_FIELD_NAME.PLATE_CONCEPT:
case STOCK_FIELD_NAME.PLATE_REGION:
return data.GetPlate(this.TagID, field);
//资金流
case STOCK_FIELD_NAME.CAPITAL_FLOW_DAY:
case STOCK_FIELD_NAME.CAPITAL_FLOW_DAY3:
case STOCK_FIELD_NAME.CAPITAL_FLOW_DAY5:
case STOCK_FIELD_NAME.CAPITAL_FLOW_DAY10:
return data.GetCapitalFlowDay(this.TagID, field);
//资金流 DDE
case STOCK_FIELD_NAME.DDE:
case STOCK_FIELD_NAME.DDE3:
case STOCK_FIELD_NAME.DDE5:
case STOCK_FIELD_NAME.DDE10:
return data.GetDDE(this.TagID, field);
//事件/属性
case STOCK_FIELD_NAME.EVENTS:
return data.GetEvent(this.TagID, field);
//个股资料
case STOCK_FIELD_NAME.COMPANY_NAME:
case STOCK_FIELD_NAME.COMPANY_BUSINESS:
case STOCK_FIELD_NAME.COMPANY_VOL:
case STOCK_FIELD_NAME.COMPANY_PRICE:
case STOCK_FIELD_NAME.COMPANY_RELEASEDATE:
case STOCK_FIELD_NAME.COMPANY_COMPETENCE:
return data.GetCompany(this.TagID, field);
//股本
case STOCK_FIELD_NAME.CAPITAL_A:
case STOCK_FIELD_NAME.CAPTIAL_ARATE:
case STOCK_FIELD_NAME.CAPITAL_TOTAL:
return data.GetCapital(this.TagID, field);
default:
return null;
}
};
//symbol=指数或板块 field=排序字段 order=排序方式
this.GetSort = function (symbol, field, order) {
var data = stock.Get(symbol, this.TagID);
if (data == null) return data;
return data.GetSortData(this.TagID, field, order);
};
//读取完成 isUpdate 是否马上更新数据
this.EndRead = function (isUpdate) {
if (isUpdate == true) this.JSStock.ReqeustData();
};
//批量设置查询数据字段
this.SetQueryField = function (symbol, aryField) {
for (var i in aryField) {
this.Get(symbol, aryField[i]);
}
};
}
//历史数据 个股财务粉饰 || 大宗交易 || 股东减持 || 限售解禁 || 业绩预告 || 空头指标
function JSStockHistory() {
this.Symbol;
this.Callback; //UI回调
this.Order = -1; //排序方向
this.SortField; //排序字段
this.Field; //返回字段
this.Plate; //全市场
this.Data = new _map2.default(); //数据
this.ApiUrl = g_JSStockResource.Domain + "/API/StockHistoryDay";
this.PageSize = 20; //一页请求10调数据
this.PageIndex = 1;
this.Count; //数据总数
this.currentData = null; //请求入参
this.RequsetData = function (condition, condition2) {
var self = this;
var currentSymbol = typeof self.Symbol == "string" ? [this.Symbol] : this.Symbol;
var currentSymbolLength = currentSymbol ? currentSymbol.length : 0;
if (this.Plate) {
this.currentData = {
"plate": this.Plate, //["CNA.ci"],
"symbol": currentSymbol,
"start": 0,
"end": this.PageSize,
"field": this.Field,
"orderfield": this.SortField,
"order": this.Order,
"condition": condition.GetQuery(),
"condition2": condition2 ? condition2.GetQuery() : []
};
} else {
this.currentData = {
"symbol": currentSymbol,
"start": 0,
"end": currentSymbolLength,
"field": this.Field,
"orderfield": this.SortField,
"order": this.Order,
"condition": condition.GetQuery(),
"condition2": condition2 ? condition2.GetQuery() : []
};
}
_jquery2.default.ajax({
url: this.ApiUrl,
data: self.currentData,
method: 'POST',
dataType: 'json',
success: function success(data) {
self.Count = data.data.count;
self.RecvData(data, condition);
},
fail: function fail(request) {
self.RecvError(request, condition);
}
});
};
this.GetNextPage = function () {
var self = this;
if (this.PageSize * this.PageIndex < this.Count) {
this.currentData.start = this.PageSize * this.PageIndex;
this.PageIndex++;
this.currentData.end = this.PageSize * this.PageIndex;
_jquery2.default.ajax({
url: this.ApiUrl,
data: self.currentData,
method: 'POST',
dataType: 'json',
success: function success(data) {
self.RecvData(data);
},
fail: function fail(request) {
self.RecvError(request);
}
});
} else {
alert("数据已全部加载");
// wx.showToast({
// title: "数据已全部加载",
// icon: 'success',
// duration: 1000
// })
}
};
//结果处理 个股财务粉饰
this.RecvData = function (recvData, condition) {
var data = recvData.data;
for (var i in data.stock) {
var item = data.stock[i];
var strSymbol = item.symbol;
var stockData = {};
// console.log("this.Data.has(strSymbol)", this.Data, strSymbol, this.Data.has(strSymbol));
if (this.Data.has(strSymbol)) {
stockData = this.Data.get(strSymbol);
} else {
stockData = {
Symbol: item.symbol,
Name: item.name,
Data: new _map2.default() //Map key=日期 value=Map(key=字段名, value=数值)
};
this.Data.set(strSymbol, stockData);
}
this.SetStockData(item, stockData);
}
if (this.Callback) this.Callback(this, condition);
};
this.SetStockData = function (data, stockData) {
for (var i in data.stockday) {
var item = data.stockday[i];
var date = item.date;
var dataMap = new _map2.default();
this.SetFinanceData(item, dataMap);
this.SetBlocktradingData(item, dataMap);
this.SetChangesData(item, dataMap);
this.SetLiftingData(item, dataMap);
this.SetPforecastData(item, dataMap);
this.SetShortIndicatorsData(item, dataMap);
stockData.Data.set(date, dataMap);
}
return stockData;
};
this.SetFinanceData = function (recvData, dataMap) {
//1季度
var finnance = recvData.finance1;
if (finnance) {
if (!isNaN(finnance.nprofitincrease)) dataMap.set(STOCK_HISTORY_FIELD_NAME.FINANCE1_NPROFITINCREASE, finnance.nprofitincrease);
if (!isNaN(finnance.nnprofitincrease)) dataMap.set(STOCK_HISTORY_FIELD_NAME.FINANCE1_NNPROFITINCREASE, finnance.nnprofitincrease);
if (!isNaN(finnance.nnprofitspeed)) dataMap.set(STOCK_HISTORY_FIELD_NAME.FINANCE1_NNPROFITSPEED, finnance.nnprofitspeed);
if (!isNaN(finnance.benford)) dataMap.set(STOCK_HISTORY_FIELD_NAME.FINANCE1_BENFORD, finnance.benford);
}
var announcement = recvData.announcement1;
if (announcement) {
if (!isNaN(announcement.year)) dataMap.set(STOCK_HISTORY_FIELD_NAME.FINANCE1_YEAR, announcement.year);
if (!isNaN(announcement.quarter)) dataMap.set(STOCK_HISTORY_FIELD_NAME.FINANCE1_QUARTER, announcement.quarter);
}
//2季度
var finnance = recvData.finance2;
if (finnance) {
if (!isNaN(finnance.nprofitincrease)) dataMap.set(STOCK_HISTORY_FIELD_NAME.FINANCE2_NPROFITINCREASE, finnance.nprofitincrease);
if (!isNaN(finnance.nnprofitincrease)) dataMap.set(STOCK_HISTORY_FIELD_NAME.FINANCE2_NNPROFITINCREASE, finnance.nnprofitincrease);
if (!isNaN(finnance.nnprofitspeed)) dataMap.set(STOCK_HISTORY_FIELD_NAME.FINANCE2_NNPROFITSPEED, finnance.nnprofitspeed);
if (!isNaN(finnance.benford)) dataMap.set(STOCK_HISTORY_FIELD_NAME.FINANCE2_BENFORD, finnance.benford);
}
var announcement = recvData.announcement2;
if (announcement) {
if (!isNaN(announcement.year)) dataMap.set(STOCK_HISTORY_FIELD_NAME.FINANCE2_YEAR, announcement.year);
if (!isNaN(announcement.quarter)) dataMap.set(STOCK_HISTORY_FIELD_NAME.FINANCE2_QUARTER, announcement.quarter);
}
//3季度
var finnance = recvData.finance3;
if (finnance) {
if (!isNaN(finnance.nprofitincrease)) dataMap.set(STOCK_HISTORY_FIELD_NAME.FINANCE3_NPROFITINCREASE, finnance.nprofitincrease);
if (!isNaN(finnance.nnprofitincrease)) dataMap.set(STOCK_HISTORY_FIELD_NAME.FINANCE3_NNPROFITINCREASE, finnance.nnprofitincrease);
if (!isNaN(finnance.nnprofitspeed)) dataMap.set(STOCK_HISTORY_FIELD_NAME.FINANCE3_NNPROFITSPEED, finnance.nnprofitspeed);
if (!isNaN(finnance.benford)) dataMap.set(STOCK_HISTORY_FIELD_NAME.FINANCE3_BENFORD, finnance.benford);
}
var announcement = recvData.announcement3;
if (announcement) {
if (!isNaN(announcement.year)) dataMap.set(STOCK_HISTORY_FIELD_NAME.FINANCE3_YEAR, announcement.year);
if (!isNaN(announcement.quarter)) dataMap.set(STOCK_HISTORY_FIELD_NAME.FINANCE3_QUARTER, announcement.quarter);
}
//4季度
var finnance = recvData.finance4;
if (finnance) {
if (!isNaN(finnance.nprofitincrease)) dataMap.set(STOCK_HISTORY_FIELD_NAME.FINANCE4_NPROFITINCREASE, finnance.nprofitincrease);
if (!isNaN(finnance.nnprofitincrease)) dataMap.set(STOCK_HISTORY_FIELD_NAME.FINANCE4_NNPROFITINCREASE, finnance.nnprofitincrease);
if (!isNaN(finnance.nnprofitspeed)) dataMap.set(STOCK_HISTORY_FIELD_NAME.FINANCE4_NNPROFITSPEED, finnance.nnprofitspeed);
if (!isNaN(finnance.benford)) dataMap.set(STOCK_HISTORY_FIELD_NAME.FINANCE4_BENFORD, finnance.benford);
}
var announcement = recvData.announcement4;
if (announcement) {
if (!isNaN(announcement.year)) dataMap.set(STOCK_HISTORY_FIELD_NAME.FINANCE4_YEAR, announcement.year);
if (!isNaN(announcement.quarter)) dataMap.set(STOCK_HISTORY_FIELD_NAME.FINANCE4_QUARTER, announcement.quarter);
}
};
//大宗交易
this.SetBlocktradingData = function (recvData, dataMap) {
var blocktrading = recvData.blocktrading;
if (blocktrading) {
dataMap.set(STOCK_HISTORY_FIELD_NAME.BLOCK_TRADING, {
Premium: blocktrading.premium, ////总溢价
Price: blocktrading.price, //总成交价
Vol: blocktrading.vol, //总成交量
Amount: blocktrading.amount //成交额
});
}
};
//股东减持
this.SetChangesData = function (recvData, dataMap) {
var changes = recvData.changes;
if (changes) {
dataMap.set(STOCK_HISTORY_FIELD_NAME.HOLDERS_CHANGES, { List: changes.list });
}
};
//限售解禁
this.SetLiftingData = function (recvData, dataMap) {
var lifting = recvData.lifting;
if (lifting) {
// console.log("lifting",lifting);
dataMap.set(STOCK_HISTORY_FIELD_NAME.LIFTING, { Lifting: lifting });
}
};
//业绩公告
this.SetPforecastData = function (recvData, dataMap) {
var pforecast = recvData.pforecast;
if (pforecast) {
// console.log("pforecast", pforecast)
dataMap.set(STOCK_HISTORY_FIELD_NAME.PFORECAST, {
Lowprofit: pforecast[0].lowprofit, ////最低利润
Highprofit: pforecast[0].highprofit, //最高利润
Lowchange: pforec