I'm trying to create a junction of the dicts bellow:
buy_dict = {'Coin1': [{'buy_price': 105, 'id_buy':2 },{'buy_price': 100, 'id_buy':1 }], 'Coin2': [{'buy_price': 1200, 'id_buy':2 },{'buy_price': 1100, 'id_buy':1 }]}
sell_dict = {'Coin1': [{'sell_price': 106, 'id_sell':1 }, {'sell_price': 110, 'id_sell':2 }], 'Coin2': [{'sell_price': 1250, 'id_sell':1 },{'sell_price': 1350, 'id_sell':2 }]}
On the buy_dict I have a dict with buy prices and its ids, grouped by Coin. The same model on the sell_dict. What I need to do is create a third dict by joining the data from two dicts adobe, so the first record of the new dict would be the first record of the dictA plus the first record of the dictB. Below is how it should look:
DictC = {'Coin1': [{'buy_price': 105, 'id_buy':2, 'sell_price': 106, 'id_sell':1}, {'buy_price': 100, 'id_buy':1, 'sell_price': 110, 'id_sell':2}], 'Coin2': [{'buy_price': 1200,'id_buy':2, 'sell_price': 1250,'id_sell':1}, {'buy_price': 1100, 'id_buy':1,'sell_price': 1350,'id_sell':2}]}
In short, the records of DictC would be a junction of the highest buying price and the lowest selling prices. No ordering is required because buy_dict and sell_dict are already ordered.
Thanks!!