Binance fee calculation BNB conversion rates

According to the [explanation](https://support.binance.com/hc/en-us/articles/115000583311), the rate for converting the trade receivable to BNB is updated every second.
Questions:
1. How do we concretely get this rate through the API?
2. How is the "market price" written in same section determined? Is it going to be a market order to yield BNB? Or will the rate be something like the mean of the current bid and ask? Or the last done price?