# Keeping market history updated using ESI

**URL:** <https://forums.eveonline.com/t/keeping-market-history-updated-using-esi/84489>\
**Category:** Third Party Developers\
**Created:** [June 22, 2018, 8:32am UTC](https://forums.eveonline.com/t/keeping-market-history-updated-using-esi/84489 "2018-06-22T08:32:56Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dalden\_V](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/dalden_v/32/80729_2.png) [@Dalden\_V](https://forums.eveonline.com/u/Dalden_V)\
**Post date:** [June 22, 2018, 8:32am UTC](https://forums.eveonline.com/t/keeping-market-history-updated-using-esi/84489/1 "2018-06-22T08:32:56Z")

</div>

Hi there!

I’ve recently returned to the game and I’m busy updating all my tools to use the new ESI API.

I’d like to keep my local copy of the market history for The Forge region updated daily and I’m currently using the GET /markets/{region\_id}history/ endpoint to do so.

I call this endpoint for each type\_id, and this is working, but I was wondering if there’s a more efficient way of doing this without retrieving redundant data daily?

If I updated the history for all items yesterday then today I don’t need the history going back a year, I just need the one day I’m missing. Is there a way to do that? Or even better, is there a way to get the history for all item\_types for just the last day in a single call?

---

<div class="post-metadata">

**Author:** ![Blacksmoke16](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/blacksmoke16/32/376589_2.png) [@Blacksmoke16](https://forums.eveonline.com/u/Blacksmoke16)\
**Post date:** [June 22, 2018, 12:11pm UTC](https://forums.eveonline.com/t/keeping-market-history-updated-using-esi/84489/2 "2018-06-22T12:11:49Z")

</div>

No, you would have to just parse the response and filter out the date range you need.

---

<div class="post-metadata">

**Author:** ![Dalden\_V](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/dalden_v/32/80729_2.png) [@Dalden\_V](https://forums.eveonline.com/u/Dalden_V)\
**Post date:** [June 22, 2018, 12:59pm UTC](https://forums.eveonline.com/t/keeping-market-history-updated-using-esi/84489/3 "2018-06-22T12:59:04Z")

</div>

Thanks @Blacksmoke16, that’s what I’m currently doing, just seems wasteful throwing away data I’m not using. CCP doesn’t mind us doing this request every day for all items in the region?

---

<div class="post-metadata">

**Author:** ![Piotr\_Leusten](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/piotr_leusten/32/169358_2.png) [@Piotr\_Leusten](https://forums.eveonline.com/u/Piotr_Leusten)\
**Post date:** [June 22, 2018, 1:07pm UTC](https://forums.eveonline.com/t/keeping-market-history-updated-using-esi/84489/4 "2018-06-22T13:07:14Z")

</div>

I haven’t actually tried programming this, but might this be what **etags** are for?  
[https://developers.eveonline.com/blog/article/esi-etag-best-practices](https://developers.eveonline.com/blog/article/esi-etag-best-practices)

---

<div class="post-metadata">

**Author:** ![Steve\_Ronuken](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/steve_ronuken/32/373894_2.png) [@Steve\_Ronuken](https://forums.eveonline.com/u/Steve_Ronuken)\
**Post date:** [June 22, 2018, 1:09pm UTC](https://forums.eveonline.com/t/keeping-market-history-updated-using-esi/84489/5 "2018-06-22T13:09:06Z")

</div>

etags are just to identify a version of the content.

So you send an etag with the request, and if you have the most recent, the server responds with a 304 response, saying “you’ve got it.”

If it doesn’t match, you get the content with a 200 tag.

---

<div class="post-metadata">

**Author:** ![Dalden\_V](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/dalden_v/32/80729_2.png) [@Dalden\_V](https://forums.eveonline.com/u/Dalden_V)\
**Post date:** [June 22, 2018, 1:20pm UTC](https://forums.eveonline.com/t/keeping-market-history-updated-using-esi/84489/6 "2018-06-22T13:20:00Z")

</div>

Yeah, etags won’t help here, because each day there will be a new version that includes the new day’s history as well as a year’s worth of history I already have 🙂

---

<div class="post-metadata">

**Author:** ![Catherine\_Solenne](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/catherine_solenne/32/206827_2.png) [@Catherine\_Solenne](https://forums.eveonline.com/u/Catherine_Solenne)\
**Post date:** [June 22, 2018, 3:58pm UTC](https://forums.eveonline.com/t/keeping-market-history-updated-using-esi/84489/7 "2018-06-22T15:58:57Z")

</div>

They’ll still help for low-volume types that don’t necessarily sell every day

---

<div class="post-metadata">

**Author:** ![Ethan02](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/ethan02/32/378764_2.png) [@Ethan02](https://forums.eveonline.com/u/Ethan02)\
**Post date:** [June 22, 2018, 5:33pm UTC](https://forums.eveonline.com/t/keeping-market-history-updated-using-esi/84489/8 "2018-06-22T17:33:11Z")

</div>

See ESI ticket [https://github.com/esi/esi-issues/issues/706](https://github.com/esi/esi-issues/issues/706) regarding this and feel free to upvote to get it to the attention of the devs quicker

---

<div class="post-metadata">

**Author:** ![Dalden\_V](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/dalden_v/32/80729_2.png) [@Dalden\_V](https://forums.eveonline.com/u/Dalden_V)\
**Post date:** [June 22, 2018, 10:13pm UTC](https://forums.eveonline.com/t/keeping-market-history-updated-using-esi/84489/9 "2018-06-22T22:13:19Z")

</div>

Thanks @Ethan02, that’s exactly the issue, I guess it’s a trade-off between the cost of transmitting the data and the cost of filtering the data which could impact caching on the server side. I’ll keep an eye on the GitHub issue and in the meantime just continue filtering the data locally.

---

<div class="post-metadata">

**Author:** ![Krysenth](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/krysenth/32/58194_2.png) [@Krysenth](https://forums.eveonline.com/u/Krysenth)\
**Post date:** [June 23, 2018, 12:59am UTC](https://forums.eveonline.com/t/keeping-market-history-updated-using-esi/84489/10 "2018-06-23T00:59:14Z")

</div>

The etags wouldnt work entirely well with this endpoint as whenever there’s new data (aka “today”), it’s likely dropping off the oldest entry. That cascade’s every page and etags arent useful.

_Now_, if it grouped the response by month objects instead, and returned those as “pages” etags would work, as if you’ve already got last july through may historical prices already, you’re just interested in the new ones for June. 🤔 But then you’d just call the latest month anyways.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/eveonline/original/3X/4/1/41ec4921cbaca7a6f9ea556e7cc20018461eae5e.png) [@system](https://forums.eveonline.com/u/system)\
**Post date:** [September 21, 2018, 12:59am UTC](https://forums.eveonline.com/t/keeping-market-history-updated-using-esi/84489/11 "2018-09-21T00:59:16Z")

</div>

Closed on September 21, 2018, 12:59am UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
