The smart grid technologies provide an automatic and efficient operation of power systems. As the renewable energy tremendously grows, designing a suitable market mechanism in the background of smart grid to better integrate renewable energy becomes an urgent issue. In this paper, an automatic transaction mechanism is proposed to trade renewable energy in both day-ahead and real-time timescales. In comparison with ordinary spot market, with the help of smart grid technologies, the proposed market mechanism offers data-driven automatic transactions for renewable energy, where the participators do not have to submit bids manually. The mathematical models for the transaction schemes are put forward according to real-world data. At least, case studies indicate the applicability and efficiency of the proposed scheme.