Maxximiliann
results =
[
{%{
asset: "3QvxP6YFBKpWJSMAfYtL8Niv8KmmKsnpb9uQwQpg8QN2",
price: 0.10878614,
priced_in: "WAVES",
value_in_usd_n: 0.11197357390200001
},
%{
asset: "3QvxP6YFBKpWJSMAfYtL8Niv8KmmKsnpb9uQwQpg8QN2",
price: 1.668e-5,
priced_in: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
value_in_usd_n: 0.126019068
}},
{%{
asset: "474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu",
price: 0.0257055,
priced_in: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
value_in_usd_n: 194.20762305
},
%{
asset: "474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu",
price: 191.02,
priced_in: "WAVES",
value_in_usd_n: 196.61688600000002
}},
{%{
asset: "4LHHvYGNKJUg5hj65aGD5vgScvCBmLpdRFtjokvCjSL8",
price: 0.078461,
priced_in: "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p",
value_in_usd_n: 0.078461
},
%{
asset: "4LHHvYGNKJUg5hj65aGD5vgScvCBmLpdRFtjokvCjSL8",
price: 0.07653975,
priced_in: "WAVES",
value_in_usd_n: 0.07878236467500001
}}
]
Code:
results
|> Map.new(fn {%{
asset: asset,
price: ask,
priced_in: buy_with,
value_in_usd_n: purchase_value_in_usd_n
},
%{
asset: asset,
price: bid,
priced_in: sell_into,
value_in_usd_n: sell_value_in_usd_n
}}
->
%{
asset: asset,
buy_with: buy_with,
ask: ask,
purchase_value_in_usd_n: purchase_value_in_usd_n,
sell_into: sell_into,
bid: bid,
sell_value_in_usd_n: sell_value_in_usd_n,
profit_percentage: ((sell_value_in_usd_n - purchase_value_in_usd_n) / purchase_value_in_usd_n) * 100 |>Float.round(2)
}
end)
Error:
** (ArgumentError) argument error
(stdlib 3.11.2) :maps.from_list([%{ask: 0.10878614, asset: "3QvxP6YFBKpWJSMAfYtL8Niv8KmmKsnpb9uQwQpg8QN2", bid: 1.654e-5, buy_with: "WAVES", profit_percentage: 11.6, purchase_value_in_usd_n: 0.11197357390200001, sell_into: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS", sell_value_in_usd_n: 0.12496135400000001}, %{ask: 0.0257055, asset: "474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu", bid: 191.02, buy_with: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS", profit_percentage: 1.24, purchase_value_in_usd_n: 194.20762305, sell_into: "WAVES", sell_value_in_usd_n: 196.61688600000002}, %{ask: 0.078461, asset: "4LHHvYGNKJUg5hj65aGD5vgScvCBmLpdRFtjokvCjSL8", bid: 0.07653975, buy_with: "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p", profit_percentage: 0.41, purchase_value_in_usd_n: 0.078461, sell_into: "WAVES", sell_value_in_usd_n: 0.07878236467500001}
(elixir 1.10.1) lib/map.ex:213: Map.new_transform/3
What did I miss? Thanks so much for your patient help! ![]()
Trending in Questions
One of my LiveView view’s has a very heavy javascript dependency so I want to avoid loading it for every page on the site, while still us...
New
Hi all!
I know that quite a few people use Phoenix LiveView but it is hard to get a more up-to-date list of folks/companies using it. I ...
New
Hello everyone!
I am new to coding with Elixir/Erlang. And i am looking for some utilities for fuzzing testing like AFL++.
Does anyone ...
New
I load tested a plain Phoenix chat app backed by Postgres with 100 million messages in it, everything on default settings, to see what br...
New
Hey, I know this has been discussed ad nauseum, but I couldn’t find a definitive answer or at least some consensus around this, so let me...
New
I don’t suppose you can lazy load a library depending on runtime data? For example if it’s a certain user they can lazy load ‘library A’ ...
New
Hey everyone, I have been building a lightweight Phoenix backend aimed at backing up and synchronizing user profiles across mobile device...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
On November 23, 2026, an unauthorized third party exploited a vulnerability in hex.pm (CVE-2026-129514, CVSS 10.0) that let them run comm...
New
Hi everyone :waving_hand:
I’ve been working on PhiaUI, an open-source UI component library for Phoenix LiveView, and I wanted to share i...
New
@hugobarauna, Dr. Dimitrios Koutmos (my brother) and I (Alex Koutmos) have been hard at work on writing a book on how you can use Elixir ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #code-sync
- #exunit
- #discussion
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #ai
- #authentication
- #elixirconf-us
- #umbrella
- #full-time-contract
- #blog-post
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-eu
- #distillery
- #security
- #processes
- #api
- #forms
- #hex










Showing Posts 1 to 2- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
al2o3cr
The function passed to
Map.new/2is specced to have this type:The function in your example is returning a map instead of a two-element tuple.
Based on the code in the function, I believe you want
Enum.map/2, notMap.new/2.Maxximiliann
Got it! Thanks for helping me make sense of it.