Now we have everything ready to squeeze out additional profits from a potential profit strategy. This chapter presents two profit-and-loss reserve algorithms and a program computing the market offer. Forward!
The natural input for building the first and second profit-and-loss (P&L) reserve strategies includes vectors of prices P and costs C, initial margin M, maintenance margin Mm, and the initial number of contracts traded U. It is simpler, however, to build both strategies assuming that a potential profit strategy Upps and its initial cash balance A0 are known in advance. The function potential_profit_min_account_alg previously described helps us get both items. Given the vectors P, C, Upps, and values A0, M, and Mm, the following steps represent the first algorithm: