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

Method create_order_ws

python/ccxt/pro/cex.py:1208–1242  ·  view source on GitHub ↗

https://docs.cex.io/#ws-api-order-placement create a trade order :param str symbol: unified symbol of the market to create an order in :param str type: 'market' or 'limit' :param str side: 'buy' or 'sell' :param float amount: how much of currency yo

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

Source from the content-addressed store, hash-verified

1206 return self.parse_orders(response, market, since, limit, params)
1207
1208 async def create_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}) -> Order:
1209 """
1210
1211 https://docs.cex.io/#ws-api-order-placement
1212
1213 create a trade order
1214 :param str symbol: unified symbol of the market to create an order in
1215 :param str type: 'market' or 'limit'
1216 :param str side: 'buy' or 'sell'
1217 :param float amount: how much of currency you want to trade in units of base currency
1218 :param float price: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1219 :param dict [params]: extra parameters specific to the kraken api endpoint
1220 :param boolean [params.maker_only]: Optional, maker only places an order only if offers best sell(<= max) or buy(>= max) price for self pair, if not order placement will be rejected with an error - "Order is not maker"
1221 :returns dict: an `order structure <https://docs.ccxt.com/en/latest/manual.html#order-structure>`
1222 """
1223 if price is None:
1224 raise BadRequest(self.id + ' createOrderWs requires a price argument')
1225 await self.load_markets()
1226 await self.authenticate()
1227 market = self.market(symbol)
1228 url = self.urls['api']['ws']
1229 messageHash = self.request_id()
1230 data = self.extend({
1231 'pair': [market['baseId'], market['quoteId']],
1232 'amount': amount,
1233 'price': price,
1234 'type': side,
1235 }, params)
1236 request = {
1237 'e': 'place-order',
1238 'oid': messageHash,
1239 'data': data,
1240 }
1241 rawOrder = await self.watch(url, messageHash, request, messageHash)
1242 return self.parse_order(rawOrder, market)
1243
1244 async def edit_order_ws(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}) -> Order:
1245 """

Callers 1

exampleFunction · 0.45

Calls 8

authenticateMethod · 0.95
request_idMethod · 0.95
parse_orderMethod · 0.95
BadRequestClass · 0.90
load_marketsMethod · 0.45
marketMethod · 0.45
extendMethod · 0.45
watchMethod · 0.45

Tested by

no test coverage detected