BitShares Forum

Main => Technical Support => Topic started by: FrankBlabu on May 31, 2018, 08:38:43 pm

Title: How is the asset exchange rate computed from the blockchain operation?
Post by: FrankBlabu on May 31, 2018, 08:38:43 pm
Hi,

I would like to learn more about the technology bitshares is based on. For that purpose I am using pybitshares to list the raw operations in the blockchain. Now I wonder how the current (settlement) exchange rate is computed using these operations?

From time to time, an asset feed operation arrives. But this seems not to happen frequent enough to get a settlement exchange rate for every major asset daily or even more frequently. So I assume it is computed from the limit order creates and cancels instead. But how?

Is there documentation about this? Or even a link to a source file implementing the basic algorithm?

Thank you in advance!
Title: Re: How is the asset exchange rate computed from the blockchain operation?
Post by: abit on May 31, 2018, 09:09:00 pm
I'm not sure whether your definition of "settlement" and the word used in the system are the same.

Code about order matching:
https://github.com/bitshares/bitshares-core/blob/test-2.0.180525/libraries/chain/db_market.cpp#L380

Code about price feed:
https://github.com/bitshares/bitshares-core/blob/test-2.0.180525/libraries/chain/asset_evaluator.cpp#L931
Title: Re: How is the asset exchange rate computed from the blockchain operation?
Post by: FrankBlabu on June 13, 2018, 05:16:14 pm
Yes, great and well documented ! This helps me a lot in understanding the technical background. Thank you very much !