Hi,

I am trying to get an equation for a calculator I am building.

Any help writing this as an equation would be very helpful.

I have 1 bitcoin. I am able to leverage my Bitcoin from 1x - 100x.

I pay an initial fee of 0.025% for a trade. I will also pay 0.01% funding fee every 8 hours. I will finally pay a further fee of 0.025% to close my trade.

So - How can I write this as an equation so that I can change the some of the variables to work out end results of trades.

An example being:

I have 1 Bitcoin I have bought for \$6300.

I leverage the Bitcoin by 10x and short it (sell it in the hope the prices goes lower so I can buy more back thus making a profit).

So I have sold 10 Bitcoins for a total of \$63 000. I will have paid 0.025% fee for the trade. This is \$15.75

I now have \$62984.25.

I keep this trade open for 6 days. This is 144 hours. I pay a funding fee of 0.01% every 8 hours. So after 8 hours have gone, I am charged 0.01% on my balance of \$62984.25. I will be charged this every 8 hours for the duration of the 6 days (18 cycles of 8 hour periods). This will leave me with a net balance of \$62870.97.

So 6 days have now gone by and Bitcoin price is \$5400.

I wish to close my trade. So I pay a fee of 0.025%. This leaves me with \$62855.26

I buy back the bitcoins, this means I have 11.6398624 Bitcoins.

I return the 10 Bitcoins used for Leverage to be left with 1.6398624 Bitcoins. A profit of 0.6398624 Bitcoins.

So my question is how can I put this in an equation whereby I can input the duration of the trade, the amount of bitcoin, the leverage used and the start and end prices so give me my end results?

I thank you in advance for any help provided.