Sell price based on desired profit: X = sell price B = buy price A = amt invested in

aatika

New member
Joined
Dec 13, 2018
Messages
2
Hi I am wanting to find a formula/several formulas for determining the sell price for a stock given the following parameters

X = sell price
B = buy price
A = amt invested in $
D = desired profit in $
S = Number of shares

I would like the formula to calculate variables X and S based on B, A and D. This will be a useful calculation for determing what I need to sell a stock at based on the known variables.

I want to write in a python program so if it can be broken down into multiple calculations that would be better.

Question/answer format would be such:

1. What is the buy price? I.e. $2
2. How much do you want to invest? $500
3. How much profit in $ do you want to make? $200

Your sell price for this amount is x

I can work it out based on percentages, but I prefer to use $ amt variables.

Cheers
 

tkhunny

Moderator
Staff member
Joined
Apr 12, 2005
Messages
10,237
Hi I am wanting to find a formula/several formulas for determining the sell price for a stock given the following parameters

X = sell price
B = buy price
A = amt invested in $
D = desired profit in $
S = Number of shares

I would like the formula to calculate variables X and S based on B, A and D. This will be a useful calculation for determing what I need to sell a stock at based on the known variables.

I want to write in a python program so if it can be broken down into multiple calculations that would be better.

Question/answer format would be such:

1. What is the buy price? I.e. $2
2. How much do you want to invest? $500
3. How much profit in $ do you want to make? $200

Your sell price for this amount is x

I can work it out based on percentages, but I prefer to use $ amt variables.

Cheers
I'm not real clear on what it i you are trying to do. Can you provide one of those worked out examples?
 

JeffM

Elite Member
Joined
Sep 14, 2012
Messages
3,937
Hi I am wanting to find a formula/several formulas for determining the sell price for a stock given the following parameters

X = sell price
B = buy price
A = amt invested in $
D = desired profit in $
S = Number of shares

I would like the formula to calculate variables X and S based on B, A and D. This will be a useful calculation for determing what I need to sell a stock at based on the known variables.

I want to write in a python program so if it can be broken down into multiple calculations that would be better.

Question/answer format would be such:

1. What is the buy price? I.e. $2
2. How much do you want to invest? $500
3. How much profit in $ do you want to make? $200

Your sell price for this amount is x

I can work it out based on percentages, but I prefer to use $ amt variables.

Cheers
\(\displaystyle d = (x - b) * s.\)

\(\displaystyle a = bs.\)

\(\displaystyle \text { ASSUME } a > 0 < b.\)

Because a is an amount of money and b is a price, it is reasonable to assume that both are positive numbers.

\(\displaystyle a = bs \implies s = \dfrac{a}{b}.\)

\(\displaystyle d = (x - b)s \implies (x - b) * \dfrac{a}{b} = d \implies a(x - b) = bd \implies x - b = \dfrac{bd}{a} \implies\)

\(\displaystyle x = \dfrac{bd}{a} + b= b \left ( \dfrac{d}{a} + 1\right ) = b * \dfrac{a + d}{a}.\)

Is this what you want?
 
Last edited:
Top