Is there a way to find relationship between VESTS and STEEM at dates in the past?

in hive-137029 •  4 years ago 

VestsToSteem.png

I've been trying to write a script that will show the changes in an account's value over time. With liquid STEEM and SBDs that's somewhat straightforward, I can just find operations that add to them (like rewards or transfers in) or subtract from them (like transfers out), but for SteemPower it's complicated because the API reports most things in terms of VESTS, because that's how the blockchain handles them internally. The relationship between VESTS and SP can be determined for the present moment via some dynamic properties, but I think that relationship changes over time based on SP interest earnings and how much steem people have powered up at any give time, so if we want to know what a reward of 800 VESTS meant in terms of SP 3 years ago when it was claimed we'd need to know the VESTS/SP conversion from 3 years ago. Is there a way to get that without having to replay every transaction in the blockchain? (I can't even keep it strictly in terms of vests because a powerup just has an "amount" of steem).

I saw a suggestion in an old post that you could figure it out by looking at powerdown transactions so I started pursuing that idea (although unless I'm missing something I don't see a way in the API to search the blockchain for particular transaction types so my approach was pretty cumbersome) but the numbers seem to be different than what you'd get by looking at the dynamic properties, e.g. this recent fill_vesting_withdraw:

{
  trx_id: '0000000000000000000000000000000000000000',
  block: 43266519,
  trx_in_block: 4294967295,
  op_in_trx: 0,
  virtual_op: 2,
  timestamp: '2020-05-10T23:56:51',
  op: [
    'fill_vesting_withdraw',
    {
      from_account: 'pandaparker',
      to_account: 'pandaparker',
      withdrawn: '59709.538032 VESTS',
      deposited: '30.573 STEEM'
    }
  ]
}

Suggests that 59709.538032 vests for 30.573 steem = 0.0005120287479634339 steem/vest, which is close to ~0.000513 but a little bit different, so I'm not sure how much I should trust that.

Is there a way to get this information from the API? How do the block explorers do it?

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

The way you're doing it is the only way I can think of off the top of my head. I'll mull it over and let you know if I come up with anything else. I believe that these points from your post are correct:

  • The ratio of STEEM / MVESTS increases from block to block in conjunction with the blockchain inflation rate.
  • I am also not aware of any way to query the API for just powerdown transactions.
  • I think that the powerdown transactions are a good estimate, but of course they're at discrete points in time, and the value is constantly changing, so they can only be approximations.

This is the third time in the last few days that I've missed steemsql.

I know that this is kind of old now. But @steemchiller's SDS has the APIs to get the past PD conversions as well.

Thanks. I don't think I was even aware of SDS when we had this conversation, and I've never used it, so this is useful to know.

cc: @danmaruschak

This is potentially very interesting, because I'm in the process of figuring out how to dust off the project I needed this for.