def r_to_q_Ri(params, substep, state_history, prev_state, policy_input):
    """
    For a 'r to q' trade this function returns the amount of token UNI_R for the respective asset depending on the policy_input
    """
    asset_id = policy_input['asset_id'] # defines asset subscript
    r = (policy_input['ri_sold']) #amount of Ri being sold by the user
    Ri = (prev_state['UNI_R' + asset_id])
    return ('UNI_R' + asset_id, r + Ri)