Vadim
April 3, 2023, 9:08pm
1
is it possible to get held amount from api by satellite?
I have lot of nodes, and as storj delete test data, i would like analyze how much held amount from test satellite I have.
The dashboard has a held amount history.
Vadim
April 5, 2023, 8:45am
3
Yes but i need it from, API
Alexey
April 5, 2023, 8:53am
4
for the current month:
Current Month Earnings can be found by adding up the payout and held amounts at the following URL: http://${NODE_IP}:${API_PORT:-14002}/api/sno/estimated-payout.
I’m not sure if the API makes available the Total Held Amount value. If it does, I can’t find it.
but for total you need to summarize the held for each month using
There is the payment stub endpoint: http://storagenode:14002/api/heldamount/paystubs/<START_DATE: YYYY-MM>/<END_DATE: YYYY-MM>
For example, on a storage node created on 2019-07, you can get historical payment data with
curl 'http://storagenode:14002/api/heldamount/paystubs/2019-07/2022-01'
And sum all payments amount:
curl 'http://storagenode:14002/api/heldamount/paystubs/2019-07/2022-01' 2>/dev/null \
| jq -r '.[].paid' \
| awk '{s+=$1} END {print s}' -
You’ll then have to divide …
I.e., total held:
((Invoke-WebRequest -UseBasicParsing http://localhost:14002/api/heldamount/paystubs/2019-07/2022-01).content | ConvertFrom-Json).held | Measure-Object -Sum
total held returned:
((Invoke-WebRequest -UseBasicParsing http://localhost:14002/api/heldamount/paystubs/2019-07/2022-01).content | ConvertFrom-Json).disposed | Measure-Object -Sum
Then substract the returned held amount from held amount and divide the result to 10^6 to get an USD value.