'Update the position by the split ratio, and return the resulting
fractional share that will be converted into cash.
Returns the unused cash.'

@expect_types(asset=Asset)
def handle_split(self, asset, ratio):

    if (self.asset != asset):
        raise Exception('updating    split    with    the    wrong    asset!')
    raw_share_count = (self.amount / float(ratio))
    full_share_count = np.floor(raw_share_count)
    fractional_share_count = (raw_share_count - full_share_count)
    new_cost_basis = round((self.cost_basis * ratio), 2)
    self.cost_basis = new_cost_basis
    self.amount = full_share_count
    return_cash = round(float((fractional_share_count * new_cost_basis)), 2)
    log.info(('after    split:    ' + str(self)))
    log.info(('returning    cash:    ' + str(return_cash)))
    return return_cash
