I want to be able to plug in these variables to a bot that buys things in larger quantities as their price goes down:

  • a number of buy points
  • a price range between each buy point
  • an amount of cash I have available

I'm trying to find a formula to tell me how much to increase successive amounts by to spend exactly the amount of cash over the chosen number of price drops, over the specified range.

For instance, if starting price was USD 10,000, I could set the range for 10 buy points to 3% or USD 300. If I had USD 20,000 to spend and start the first buy at USD 100, the formula could tell me to spend around 1.62 times as much on each successive buy giving me an outcome like below. I solved to get ~1.62 with trial and error since I could not determine the formula.

Price           Buy Amount   Total Bought
$10,000         $0           $0     
$9700           $100         $100
$9400           $162.09      $262.09
$9100           $262.72      $524.81
$8800           $425.84      $950.65
$8500           $690.23      $1640.88
$8200           $1118.77     $2759.65
$7900           $1813.37     $4573.02
$7600           $2939.24     $7512.26
$7300           $4764.12     $12,276.38
$7000           $7722.01     $19,998.39

I've come up with a formula where s = starting buy amount, x = amount to increase by, a = available cash and there is an increasing exponent for each of the number of buy points:


What I don't get is if I have variable "s" (like USD 50), a variable "a" (like USD 5,000) and the number of buy points (like 50), how do I solve for variable "x" (the amount to increase each buy)? I want to be able to change any of the variables and be able to get the answer for how much to increase each buy.

Also perhaps there is a smarter way to adjust amounts upward then using exponents on a set amount (like the 1.62). Any suggestions would be helpful or just how to solve this specific formula.

I am a math beginner and probably won't understand more complicated math symbols than this, so please explain any symbols that the formula uses. I appreciate any help I can get here including pointing me to something specific to study.

Edit: I found this formula for getting the sum of consecutive exponents:

(p^n+1 - 1) / (p - 1)

applying that formula I can get:

100(x^10 - 1 / x - 1) = 20000
x^10 - 1 / x - 1 = 200
x^10 = 200x - 199
x^10 - 200x = -199
x(x^9 - 200) = -199

I'm still not at an equation where I know how to solve for x, but I feel like I'm close.

  • $\begingroup$ If you are down voting me please let me know why. This is my first question in this forum. Any advice about what's wrong with my question would be appreciated. I am not a math major so I worded it the best I could. $\endgroup$ – curtwphillips Nov 25 '17 at 6:59


  • $m$: Starting buy amount
  • $r$: Increasing ratio
  • $M$: Total amount

Then the previously indicated formula is written as: $$M=\sum_{i=0}^{N-1} m r^i = m \frac{1-r^{N}}{1-r}$$

The starting buy amount and the total amount are trivially related each other.

The number of transactions $N$ is: $$ N= \frac{\log(1-\frac Mm (1-r))}{\log r} $$

The Increasing Ratio $r$ from the number of transactions, is obtained from the real positive roots (solutions) of: $$r^N-\frac Mm r+\frac{M-m}m =0$$

From here, most of the calculation is done, by fixing any set of the given variables as your best discretion.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.