1
This commit is contained in:
@@ -722,12 +722,20 @@ class mt5(mt5Parent):
|
||||
mark_price = self.safe_number(order_data, 'closePrice')
|
||||
notional = contracts * entry_price if contracts and entry_price else None
|
||||
|
||||
# 获取止损止盈价格
|
||||
stop_loss_price = self.safe_number(order_data, 'stopLoss')
|
||||
take_profit_price = self.safe_number(order_data, 'takeProfit')
|
||||
|
||||
# 确定持仓方向
|
||||
order_type = self.safe_string(order_data, 'orderType')
|
||||
side = 'long' if order_type == 'Buy' else 'short'
|
||||
|
||||
return {
|
||||
'id': self.safe_string(order_data, 'ticket'),
|
||||
'symbol': symbol,
|
||||
'timestamp': timestamp,
|
||||
'datetime': self.iso8601(timestamp),
|
||||
'side': self.parse_order_side(self.safe_string(order_data, 'orderType')),
|
||||
'side': side,
|
||||
'contracts': contracts,
|
||||
'contractSize': self.safe_number(order_data, 'contractSize', 1.0),
|
||||
'entryPrice': entry_price,
|
||||
@@ -745,9 +753,14 @@ class mt5(mt5Parent):
|
||||
'initialMarginPercentage': None,
|
||||
'maintenanceMargin': None,
|
||||
'maintenanceMarginPercentage': None,
|
||||
'stopLossPrice': stop_loss_price,
|
||||
'takeProfitPrice': take_profit_price,
|
||||
'lastPrice': mark_price,
|
||||
'hedged': None,
|
||||
'info': order_data,
|
||||
}
|
||||
|
||||
|
||||
def parse_ws_ohlcv_message(self, data):
|
||||
"""解析WebSocket K线数据"""
|
||||
timestamp = self.parse8601(self.safe_string(data, 'time'))
|
||||
|
||||
@@ -161,8 +161,8 @@ async def websocket_quick_test():
|
||||
|
||||
# 运行监听器
|
||||
await asyncio.gather(
|
||||
order_listener(),
|
||||
# positions_listener(),
|
||||
# order_listener(),
|
||||
positions_listener(),
|
||||
# balance_listener(),
|
||||
return_exceptions=True
|
||||
)
|
||||
@@ -176,5 +176,5 @@ async def websocket_quick_test():
|
||||
|
||||
if __name__ == "__main__":
|
||||
# 运行快速测试
|
||||
asyncio.run(quick_order_test())
|
||||
# asyncio.run(websocket_quick_test())
|
||||
# asyncio.run(quick_order_test())
|
||||
asyncio.run(websocket_quick_test())
|
||||
Reference in New Issue
Block a user