A marked bias towards risk aversion has been observed in nearly every species tested. A minority of individuals, however, instead seem to prefer risk (repeatedly choosing uncertain large rewards over certain but smaller rewards), and even risk-averse individuals sometimes opt for riskier alternatives. It is not known how neural activity underlies such important shifts in decision-making--either as a stable trait across individuals or at the level of variability within individuals. Here we describe a model of risk-preference in rats, in which stable individual differences, trial-by-trial choices, and responses to pharmacological agents all parallel human behaviour. By combining new genetic targeting strategies with optical recording of neural activity during behaviour in this model, we identify relevant temporally specific signals from a genetically and anatomically defined population of neurons. This activity occurred within dopamine receptor type-2 (D2R)-expressing cells in the nucleus accumbens (NAc), signalled unfavourable outcomes from the recent past at a time appropriate for influencing subsequent decisions, and also predicted subsequent choices made. Having uncovered this naturally occurring neural correlate of risk selection, we then mimicked the temporally specific signal with optogenetic control during decision-making and demonstrated its causal effect in driving risk-preference. Specifically, risk-preferring rats could be instantaneously converted to risk-averse rats with precisely timed phasic stimulation of NAc D2R cells. These findings suggest that individual differences in risk-preference, as well as real-time risky decision-making, can be largely explained by the encoding in D2R-expressing NAc cells of prior unfavourable outcomes during decision-making.