Best betting strategy for an unfair random walk with a skewed payoff Say you start with bankroll $B$ and i.i.d. random variables $U_i$ with distribution $p=P(U_i=r)>.5$ and $q=1-p=P(U_i=-1)$.  Your earnings from bet $i$ is $W_iU_i$, where $W_i$ is your wager at step $i$.  Notice that we think of $U_i$ as the payout for bet $i$.  It follows then that our bankroll at step $n$ is $B_n=B+\sum_{i=1}^{n}W_iU_i$.  We will also add the constraint that $W_{n+1} \leq B_{n}$ so that we cannot bet more than what we have made.  Suppose also that the expected value for $U_i$ is positive so that it makes sense to play the game in the first place.  Is there a known "optimal" choice for $W_i$ that balances both risk and reward?  I thought about trying to maximize the expected value of the $B_n$ but this didn't seem to help since all we get is $E(B_N)=B+E(U_1) \sum_{i=1}^N W_i$, which suggests we need to bet our entire bankroll each turn to maximize earnings.  This is obviously not a winning strategy so we most likely also need to minimize the probability $Q_N$ that $B_n =0$ for time $n\leq N$.
This is where I'm stuck.  The bet size $W_i $ will almost surely depend on $B_{n-1}$ and the expected value of the $U_i$.
I thought of doing this in the context of ergodic theory as well.  After all we are basically dealing with an ergodic markov shift $(X,T)$ and here the $U_i$ are equal to $U_0(T^nx)$.
I would be happy with a solution that does not give an exact value for the $W_i$ but instead a method that is able to approximate it well.
 A: Assume for simplicity that $r=1$. You may solve the problem of maximizing the value of the game at stage $N$ recursively. Suppose that you're at stage $N-1$. What strategy maximizes $\mathsf{E}B_N$? Write
\begin{align}
\mathsf{E}B_N&=\mathsf{E}[B_{N-1}+U_N (W_N\wedge B_{N-1})] \\
&=\mathsf{E}B_{N-1}+(2p-1)\mathsf{E}[W_N\wedge B_{N-1}].
\end{align}
Since $2p>1$, setting $W_N^{*}=B_{N-1}$ maximizes the terminal expected gain. At stage $N-2$,
\begin{align}
\mathsf{E}B_N&=\mathsf{E}[B_{N-2}+U_{N-1}(W_{N-1}\wedge B_{N-2})+U_NW_N^*] \\
&=\mathsf{E}[(1+U_N)(B_{N-2}+U_{N-1}(W_{N-1}\wedge B_{N-2}))] \\
&=2p\,\mathsf{E}B_{N-2}+2p(2p-1)\mathsf{E}[W_{N-1}\wedge B_{N-2}]
\end{align}
Again, setting $W_{N-1}^*=B_{N-2}$ maximizes $\mathsf{E}B_N$. Proceeding this way, we conclude that the "bold" strategy is optimal in these settings.

Here are some simulation results with $B=10$, $p=0.6$, and $N=10$:
             
             
             
             
   

Since the risk associated with the strategy $W_i=B_{i-1}$ is high as pointed out by @Henry, one may consider maximizing $\mathsf{E}u(B_N)$, where $u(\cdot)$ is a concave function which accounts for risk-aversion. For example, if $u(b)=\ln{b}$, the  gambler does not tolerate going bankrupt. In this case, the optimal bet is $W_i^*=(2p-1)B_{i-1}$. To see this, start with period $N-1$ and write
$$
\mathsf{E}\ln(B_N)=\mathsf{E}\ln(B_{N-1}+U_NW_N)
$$
Conditionally on $\{B_{N-1}=b\}$, the problem can be solved by maximizing
$$
\mathsf{E}\ln(b+U_NW_N)=\ln(b+W_N)p+\ln(b-W_N)(1-p).
$$
Taking the derivative w.r.t. $W_N$ and equating it to $0$, we find that $W_N^*=(2p-1)b\le b$. For $i<N-1$,
$$
\mathsf{E}\ln(B_N)=\mathsf{E}\ln(\alpha_i(\boldsymbol{U}_{i+1})(B_{i-1}+U_iW_i)),
$$
where $\alpha_i(\boldsymbol{U}_{i+1})$ is a function of $\boldsymbol{U}_{i+1}\equiv(U_{i+1},\ldots, U_N)$ and the parameter $p$. Conditionally on $\{B_{i}=b,\boldsymbol{U}_{i+1}=u\}$, we maximize
$$
\mathsf{E}\ln(\alpha_i(u)(b+U_i W_i)).
$$
Similarly to the previous case, $W_i^*=(2p-1)B_{i-1}$.
