tool.py
@@ -25,6 +25,19 @@ return _decimal.quantize(decimal.Decimal("0.00"), decimal.ROUND_HALF_UP) # 是否为交易时间 def is_trade_time(): relative_timestamp = t.time() % (24 * 60 * 60) + 8 * 60 * 60 start1 = 60 * 60 * 9 + 24 * 60; end1 = 60 * 60 * 11 + 35 * 60; start2 = 60 * 60 * 12 + 50 * 60; end2 = 60 * 60 * 15 + 5 * 60; if start1 < relative_timestamp < end1 or start2 < relative_timestamp < end2: return True else: return False if __name__=="__main__": d1 = decimal.Decimal("0.12") d2 = decimal.Decimal("0.12")