Extracing a specific value from a list of maps based on multiple criteria

markets = 
[
  %{
    asset: "WAVES",
    last_price: 1.4422,
    priced_in: "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p",
    volume: 217364.71704254
  },
  %{
    asset: "WAVES",
    last_price: 1.4967e-4,
    priced_in: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    volume: 104369.74363504
  },
  %{
    asset: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    last_price: 9695.11,
    priced_in: "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p",
    volume: 94162.0556780501
  },
  %{
    asset: "474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu",
    last_price: 183.59929648,
    priced_in: "WAVES",
    volume: 80387.9642192165
  },
  %{
    asset: "6UfBupFwFnWTrnFDWiR73LQjPxRY38CgZ6Bu4m4SySQY",
    last_price: 4.62,
    priced_in: "WAVES",
    volume: 48263.8000000003
  },
  %{
    asset: "5b3UGNZXX5srkHUQWnEWEiaVtnNWmg5aLo5uZMdjWupH",
    last_price: 153.665,
    priced_in: "WAVES",
    volume: 43363.5978799705
  },
  %{
    asset: "474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu",
    last_price: 266.504728,
    priced_in: "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p",
    volume: 41036.1421656664
  },
  %{
    asset: "474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu",
    last_price: 0.02731258,
    priced_in: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    volume: 18391.113021679
  },
  %{
    asset: "HZk1mbfuJpmxU1Fs4AX5MWLVYtctsNcg6e2C6VKqK8zk",
    last_price: 50.41491557,
    priced_in: "WAVES",
    volume: 14696.933692985
  },
  %{
    asset: "DHgwrRvVyqJsepd32YbBqUeDH4GJ1N984X8QoekjgH8J",
    last_price: 0.03884141,
    priced_in: "WAVES",
    volume: 14160.863545616
  },
  %{
    asset: "4LHHvYGNKJUg5hj65aGD5vgScvCBmLpdRFtjokvCjSL8",
    last_price: 0.04941776,
    priced_in: "WAVES",
    volume: 14112.4053479133
  },
  %{
    asset: "FLbGXzrpqkvucZqsHDcNxePTkh2ChmEi4GdBfDRRJVof",
    last_price: 0.09086364,
    priced_in: "WAVES",
    volume: 13442.6847576799
  },
  %{
    asset: "3QvxP6YFBKpWJSMAfYtL8Niv8KmmKsnpb9uQwQpg8QN2",
    last_price: 0.08267645,
    priced_in: "WAVES",
    volume: 13343.9795101583
  },
  %{
    asset: "7FzrHF1pueRFrPEupz6oiVGTUZqe8epvC7ggWUx8n1bd",
    last_price: 0.04522094,
    priced_in: "WAVES",
    volume: 11715.6982654709
  },
  %{
    asset: "5WvPKSJXzVE2orvbkJ8wsQmmQKqTv9sGBPksV4adViw3",
    last_price: 0.00827027,
    priced_in: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    volume: 10016.6470872845
  },
  %{
    asset: "3QvxP6YFBKpWJSMAfYtL8Niv8KmmKsnpb9uQwQpg8QN2",
    last_price: 0.11950669,
    priced_in: "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p",
    volume: 9745.92082523223
  },
  %{
    asset: "4LHHvYGNKJUg5hj65aGD5vgScvCBmLpdRFtjokvCjSL8",
    last_price: 0.071283,
    priced_in: "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p",
    volume: 9605.59902900125
  },
  %{
    asset: "3QvxP6YFBKpWJSMAfYtL8Niv8KmmKsnpb9uQwQpg8QN2",
    last_price: 1.237e-5,
    priced_in: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    volume: 9374.73747957679
  },
  %{
    asset: "DHgwrRvVyqJsepd32YbBqUeDH4GJ1N984X8QoekjgH8J",
    last_price: 5.73e-6,
    priced_in: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    volume: 9373.09209757368
  },
  %{
    asset: "FLbGXzrpqkvucZqsHDcNxePTkh2ChmEi4GdBfDRRJVof",
    last_price: 1.359e-5,
    priced_in: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    volume: 9352.92150758552
  },
  %{
    asset: "5dJj4Hn9t2Ve3tRpNGirUHy4yBK6qdJRAJYV21yPPuGz", 
    last_price: 3.995e-5,
    priced_in: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    volume: 9335.1007797661
  },
  %{
    asset: "DHgwrRvVyqJsepd32YbBqUeDH4GJ1N984X8QoekjgH8J",
    last_price: 0.05623643,
    priced_in: "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p",
    volume: 9141.99462317228
  },
  %{
    asset: "4LHHvYGNKJUg5hj65aGD5vgScvCBmLpdRFtjokvCjSL8",
    last_price: 7.66e-6,
    priced_in: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    volume: 9116.55774607903
  },
  %{
    asset: "7FzrHF1pueRFrPEupz6oiVGTUZqe8epvC7ggWUx8n1bd",
    last_price: 0.068978, 
    priced_in: "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p",
    volume: 8687.88783667355
  },
  %{
    asset: "7FzrHF1pueRFrPEupz6oiVGTUZqe8epvC7ggWUx8n1bd",
    last_price: 6.82e-6,
    priced_in: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    volume: 7997.88429025505
  },
  %{
    asset: "HZk1mbfuJpmxU1Fs4AX5MWLVYtctsNcg6e2C6VKqK8zk",
    last_price: 0.0075719,
    priced_in: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    volume: 7009.80142143737
  },
  %{
    asset: "51LxAtwBXapvvTFSbbh4nLyWFxH6x8ocfNvrXxbTChze",
    last_price: 3.14e-4,
    priced_in: "WAVES",
    volume: 6095.72522228601
  },
  %{
    asset: "34N9YcEETLWn93qYQ64EsP1x89tSruJU44RrEMSXXEPJ",
    last_price: 1.010003,
    priced_in: "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p",
    volume: 6029.06554224152
  },
  %{
    asset: "EYz8Zvs62D4d7F5ZgXHCWuzuFaZg63FYnfVQrTWQoLSK",
    last_price: 0.448,
    priced_in: "WAVES",
    volume: 5892.67906935
  },
  %{
    asset: "EYz8Zvs62D4d7F5ZgXHCWuzuFaZg63FYnfVQrTWQoLSK",
    last_price: 6.64e-5,
    priced_in: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    volume: 5424.87379990571
  },
  %{
    asset: "WAVES",
    last_price: 2.89,
    priced_in: "Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck",
    volume: 4742.8462136
  },
  %{
    asset: "HXtwvrpL8qiYCGC2D6WdiWgqQ5qSyQRQWmo9zDJk32ki",
    last_price: 0.00455003,
    priced_in: "WAVES",
    volume: 3273.82899018523
  },
  %{
    asset: "bPWkA3MNyEr1TuDchWgdpqJZhGhfPXj7dJdr3qiW2kD",
    last_price: 0.10588957,
    priced_in: "4LHHvYGNKJUg5hj65aGD5vgScvCBmLpdRFtjokvCjSL8",
    volume: 2847.14438899417
  },
  %{
    asset: "B3uGHFRpSUuGEDWjqB9LWWxafQj8VTvpMucEyoxzws5H",
    last_price: 0.01122179,
    priced_in: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    volume: 2690.68907531833
  },
  %{
    asset: "GSFvcF6ycBfXwPJLLKMExRsHWnvVdZQFHtGiYu4A2kZP",
    last_price: 13,
    priced_in: "5f1txDysSx2fVDjgXMdNpuprpdgXKjoHPtebL3SrMGzE",
    volume: 2673.3000000798
  },
  %{
    asset: "zKyPD5DmwTuf3dJfTd54MhQ8ZnUYLXpAmEm5jTJc8MQ",
    last_price: 2.032e-4,
    priced_in: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    volume: 2581.32874589081
  },
  %{
    asset: "B3uGHFRpSUuGEDWjqB9LWWxafQj8VTvpMucEyoxzws5H",
    last_price: 75.33779182,
    priced_in: "WAVES",
    volume: 1851.03313956612
  },
  %{
    asset: "FekmTKV2K1EUccu2uta4M4cHXheSb22Whb41TfZkjQC6",
    last_price: 2.75e-4,
    priced_in: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    volume: 1836.93958407045
  },
  %{
    asset: "7uncmN7dZfV3fYVvNdYTngrrbamPYMgwpDnYG1bGy6nA",
    last_price: 1.6e-7,
    priced_in: "WAVES",
    volume: 1422.64391844
  },
  %{
    asset: "5WvPKSJXzVE2orvbkJ8wsQmmQKqTv9sGBPksV4adViw3",
    last_price: 0.30193794,
    priced_in: "474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu",
    volume: 1116.45865329394
  },
  %{
    asset: "8Yw4QmskrQauQeNjgh2fTQ4swmkNm85GTQzdHEf6QdUU",
    last_price: 0.0019155,
    priced_in: "WAVES",
    volume: 1111.91910869156
  },
  %{
    asset: "45aH8AsLe1CgcSmPVek7J3XoZW7n3fnW5Xtw4ohRD2yd",
    last_price: 2.4e-7,
    priced_in: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    volume: 1100.23031779426
  },
  %{
    asset: "EYz8Zvs62D4d7F5ZgXHCWuzuFaZg63FYnfVQrTWQoLSK",
    last_price: 0.645,
    priced_in: "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p",
    volume: 1088.57903138516
  },
  %{
    asset: "EYz8Zvs62D4d7F5ZgXHCWuzuFaZg63FYnfVQrTWQoLSK",
    last_price: 0.645,
    priced_in: "34N9YcEETLWn93qYQ64EsP1x89tSruJU44RrEMSXXEPJ",
    volume: 1078.97287816868
  },
  %{
    asset: "BrjUWjndUanm5VsJkbUip8VRYy6LWJePtxya3FNv4TQa",
    last_price: 0.00634109,
    priced_in: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    volume: 986.556468480517
  },
  %{
    asset: "3p1i78cgCVgeV9TSsteSe67AFLTKWW5urjgHu5kizTyK",
    last_price: 1.0051,
    priced_in: "34N9YcEETLWn93qYQ64EsP1x89tSruJU44RrEMSXXEPJ",
    volume: 974.171165050622
  },
  %{
    asset: "HZk1mbfuJpmxU1Fs4AX5MWLVYtctsNcg6e2C6VKqK8zk",
    last_price: 0.27688008,
    priced_in: "474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu",
    volume: 845.611665721807
  },
  %{
    asset: "DHgwrRvVyqJsepd32YbBqUeDH4GJ1N984X8QoekjgH8J",
    last_price: 1,
    priced_in: "fQft3z2fkdiozA7zDnaXczB3VBPM5y6sAbFGwvXA83E",
    volume: 775.85827213728
  },
  %{
    asset: "DHgwrRvVyqJsepd32YbBqUeDH4GJ1N984X8QoekjgH8J",
    last_price: 1,
    priced_in: "BwnVwoaQorLvqWtZaZazsdH7uGmXRDdLbCGWpLiiZTQt",
    volume: 775.85827213728
  },
  %{
    asset: "55smkCchKqv2w19GAVSDJ83f5NzjUErXugzcTQwHQoK2",
    last_price: 1849.99,
    priced_in: "Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck",
    volume: 693.415811207236
  },
  %{
    asset: "WAVES",
    last_price: 1.41,
    priced_in: "34N9YcEETLWn93qYQ64EsP1x89tSruJU44RrEMSXXEPJ",
    volume: 634.41523008
  },
  %{
    asset: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    last_price: 19318.94,
    priced_in: "Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck",
    volume: 572.90208070948
  },
  %{
    asset: "33sQbDqb5m3DpKJirp5ZRhQZ8iHetYTVq4LhuWdjjAqx",
    last_price: 3.5e-6,
    priced_in: "WAVES",
    volume: 524.982499972
  },
  %{
    asset: "5WvPKSJXzVE2orvbkJ8wsQmmQKqTv9sGBPksV4adViw3",
    last_price: 55.55292235,
    priced_in: "WAVES",
    volume: 450.349641866159
  },
  %{
    asset: "474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu",
    last_price: 505.74,
    priced_in: "Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck",
    volume: 405.106084082761
  },
  %{
    asset: "9wHHMpb6YDfKaCFasXg9urAkzQ8p933CPN1KHqbQ1qpR",
    last_price: 0.00146599,
    priced_in: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    volume: 402.736653395769
  },
  %{
    asset: "6mRmui8aKUKgDQAQd6TroLCVhKUSNZnt91zR25RGz3SQ",
    last_price: 0.024,
    priced_in: "WAVES",
    volume: 384.60264
  },
  %{
    asset: "9wHHMpb6YDfKaCFasXg9urAkzQ8p933CPN1KHqbQ1qpR",
    last_price: 10.0981469,
    priced_in: "WAVES",
    volume: 360.949930851591
  },
  %{
    asset: "81HnQ1PWViWUiv39NGkPjbfDehW1edjeJe6XxVhw1TPZ",
    last_price: 0.01577,
    priced_in: "WAVES",
    volume: 268.21626929
  },
  %{
    asset: "EgdXZCDja5H54dQqvY1GbJEjJ4TzpNtBsj45m1UmQFa2",
    last_price: 0.00638611,
    priced_in: "WAVES",
    volume: 235.31055725407
  },
  %{
    asset: "4SvrfTcELe39nd28sa64mVEifH5DXpCFemZcu3yWkhqi",
    last_price: 9.91e-6,
    priced_in: "WAVES",
    volume: 218.336838883476
  },
  %{
    asset: "DnPitVcpLXMD19rKCcT4x3jBNwsbJkTY8TaEkReM3EYS",
    last_price: 4.0e-7,
    priced_in: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    volume: 216.927518838923
  },
  %{
    asset: "DmuB5m3XPBkoM4Nfbz4gLDq3rXpWkhSugob8GzYtv7g4",
    last_price: 5.01e-6,
    priced_in: "WAVES",
    volume: 215.8942736393
  },
  %{
    asset: "BrjUWjndUanm5VsJkbUip8VRYy6LWJePtxya3FNv4TQa",
    last_price: 42.39690016,
    priced_in: "WAVES",
    volume: 208.131669371147
  },
  %{
    asset: "6XNchDjcKGDRN5d8YVWb3X5NDPoRym6joZJdBysvr6BP",
    last_price: 0.12,
    priced_in: "WAVES",
    volume: 189.818585601848
  },
  %{
    asset: "EbLVSrAi6vS3AkLwBinzZCvAXP2yYiFJEzj1MBVHcwZ5",
    last_price: 4.55e-6,
    priced_in: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    volume: 185.509139103901
  },
  %{
    asset: "WAVES",
    last_price: 2.64,
    priced_in: "Gtb1WRznfchDnTh37ezoDTJ4wcoKaRsKqKjJjy7nm2zU",
    volume: 179.55605453
  },
  %{
    asset: "5dJj4Hn9t2Ve3tRpNGirUHy4yBK6qdJRAJYV21yPPuGz",
    last_price: 0.2668701,
    priced_in: "WAVES",
    volume: 173.957633855766
  },
  %{
    asset: "FvWC4VrsGcaAhgwg51ogyFG2QPXgFMco1HKx4V6RsCoW",
    last_price: 0.054,
    priced_in: "WAVES",
    volume: 157.922
  },
  %{
    asset: "EGFTAADbJk7xJFY3gNPMqKfaj74A1FYGJ1S8HAvyArmS",
    last_price: 3,
    priced_in: "5f1txDysSx2fVDjgXMdNpuprpdgXKjoHPtebL3SrMGzE",
    volume: 149.25
  },
  %{
    asset: "D5nuirqx1W495jFKpji9EBkKLwf6QmLFFASPMsurmX2V",
    last_price: 1.43e-6,
    priced_in: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    volume: 116.357870875764
  },
  %{
    asset: "zMFqXuoyrn5w17PFurTqxB7GsS71fp9dfk6XFwxbPCy",
    last_price: 262.18295038,
    priced_in: "WAVES",
    volume: 85.2863111700993
  },
  %{
    asset: "DHgwrRvVyqJsepd32YbBqUeDH4GJ1N984X8QoekjgH8J",
    last_price: 0.1,
    priced_in: "7J6vNWxR4WyW7tjYmmoGyGrVmL6zgzm87m2Ntu4CXt9z",
    volume: 77.585827213728
  },
  %{
    asset: "62LyMjcr2DtiyF5yVXFhoQ2q414VPPJXjsNYp72SuDCH",
    last_price: 0.02900293,
    priced_in: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    volume: 77.500597992925
  },
  %{
    asset: "6gr93FQ7Jrein3QoNQfCyRKCTxbYPx2nYxBhaXbgwpAt",
    last_price: 0.002201,
    priced_in: "WAVES",
    volume: 73.233222
  },
  %{
    asset: "GBVwdNWUQgPDG5okatff1AcHyFi28PMRmNEKxEDr89Pz",
    last_price: 1.3311,
    priced_in: "34N9YcEETLWn93qYQ64EsP1x89tSruJU44RrEMSXXEPJ",
    volume: 71.446382423745
  },
  %{
    asset: "Gtb1WRznfchDnTh37ezoDTJ4wcoKaRsKqKjJjy7nm2zU",
    last_price: 1.12,
    priced_in: "Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck",
    volume: 59.421012320656
  }, 
  %{
    asset: "HKJK3zswXJLbsgJ3pQNiYVNu6svy4SM9zucB8YEJFXqt",
    last_price: 2.59e-4,
    priced_in: "WAVES",
    volume: 53.7720590400376
  },
  %{
    asset: "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p",
    last_price: 2,
    priced_in: "Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck",
    volume: 52.3605556159396
  },
  %{
    asset: "5JMonS968BwKRQFDVVtUVDVaK4ECsWTyDZ1P6eSoHEiY",
    last_price: 15,
    priced_in: "WAVES",
    volume: 52.2360187700001
  },
  %{
    asset: "bPWkA3MNyEr1TuDchWgdpqJZhGhfPXj7dJdr3qiW2kD",
    last_price: 0.00499982,
    priced_in: "WAVES",
    volume: 51.075288780434
  },
  %{
    asset: "4supDaaXJB65X2gBhkEyU5rd2Rkt4TzgunfhT1qynokr",
    last_price: 0.0051,
    priced_in: "WAVES",
    volume: 51.0051
  },
  %{
    asset: "zMFqXuoyrn5w17PFurTqxB7GsS71fp9dfk6XFwxbPCy",
    last_price: 0.03893056,
    priced_in: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    volume: 41.0779414016256
  },
  %{
    asset: "GoqqjKHRkUd9GUaByzqcCYpTo7K2aAXHc2NvXS21eY4H",
    last_price: 1,
    priced_in: "GWmNS4hx2JDB268nAz3k24YwxuBxvCPZ56y6nt6DDgWe",
    volume: 36.7406667553333
  },
  %{
    asset: "7HHA2jJwdci3kGc9AVQTbDYtZVhZ49zxXRzhq6sNysSL",
    last_price: 0.00249999,
    priced_in: "WAVES",
    volume: 36.316251250089
  },
  %{
    asset: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    last_price: 9500,
    priced_in: "34N9YcEETLWn93qYQ64EsP1x89tSruJU44RrEMSXXEPJ",
    volume: 34.1848015292511
  },
  %{
    asset: "2waRx82MNVMygF1FroPZnfTPPDAZ8nNwU8PqSKJ1SgQ4",
    last_price: 2.444e-4,
    priced_in: "WAVES",
    volume: 33.0430528
  },
  %{
    asset: "2abAatDSy31k3FDcdp3YciW7N8abbqXj62Z5t8E7Mdtp",
    last_price: 5.0e-6,
    priced_in: "WAVES",
    volume: 30.28263
  },
  %{
    asset: "Bt1McXLofi7fpgJYSrJ5uKX9vbcXomsHL1gf2NsAw84L",
    last_price: 2.8,
    priced_in: "WAVES",
    volume: 28.28
  },
  %{
    asset: "GWmNS4hx2JDB268nAz3k24YwxuBxvCPZ56y6nt6DDgWe",
    last_price: 1,
    priced_in: "Bt1McXLofi7fpgJYSrJ5uKX9vbcXomsHL1gf2NsAw84L",
    volume: 26.35
  },
  %{
    asset: "DtCVENfffttjG8kBA7k8mCvE2Yo3mKjGgyr958LpSX9W",
    last_price: 8.005e-4,
    priced_in: "WAVES",
    volume: 24.1840051886
  },
  %{
    asset: "6GQkwHGyd769EghKQ6qXhAHG55JyaFjK7VGWEKSSg4Z8",
    last_price: 12.3125,
    priced_in: "WAVES",
    volume: 22.1625
  },
  %{
    asset: "HADyDcbr8kyiR4n48n8raXXeahhSMUk7wipWvrMmKbyi",
    last_price: 1.0e-8,
    priced_in: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    volume: 22.1100728119025
  },
  %{
    asset: "3f2XzwnKvnjXp45G3PBcKGze9L6AXasKae7UyiW7AJRV",
    last_price: 0.008669,
    priced_in: "WAVES",
    volume: 20.83195376
  },
  %{
    asset: "8sjzi4otKssS34aYL6Cwc9rKQ5HXw9oKp8zXJaXa2VwR",
    last_price: 1.33,
    priced_in: "WAVES",
    volume: 16.9837058754055
  },
  %{
    asset: "BS1KFNR8zrXKBEWdUUvpaP6G57Hic3aESkwK7qQKdLpB",
    last_price: 1.39e-5,
    priced_in: "WAVES",
    volume: 16.01008108
  },
  %{
    asset: "BCt4cQTfjZ1gBedWmRnTMmTd45j6kzCcRP4uWDSJ1tah",
    last_price: 1.9e-5,
    priced_in: "WAVES",
    volume: 15.695406412
  },
  %{
    asset: "FhsFXnMnZYk2nFQGfcd9rCmDaKYYxqhmDrExUTtDYAtC",
    last_price: 0.057,
    priced_in: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
    volume: 14.3192679941058
  },
  %{
    asset: "B3mFpuCTpShBkSNiKaVbKeipktYWufEMAEGvBAdNP6tu",
    last_price: 0.0069978,
    priced_in: "WAVES",
    volume: 13.8721954600225
  },
  %{
    asset: "9GXcKkZe3NCC58FD95o7F2NdjXk4HZ4mXLSG9JfnPiwh",
    last_price: 1.2e-6,
    priced_in: "WAVES",
    volume: 12.862074040616
  }
]

iex(1)>  markets |> Enum.reject(&(&1).asset != "WAVES") |> Enum.find(fn map -> map.priced_in == "Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck" end)
					
iex(2)> waves_to_usd_rate = markets[:last_price]
2.89

Starting with markets, we need the value of last_price where asset == "WAVES" and ‘priced_in == "Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck". Is there a better way to do this with than the method above?

Any reason for using reject? Why not just find what you’re looking for in a single pass?

match = Enum.find(markets, fn item -> item.asset == "WAVES" and item.priced_in == "Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck" end)
1 Like

The thinking was that this would be faster since the search would be across the smaller map created by Enum.reject.

I think (but haven’t benchmarked) that find by itself would be quicker. reject has to do a full pass through the list and build an output list whereas find exits as soon as there’s a match and doesn’t have to accumulate any output along the way.

You can double-check in the source: https://github.com/elixir-lang/elixir/blob/master/lib/elixir/lib/enum.ex - compare reject_list with find_list

2 Likes

Benchmarking showed that both approaches produced their results with similar times but your approach is the most sensible given the advantages Enum.find offers.

Thanks for all your insights! :slight_smile: