'Calculates how many shares/contracts to order based on the type of
asset being ordered.'

def _calculate_order_value_amount(self, asset, value):

    normalized_date = normalize_date(self.datetime)
    if (normalized_date < asset.start_date):
        raise CannotOrderDelistedAsset(msg='Cannot    order    {0},    as    it    started    trading    on    {1}.'.format(asset.symbol, asset.start_date))
    elif (normalized_date > asset.end_date):
        raise CannotOrderDelistedAsset(msg='Cannot    order    {0},    as    it    stopped    trading    on    {1}.'.format(asset.symbol, asset.end_date))
    else:
        last_price = self.trading_client.current_data.current(asset, 'price')
        if np.isnan(last_price):
            raise CannotOrderDelistedAsset(msg='Cannot    order    {0}    on    {1}    as    there    is    no    last    price    for    the    security.'.format(asset.symbol, self.datetime))
    if tolerant_equals(last_price, 0):
        zero_message = "Price    of    0    for    {psid};    can't    infer    value".format(psid=asset)
        if self.logger:
            self.logger.debug(zero_message)
        return 0
    if isinstance(asset, Future):
        value_multiplier = asset.multiplier
    else:
        value_multiplier = 1
    return (value / (last_price * value_multiplier))
