Real life Optimization problem

In summary: I know there is a mathematical way of doing it, if one strategy leads to a linear profit over time and the other leads to an exponential one, but every multiplication of the exponent is associated with a cost.. surely there is a way to optimize this?In summary, the problem with trading is that you need to pay a commission to the bank every time you make a trade, and the more trades you make, the smaller your profit becomes. You can make more money by closing trades quickly and reinvesting your profits, but this is difficult to do. There is a way to make more money trading, but it involves knowing how to optimize your profits.
  • #1
bozmonster
5
0
Hi

context:
The USD/CNH currency pair has been trending down at an almost linear rate past 3 years, it's safe to assume it will continue to trend downwards for the short term foreseeable future as the Chinese govt slowly allows the Yuan to appreciate to its real value.

The problem:
Every initiation of a trade requires a fee that's proportional to the volume of the trade, assume its a static 0.03%, this fee is taken off as soon as you make the trade so to break even after initiating a trade the exchange rate has to move in your favour by at least 0.03%. When you start trades the bank is willing to lend you 200$ for every of your $'s.
So the best strategy would be to close trades immediately after making a profit and reinvesting it so your profit increases future profits, in effect exponentially increasing the size of your bank account... except this doesn't work, here's why.

Because of that 0.03% commission you pay to the bank, the first 0.03% profit you make on a trade goes towards breaking even, so you can't spam trades.. taking profit and making a bigger trade straight after. Even if you make a little bit of profit, say you make 0.04% profit, you keep that 0.01% and start a new trade, but once again you have to wait for another 0.03% before you get anything from this new trade... but if you kept the previous trade and the exchange rate went your way for a total of 0.07% then you would get to keep 0.04% for yourself...

I should mention that the reason it would work exponentially when you reinvest your profits is because every 1$ you put in, the bank puts in 199$ so totalling 200.

the way profit works is..
examples:

So to trade 100,000$ I put in 500$. Profit I make comes when the actual amount of money I'm trading (100,000) changes in value due to exchange rates.

so if 100,000 appreciates by 2% then
profit = 2000 - (100,000 * 0.0003) = 1970

