예제 #1
0
 def sell(self,
          trading_pair: str,
          amount: Decimal,
          order_type: OrderType = OrderType.MARKET,
          price: Decimal = s_decimal_NaN,
          **kwargs) -> str:
     """
     Sells an amount of base asset as specified in the trading pair. This function returns immediately.
     To see an actual order, wait for a BuyOrderCreatedEvent.
     :param trading_pair: The market (e.g. BTC-CAD) to buy from
     :param amount: The amount in base token value
     :param order_type: The order type
     :param price: The price in which the order is to be placed at
     :returns A new client order id
     """
     order_id: str = ndax_utils.get_new_client_order_id(False, trading_pair)
     safe_ensure_future(
         self._create_order(
             trade_type=TradeType.SELL,
             trading_pair=trading_pair,
             order_id=order_id,
             amount=amount,
             price=price,
             order_type=order_type,
         ))
     return order_id
예제 #2
0
 def test_client_order_id_creation(self, nonce_provider_mock):
     nonce_provider_mock.return_value = 1000
     self.assertEqual(f"{utils.HUMMINGBOT_ID_PREFIX}{1000}",
                      utils.get_new_client_order_id(True, "BTC-USDT"))