Crypto earn/staking

Is there a way to implement a crypto earn/staking in such a way that the number of crypto that we have in our portfolio evolves weekly/monthly considering the earn rate?

Thanks!