because I just made 1970 profit I can reinvest all of it (with the bank's generous lending), and trade 494,000$ instead of 100k because I have my previous 500 and my new 1970.

now if 494k appreciates by 2% then
profit = 9880 - (494,000 * 0.0003) = 9732

then reinvest 9732 etc.. you can see how this grows exponentially.. but 2% isn't the best number for maximizing profit over a long period of time and I want to know what is the best %

the jist of it is, that if you open one trade and wait for a long time assuming the currency will do the same thing it has past 3 years your profit will grow at a linear rate, if you trade very fast then it can increase exponentially, but if you trade too fast then you might not make any money at all, because all your exponential profits get sucked up by commissions to the bank.

the question:
what is the optimal profit (as a % of your bank account) for a trade to appreciate, before you close it and use all the profit to reinvest into a new trade.


let me know if you need more information to solve this problem, I think the only information needed is the leverage and the commission and I don't want to information overload.
 
Physics news on Phys.org
  • #2
bozmonster said:
Hi

context:
The USD/CNH currency pair has been trending down at an almost linear rate past 3 years, it's safe to assume it will continue to trend downwards for the short term foreseeable future as the Chinese govt slowly allows the Yuan to appreciate to its real value.
[...]

You need to show work, or we can't help. It's a rule.
 
  • #3
Mandelbroth said:
You need to show work, or we can't help. It's a rule.

if i knew how to do it i wouldn't have posted it?

what sort of working do you want
 
  • #4
Doesn't what you pay a (real) bank depend on the time you take to repay the loan?
 
  • #5
bozmonster said:
if i knew how to do it i wouldn't have posted it?

what sort of working do you want
We want you to try. If you have absolutely no idea how to even start, why are you trying to do such a problem?
 
  • #6
If I understand your problem correctly, the right answer is that selling your Canadian dollars so you can buy more of them is pointless. Why isn't the bank lending to you based on your Canadian capital?
 
Last edited:
  • #7
HallsofIvy said:
We want you to try. If you have absolutely no idea how to even start, why are you trying to do such a problem?

because I know there is a mathematical way of doing it, if one strategy leads to a linear profit over time and the other leads to an exponential one, but every multiplication of the exponent is associated with a cost.. surely there is a way to figure out what's the most I can get.

it's like a 3D axis, one axis being time, the other being price and the third being frequency of trades, at frequency 1 the graph is linear, at a very high frequency the graph is negative, but before that it's a larger positive than the linear line at frequency 1, so I want to find the highest point which is just a derivative, but involves three variables and I don't know how to describe a function with the required properties (ie exponential increase, but each increment is associated with a cost)
 
  • #8
Office_Shredder said:
If I understand your problem correctly, the right answer is that selling your Canadian dollars so you can buy more of them is pointless. Why isn't the bank lending to you based on your Canadian capital?

its not a bank, its a broker and they don't "lend" like a bank does they leverage which is slightly different, I didn't want tio mention this because I think it just adds irrelevant information to the problem and allows room for more confusion
 
  • #9
The problem hasn't been state precisely yet.

Assuming all monetary units are given in the "home" currency, let:

Tbuy =the time of purchase of the ith investment
Tsell = the time of the sale of the ith investment
Invest = the total initial investment amount of the ith investment
Sale = the total payoff from selling the ith investment
Stake = the investors share of the initial investment amount in the ith investment
Leverage = the bank's share of the initial investment amount in the ith investment
Cost = the cost to the investor of making the ith investment
Profit = the investors profit on the ith investment

Does Sale = Invest + Invest * (Tsell - Tbuy) * trend where "trend" is some constant?

Are we assuming Invest = Stake + Stake*200 for every investment i, or just for i = 1?

What's the formula for Cost in terms of the other variables?

Cost = Leverage + comission * Invest, where "comission" = 0.0003 ?

I gather we are assuming all profit is reinvested, so Stake = Stake[i-1] + Profit[i-1].


I gather we are assuming a fixed length of time T and asking how trades should be made within that time in order to maximize the total profit to the investor within that length of time. (This is a different question that asking about what frequency of trades maximizes the rate of increase in the investors funds as T approaches infinity.)
 
  • #10
I'm probably just going to approximate this problem using a brute force search in java. I've started coding it already, but this is what I plan to do.

let P(t) be the price at time t

0 ≤ t ≤ 1095

upper bound - price of USDCNH at time 0
P(0) = 6.8023

lower bound - price of USDCNH 3 years later
P(t) = 6.1441

assume its linear with some temporary stochastic variance.


A strategy S is a sequence of Trades T.

T is a structure that stores a value V and volume λ

where V is the result of the function
Δprice * λ * 100,000 - (0.0003 * 100,000)

and λ is constant for that instance of a Trade

Each strategy has a constant associated with it, this constant is a percentage or ratio, that goes into a function that is called on the last T in the sequence S per increment of time.

Function S(t) {
for the last T in the sequence S, is the change in V [itex]\in[/itex] T between when T was added to the sequence and currently, greater than ( * initial V [itex]\in[/itex] T - current V [itex]\in[/itex] T ).

if not then just update its value.

if it is greater then close the trade and take the profit, create a new trade T' with the same , but increase the volume by 0.01 for every 10 units of value gained and add T' to the end of S.

thats basically it/

bounds for ...

upper bound - if ≥ the total change in price (ratio) from P(0) to P(t)
- you make a single trade over the 3 year period and we assume the profit/time is linear, anything higher than this number does not change the output

lower bound - if = 0.0003 you break even because the first 0.03% of increase in value goes towards the broker.

anything smaller than 0.0003 creates a loss, but the more frequently you can trade the more 'exponential' your profit becomes over time because you can use your Δprice to increase volume.

except at some values of close to 0.0003 the exponential growth is so slow that the linear one is probably better.

what is the best value for

ie try maybe I should try many S' with different values for between those two bounds and see which S has the most valuable T at the end of its sequence.. but surely there is a way to derive this. Otherwise I'll just proceed with writing my 4000 b.c. hill climbing algorithm
 
Last edited:

1. What is an optimization problem?

An optimization problem is a mathematical problem that involves finding the best possible solution from all available options. It requires determining the maximum or minimum value of a function, subject to constraints, in order to achieve the most desirable outcome.

2. How are optimization problems used in real life?

Optimization problems are used in various fields such as engineering, economics, business, and science to improve and optimize processes, systems, and decision making. They can help in maximizing profits, minimizing costs, and improving efficiency.

3. What are the steps involved in solving an optimization problem?

The steps involved in solving an optimization problem include defining the problem, identifying the objective function and constraints, formulating the problem mathematically, finding the optimal solution using mathematical techniques, and interpreting and implementing the solution in real life.

4. What are some common techniques used to solve optimization problems?

Some common techniques used to solve optimization problems include linear programming, dynamic programming, gradient descent, genetic algorithms, and simulated annealing. These techniques use mathematical algorithms to find the optimal solution.

5. What are the challenges in solving real-life optimization problems?

Solving real-life optimization problems can be challenging due to the complexity of the problems, the large number of variables and constraints involved, and the need for accurate and relevant data. Additionally, the solution may not always be a perfect or absolute solution, but rather a trade-off between different factors.

Similar threads

  • General Discussion
2
Replies
41
Views
2K
  • Calculus and Beyond Homework Help
Replies
4
Views
1K
Replies
6
Views
1K
Replies
6
Views
2K
Replies
32
Views
18K
Replies
20
Views
10K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
7K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
17
Views
2K
  • General Discussion
Replies
24
Views
5K
Replies
3
Views
4K
Back
Top