Its Here ....

Starfinder

Elite
Joined
Jan 31, 2005
Posts
3,062
Location
Denmark
Society
Planet Express
Avatar Name
Ms. Kazzza 'Starfinder' Milla
Its here.. The FIRST EVER PROJECT ENTROPIA MARKET INDEX.


From the PEMI:

The Project Entropia Market Index or PEMI is a fast way to get an overview of the diffrent markets that are avalible in Project Entropia.
The current market trends are calculated from average market prices during the last 14 days.
The graphs are updated every 30 minutes.
The graphs and market trends factor in such things as volume of sales, frequency of sales and price of sales.
With all of those factors combined it is possible to show market trends and specific market index for each of the diffrent categories.
The market index should not be used to advocate sales within the specific category, the index is an average of all sales that occured in a specific category. If you would like information of a specific item within a category, simply click the links found in the left hand side.


Please check it out here: http://www.perc.info/pricefinder.asp?mode=PEMI

(Note: the new graph system have just been running for 2 hours so the graphs may look like they arent correct, but they are.. they just havent got much information yet...)
 
This is great imo. Well done as always Starfinder :girl:
 
Great work! One thing I notice is that the fluctuation on the clothing and tailoring seem a bit high. I would be interested in hearing exactly how you are calculating it.

DD
:evilking:
 
The following is a pseudo code for the calc of the index prices:
(code is in red)

' Create variables as numbers.
ThisIndex = 0
ThisQty = 0
ThisPerc = 0
Yesterday = 0
YesterQty = 0
YesterPers = 0


'Select what we need in the database

Set rs_Index = conn.Execute ("SELECT * FROM where itemtype is in the right category and where its the final bid on the specific item")

'Loop through the database to get them all

do while not rs_Index.eof




'First we get all the entries that match the search criteria and is within the last 7 days.

'Date compare - If its 1, its 1 day ago, 2.. 2 days ago.. and so on..

if DateDiff("d",rs_Index("Dato"),date()) < 7 then

'Add the current rs QTY to the total qty within the past week, when it loops the total qty increases...

ThisQty = ThisQty + rs_Index("qty")

'Then we add the selling percentage to the formular, this also increases for each loop.

ThisPerc = ThisPerc + (rs_Index("qty") * ((rs_Index("Bidprice") / rs_Index("Price"))*100))




'Next 7 days
elseIF DateDiff("d",rs_Index("Dato"),date()) > 7 AND DateDiff("d",rs_Index("Dato"),date()) < 14 then
'Add the current rs QTY to the total qty a 7-14 days ago
YesterQty = YesterQty + rs_Index("qty")
YesterPers = YesterPers + (rs_Index("qty") * ((rs_Index("Bidprice") / rs_Index("Price"))*100))
end if


'Then we move to the next rs( result set) from the database..
rs_Index.movenext

'Then we loop back to the "Do while"
loop

'When we have looped through the database we close the result set, so we dont take up too much RAM.. prehaps MA could learn somethign ?? :p

rs_Index.close
set rs_Index = nothing


' Now we know the database has been looped through and we have added all the information to the variables we need. So now we can calc the index, and how it has performed in the last 14 days.


ThisIndex = Round(ThisPerc / ThisQty,2)
Yesterday = Round(YesterPers / YesterQty,2)


' Then we decide which image (Arrow) we should print to the page (the printing code is not provided here... This is JUST the back end code..

If ThisIndex > Yesterday then
UpDown = "up.jpg"
else
UpDown = "down.jpg"
end if


'Then we calc the details number.. That is the number shown in the () on the page, that shows how much the index have moved within the last 14 days.


Detail = Round(ThisIndex - Yesterday,3)


____________________________________________________________

In essence what the code does is that it takes all (percentages * qty) / qty

So if we come up with some fictive numbers.. like
1500 ingots sold for 140 %
10 ingots sold for 185 %
1 ingot sold for 900%

The equation will be:
index = ((1500 * 140) + (10 * 185) + (1 * 900)) / 1511 = (210000 + 1850 + 900) / 1511 = 140.80.

This is prehaps easy enough to calc for 3 (in this case) minerals.. but the database loops through arround 500 entries (only looping thogh entries for the last 14 days)..
The index therefore show what the average selling "value" has been for the specific category in the last 14 days, and how the market is moving.
____________________________________________________________
Note that the code here has been "prettyfied" so it isent soo complex as it is in the actual code.. but the basics is the same...
Also.. Each time you enter the index page you calc. all the index' on the fly.. thats why it can take a bit of time before the page loads...
 
on a side note... to get an idea of just how massive pricefinder is...

Pricefinder is currently: 3628 lines of code..

The index you just saw is just 68 lines of code.. The graphs are a bit over 150 lines of code....
 
To simplify:

