A network approach for opinion dynamics and price formation