MCPcopy Create free account
hub / github.com/ccxt/ccxt / create_order_ws

Method create_order_ws

python/ccxt/pro/pacifica.py:84–163  ·  view source on GitHub ↗

create a trade order https://docs.pacifica.fi/api-documentation/api/websocket/trading-operations/create-market-order https://docs.pacifica.fi/api-documentation/api/websocket/trading-operations/create-limit-order :param str symbol: unified symbol of the market to cr

(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={})

Source from the content-addressed store, hash-verified

82 self.options['ws']['options']['headers'] = headers
83
84 async def create_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
85 """
86 create a trade order
87
88 https://docs.pacifica.fi/api-documentation/api/websocket/trading-operations/create-market-order
89 https://docs.pacifica.fi/api-documentation/api/websocket/trading-operations/create-limit-order
90
91 :param str symbol: unified symbol of the market to create an order in
92 :param str type: 'market' or 'limit'
93 :param str side: 'buy' or 'sell'
94 :param float amount: how much of currency you want to trade in units of base currency
95 :param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
96 :param dict [params]: extra parameters specific to the exchange API endpoint
97 :param float [params.triggerPrice]: The price a trigger order is triggered at
98 :param float|None [params.stopLossPrice]: the price that a stop loss order is triggered at(optional provide stopLossCloid)
99 :param float|None [params.takeProfitPrice]: the price that a take profit order is triggered at(optional provide takeProfitCloid)
100 :param str|None [params.timeInForce]: "GTC", "IOC", or "PO" or "ALO" or "PO_TOB"(or "TOB" - PO by top of book)
101 :param bool|None [params.reduceOnly]: Ensures that the executed order does not flip the opened position.
102 :param str|None [params.clientOrderId]: client order id,(optional uuid v4 e.g.: f47ac10b-58cc-4372-a567-0e02b2c3d479)
103 :param int|None [params.expiryWindow]: time to live in milliseconds
104 :param str|None [params.agentAddress]: only if agent wallet in use.
105 :param str|None [params.originAddress]: only if agent in use. Agent's owner address( default = credentials walletAddress )
106 :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
107 """
108 await self.load_markets()
109 request, operationType = self.create_order_request(symbol, type, side, amount, price, params)
110 params = self.omit(params, [
111 'reduceOnly', 'clientOrderId', 'stopLimitPrice', 'timeInForce', 'triggerPrice', 'stopLossCloid',
112 'stopLossPrice', 'stopLossLimitPrice', 'takeProfitCloid', 'takeProfitPrice', 'takeProfitLimitPrice', 'expiryWindow', 'agentAddress', 'originAddress',
113 ])
114 isTestnet = self.isSandboxModeEnabled
115 urlKey = 'test' if (isTestnet) else 'api'
116 url = self.urls[urlKey]['ws']['public']
117 wsRequest = self.wrap_as_post_action(operationType, request)
118 requestId = self.safe_string(wsRequest, 'id')
119 if operationType == 'create_stop_order':
120 raise NotSupported(self.id + ' createOrderWs() do not support stop order type of order. Check provided arguments correctly!')
121 elif operationType == 'set_position_tpsl':
122 raise NotSupported(self.id + ' createOrderWs() do not support set position tpsl type of order. Check provided arguments correctly!')
123 response = await self.watch(url, requestId, wsRequest, requestId)
124 #
125 # market order
126 # {
127 # "code": 200,
128 # "data": {
129 # "I": "79f948fd-7556-4066-a128-083f3ea49322",
130 # "i": 645953,
131 # "s": "BTC"
132 # },
133 # "id": "660065de-8f32-46ad-ba1e-83c93d3e3966",
134 # "t": 1749223025962,
135 # "type": "create_market_order"
136 # }
137 #
138 # limit order
139 # {
140 # "code": 200,
141 # "data": {

Callers

nothing calls this directly

Calls 10

create_order_requestMethod · 0.95
wrap_as_post_actionMethod · 0.95
NotSupportedClass · 0.90
safe_stringMethod · 0.80
safe_integerMethod · 0.80
safe_dictMethod · 0.80
safe_orderMethod · 0.80
load_marketsMethod · 0.45
omitMethod · 0.45
watchMethod · 0.45

Tested by

no test coverage detected