How I can place order through this code :def order(self, symbol: str, price: float, vol:…
- User
How I can place order through this code :def order(self, symbol: str, price: float, vol: float, side: int, type: int, open_type: int, position_id: Optional[int] = None, leverage: Optional[int] = None, external_oid: Optional[str] = None, stop_loss_price: Optional[float] = None, take_profit_price: Optional[float] = None, position_mode: Optional[int] = None, reduce_only: Optional[bool] = False) -> dict: """ ### Order (Under maintenance) #### Required permissions: Trading permission
Rate limit: 20 times / 2 seconds https://mxcdevelop.github.io/apidocs/contract_v1_en/#order-under-maintenance :param symbol: the name of the contract :type symbol: str :param price: price :type price: decimal :param vol: volume :type vol: decimal :param leverage: (optional) leverage, Leverage is necessary on Isolated Margin :type leverage: int :param side: order direction 1 open long ,2close short,3open short ,4 close l :type side: int :param type: orderType,1:price limited order,2:Post Only Maker,3:transact or cancel instantly ,4 : transact completely or cancel completely,5:market orders,6 convert market price to current price :type type: int :param openType: open type,1:isolated,2:cross :type openType: int :param positionId: (optional) position Id, It is recommended to fill in this parameter when closing a position :type positionId: long :param externalOid: (optional) external order ID :type externalOid: str :param stopLossPrice: (optional) stop-loss price :type stopLossPrice: decimal :param takeProfitPrice: (optional) take-profit price :type takeProfitPrice: decimal :param positionMode: (optional) position mode,1:hedge,2:one-way,default: the user's current config :type positionMode: int :param reduceOnly: (optional) Default false,For one-way positions, if you need to only reduce positions, pass in true, and two-way positions will not accept this parameter. :type reduceOnly: bool :return: response dictionary :rtype: dict """ return self.call("POST", "api/v1/private/order/submit", params = dict( symbol = symbol, price = price, vol = vol, side = side, type = type, openType = open_type, positionId = position_id, leverage = leverage, externalOid = external_oid, stopLossPrice = stop_loss_price, takeProfitPrice = take_profit_price, positionMode = position_mode, reduceOnly = reduce_only )) - Assistant
To place an order using this code, you would need to instantiate an object of the class that contains this code and call the
ordermethod on that object. The method takes the following parameters:symbol(str): the name of the contractprice(float): pricevol(float): volumeleverage(Optional[int]): leverage (optional, necessary on Isolated Margin)side(int): order direction (1: open long, 2: close short, 3: open short, 4: close long)type(int): order type (1: price limited order, 2: Post Only Maker, 3: transact or cancel instantly, 4: transact completely or cancel completely, 5: market orders, 6: convert market price to current price)- (int): open type (1: isolated, 2: cross)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.