I have this type of function written:
def sendOrder(self,symbol, orderType, volume, openPrice, slippage = 0, stopLoss = 0, takeProfit = 0, comment = None, magic = 0, expiration = 0) :
sendOrder = {"messageType": "sendOrder", **locals()}
print(sendOrder)
It prints this:
{'messageType': 'sendOrder', 'self': <__main__.forexPlatformBridge object at 0x03077100>, 'symbol': 'EURUSD', 'orderType': 'buy', 'volume': 0.5, 'openPrice': 1.115, 'slippage': 0, 'stopLoss': 0, 'takeProfit': 0, 'comment': None, 'magic': 0, 'expiration': 0}
How do I remove the 'self' key? Is there a way to make a python dict out of parameters without including 'self' and adding 'messageType'
The desired output would be:
{'messageType': 'sendOrder', 'symbol': 'EURUSD', 'orderType': 'buy', 'volume': 0.5, 'openPrice': 1.115, 'slippage': 0, 'stopLoss': 0, 'takeProfit': 0, 'comment': None, 'magic': 0, 'expiration': 0}