- def create_exchange_order(self, symbol, type, side, amount, price=None, params={}):
- return super().create_order(symbol, type, side, amount, price=price, params=params)
-
- def create_margin_order(self, symbol, type, side, amount, price=None, lending_rate=None, params={}):
- if type == 'market':
- raise ExchangeError(self.id + ' allows limit orders only')
- self.load_markets()
- method = 'privatePostMargin' + self.capitalize(side)
- market = self.market(symbol)
- price = float(price)
- amount = float(amount)
- if lending_rate is not None:
- params = self.extend({"lendingRate": lending_rate}, params)
- response = getattr(self, method)(self.extend({
- 'currencyPair': market['id'],
- 'rate': self.price_to_precision(symbol, price),
- 'amount': self.amount_to_precision(symbol, amount),
- }, params))
- timestamp = self.milliseconds()
- order = self.parse_order(self.extend({
- 'timestamp': timestamp,
- 'status': 'open',
- 'type': type,
- 'side': side,
- 'price': price,
- 'amount': amount,
- }, response), market)
- id = order['id']
- self.orders[id] = order
- return self.extend({'info': response}, order)
-