Are you saying that each item = an individual stock and you are calculating the return per stock/item?

or

Are you treating every item as if it were the same stock?

Does my question ever make sense :laugh:

I would think it should work something like this...

for every item logged in PF

if sale today
calc price% increase decrease
else
loop back to find last sale
set no % increase decrease
end

volume of each items sales effects the overall index based on its percentage of total volume

this way you have a "base" factor of every item. if no sales occur the "price" or "return" on that item is stale. the onlything that should effect the index is a change in price.

do I make any sense? probably not :eek:



DD
:evilking:
 
I treat a category as one item... for instance.. all ores are one item (from my SQL)

I then look at all ores sold from today and 7 days back.. adn do the calc on that.. to find the average selling index for that...

I then do the same to calc for 7 to 14 days back.. And get avg selling price for that (with qty and all of that in).. not just X ingots sold at 100%.. and X sold at 200%..

that would mean that avg were 150%.. here it can be 100.1%.. if the qty dictated so...

I then, when i have both indexes, can see how the new index is in comparrison to the older index.. and then i can determine how the average market price for IE ores have behaved in the last 14 days....

Hope that explained it better than the code :D
 
Thanks for the explaination. I do not know how much you know about the real market indexes so I will explain a little bit.

I will use Ores in PE as an example.

Below is a table showing the stocks that make up the Dow Jones industrial average. The main colums we are initially concerned with are the Company Name and USD Close.

http://www.djindexes.com/mdsidx/index.cfm?event=showComponentWeights&rptsymbol=DJI&sitemapid=1

In our example the first step would be to choose the Ores that will make up our index. We would want to represent all classes of ores. For example Lyst and other common ores, Rugaritz and a few more rare ores. Once we have this we calculated the price for these ores on a daily basis. This can be done by pulling the last 24 hours of activity and dividing the sale price by the units. This will give you your price per share.

EXAMPLE: 100 IRON ingots sold at 200 ped. 200/100=2 PED.

So our share price in this example is 2 PED. If no sales are present you will need to look back to find your last price in 24 hour period chunks. This will lead to a "no change" price which is what you want as a stabalizing factor for your index.

Now, to get your index value you will purchase a pretend share amount. Say 100. Here is where you may use a weighting factor to determine how many shares you would like your index to have in each stock. For this example I have used a factor based on price/total price for all stocks.

(100*6.96%)*2=13.920
(100*15.65%)*4.5=70.43
(100*77.39%)*28.75=2147.57

TOTAL Index value of 2,231.92

When tomorrow the price changes we do the final calc all over again. Lets assume no ruga sales so the ruga price stays the same...

(100*6.96%)*3=20.88
(100*15.65%)*5=78.25
(100*77.39%)*28.75=2147.57

TOTAL Index value of 2,246.70

This is just one way an index works IRL. The key is selecting the investments (items) you want to be in your index so the changes accuratly reflect what you are looking to show.

For example, if you are looking to show how the everyday tailoring market is performing you would want to include basic shirts and pants but probably not less stable items such as new coats etc.

:twocents:

DD
:evilking:
 
ok, where's the Trout emote.... ah....

Dirk :trout: Starfinder

What we mean to say here is, the ore index is calculated by taking each sale, multiplying the amount of ingots sold, by the selling percentage, then summing all those values and dividing by the total ingots sold. Simple, the formula looks like this.....


sum (Ix x Px)
TI​

Where:

I = amount of ingots
P = selling percentage
x = auction number (ie, this done recursivley for all sales in selected time period)
TI = Total Ingots (within selected time period)

OK, I'm reasonably sure I wrote this down wrong, but it seems close enough, perhaps someone else would like to try?
 
Dirk said:
ok, where's the Trout emote.... ah....

Dirk :trout: Starfinder

What we mean to say here is, the ore index is calculated by taking each sale, multiplying the amount of ingots sold, by the selling percentage, then summing all those values and dividing by the total ingots sold. Simple, the formula looks like this.....


sum (Ix x Px)
TI​

Where:

I = amount of ingots
P = selling percentage
x = auction number (ie, this done recursivley for all sales in selected time period)
TI = Total Ingots (within selected time period)

OK, I'm reasonably sure I wrote this down wrong, but it seems close enough, perhaps someone else would like to try?


Thanks now my brain hurts :(
 
this thread is hurting my head :scared:
 
U Rock man!
Perc Rox !!

Really best info site :wise: :cool:
 
;) just say if you want something on the site.. then we will do our best to accomodate it :p
 
little update done...

It now shows two lines...

Blue = index...

Green = how much have sold in the last 14 days :D

Note the green line dosent go a long back as the blue line since its a new addition :D and its more or less straight sine i ran the updater a couple of times to check if it worked... but once it has run for some time it will work :D
 
Woot! Great work!

DD
:evilking:
 
Back
Top