| | |
| | | return date |
| | | |
| | | |
| | | def get_now_date_str(): |
| | | date = datetime.datetime.now().strftime("%Y-%m-%d") |
| | | return date |
| | | |
| | | def get_now_time_str(): |
| | | time_str = datetime.datetime.now().strftime("%H:%M:%S") |
| | | return time_str |
| | | |
| | | |
| | | |
| | | # 转为价格,四舍五入保留2位小数 |
| | | def to_price(_decimal): |
| | | return _decimal.quantize(decimal.Decimal("0.00"), decimal.ROUND_HALF_UP) |
| | |
| | | return True |
| | | else: |
| | | return False |
| | | |
| | | |
| | | # 是否为报警时间 |
| | | def is_alert_time(): |
| | |
| | | return False |
| | | |
| | | |
| | | |
| | | def is_set_code_time(): |
| | | # 测试 |
| | | if constant.TEST: |
| | |
| | | return True |
| | | else: |
| | | return False |
| | | |
| | | |
| | | def run_time(): |
| | | def decorator(func): |
| | |
| | | return time_1 - time_2 |
| | | |
| | | |
| | | def compute_buy1_real_time(time_): |
| | | ts = time_.split(":") |
| | | s = int(ts[0]) * 3600 + int(ts[1]) * 60 + int(ts[2]) |
| | | cha = (s - 2) % 3 |
| | | return time_seconds_format(s - 2 - cha) |
| | | |
| | | if __name__ == "__main__": |
| | | print(trade_time_sub("11:29:59", "13:00:00")) |
| | | print(trade_time_sub("11:29:59", "14:00:00")) |