Your answer would be that the literary device used in the passage is an analogy.
Explanation:
In the passage above, the author has used the literary device called analogy. An analogy is a comparison in which a thing or an idea is compared to another thing which is a little different from it. Its purpose is to explain the original idea by comparing it to something that is familiar. In this case, a relationship is compared to the way the stock market works. The author explains that both of them have ups and downs and that, in both cases, you only get what you put into them.
Actually, it takes more commitment from society to accept immigrants as fellow humans who are seeking a better and safer place to live and create a life for themselves and family. It's the Americans who need to help immigrants feel American.