  The ad-trading desks of media-buying agencies are increasingly relying on
complex algorithms for purchasing advertising inventory. In particular,
Real-Time Bidding (RTB) algorithms respond to many auctions -- usually Vickrey
auctions -- throughout the day for buying ad-inventory with the aim of
maximizing one or several key performance indicators (KPI). The optimization
problems faced by companies building bidding strategies are new and interesting
for the community of applied mathematicians. In this article, we introduce a
stochastic optimal control model that addresses the question of the optimal
bidding strategy in various realistic contexts: the maximization of the
inventory bought with a given amount of cash in the framework of audience
strategies, the maximization of the number of conversions/acquisitions with a
given amount of cash, etc. In our model, the sequence of auctions is modeled by
a Poisson process and the \textit{price to beat} for each auction is modeled by
a random variable following almost any probability distribution. We show that
the optimal bids are characterized by a Hamilton-Jacobi-Bellman equation, and
that almost-closed form solutions can be found by using a fluid limit.
Numerical examples are also carried out.
