- 帖子
- 14
- 积分
- 24
- 技术
- 0
- 捐助
- 0
- 注册时间
- 2018-11-12
|
3楼
发表于 2021-9-15 17:12
| 只看该作者
本帖最后由 380333722 于 2021-9-15 17:17 编辑
做了一个简单的,基本可以实现,不过没有筛选列,把所有列的数据都取出来放到表里了。
需要用到 wget.exe iconv.exe jq-win64.exe
1.csv 是excel表头。内容如下,需要修改成对应的中文:
bond_id,bond_nm,stock_id,stock_nm,btype,convert_price,convert_price_valid_from,convert_dt,maturity_dt,next_put_dt,put_dt,put_notes,put_price,put_inc_cpn_fl,put_convert_price_ratio,put_count_days,put_total_days,put_real_days,repo_discount_rt,repo_valid_from,repo_valid_to,turnover_rt,redeem_price,redeem_inc_cpn_fl,redeem_price_ratio,redeem_count_days,redeem_total_days,redeem_real_days,redeem_dt,redeem_flag,orig_iss_amt,curr_iss_amt,rating_cd,issuer_rating_cd,guarantor,ssc_dt,esc_dt,sc_notes,market_cd,force_redeem,real_force_redeem_price,convert_cd,repo_cd,ration,ration_cd,apply_cd,online_offline_ratio,qflag,qflag2,ration_rt,fund_rt,margin_**,lt_bps,pb,pb_flag,total_shares,float_shares,sq**,sprice,svolume,sincrease_rt,qstatus,bond_value,bond_value2,volatility_rate,last_time,convert_value,premium_rt,year_left,ytm_rt,ytm_rt_tax,price,full_price,increase_rt,volume,convert_price_valid,adj_scnt,adj_cnt,redeem_icon,ref_yield_info,adjust_tip,adjusted,option_tip,bond_value3,left_put_year,short_maturity_dt,dblow,force_redeem_price,put_convert_price,convert_amt_ratio,convert_amt_ratio2,convert_amt_ratio_tips,stock_net_value,stock_cd,pre_bond_id,repo_valid,convert_cd_tip,price_tips,
@echo off
setlocal enabledelayedexpansion
cd /d %~dp0
wget -O 1.txt https://www.jisilu.cn/data/cbnew/cb_list/
type 1.txt |jq-win64.exe |iconv.exe -f utf-8 -t cp936 >2.txt
copy /y 1.csv result.txt
for /f "tokens=1,2 skip=1 delims=: " %%a in ('findstr /i /v /r "{ } [ ] \"id\" \"total\" \"warn\"" 2.txt') do (
if "%%~a"=="bond_id" (
echo !string!>>result.txt
set string=%%b
) else (
set string=!string!%%b
)
)
move /y result.txt result.csv |
|