Returns a lower and upper money amount separated by a spread percentage
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)
712376
def chaikin_money_flow(close_data, high_data, low_data, volume, period):
    
    catch_errors.check_for_input_len_diff(
        close_data, high_data, low_data, volume)
    catch_errors.check_for_period_error(close_data, period)

    close_data = np.array(close_data)
    high_data = np.array(high_data)
    low_data = np.array(low_data)
    volume = np.array(volume)
    cmf = [sum((((close_data[idx+1-period:idx+1] - low_data[idx+1-period:idx+1]) -
            (high_data[idx+1-period:idx+1] - close_data[idx+1-period:idx+1])) /
            (high_data[idx+1-period:idx+1] - low_data[idx+1-period:idx+1])) *
            volume[idx+1-period:idx+1]) / sum(volume[idx+1-period:idx+1]) for idx in range(period-1, len(close_data))]
    cmf = fill_for_noncomputable_vals(close_data, cmf)
    return cmf
383014
def _percent_to_integer(percent):
    
    num = float(percent.split('%')[0]) / 100.0 * 255
    e = num - math.floor(num)
    return e < 0.5 and int(math.floor(num)) or int(math.ceil(num))
1236915
def money_flow(close_data, high_data, low_data, volume):
    
    catch_errors.check_for_input_len_diff(
        close_data, high_data, low_data, volume
        )
    mf = volume * tp(close_data, high_data, low_data)
    return mf
952136
def get_medium_order(self, lower=200000, higher=1000000):
        

        return self.data.query('amount>={}'.format(lower)).query('amount<={}'.format(higher))
967781
function percentToValue(percent) {
      var adjustedPercent = invert ? (1 - percent) : percent;
      return (min + adjustedPercent * (max - min));
    }
1360316
public function getCalculatedPrice($spread_type, $spread_value, $stock_price, $product_price_charmer, $currency)
    {
        $price = $stock_price;

        switch($spread_type) {
            case 0;
                $price = $this->calculateProductsPriceByFlat($spread_value, $stock_price, $currency);
                break;
            case 1:
                $price = $this->calculateProductsPriceByPercent($spread_value, $stock_price, $currency);
                break;
        }

        $price = round($price, 2);

        if($product_price_charmer) {
            $price = $this->priceAdjuster($price);
        }

        return $price;
    }
676721
def get_percentage_from_prob(prob):
    
    assert isinstance(prob, (float, int))
    prob = float(prob)
    assert prob >= 0
    assert prob <= 1

    percentages = list(probability_list.keys())
    percentages.sort()
    for percentage in percentages:
        if prob < probability_list[percentage]:
            return percentage - 1
    return 100
318850
function (percent) {
            var min = this.options.min,
                max = this.options.max,
                min_decimals = min.toString().split(".")[1],
                max_decimals = max.toString().split(".")[1],
                min_length, max_length,
                avg_decimals = 0,
                abs = 0;

            if (percent === 0) {
                return this.options.min;
            }
            if (percent === 100) {
                return this.options.max;
            }


            if (min_decimals) {
                min_length = min_decimals.length;
                avg_decimals = min_length;
            }
            if (max_decimals) {
                max_length = max_decimals.length;
                avg_decimals = max_length;
            }
            if (min_length && max_length) {
                avg_decimals = (min_length >= max_length) ? min_length : max_length;
            }

            if (min < 0) {
                abs = Math.abs(min);
                min = +(min + abs).toFixed(avg_decimals);
                max = +(max + abs).toFixed(avg_decimals);
            }

            var number = ((max - min) / 100 * percent) + min,
                string = this.options.step.toString().split(".")[1],
                result;

            if (string) {
                number = +number.toFixed(string.length);
            } else {
                number = number / this.options.step;
                number = number * this.options.step;

                number = +number.toFixed(0);
            }

            if (abs) {
                number -= abs;
            }

            if (string) {
                result = +number.toFixed(string.length);
            } else {
                result = this.toFixed(number);
            }

            if (result < this.options.min) {
                result = this.options.min;
            } else if (result > this.options.max) {
                result = this.options.max;
            }

            return result;
        }
685305
def _limit_value(value, upper=1.0, lower=0.0):
    
    if value > upper:
        return(upper)
    if value < lower:
        return(lower)
    return value
1068538
public InstanceSet[] split(float percent) {
        shuffle();
        int length = this.size();
        InstanceSet[] sets = new InstanceSet[2];
        sets[0] = new InstanceSet(pipes, factory);
        sets[1] = new InstanceSet(pipes, factory);
        int idx = (int) Math.round(percent*length);
        sets[0].addAll(subList(0, idx));
        if(idx+1<length)            
            sets[1].addAll(subList(idx+1, length));
        return sets;
    }
379802
def upper_price_channel(data, period, upper_percent):
    
    catch_errors.check_for_period_error(data, period)

    emas = ema(data, period)
    upper_channel = [val * (1+float(upper_percent)/100) for val in emas]
    return upper_channel
697384
private int getPercentageY(double value) {
		value = 1.0 - value;
		double d = top + (((bottom - top) * value) / (maxPercentage - minPercentage));
		return (int) d;
	}
181007
function pickMultipleCoinsAndContinue(){
		conn.query(
			"SELECT unit, message_index, output_index, amount, address, blinding \n\
			FROM outputs \n\
			CROSS JOIN units USING(unit) \n\
			WHERE address IN(?) AND asset"+(asset ? "="+conn.escape(asset) : " IS NULL")+" AND is_spent=0 \n\
				AND sequence='good' "+confirmation_condition+"  \n\
			ORDER BY amount DESC LIMIT ?",
			[arrSpendableAddresses, constants.MAX_INPUTS_PER_PAYMENT_MESSAGE-2],
			function(rows){
				async.eachSeries(
					rows,
					function(row, cb){
						var input = row;
						objectHash.cleanNulls(input);
						required_amount += is_base*TRANSFER_INPUT_SIZE;
						addInput(input);
						// if we allow equality, we might get 0 amount for change which is invalid
						var bFound = is_base ? (total_amount > required_amount) : (total_amount >= required_amount);
						bFound ? cb('found') : cb();
					},
					function(err){
						if (err === 'found')
							onDone(arrInputsWithProofs, total_amount);
						else if (asset)
							issueAsset();
						else
							addHeadersCommissionInputs();
					}
				);
			}
		);
	}
238767
def percent
      return unless (buffer = accept_stripped :exp_percent)
      match_start = buffer[-1]
      match_name = :"percent#{match_start}"

      unless Tokens[match_name]
        match_end = Tokens.bracket(match_start) || match_start

        match_inner = "\\#{match_start}"
        match_inner += "\\#{match_end}" unless match_end == match_start

        pattern = /(((?:[^#{match_inner}\\]|\\.)*?)#{'\\' + match_end})/

        Tokens[match_name] = pattern
      end

      buffer += accept match_name
      buffer
    end
1275866
public R between(int lower, int upper) {
    expr().between(_name, lower, upper);
    return _root;
  }
858073
def _percent_selection(self, non_empty_slices):
        """"""

        return np.around(self._sampler * len(non_empty_slices) / 100).astype('int64')