DolphinDB中有个函数可以判断某个日期是周几,例如
days=2020.010.01..2020.10.30
days[weekday(days) between 1:5]
上述代码列出了10月周一到周五的所有日期,但周一到周五有可能是节假日,不一定是交易日。这个可以通过手工列举所有假日并从中剔除。
days=2020.10.01..2020.10.30
holiday=[2020.10.01,2020.10.02]
def getTradingDays(days,holiday){
return days[weekday(days) between 1:5 and not days in holiday ]
}
getTradingDays(days,holiday)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…