What happened

Shares of San Francisco-based solar panel installer Sunrun (RUN -3.60%) stock ran up nearly 10% in early trading Tuesday before falling back to close the day up a still-respectable 6.9%.

You can thank Goldman Sachs for that.

Construction worker installing solar panels on rooftop.

Image source: Getty Images.

So what

This morning, Goldman Sachs upgraded Sunrun stock from neutral to buy and assigned the $18-and-change stock a new price target of $20 a share.

StreetInsider.com, covering the upgrade, reported that Goldman's buy thesis "is predicated on 1) strong growth in the [residential] solar market, with key near-term catalysts, 2) a stable lending environment with upside from refinancing, and 3) the presence of key differentiators (i.e., Brightbox, dynamic pricing, simplified reporting metrics) which help RUN maintain its position as leader in the space."

Now what

As my fellow Fool and solar enthusiast Travis Hoium reported more than a year ago, California's Energy Commission is making the inclusion of solar panels mandatory for all new homes built after 2020. Market researchers estimate that complying with this mandate will guarantee a demand for at least 222 megawatts' worth of solar power generating capacity annually from next year on -- and as much as $2 billion in additional revenues for solar players in the period running from 2020 to 2023.

As one of the nation's three biggest players in solar installation and one located right in the epicenter of all this new demand, Sunrun looks admirably placed to reap the benefit of all these new revenues. It's no wonder Goldman is upgrading it; the real wonder is why analysts waited so long to do so.