Nom nom tasty market data!
Yay! More dev blogs for the developer's site. This time we are going to talk about market data.
To be clear upfront we do NOT believe this will, nor is this an attempt to, kill web sites like EVE Central. For one the format of this data is not very friendly for many applications. It is not the best optimized if you are trying to bulk get data for many different items from many different regions, and other such things. Web sites such as EVE Central and their APIs will be around for a long time to come. We are however fairly hopeful EVEMon can stop cache scraping after this.
When it comes to dealing with market data one of the most important things is to know is what types are on the market to even get data about. For that purpose we have the MarketTypes resource available at the following route: /market/types/
We also are making available the MarketType resource. MarketTypes is a collection of all possible MarketType resources. You can access individual MarketType resources with the following route: /market/types/<typeID:int>/
The MarketTypes resource is paginated with up to 1,000 results per page. With 11,273 types available on the market at the time of writing that results in 12 pages.
You can also filter the MarketTypes resource by specifying a group, which you can get from the MarketGroups resource found at the following route: /market/groups/
The MarketTypes resource takes a group parameter and expects it to be a href to a MarketGroup.
Due to a technical decision in the early days of EVE the market data is split per region. Which means that you need region information in CREST if you want to be able to get all the market data from CREST without knowing about the regions from the SDE. For the reason we have gone and cleaned up some of the universe resources and gotten them ready to be opened up. You can now access the Regions, Region, Constellation, SolarSystem, and Planet resources.
Starting with Regions found at /regions/ you will get a list of all regions in the game. From that you can follow the links to an individual Region resource under /regions/<regionID:int>/ which will give you all the information about the region, including the constellations in that region. I think you can guess where this is going. From there you can follow the links to each constellation, then to each solar system, and finally to each planet.
This should give you an always accurate picture of the universe.
One of the key elements to this however is back in the Region resource. Each Region resource along with giving details on the region such as name, X, Y,Z, and the constellations also gives two other links to MarketBuyOrders and MarketSellOrders resources for that region.
Putting It Together
It's important to remember that one of the ideas behind CREST is that applications should not have to construct URIs themselves. For more information on that I highly recommend you check out this presentation here. So with that in mind, the first step is to get the URI to types you want market orders for. If you simply want all types on the market you would go from the root to MarketTypes. Each item in that resource will have a href for the type, get that.
Next assuming you want the market orders for every region in the game, you would go from the root to Regions, follow the href for each item to the individual Region resource, and get the MarketBuyOrders href.
With the href for each region's MarketBuyOrders and the href for all the types, you can send a GET request to the region's MarketBuyOrders with the added parameter of type that includes the href to that type.
Doing it the way described above, while specifying an Accept header, means that if we ever change the routes or format for any of these resources your application will keep on working, and I wouldn't mind moving all the universe data to /universe/regions/ instead of just /regions/.
Authorization: Bearer jKVB8oaN9qboU5kQG4sWSoWxzSUaFkQaUyeisy8jWU3apRfYSgYsKpZGNbLh41xXEzuy-NDBX1FohEdEadaukQ2
The resource for market groups and market types along with all the universe data will be exposed via public CREST. Actually, it's all on Sisi right now: public-crest-sisi.testeveonline.com
The market buy order and market sell order resources will NOT be made available on public CREST. There are several reasons for this but actually this is a good thing for you guys. Since this resource wont be in public CREST but we want you to access it we need to give you authed CREST. Authed CREST actually has a substantially higher rate limit as well. This will require creating an application here on the developers site and select the publicData scope. Yes, this does mean it's going to be basically impossible to get this data straight from CREST into things such as excel or Google Docs as you will have to send custom headers along with going through the whole OAuth flow. However doing this through authed CREST gives us more confidence in releasing resources, it preps the way for authed CREST to private data, and gives us better monitoring/control over people using it.
Work on upgrading the developers site to allow you to create applications that require scopes is currently ongoing and should be ready for Rhea. For now however as I am sure many of you want to test this stuff on Sisi make a post in this dev blogs comments thread and include your applications name and client ID. I will then update the application to receive refresh tokens along with having the appropriate scope. As this will be done manually please understand if it's a bit slow. :)
That's all for now. I do expect a site replicating the market UI in short order guys. You have the market history and market orders information now. I should point out that there is a discussion on going about making the market history resource work like the market orders resource with a parameter. We will keep you updated on how that goes.