查看未结算的赎回交易

-- 查看未清算赎回交易
select t.account_no, t.trading_no, t.fundcode, t.cnfrm_nv, t.cnfrm_shares,t.shares_cnfrm_date,
    s.sttlmnt_time, s.sttlmnt_status
from trading_rcd t left join shares_sttlmnt_rgst s
on t.trading_no = s.trading_no
where t.trading_drctn = 2 and (sttlmnt_status = '2' or sttlmnt_status is null)
order by t.account_no, t.shares_cnfrm_date desc

查看累计剩余份额,成本净值,最新总市值,最新净值

SELECT t.account_no, t.fundcode, s.fundname
	, round(sum(t.remaining_shares), 2) AS '剩余份额'
	, round(sum(t.remaining_shares * t.cnfrm_nv) / sum(t.remaining_shares), 4) AS '剩余成本'
	, round(sum(t.remaining_shares*p.unt_nv), 2) '当前市值' 
	, p.nv_date '最新净值日'
	, p.unt_nv '最新净值'
FROM trading_rcd t
	LEFT JOIN fund_list s
	ON t.fundcode = s.fundcode
		AND t.account_no = s.account_no
	LEFT JOIN (
		SELECT a.fundcode, a.nv_date, a.unt_nv
		FROM fund_nv_rcd a, (
				SELECT fundcode, max(nv_date) AS nv_dt
				FROM fund_nv_rcd
				GROUP BY fundcode
			) b
		WHERE a.fundcode = b.fundcode
			AND a.nv_date = b.nv_dt
	) p
	ON t.fundcode = p.fundcode
WHERE t.remaining_shares > 0
GROUP BY t.account_no, t.fundcode, s.fundname
ORDER BY t.account_no, t.fundcode

查看最新PE、PB分位数

SELECT a.ts_code, a.name, b.last_trd_dt AS '最后交易日', e.close AS '收盘点位'
	, CONCAT(round(e.pct_chg, 2) + '', '%') AS '涨跌幅'
	, c.pe_ttm AS '市盈率', c.pb AS '市净率'
	, concat(round(d.pe_ttm_l10y_prcntl * 100, 2) + '', '%') AS '近十年/成立至今市盈率百分位'
	, concat(round(d.pb_l10y_prcntl * 100, 2) + '', '%') AS '近十年/成立至今市净率百分位'
FROM index_traking a, (
		SELECT ts_code, max(trade_date) AS last_trd_dt
		FROM index_daily
		GROUP BY ts_code
	) b, index_dailybasic c, index_dlybsc_anlyz d, index_daily e
WHERE a.ts_code = b.ts_code
	AND a.status = 1
	AND b.last_trd_dt = c.trade_date
	AND a.ts_code = c.ts_code
	AND a.ts_code = d.ts_code
	AND b.last_trd_dt = d.trade_date
	AND a.ts_code = e.ts_code
	AND b.last_trd_dt = e.trade_date

Linux 常用脚本命令

tar压缩/解压命令 https://blog.csdn.net/CSNN2019/article/details/111469541
screen命令 https://blog.csdn.net/carefree2005/article/details/122415714
SSH端口修改 https://blog.csdn.net/sdujava2011/article/details/126836571
查看crontab日志 tail -f /var/log/cron
在目录下搜索关键字 find ./ -name '*.*' | xargs grep "test" -R
重启服务器 shutdown -r now --立即重启 https://www.xaheimi.com/safe/438.html
查看进程
– Linux提示killed的原因 https://blog.csdn.net/Castlehe/article/details/122936585
– Linux查看CPU和内存使用情况 https://www.cnblogs.com/xd502djj/archive/2011/03/01/1968041.html

Mysql数据库

数据库备份
导出gz压缩文件 mysqldump -u用户名 -h127.0.0.1 -p密码 数据库名 | gzip > 备份文件名.sql.gz
导入gz压缩文件 gunzip -f < 备份文件名.sql.gz |mysql -u用户名 -h127.0.0.1 -p密码 数据库名
参考:https://blog.csdn.net/A___LEi/article/details/117031973