123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389 |
- import bus from '@/api/bus'
- // console.log(bus.$i18nt.t('EtaBasePage.future_common_edb'))
- /* 公用校验 计算指标 */
- export const formRules= {
- targetName: [
- { required: true, message: bus.$i18nt.t('Edb.Valids.name_msg'), trigger: 'blur' },
- ],
- unit: [
- { required: true, message: /* '单位不能为空' */bus.$i18nt.t('Edb.Valids.unit_msg'), trigger: ['blur','change'] },
- ],
- menu: [
- { required: true, message: /* '指标目录不能为空' */bus.$i18nt.t('Edb.Valids.menu_msg'), trigger: 'blur' },
- ],
- frequency: [
- { required: true, message: /* '频度不能为空' */bus.$i18nt.t('Edb.Valids.fre_msg'), trigger: 'blur' },
- ],
- n_num: [
- { required: true, message: /* 'N不能为空' */bus.$i18nt.t('Edb.Valids.n_msg'), trigger: 'blur' },
- ],
- moveVal: [
- { required: true, message: /* '移动方式参数不能为空' */bus.$i18nt.t('Edb.Valids.move_msg'),trigger: 'blur' }
- ],
- calendar_type: [
- { required: true, message: /* '日历不能为空' */bus.$i18nt.t('Edb.Valids.calendar_msg'),trigger: 'blur' }
- ],
- alphaValue:[
- { validator:(rule,value,callback)=>{
- if(Number(value)<=0||Number(value)>=1){
- callback(new Error(bus.$i18nt.t('Edb.Valids.alpha_value_vaild')))
- }else{
- callback()
- }
- },trigger:['change','blur']},
- { required:true,message:/* 'alpha值不能为空' */bus.$i18nt.t('Edb.Valids.alpha_msg'),trigger:'blur'},
- ]
- }
- //计算指标弹窗类型
- export const computedTypes = [
- {
- name:/* '指标运算' */bus.$i18nt.t('Edb.CalculatesAll.calculate'),
- type:4
- },
- {
- name:/* '累计值转月/季值' */bus.$i18nt.t('Edb.CalculatesAll.to_month_quarter'),
- type:'toMonthSeason'
- },
- {
- name:/* '同比值' */bus.$i18nt.t('Edb.CalculatesAll.on_year'),
- type:6
- },
- {
- name:/* '同差值' */bus.$i18nt.t('Edb.CalculatesAll.differ'),
- type:7
- },
- {
- name:/* 'N数值移动平均计算' */bus.$i18nt.t('Edb.CalculatesAll.n_move_average'),
- type:8
- },
- {
- name:/* 'N数值环比值' */bus.$i18nt.t('Edb.CalculatesAll.n_rate'),
- type:12
- },
- {
- name:/* 'N数值环差值' */bus.$i18nt.t('Edb.CalculatesAll.n_differ'),
- type:13
- },
- {
- name:/* '升频' */bus.$i18nt.t('Edb.CalculatesAll.up_conver'),
- type:14
- },
- {
- name:/* '指标拼接' */bus.$i18nt.t('Edb.CalculatesAll.splic'),
- type: 'joint'
- },
- {
- name: /* '时间移位' */bus.$i18nt.t('Edb.CalculatesAll.time_move'),
- type: 22
- },
- {
- name: /* '超季节性' */bus.$i18nt.t('Edb.CalculatesAll.super_season'),
- type: 35
- },
- {
- name: /* '拟合残差' */bus.$i18nt.t('Edb.CalculatesAll.fit_residu'),
- type: 37
- },
- {
- name: /* '年化' */bus.$i18nt.t('Edb.CalculatesAll.annual'),
- type: 52
- },
- {
- name: /* '降频' */bus.$i18nt.t('Edb.CalculatesAll.down_conver'),
- type: 51
- },
- {
- name: /* '扩散指数' */bus.$i18nt.t('Edb.CalculatesAll.diff_index'),
- type: 53
- },
- {
- name: /* '累计值' */bus.$i18nt.t('Edb.CalculatesAll.cumulate'),
- type: 'accumulate'
- },
- {
- name:/* '指数修匀' */bus.$i18nt.t('Edb.CalculatesAll.ex_smooth'),
- type:'alpha'
- },
- {
- name:/* '日均值' */bus.$i18nt.t('Edb.CalculatesAll.day_mean'),
- type: 75
- }
- ]
- //批量指标类型
- export const computedBatchTypes = [
- {
- name:/* '同比值' */bus.$i18nt.t('Edb.CalculatesAll.on_year'),
- type:6
- },
- {
- name:/* '同差值' */bus.$i18nt.t('Edb.CalculatesAll.differ'),
- type:7
- },
- {
- name:/* 'N数值移动平均计算' */bus.$i18nt.t('Edb.CalculatesAll.n_move_average'),
- type:8
- },
- {
- name:/* 'N数值环比值' */bus.$i18nt.t('Edb.CalculatesAll.n_rate'),
- type:12
- },
- {
- name:/* 'N数值环差值' */bus.$i18nt.t('Edb.CalculatesAll.n_differ'),
- type:13
- },
- {
- name:/* '升频' */bus.$i18nt.t('Edb.CalculatesAll.up_conver'),
- type:14
- },
- {
- name:/* '累计值转月/季值' */bus.$i18nt.t('Edb.CalculatesAll.to_month_quarter'),
- type:'toMonthSeason'
- },
- {
- name: /* '累计值' */bus.$i18nt.t('Edb.CalculatesAll.cumulate'),
- type: 'accumulate'
- },
- {
- name:/* '指数修匀' */bus.$i18nt.t('Edb.CalculatesAll.ex_smooth'),
- type:'alpha'
- },
- {
- name:/* '日均值' */bus.$i18nt.t('Edb.CalculatesAll.day_mean'),
- type: 75
- }
- ]
- //批量指标类型
- export const computedBatchTypesV2=[
- {
- name:'同比值',
- type:6
- },
- {
- name:'同差值',
- type:7
- },
- {
- name:'累计值转月/季值',
- type:'toMonthSeason'
- },
- {
- name:'N期移动均值',
- type:8
- },
- {
- name:'N期环比值',
- type:12
- },
- {
- name:'N期环差值',
- type:13
- },
- {
- name:'升频',
- type:14
- },
- {
- name:'超级季节性',
- type:35
- },
- {
- name:'年化值',
- type:52
- },
- {
- name:'降频',
- type:51
- },
- {
- name: '累计值',
- type: 'accumulate'
- },
- {
- name:'指数修匀',
- type:72
- },
- {
- name:'日均值',
- type: 75
- },
- {
- name:'与常数计算',
- type:'withNum'
- },
- {
- name:'与单指标计算',
- type:'withEDB'
- },
- {
- name:'多指标求和/平均',
- type:'multipleEDB',//81求和 82求平均
- },
- ]
- //频度
- export const frequencyArr = ['日度','周度','旬度','月度','季度','年度'];
- //添加基础指标来源 已改为从接口获取 datamanage/edb_source/list
- export const fromArr = ['wind','同花顺','彭博','彭博财务','路透','手工指标','隆众指标','SMM','Mysteel','郑商所',
- '大商所','上期所','中金所','上期能源','欧洲天然气','中国煤炭市场网','谷歌出行指数','EIA STEO报告','UN','卓创数据(红桃3)',
- '百川盈孚','国家统计局','富宝数据'];
- // 已改为从接口获取 datamanage/edb_source/list
- export const fromCode = new Map([
- ['同花顺','1'],
- ['wind','2'],
- ['SMM','11'],
- ['彭博','3'],
- ['彭博财务','28'],
- ['路透','25'],
- ['手工指标','9'],
- ['隆众指标','10'],
- ['Mysteel','15'],
- ['郑商所','16'],
- ['大商所','17'],
- ['上期所','18'],
- ['中金所','19'],
- ['上期能源','20'],
- ['欧洲天然气','21'],
- ['中国煤炭市场网','26'],
- ['谷歌出行指数','29'],
- ['EIA STEO报告','36'],
- ['UN','38'],
- ['卓创数据(红桃3)','41'],
- ['百川盈孚','57'],
- ['国家统计局','60'],
- ['富宝数据','71']
- ]);
- //所有来源 只用于pycode代码运算 别问我我也不知道为什么每个地方要用不一样的来源
- export const allFromArr = [
- { name: 'wind',key: 2 },
- { name: '同花顺',key: 1 },
- { name: '彭博',key: 3 },
- { name:'彭博财务',key:28},
- { name: '路透', key: 25 },
- { name: '手工指标', key: 9 },
- { name: '隆众指标', key: 10 },
- { name: 'SMM', key: 11 },
- { name: 'Mysteel', key: 15 },
- { name: '郑商所', key: 16 },
- { name: '大商所', key: 17 },
- { name: '上期所', key: 18 },
- { name: '中金所', key: 19 },
- { name: '上期能源', key: 20 },
- { name: '欧洲天然气', key: 21 },
- { name: '中国煤炭网', key: 26 },
- { name: '指标运算',key: 4 },
- { name: '累计值转月',key: 5 },
- { name: '同比值', key: 6 },
- { name: '同差值', key: 7 },
- { name: 'N数值移动平均计算', key: 8 },
- { name: '环比值', key: 12 },
- { name: '环差值', key: 13 },
- { name: '变频',key: 14 },
- { name: '时间移位', key: 22 },
- { name: '直接拼接', key: 23 },
- { name: '累计值同比拼接', key: 24 },
- { name: 'python代码', key: 27 },
- { name: '谷歌出行指数' ,key:29},
- { name: '钢联化工' ,key:34},
- { name: 'EIA STEO报告' ,key:36},
- { name: 'UN' ,key:38},
- { name: '卓创数据(红桃3)' ,key:41},
- { name:'百川盈孚',key:57},
- { name: '存量装置',key:58 },
- { name:'国家统计局',key:60}
- ]
- //公式说明 eta指标库
- export const formulaTip = new Map([
- [4,bus.$i18nt.t('Edb.FormulaTips.calculate')], //指标运算
- [5,bus.$i18nt.t('Edb.FormulaTips.to_month')], //累计转月
- ['toMonthSeason',bus.$i18nt.t('Edb.FormulaTips.to_month_quarter')], //累计转月、转季
- [6,bus.$i18nt.t('Edb.FormulaTips.on_year')], //同比
- [7,bus.$i18nt.t('Edb.FormulaTips.differ')], //同差
- [8,bus.$i18nt.t('Edb.FormulaTips.n_move_average')], //n数值移动平均
- [12,bus.$i18nt.t('Edb.FormulaTips.n_rate')], //n数值环比
- [13,bus.$i18nt.t('Edb.FormulaTips.n_differ')],//n数值环差
- [14,bus.$i18nt.t('Edb.FormulaTips.up_conver')], //升频
- ['joint',bus.$i18nt.t('Edb.FormulaTips.splic')], //指标拼接
- [22,bus.$i18nt.t('Edb.FormulaTips.time_move')], //时间移位
- [35,bus.$i18nt.t('Edb.FormulaTips.super_season')], //超季节性
- [37,bus.$i18nt.t('Edb.FormulaTips.fit_residu')], //拟合残差
- [40,bus.$i18nt.t('Edb.FormulaTips.adjust_data')], //数据调整
- [52,bus.$i18nt.t('Edb.FormulaTips.annual')], //年化
- [51,bus.$i18nt.t('Edb.FormulaTips.down_conver')], //降频
- [53,bus.$i18nt.t('Edb.FormulaTips.diff_index')], //扩散指数
- ['accumulate',bus.$i18nt.t('Edb.FormulaTips.cumulate_and_toyear')], //累计值、年初至今累计
- [61,bus.$i18nt.t('Edb.FormulaTips.to_quarter')], //累计转季
- [62,bus.$i18nt.t('Edb.FormulaTips.cumulate_val')], //累计值
- [63,bus.$i18nt.t('Edb.FormulaTips.cumulate_to_year')], //年初至今累计值
- ['alpha',bus.$i18nt.t('Edb.FormulaTips.ex_smooth')], //指数修匀
- [75,bus.$i18nt.t('Edb.FormulaTips.day_mean')], //日均值
- ])
- // wind 日期序列常见指标代码
- export const windCommonIndexCodeArr=[
- {value:'pre_close',label:bus.$i18nt.t('EtaBasePage.pre_price')},
- {value:'open',label:bus.$i18nt.t('EtaBasePage.op_price')/* "开盘价" */},
- {value:'high',label:bus.$i18nt.t('EtaBasePage.high_price')/* "最高价" */},
- {value:'low',label:bus.$i18nt.t('EtaBasePage.low_price')/* "最低价" */},
- {value:'close',label:bus.$i18nt.t('EtaBasePage.close_price')/* "收盘价" */},
- {value:'settle',label:bus.$i18nt.t('EtaBasePage.settle_price')/* "结算价" */},
- {value:'volume',label:bus.$i18nt.t('EtaBasePage.trade_volume')/* "成交量" */},
- {value:'amt',label:bus.$i18nt.t('EtaBasePage.turnover')/* "成交额" */},
- {value:'pct_chg',label:bus.$i18nt.t('EtaBasePage.incre_decre')/* "涨跌幅" */},
- {value:'swing',label:bus.$i18nt.t('EtaBasePage.fluctua')/* "振幅" */},
- {value:'turn',label:bus.$i18nt.t('EtaBasePage.turn_rate')/* "换手率" */},
- {value:'oi',label:bus.$i18nt.t('EtaBasePage.open_inter')/* "持仓量" */},
- {value:'oiamount',label:bus.$i18nt.t('EtaBasePage.open_val')/* "持仓额" */}
- ]
- // 同花顺 日期序列常见 股票指标代码
- export const THSCommonIndexStockCodeArr=[
- {value:'ths_pre_close_stock',label:bus.$i18nt.t('EtaBasePage.pre_price')/* "前收盘价" */},
- {value:'ths_open_price_stock',label:bus.$i18nt.t('EtaBasePage.op_price')/* "开盘价" */},
- {value:'ths_high_price_stock',label:bus.$i18nt.t('EtaBasePage.high_price')/* "最高价" */},
- {value:'ths_low_stock',label:bus.$i18nt.t('EtaBasePage.low_price')/* "最低价" */},
- {value:'ths_close_price_stock',label:bus.$i18nt.t('EtaBasePage.close_price')/* "收盘价" */},
- {value:'ths_vol_stock',label:bus.$i18nt.t('EtaBasePage.trade_volume')/* "成交量" */},
- {value:'ths_amt_stock',label:bus.$i18nt.t('EtaBasePage.turnover')/* "成交额" */},
- {value:'ths_chg_ratio_stock',label:bus.$i18nt.t('EtaBasePage.incre_decre')/* "涨跌幅" */},
- {value:'ths_swing_stock',label:bus.$i18nt.t('EtaBasePage.fluctua')/* "振幅" */},
- {value:'ths_turnover_ratio_stock',label:bus.$i18nt.t('EtaBasePage.turn_rate')/* "换手率" */},
- ]
- // 同花顺 日期序列常见 指标代码
- export const THSCommonIndexFuturesCodeArr=[
- {value:'ths_pre_close_future',label:bus.$i18nt.t('EtaBasePage.pre_price')/* "前收盘价" */},
- {value:'ths_open_price_future',label:bus.$i18nt.t('EtaBasePage.op_price')/* "开盘价" */},
- {value:'ths_high_price_future',label:bus.$i18nt.t('EtaBasePage.high_price')/* "最高价" */},
- {value:'ths_low_future',label:bus.$i18nt.t('EtaBasePage.low_price')/* "最低价" */},
- {value:'ths_close_price_future',label:bus.$i18nt.t('EtaBasePage.close_price')/* "收盘价" */},
- {value:'ths_settle_future',label:bus.$i18nt.t('EtaBasePage.settle_price')/* "结算价" */},
- {value:'ths_vol_future',label:bus.$i18nt.t('EtaBasePage.trade_volume')/* "成交量" */},
- {value:'ths_amt_future',label:bus.$i18nt.t('EtaBasePage.turnover')/* "成交额" */},
- {value:'ths_chg_ratio_future',label:bus.$i18nt.t('EtaBasePage.incre_decre')/* "涨跌幅" */},
- {value:'ths_swing_d_future',label:bus.$i18nt.t('EtaBasePage.fluctua_day')/* "日振幅" */},
- {value:'ths_open_interest_future',label:bus.$i18nt.t('EtaBasePage.open_inter')/* "持仓量" */},
- ]
- // 生成序列数组
- export function generateSeriesArray(){
- let result = [];
- const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
- for(let i=0;i<26;i++) result.push(String.fromCharCode(65+i))
- for (let i = 0; i < 26; i++) {
- const firstChar = alphabet[i];
- for (let j = 0; j < 26; j++) {
- const secondChar = alphabet[j];
- result.push(firstChar + secondChar);
- }
- }
- return result;
- }
|