feat QMT_API.py
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,7 +1,8 @@
|
||||
from .models import *
|
||||
from typing import Any
|
||||
|
||||
OP_BUY, OP_SELL = 23, 24
|
||||
OP_BUY = 23
|
||||
OP_SELL = 24
|
||||
ORDER_TYPE_VOLUME, PR_TYPE_LATEST, QUICK_TRADE_NOW = 1101, 5, 2
|
||||
ORDER_SIDE_BY_OFFSET = {"23": "BUY", "24": "SELL", "48": "BUY", "49": "SELL"}
|
||||
|
||||
@@ -16,11 +17,11 @@ class TradeMixin:
|
||||
return self._post("/api/trade/passorder", body)
|
||||
|
||||
def passorder_latest(self, side, stock, volume): return self.passorder_latest_tagged(side, stock, volume, "", "")
|
||||
def passorder_latest_tagged(self, side, stock, volume, strategy_name, order_id):
|
||||
def passorder_latest_tagged(self, side, stock_code, volume, strategy_name, order_id):
|
||||
body = {
|
||||
"opType": side,
|
||||
"orderType": ORDER_TYPE_VOLUME,
|
||||
"stock": stock,
|
||||
"stockCode": stock_code,
|
||||
"prType": PR_TYPE_LATEST,
|
||||
"price": -1,
|
||||
"volume": volume,
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -108,7 +108,6 @@ def StartTrend() -> None:
|
||||
def RunOnce(run: Runtime, signals:list[SignalItem]) -> None:
|
||||
"""按固定步骤执行一轮趋势策略, ``RunOnce``。"""
|
||||
if not trading_time(datetime.now()):
|
||||
log.info("[运行] 非交易时间,跳过本轮")
|
||||
return
|
||||
|
||||
print("=" * 40 + f" Ticker {datetime.now().strftime('%Y-%m-%d %H:%M:%S')} " +"=" * 40)
|
||||
|
||||
@@ -71,6 +71,7 @@ def do_open(run:Runtime,code:str,volume:int,signal_key:str)->None:
|
||||
run.client,
|
||||
OP_BUY,
|
||||
code,
|
||||
-1,
|
||||
volume,
|
||||
order_id,
|
||||
signal_key,
|
||||
|
||||
@@ -25,6 +25,7 @@ class PlaceOrderRequest:
|
||||
client: Any
|
||||
op: int
|
||||
code: str
|
||||
price: float
|
||||
volume: int
|
||||
order_id: str
|
||||
strategy_name: str
|
||||
|
||||
Reference in New Issue
Block a user