dm-web-react
Version:
The DM web client with React.
68 lines (64 loc) • 3.57 kB
text/typescript
import { ObjectUtils } from "ts-commons";
export interface BrokerMarketTodayDealDto {
// table
id: string; // ID
bondUniCode: number; // 债券id
tenor: string; // 剩余期限
tenorRegion: string; // 剩余期限 期限(区间),用于分类
code: string; // 债券代码
shortName: string; // 债券简称
yield: string; // 成交价(收益率)
fairValue: string; // 中债估值
dealSubChinaBond: string; // 成交-中债
macd: string; // 久期
ratingList: string; // 主/债/展望
brokerShortName: string; // 经纪商
updateTime: string; // 更新时间
instInvestmentAdvice: string; // 投资建议
instRating: string; // 内部评级
pd: string; // DM量化评分
pdRating: string; // DM量化评分
pdDiff?: number; // DM量化评分 diff
pdTime: string; // DM量化评分 time
worstPd: string; // 历史最高风险
worstPdTime: string; // 历史最高风险时间
yieldToMaturity: string; // 中证估值
dealSubChinaSecurities: string; // 成交-中证
statusValue: number; // 成交类型1:done 2:gvn 3:tkn 4:other
isChinaBondAccess: boolean; // 是否有中债权限
isChinaBondHistoryAccess: boolean; // 是否有中债历史权限
isChinaSecuritiesAccess: boolean; // 是否有中证权限
}
function brokerMarketTodayDealFilter(item: any) {
const todayDeal: BrokerMarketTodayDealDto = {
id: item.id,
bondUniCode: item.bondUniCode,
tenor: ObjectUtils.isNullOrUndefined(item.tenor) ? "--" : item.tenor,
tenorRegion: item.tenorRegion,
code: ObjectUtils.isNullOrUndefined(item.code) ? "--" : item.code,
shortName: ObjectUtils.isNullOrUndefined(item.shortName) ? "--" : item.shortName,
yield: ObjectUtils.isNullOrUndefined(item.yield) ? "--" : item.yield.toFixed(4),
fairValue: ObjectUtils.isNullOrUndefined(item.fairValue) ? "--" : item.fairValue.toFixed(4),
dealSubChinaBond: ObjectUtils.isNullOrUndefined(item.dealSubChinaBond) ? "--" : item.dealSubChinaBond.toFixed(2),
macd: ObjectUtils.isNullOrUndefined(item.macd) ? "--" : item.macd,
ratingList: `${item.issRating || "--"}/${item.bondRating || "--"}/${item.issRatePros || "--"}`,
brokerShortName: item.brokerShortName,
updateTime: ObjectUtils.isNullOrUndefined(item.updateTime) ? "--" : item.updateTime,
instInvestmentAdvice: ObjectUtils.isNullOrUndefined(item.instInvestmentAdvice) ? "--" : item.instInvestmentAdvice,
instRating: ObjectUtils.isNullOrUndefined(item.instRating) ? "--" : item.instRating,
pd: ObjectUtils.isNullOrUndefined(item.pd) ? "--" : item.pd,
pdRating: ObjectUtils.isNullOrUndefined(item.pdRating) ? "--" : item.pdRating,
pdDiff: item.pdDiff,
pdTime: ObjectUtils.isNullOrUndefined(item.pdTime) ? "--" : item.pdTime,
worstPd: ObjectUtils.isNullOrUndefined(item.worstPd) ? "--" : item.worstPd,
worstPdTime: ObjectUtils.isNullOrUndefined(item.worstPdTime) ? "--" : item.worstPdTime,
yieldToMaturity: ObjectUtils.isNullOrUndefined(item.yieldToMaturity) ? "--" : item.yieldToMaturity.toFixed(4),
dealSubChinaSecurities: ObjectUtils.isNullOrUndefined(item.dealSubChinaSecurities) ? "--" : item.dealSubChinaSecurities.toFixed(2),
statusValue: item.statusValue,
isChinaBondAccess: item.chinaBondAccess === 1 ? false : true,
isChinaBondHistoryAccess: item.chinaBondHistoryAccess === 1 ? false : true,
isChinaSecuritiesAccess: item.chinaSecuritiesAccess === 1 ? false : true,
};
return todayDeal;
}
export { brokerMarketTodayDealFilter };