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

Method create_order

python/ccxt/xt.py:2351–2381  ·  view source on GitHub ↗

create a trade order https://doc.xt.com/#orderorderPost https://doc.xt.com/#futures_ordercreate https://doc.xt.com/#futures_entrustcreatePlan https://doc.xt.com/#futures_entrustcreateProfit :param str symbol: unified symbol of the market to create a

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

Source from the content-addressed store, hash-verified

2349 return self.create_order(symbol, 'market', 'buy', cost, 1, params)
2350
2351 def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
2352 """
2353 create a trade order
2354
2355 https://doc.xt.com/#orderorderPost
2356 https://doc.xt.com/#futures_ordercreate
2357 https://doc.xt.com/#futures_entrustcreatePlan
2358 https://doc.xt.com/#futures_entrustcreateProfit
2359
2360 :param str symbol: unified symbol of the market to create an order in
2361 :param str type: 'market' or 'limit'
2362 :param str side: 'buy' or 'sell'
2363 :param float amount: how much you want to trade in units of the base currency
2364 :param float [price]: the price to fulfill the order, in units of the quote currency, can be ignored in market orders
2365 :param dict params: extra parameters specific to the xt api endpoint
2366 :param str [params.timeInForce]: 'GTC', 'IOC', 'FOK' or 'GTX'
2367 :param str [params.entrustType]: 'TAKE_PROFIT', 'STOP', 'TAKE_PROFIT_MARKET', 'STOP_MARKET', 'TRAILING_STOP_MARKET', required if stopPrice is defined, currently isn't functioning on xt's side
2368 :param str [params.triggerPriceType]: 'INDEX_PRICE', 'MARK_PRICE', 'LATEST_PRICE', required if stopPrice is defined
2369 :param float [params.triggerPrice]: price to trigger a stop order
2370 :param float [params.stopPrice]: alias for triggerPrice
2371 :param float [params.stopLoss]: price to set a stop-loss on an open position
2372 :param float [params.takeProfit]: price to set a take-profit on an open position
2373 :returns dict: an `order structure <https://docs.ccxt.com/en/latest/manual.html#order-structure>`
2374 """
2375 self.load_markets()
2376 market = self.market(symbol)
2377 symbol = market['symbol']
2378 if market['spot']:
2379 return self.create_spot_order(symbol, type, side, amount, price, params)
2380 else:
2381 return self.create_contract_order(symbol, type, side, amount, price, params)
2382
2383 def create_spot_order(self, symbol: str, type, side, amount, price=None, params={}):
2384 self.load_markets()

Callers 15

mainFunction · 0.45
exampleFunction · 0.45
gate-swaps.pyFile · 0.45
mainFunction · 0.45
example_2Function · 0.45
create_orderFunction · 0.45
exampleFunction · 0.45
htx-spot.pyFile · 0.45
mainFunction · 0.45

Calls 4

create_spot_orderMethod · 0.95
create_contract_orderMethod · 0.95
load_marketsMethod · 0.45
marketMethod · 0.45

Tested by

no test coverage detected