Administrator
2023-10-13 da57f0e87d95b007b26560e6067169d1c434dc69
测试影子订单
2个文件已修改
15 ■■■■ 已修改文件
huaxin_client/trade_client.py 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/tool.py 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
huaxin_client/trade_client.py
@@ -170,7 +170,7 @@
                # 下一个影子订单
                shadow_order_ref = order_ref + 1
                shadow_sinfo = f"s_b_{order_ref}"
                shadow_price = price - 0.05
                shadow_price = tool.get_buy_min_price(price)
                req_field.LimitPrice = shadow_price
                req_field.SInfo = shadow_sinfo
                req_field.OrderRef = shadow_order_ref
utils/tool.py
@@ -3,6 +3,7 @@
"""
import ctypes
import decimal
import math
import random
import threading
import time
@@ -213,8 +214,16 @@
    return datetime.datetime.fromtimestamp(timestamp_second).strftime(format_)
# 获取买入价格笼子的最低价
def get_buy_min_price(price):
    price1 = price * (1 - 0.02)
    price1 = math.ceil(price1 * 100) / 100
    price2 = price - 0.1
    return max(price1, price2)
if __name__ == "__main__":
    print(int(to_time_str(1684132912).replace(":", "")))
    print(get_buy_min_price(20))
    # print(trade_time_sub("11:29:59", 5))
    # print(trade_time_sub("10:29:59", 10))
    # print(trade_time_add_second("13:29:59", 60))
@@ -247,4 +256,4 @@
            return thread_id
    except:
        pass
    return None
    return None