There's serious nerd sniping potential in asking how best to construct an automatic bidder, especially with the speed and scale requirements in place. It's an incredibly deep problem, and I don't believe there is a single right answer.
The problem is that it is unwise to trust an bidding algorithm designer whose incentives are aligned against yours. Google benefits from higher winning bids.
In the ad tech space the only winners are the people building and operating the adtech; everyone else is a sucker.
The only truly novel version of it which I have seen emerged from the Turkish hypercasual games space, where they managed to construct a giant audience everyone else thought was worthless, funnel them into their games, and then use the attention in the games to sell access to this apparently worthless audience.
Of course the audience actually were worthless, because all they were really interested in was new free hypercasual games, so the real suckers here were other devs that paid to access this audience but didn't have the adtech chops to make the most of it before the players moved on, and they funded their competition in the process.
RTB bid requests have support for the normal auction based bids but also indicating possible private marketplaces which may come into play depending on the exchange and seller, meaning that the highest bidder will have indicated to the world their price, but not won the auction, so they may (erroneously) conclude next time to try bidding higher, leading to price distortions.
I suspect a large proportion of advertisers still believe the whole thing is a nice transparent fair auction process, and have no idea of how convoluted it has become.
Valuing a bid is a complex and interesting task. Ever since Second Price auctions started dying out DSPs should have moved to essentially algorithmic trading. A price calculation depends on tens if not hundreds of factors that are evaluted on a per auction basis.
Advertisers have been demanding more transparency into where their money is going for quite some time now. If you're an advertiser and your DSP isn't giving you detailed reporting into the fees they're being charged then it's time to move DSP.