def test_gen_client_order_id(self, nonce_provider_mock):
     nonce_provider_mock.return_value = int(1e15)
     self.assertEqual("HMBot-BBTCUSD1000000000000000",
                      utils.gen_client_order_id(True, "BTC-USDT"))
     nonce_provider_mock.return_value = int(1e15) + 1
     self.assertEqual("HMBot-SETHUSD1000000000000001",
                      utils.gen_client_order_id(False, "ETH-USDT"))
Esempio n. 2
0
 def sell(self, trading_pair: str, amount: Decimal, order_type=OrderType.MARKET,
          price: Decimal = s_decimal_NaN, **kwargs) -> str:
     """
     Sells an amount of base asset (of the given trading pair). This function returns immediately.
     To see an actual order, you'll have to wait for SellOrderCreatedEvent.
     :param trading_pair: The market (e.g. BTC-USDT) to sell from
     :param amount: The amount in base token value
     :param order_type: The order type
     :param price: The price (note: this is no longer optional)
     :returns A new internal order id
     """
     client_order_id = ascend_ex_utils.gen_client_order_id(False, trading_pair)
     safe_ensure_future(self._create_order(TradeType.SELL, client_order_id, trading_pair, amount, order_type, price))
     return client_order_id