# Best way to calculate stream viewers average

**URL:** <https://discuss.dev.twitch.com/t/best-way-to-calculate-stream-viewers-average/27880>\
**Category:** API\
**Created:** [August 24, 2020, 8:57pm UTC](https://discuss.dev.twitch.com/t/best-way-to-calculate-stream-viewers-average/27880 "2020-08-24T20:57:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tvtop](https://avatars.discourse-cdn.com/v4/letter/t/aca169/32.png) [@tvtop](https://discuss.dev.twitch.com/u/tvtop)\
**Post date:** [August 24, 2020, 8:57pm UTC](https://discuss.dev.twitch.com/t/best-way-to-calculate-stream-viewers-average/27880/1 "2020-08-24T20:57:34Z")

</div>

Hi everyone.

I have an app that fetches data, minute to minute, from Twitch, YouTube and Facebook streams and it calculates stream viewers average of each stream and draws minute a minute graphics.

Many times, in Twitch, when you use “Get Streams” endpoint, “viewer\_count” response field doesn’t change during several minutes (due to caching?). However, when you’re watching a stream you can see how this data is refreshed each 20-25 seconds (so it doesn’t seem caching works in the same way here ).

To improve accuracy, does it exist alternative methods?. Does PubSub have any topic to fetch real time “viewer\_count”?

In the image below, it can see an example of how Twitch graphics contains more straight lines due to data takes more time in changing:

 ![image](https://d2opxh93rbxzdn.cloudfront.net/original/2X/3/3920d1730436302925bf2b1eeade491080981f67.jpeg)

Sorry for my english, it’s difficult for me 🙂

Thank you.

Best regards.

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [August 24, 2020, 8:58pm UTC](https://discuss.dev.twitch.com/t/best-way-to-calculate-stream-viewers-average/27880/2 "2020-08-24T20:58:33Z")

</div>

> [@tvtop](#):
>
> To improve accuracy, does it exist alternative methods?. Does PubSub have any topic to fetch real time “viewer\_count”?

Nope the only documented method involves doing what you are already doing.

Polling the Streams API every minute.

---

<div class="post-metadata">

**Author:** ![tvtop](https://avatars.discourse-cdn.com/v4/letter/t/aca169/32.png) [@tvtop](https://discuss.dev.twitch.com/u/tvtop)\
**Post date:** [August 24, 2020, 9:04pm UTC](https://discuss.dev.twitch.com/t/best-way-to-calculate-stream-viewers-average/27880/3 "2020-08-24T21:04:59Z")

</div>

> [@BarryCarlyon](#):
>
> Polling the Streams API every minute.

I do it but caching is present too and graphics have many straight lines … 😥

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [August 24, 2020, 9:05pm UTC](https://discuss.dev.twitch.com/t/best-way-to-calculate-stream-viewers-average/27880/4 "2020-08-24T21:05:24Z")

</div>

That the best you can do with the current API offerings that Twitch provides.

---

<div class="post-metadata">

**Author:** ![tvtop](https://avatars.discourse-cdn.com/v4/letter/t/aca169/32.png) [@tvtop](https://discuss.dev.twitch.com/u/tvtop)\
**Post date:** [August 24, 2020, 9:07pm UTC](https://discuss.dev.twitch.com/t/best-way-to-calculate-stream-viewers-average/27880/5 "2020-08-24T21:07:59Z")

</div>

Thank you so much

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [August 24, 2020, 9:08pm UTC](https://discuss.dev.twitch.com/t/best-way-to-calculate-stream-viewers-average/27880/6 "2020-08-24T21:08:42Z")

</div>

that said might be worth opening a uservoice to see if Twitch wants/can look into providing something “more accurate”

[https://twitch.uservoice.com/forums/310213-developers](https://twitch.uservoice.com/forums/310213-developers)

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [September 23, 2020, 9:08pm UTC](https://discuss.dev.twitch.com/t/best-way-to-calculate-stream-viewers-average/27880/7 "2020-09-23T21:08:43Z")

</div>

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