Modelling second price auction results

So I have a problem where you win an auction if you bid the highest price, but pay the second bidders amount. The problem is further confounded by the fact that you only observe the sum of the second bids at the end of the day, only if clicked. You do however see the number of impressions at the end of the day. The data generation process is shown below.

def get_spend_and_impressions_per_keyword(our_price):
    impressions ~ Poisson(AVERAGE_IMPRESSIONS)
    ctr ~ Uni[0, 1e-1] # we know that CTR is less than 10%
    
    spend = 0
    our_impressions = 0
    for _ in range(impressions):
        competitor_spend ~ Gamma()
        if competitor_spend < our_price:
            our_impressions += 1
            condition = Bernoulli(ctr)
            spend += condition * competitor_spend

    return spend, our_impressions

Ideally what I would like to get is the posterior given our_price. Any thoughts on how I would model this on pymc3/4?

You can try to use a Simulator with sample_smc, it’s the dirtiest way to do inference without a closed form likelihood, when you have a generating process.

Might not scale very well though: pymc.Simulator — PyMC dev documentation