Is there a way to get today's earnings in real-time?

Hi there,

is there a way to easily get the today’s earnings, e.g. from one of the node api urls? dyndsn:port/api/sno/..

I could store the everydays current month earnings and subtract the most recent value from the previous day. But if there’s a way to avoid storing data, I would prefer that.

Thx & kind regards

You can avoid using awk with extend of jq command to jq '[.[].paid] | reduce .[] as $item (0; . + $item) / 1000000', the result will be in USD.

1 Like

Thx, will check and confirm the solution then.

1 Like

Had a look into that, but I think I was too unclear in what I wanted to know:

I want to show an estimation of the earnings from the current day, but not what has been paid so far, more what the today’s traffic might have as an impact to the current months estimated earning.

@striker43 is using it for his widget, labelled as “today”: GitHub - striker43/storjWidget

I could follow the source code to understand, how the estimated payout of the current month (“estimatedPayoutTotal”) is summed up, but I don’t understand, how the “today” number is calculated (in his code it’s labeled as “estimatedPayoutToday”).

I thought about storing the today’s “estimatedPayoutTotal” into a file one minute before midnight UTC in order to have a base value for a calculation on the following day and I would output the difference to the value stored on the previous day as estimatedPayoutToday. I was wondering, if that is the only way to do so or if it might be easier.

This widget uses information from GitHub - striker43/storjWidget-exporter, not from storagenode API directly.

You can use this endpoint on storagenode API: http://localhost:14002/api/sno/estimated-payout

curl 'http://localhost:14002/api/sno/estimated-payout' 2>/dev/null | jq '.'
1 Like

Thank you. I interpret, there’s no endpoint having exactly that information available.

Then I’ll work with the workaround of storing temporary the values from one day to another. :v:t2:

That’s more or less how I did it in the widget :slight_smile:

1 Like