Bitcoin Forum
May 27, 2024, 08:57:39 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to model a logarithmic progression and is this accurate for Bitcoin price?  (Read 2046 times)
drawingthesun (OP)
Legendary
*
Offline Offline

Activity: 1176
Merit: 1015


View Profile
November 25, 2013, 10:13:32 AM
 #1

I am trying to build a simple Bitcoin price model in matlab.

I have a starting price, around $10 beginning of this year and want to model the values if the price ends up at $10,000 at the end of 2014. I believe that a linear progression is inaccurate ($5,000 end of this year) and want to run a for loop (in weeks) progressing the price each week using a logarithmic increase.

How would I set up a logarithmic "for loop"?

This works for linear increase but does not represent reality at all:
Quote
startPrice = 10;
endPrice = 10000;
years = 2;

days = years * ( 365 );

price = startPrice;
week = 0;

difference = (startPrice - endPrice) / days;

for day=1:days
   price = price - difference;
    
    if mod(day, 7) == 0
        week = week + 1;
        fprintf('Week %3i | Price: %4.2f\n',week, price)
    end
end

Also, if you think a logarithmic model is inaccurate please explain why.
Rannasha
Hero Member
*****
Offline Offline

Activity: 728
Merit: 500


View Profile
November 25, 2013, 10:44:39 AM
 #2

I assume you mean exponential progression (rate of increase goes up) rather than logarithmic progression (rate of increase slows down)? The two are eachothers inverse.

Anyway, it'd be something like this (using C-syntax):
Code:
double startprice = 10;
double endprice = 10000;
double logpriceratio = log(endprice / startprice);
int years = 2;
int days = years * 365;

double price = startprice;
int week = 0;

for (int i = 0; i < days + 1; i += 7)
{
    price = startprice * exp(i / days * logpriceratio);
    fprintf("Week %3i | Price: %4.2f\n", week, price);
}

log() and exp() are standard functions for logarithm and exponentiation with base e.
drawingthesun (OP)
Legendary
*
Offline Offline

Activity: 1176
Merit: 1015


View Profile
November 25, 2013, 10:52:39 AM
Last edit: November 25, 2013, 11:08:23 AM by drawingthesun
 #3

Awesome, thanks for the response.

I assume you mean exponential progression (rate of increase goes up) rather than logarithmic progression (rate of increase slows down)? The two are eachothers inverse.

Haha yeah this is what I need, I guess I got confused about the difference. Yeah rate of increase in absolute values increasing whereas the percentage increase is linear, thats correct right?
Rannasha
Hero Member
*****
Offline Offline

Activity: 728
Merit: 500


View Profile
November 25, 2013, 11:03:00 AM
 #4

Awesome, thanks for the response.

I assume you mean exponential progression (rate of increase goes up) rather than logarithmic progression (rate of increase slows down)? The two are eachothers inverse.

Haha yeah this is what I need, I guess I got confused about the difference. Yeah rate of increase in absolute values increasings whereas the percentage increase is linear, thats correct right?

Yes.
BitchicksHusband
Sr. Member
****
Offline Offline

Activity: 378
Merit: 255


View Profile
November 25, 2013, 05:36:28 PM
 #5

We already did a lot of work on that in this thread:

http://bitcointalk.org/index.php?topic=322058.0

There is even a Google Docs Spreadsheet that you can copy here:

https://bitcointalk.org/index.php?topic=322058.msg3549092#msg3549092

I don't know if that's the one you can play with or another copy later, but there's one where you can tweak the variables.

In any event, looking at the formulas used in this spreadsheet should give you a great head start.

1BitcHiCK1iRa6YVY6qDqC6M594RBYLNPo
drawingthesun (OP)
Legendary
*
Offline Offline

Activity: 1176
Merit: 1015


View Profile
November 25, 2013, 05:43:51 PM
 #6

Thanks BitchicksHusband, Smiley
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!