Both arguments for character comparison must have the category of LITERAL


c1 = "2018.01.01"
c2 = "2021.10.01"
stock = "000852"
script = """TICK_SH = loadTable("dfs://dwd_dys_xshg_markdata","equ_xshg_markdata") //上海
            cDate1 = monthBegin(date({}))
            cDate2 = monthBegin(date({}))
            select SecurityID, DataDate, UpdateTime, LastPrice, OpenPrice, HighPrice from TICK_SH where DataDate >=cDate1 and DataDate < cDate2 and SecurityID = {} and InstruStatus like 'TRADE%' and ((time(UpdateTime) between 09:30:00.000:11:30:00.000) or (time(UpdateTime) between 13:00:00.000:14:57:00.000)) and AskPrice1 > 0 and BidPrice1 > 0 order by DataDate, UpdateTime
        """.format(c1, c2, stock)

这个在python运行中报错是这个:Both arguments for character comparison must have the category of LITERAL,是怎么回事呀?

请先 登录 后评论

1 个回答

wale

这里是说字符串比较时两个参数都须是字符串类型,可能是where条件中securityId={}这个少了引号。

请先 登录 后评论