Place a buy order at market price.

        :param amount: Amount of major currency to buy at market price.
        :type amount: int | float | str | unicode | decimal.Decimal
        :return: Order details.
        :rtype: dict
340740
def buy_market_order(self, amount):
        
        amount = str(amount)
        self._log("buy {} {} at market price".format(amount, self.major))
        return self._rest_client.post(
            endpoint='/buy',
            payload={'book': self.name, 'amount': amount}
        )
1275786
def setCurrency( self, currency ):
        
        self._currency = currency
        self.setValue(self.value())
171691
def bid(currency_code, price, amount, limit = nil, counter_currency_code = "jpy")
            return trade(currency_code, price, amount, "bid", limit, counter_currency_code)
        end
1044273
def __place_order(self, token):
        
        order_id = 0
        response = None

        if not token or token['value'] == '':
            raise LendingClubError('The token parameter is False, None or unknown.')

        # Process order confirmation page
        try:
            # Place the order
            payload = {}
            if token:
                payload['struts.token.name'] = token['name']
                payload[token['name']] = token['value']
            response = self.lc.session.post('/portfolio/orderConfirmed.action', data=payload)

            # Process HTML for the order ID
            html = response.text
            soup = BeautifulSoup(html, 'html5lib')

            # Order num
            order_field = soup.find(id='order_id')
            if order_field:
                order_id = int(order_field['value'])

            # Did not find an ID
            if order_id == 0:
                self.__log('An investment order was submitted, but a confirmation ID could not be determined')
                raise LendingClubError('No order ID was found when placing the order.', response)
            else:
                return order_id

        except Exception as e:
            raise LendingClubError('Could not place the order: {0}'.format(str(e)), response)
1134713
def load_commodities(self):
        
        base, quote = self.market.split("_")
        if isinstance(self.price, Amount):
            self.price = Amount("{0:.8f} {1}".format(self.price.to_double(), quote))
        else:
            self.price = Amount("{0:.8f} {1}".format(float(self.price), quote))
        if isinstance(self.amount, Amount):
            self.amount = Amount("{0:.8f} {1}".format(self.amount.to_double(), base))
        else:
            self.amount = Amount("{0:.8f} {1}".format(float(self.amount), base))
        fee_currency = base if self.fee_side == 'base' else quote
        if isinstance(self.fee, Amount):
            self.fee = Amount("{0:.8f} {1}".format(float(self.fee.to_double()), fee_currency))
        else:
            self.fee = Amount("{0:.8f} {1}".format(float(self.fee), fee_currency))
1076525
def __set_unit_price(self, value):
        '''
        
        '''
        try:
            if value < 0:
                raise ValueError()

            self.__unit_price = Decimal(str(value))
        except ValueError:
            raise ValueError("Unit Price must be a positive number")
340468
def spread_money(money: Money, spread_p: Decimal) -> Tuple[Money, Money]:
    """"""
    upper, lower = spread_value(money.amount, spread_p)
    return Money(upper, money.currency), Money(lower, money.currency)
1188880
public PaymentSummaryBuilder addPriceLabel(String label, String amount) {
		PriceLabel priceLabel = new PriceLabel(label, amount);
		return addPriceLabel(priceLabel);
	}
937718
def increment(self, amount=1):
        
        self.__lock.acquire()
        self.__count += amount
        v = self.value()
        self.__lock.release()
        return v
844715
def price(self, minimum: float = 10.00,
              maximum: float = 1000.00) -> str:
        
        price = self.random.uniform(minimum, maximum, precision=2)
        return '{0} {1}'.format(price, self.currency_symbol())
1004034
def deposit(self, amount):
        
        _json = {"amount": amount}
        self.api_interface.piggy_bank_deposit(self, _json)
180852
def buy(self, security, price=0, amount=0, volume=0, entrust_prop=0):
        
        return self._trade(security, price, amount, volume, "buy")
939892
def set_amount(self, amount):
        
        if amount:
            try:
                self.IsoMessage.FieldData(4, int(amount))
            except ValueError:
                self.IsoMessage.FieldData(4, 0)
            self.rebuild()
1092223
def cancel(self):
        

        self.cancel_amount = self.amount - self.trade_amount
        if self.trade_amount == 0:
            # 未交易  直接订单全撤
            self._status = ORDER_STATUS.CANCEL_ALL
        else:
            # 部分交易 剩余订单全撤
            self._status = ORDER_STATUS.CANCEL_PART
859106
function calc_order_amount($amount, $paypalCurrency, $applyFormatting = false) {
    global $currencies;
    $amount = ($amount * $currencies->get_value($paypalCurrency));
    if ($paypalCurrency == 'JPY' || (int)$currencies->get_decimal_places($paypalCurrency) == 0) {
      $amount = (int)$amount;
      $applyFormatting = FALSE;
    }
    return ($applyFormatting ? number_format($amount, $currencies->get_decimal_places($paypalCurrency)) : $amount);
  }
861633
def price_range(self):
        
        ordered = self.variants.order_by('base_price')
        if ordered:
            return ordered.first().price, ordered.last().price
        else:
            return None, None
536199
def load_commodities(self):
        
        if isinstance(self.amount, Amount):
            self.amount = Amount("{0:.8f} {1}".format(self.amount.to_double(), self.currency))
        else:
            self.amount = Amount("{0:.8f} {1}".format(self.amount, self.currency))