Transforming a collection into a collection with variables

Hello,
I would like bulk update the prices in Baselinker using updateInventoryProductsPrices method (API documentation - baselinker.com).
To achieve this I need to build a collection (in doc it is named Array but, I think it is a mistake) that have products and inside it there are price groups with values for each price group. Demo input:

{
    "inventory_id": "307",
    "products": {
        "2685": {
            "105": 21.99,
            "106": 24.99
        },
        "2687": {
            "105": 21.99,
            "106": 23.99
        }
    }
}

To calculate this prices I would like to use one product as a base price and an extra field from each product.
So with API I get the base product prices:


I’m getting the extra field for each product (for testing there are 2 products)

And now I need to build the collection that will have a products and the prices, that will be the results of multiplying extra field with base product price.

My question is It is the only one way to iterate thru all products (it will be more than 10K products) or maybe there are some functions (maybe array functions?) that can calculate this in one step and send the result to the Baselinker.
I hope my question is clear.
Best regards
SH