| | |
| | | return wrapper |
| | | |
| | | |
| | | def singleton(cls): |
| | | """ |
| | | 单例装饰器 |
| | | @param cls: |
| | | @return: |
| | | """ |
| | | instances = {} |
| | | |
| | | def get_instance(*args, **kwargs): |
| | | if cls not in instances: |
| | | instances[cls] = cls(*args, **kwargs) |
| | | return instances[cls] |
| | | |
| | | return get_instance |
| | | |
| | | |
| | | def get_expire(): |
| | | now = int(t.time()) |
| | | end = int(t.time()) + 60 * 60 * 24 |
| | |
| | | def get_now_time_str(): |
| | | time_str = datetime.datetime.now().strftime("%H:%M:%S") |
| | | return time_str |
| | | |
| | | |
| | | def get_now_time_as_int(): |
| | | time_str = datetime.datetime.now().strftime("%H:%M:%S") |
| | | return int(time_str.replace(":", "")) |
| | | |
| | | |
| | | def get_now_time_with_ms_str(): |
| | |
| | | return round(get_buy_min_price(price) - 0.03, 2) |
| | | else: |
| | | # 大股价直接向下取2% |
| | | return round(price*(1-0.02), 2) |
| | | return round(price * (1 - 0.02), 2) |
| | | |
| | | |
| | | if __name__ == "__main__": |