(Please note: Elixir/Ecto Experience Level: Begiiner)
iex(9)> results = HTTPoison.get!("https://api.wavesplatform.com/v0/pairs") %HTTPoison.Response{
body: "{\"__type\":\"list\",\"data\":[{\"__type\":\"pair\",\"data\":{\"firstPrice\":0.00011026,\"lastPrice\":0.00010499,\"low\":0.0001048,\"high\":0.00011383,\"weightedAveragePrice\":0.000106971036782957,\"volume\":74509.8062083899,\"quoteVolume\":7.97039122060866,\"volumeWaves\":74509.8062083899,\"txsCount\":1328},\"amountAsset\":\"WAVES\",\"priceAsset\":\"8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS\"},{\"__type\":\"pair\",\"data\":{\"firstPrice\":0.15765601,\"lastPrice\":0.22153331,\"low\":0.15500002,\"high\":0.24,\"weightedAveragePrice\":0.214157531515537,\"volume\":157842.540000001,\"quoteVolume\":33803.1687345425,\"volumeWaves\":33803.1687345425,\"txsCount\":5814},\"amountAsset\":\"3QvxP6YFBKpWJSMAfYtL8Niv8KmmKsnpb9uQwQpg8QN2\",\"priceAsset\":\"WAVES\"},{\"__type\":\"pair\",\"data\":{\"firstPrice\":207.41,\"lastPrice\":212.46478799,\"low\":198.51,\"high\":213.95513488,\"weightedAveragePrice\":206.493389969896,\"volume\":162.83528274,\"quoteVolume\":33624.4095396892,\"volumeWaves\":33624.4095396892,\"txsCount\":700},\"amountAsset\":\"474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu\",\"priceAsset\":\"WAVES\"},{\"__type\":\"pair\",\"data\":{\"firstPrice\":0.16002589,\"lastPrice\":0.170008,\"low\":0.15812475,\"high\":0.17780304,\"weightedAveragePrice\":0.168479063733717,\"volume\":105792.30179714,\"quoteVolume\":17823.7879570169,\"volumeWaves\":17823.7879570169,\"txsCount\":3499},\"amountAsset\":\"4LHHvYGNKJUg5hj65aGD5vgScvCBmLpdRFtjokvCjSL8\",\"priceAsset\":\"WAVES\"},{\"__type\":\"pair\",\"data\":{\"firstPrice\":0.02258058,\"lastPrice\":0.02237766,\"low\":0.02202483,\"high\":0.02274066,\"weightedAveragePrice\":0.0223420860092187,\"volume\":60.25300657,\"quoteVolume\":1.34617785510096,\"volumeWaves\":12584.507877888,\"txsCount\":225},\"amountAsset\":\"474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu\",\"priceAsset\":\"8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS\"},{\"__type\":\"pair\",\"data\":{\"firstPrice\":0.99,\"lastPrice\":0.95,\"low\":0.93,\"high\":1.02,\"weightedAveragePrice\":0.963090809571169,\"volume\":11834.11770453,\"quoteVolume\":11397.3300006163,\"volumeWaves\":11834.11770453,\"txsCount\":205},\"amountAsset\":\"WAVES\",\"priceAsset\":\"Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck\"},{\"__type\":\"pair\",\"data\":{\"firstPrice\":0.00518329,\"lastPrice\":0.00566829,\"low\":0.00448786,\"high\":0.00599983,\"weightedAveragePrice\":0.00534974048062616,\"volume\":1911281.97286964,\"quoteVolume\":10224.8625401517,\"volumeWaves\":10224.8625401517,\"txsCount\":452},\"amountAsset\":\"bPWkA3MNyEr1TuDchWgdpqJZhGhfPXj7dJdr3qiW2kD\",\"priceAsset\":\"WAVES\"},{\"__type\":\"pair\",\"data\":{\"firstPrice\":0.13770998,\"lastPrice\":0.13800957,\"low\":0.136002,\"high\":0.14499976,\"weightedAveragePrice\":0.138947804944918,\"volume\":63667.4200000002,\"quoteVolume\":8846.44825550623,\"volumeWaves\":8846.44825550623,\"txsCount\":2739},\"amountAsset\":\"DHgwrRvVyqJsepd32YbBqUeDH4GJ1N984X8QoekjgH8J\",\"priceAsset\":\"WAVES\"},{\"__type\":\"pair\",\"data\":{\"firstPrice\":8997.99,\"lastPrice\":9000,\"low\":8800.01,\"high\":9149.99,\"weightedAveragePrice\":9049.38845425333,\"volume\":0.73014713,\"quoteVolume\":6607.3850081282,\"volumeWaves\":6860.60436094312,\"txsCount\":119},\"amountAsset\":\"8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS\",\"priceAsset\":\"Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck\"},{\"__type\":\"pair\",\"data\":{\"firstPrice\":199,\"lastPrice\":202.49,\"low\":195.01,\"high\":203.5,\"weightedAveragePrice\":202.391495756358,\"volume\":31.41856356,\"quoteVolume\":6358.8500734246,\"volumeWaves\":6602.54465127331,\"txsCount\":70},\"amountAsset\":\"474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu\",\"priceAsset\":\"Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck\"},{\"__type\":\"pair\",\"data\":{\"firstPrice\":62.89086962,\"lastPrice\":63.77798951,\"low\":60.70727777,\"high\":64.34844549,\"weightedAveragePrice\":62.6940058251126,\"volume\":103.38509285,\"quoteVolume\":6481.62561336771,\"volumeWaves\":6481.62561336771,\"txsCount\":236},\"amountAsset\":\"HZk1mbfuJpmxU1Fs4AX5MWLVYtctsNcg6e2C6VKqK8zk\",\"priceAsset\":\"WAVES\"},{\"__type\":\"pair\",\"data\":{\"firstPrice\":1.1,\"lastPrice\":0.3,\"low\":0.3,\"high\":1.1,\"weightedAveragePrice\":0.924990638899287,\"volume\":6917.63960238,\"quoteVolume\":6398.75187548049,\"volumeWaves\":6398.75187548049,\"txsCount\":81},\"amountAsset\":\"3k6vM987VAEVKJdD1J9eaXB2qi48Q7iYTEct7g9DMmtv\",\"priceAsset\":\"WAVES\"},{\"__type\":\"pair\",\"data\":{\"firstPrice\":18,\"lastPrice\":19,\"low\":18" <> ...,
headers: [
{"Date", "Fri, 11 Oct 2019 01:04:07 GMT"},
{"Content-Type", "application/json; charset=utf-8"},
{"Transfer-Encoding", "chunked"},
{"Connection", "keep-alive"},
{"Set-Cookie",
"__cfduid=d3375054f573d5d4ae085ad4e1639c8b11570755847; expires=Sat, 10-Oct-20 01:04:07 GMT; path=/; domain=.wavesplatform.com; HttpOnly"},
{"vary", "Accept-Encoding"},
{"vary", "Origin"},
{"x-request-id", "68c30f5c-2d16-4141-8deb-bf90842acfe0"},
{"x-cache-status", "EXPIRED"},
{"Access-Control-Allow-Origin", "*"},
{"Access-Control-Allow-Credentials", "true"},
{"Access-Control-Allow-Methods", "PUT, GET, POST, OPTIONS"},
{"Access-Control-Allow-Headers",
"DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization"},
{"Strict-Transport-Security", "max-age=15724800; includeSubDomains"},
{"CF-Cache-Status", "DYNAMIC"},
{"Expect-CT",
"max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\""},
{"Server", "cloudflare"},
{"CF-RAY", "523ceb0fd96cc7d5-DEN"}
],
request: %HTTPoison.Request{
body: "",
headers: [],
method: :get,
options: [],
params: %{},
url: "https://api.wavesplatform.com/v0/pairs"
},
request_url: "https://api.wavesplatform.com/v0/pairs",
status_code: 200
}
iex(10)> json_keys_into_atoms = Poison.decode!(results.body, keys: :atoms) %{
__type: "list",
data: [
%{
__type: "pair",
amountAsset: "WAVES",
data: %{
firstPrice: 1.1026e-4,
high: 1.1383e-4,
lastPrice: 1.0499e-4,
low: 1.048e-4,
quoteVolume: 7.97039122060866,
txsCount: 1328,
volume: 74509.8062083899,
volumeWaves: 74509.8062083899,
weightedAveragePrice: 1.06971036782957e-4
},
priceAsset: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS"
},
%{
__type: "pair",
amountAsset: "3QvxP6YFBKpWJSMAfYtL8Niv8KmmKsnpb9uQwQpg8QN2",
data: %{
firstPrice: 0.15765601,
high: 0.24,
lastPrice: 0.22153331,
low: 0.15500002,
quoteVolume: 33803.1687345425,
txsCount: 5814,
volume: 157842.540000001,
volumeWaves: 33803.1687345425,
weightedAveragePrice: 0.214157531515537
},
priceAsset: "WAVES"
},
%{
__type: "pair",
amountAsset: "474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu",
data: %{
firstPrice: 207.41,
high: 213.95513488,
lastPrice: 212.46478799,
low: 198.51,
quoteVolume: 33624.4095396892,
txsCount: 700,
volume: 162.83528274,
volumeWaves: 33624.4095396892,
weightedAveragePrice: 206.493389969896
},
priceAsset: "WAVES"
},
%{
__type: "pair",
amountAsset: "4LHHvYGNKJUg5hj65aGD5vgScvCBmLpdRFtjokvCjSL8",
data: %{
firstPrice: 0.16002589,
high: 0.17780304,
lastPrice: 0.170008,
low: 0.15812475,
quoteVolume: 17823.7879570169,
txsCount: 3499,
volume: 105792.30179714,
volumeWaves: 17823.7879570169,
weightedAveragePrice: 0.168479063733717
},
priceAsset: "WAVES"
},
%{
__type: "pair",
amountAsset: "474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu",
data: %{
firstPrice: 0.02258058,
high: 0.02274066,
lastPrice: 0.02237766,
low: 0.02202483,
quoteVolume: 1.34617785510096,
txsCount: 225,
volume: 60.25300657,
volumeWaves: 12584.507877888,
weightedAveragePrice: 0.0223420860092187
},
priceAsset: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS"
},
%{
__type: "pair",
amountAsset: "WAVES",
data: %{
firstPrice: 0.99,
high: 1.02,
lastPrice: 0.95,
low: 0.93,
quoteVolume: 11397.3300006163,
txsCount: 205,
volume: 11834.11770453,
volumeWaves: 11834.11770453,
weightedAveragePrice: 0.963090809571169
},
priceAsset: "Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck"
},
%{
__type: "pair",
amountAsset: "bPWkA3MNyEr1TuDchWgdpqJZhGhfPXj7dJdr3qiW2kD",
data: %{
firstPrice: 0.00518329,
high: 0.00599983,
lastPrice: 0.00566829,
low: 0.00448786,
quoteVolume: 10224.8625401517,
txsCount: 452,
volume: 1911281.97286964,
volumeWaves: 10224.8625401517,
weightedAveragePrice: 0.00534974048062616
},
priceAsset: "WAVES"
},
%{
__type: "pair",
amountAsset: "DHgwrRvVyqJsepd32YbBqUeDH4GJ1N984X8QoekjgH8J",
data: %{
firstPrice: 0.13770998,
high: 0.14499976,
lastPrice: 0.13800957,
low: 0.136002,
quoteVolume: 8846.44825550623,
txsCount: 2739,
volume: 63667.4200000002,
volumeWaves: 8846.44825550623,
weightedAveragePrice: 0.138947804944918
},
priceAsset: "WAVES"
},
%{
__type: "pair",
amountAsset: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
data: %{
firstPrice: 8997.99,
high: 9149.99,
lastPrice: 9000,
low: 8800.01,
quoteVolume: 6607.3850081282,
txsCount: 119,
volume: 0.73014713,
volumeWaves: 6860.60436094312,
weightedAveragePrice: 9049.38845425333
},
priceAsset: "Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck"
},
%{
__type: "pair",
amountAsset: "474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu",
data: %{
firstPrice: 199,
high: 203.5,
lastPrice: 202.49,
low: 195.01,
quoteVolume: 6358.8500734246,
txsCount: 70,
volume: 31.41856356,
volumeWaves: 6602.54465127331,
weightedAveragePrice: 202.391495756358
},
priceAsset: "Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck"
},
%{
__type: "pair",
amountAsset: "HZk1mbfuJpmxU1Fs4AX5MWLVYtctsNcg6e2C6VKqK8zk",
data: %{
firstPrice: 62.89086962,
high: 64.34844549,
lastPrice: 63.77798951,
low: 60.70727777,
quoteVolume: 6481.62561336771,
txsCount: 236,
volume: 103.38509285,
volumeWaves: 6481.62561336771,
weightedAveragePrice: 62.6940058251126
},
priceAsset: "WAVES"
},
%{
__type: "pair",
amountAsset: "3k6vM987VAEVKJdD1J9eaXB2qi48Q7iYTEct7g9DMmtv",
data: %{
firstPrice: 1.1,
high: 1.1,
lastPrice: 0.3,
low: 0.3,
quoteVolume: 6398.75187548049,
txsCount: 81,
volume: 6917.63960238,
volumeWaves: 6398.75187548049,
weightedAveragePrice: 0.924990638899287
},
priceAsset: "WAVES"
},
%{
__type: "pair",
amountAsset: "GSFvcF6ycBfXwPJLLKMExRsHWnvVdZQFHtGiYu4A2kZP",
data: %{
firstPrice: 18,
high: 19,
lastPrice: 19,
low: 18,
quoteVolume: 55820,
txsCount: 2,
volume: 3100,
volumeWaves: 6140.2,
weightedAveragePrice: 18.0064516129032
},
priceAsset: "5f1txDysSx2fVDjgXMdNpuprpdgXKjoHPtebL3SrMGzE"
},
%{
__type: "pair",
amountAsset: "4LHHvYGNKJUg5hj65aGD5vgScvCBmLpdRFtjokvCjSL8",
data: %{
firstPrice: 1.717e-5,
high: 1.959e-5,
lastPrice: 1.704e-5,
low: 1.61e-5,
quoteVolume: 0.491020890123835,
txsCount: 1752,
volume: 27390.32552558,
volumeWaves: 4590.2227826408,
weightedAveragePrice: 1.79268000909762e-5
},
priceAsset: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS"
},
%{
__type: "pair",
amountAsset: "EYz8Zvs62D4d7F5ZgXHCWuzuFaZg63FYnfVQrTWQoLSK",
data: %{
firstPrice: 0.56969932,
high: 0.5775,
lastPrice: 0.57002529,
low: 0.5625,
quoteVolume: 3169.14150023681,
txsCount: 936,
volume: 5551.65379999999,
volumeWaves: 3169.14150023681,
weightedAveragePrice: 0.570846384592068
},
priceAsset: "WAVES"
},
%{
__type: "pair",
amountAsset: "B3uGHFRpSUuGEDWjqB9LWWxafQj8VTvpMucEyoxzws5H",
data: %{
firstPrice: 77,
high: 80.89777459,
lastPrice: 80.89777459,
low: 74.06121095,
quoteVolume: 2940.01879828528,
txsCount: 172,
volume: 37.78763376,
volumeWaves: 2940.01879828528,
weightedAveragePrice: 77.8037285149469
},
priceAsset: "WAVES"
},
%{
__type: "pair",
amountAsset: "DCveqdzoQG1h6ED28UsdHaegweRx9RMcPxLH2tzpTbCG",
data: %{
firstPrice: 1.0955e-4,
high: 1.0959e-4,
lastPrice: 1.0959e-4,
low: 1.0955e-4,
quoteVolume: 0.291925891753,
txsCount: 4,
volume: 2664.2567,
volumeWaves: 2729.01806444407,
weightedAveragePrice: 1.09571233039594e-4
},
priceAsset: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS"
},
%{
__type: "pair",
amountAsset: "EdDvbhk4wJ1kL6pMCq1V36GbQE2nGE7Metb87zbaY2JL",
data: %{
firstPrice: 1501,
high: 1750,
lastPrice: 1750,
low: 1499.99999999,
quoteVolume: 2527.59499990864,
txsCount: 14,
volume: 1.5535,
volumeWaves: 2527.59499990864,
weightedAveragePrice: 1627.0325071829
},
priceAsset: "WAVES"
},
%{
__type: "pair",
amountAsset: "HZk1mbfuJpmxU1Fs4AX5MWLVYtctsNcg6e2C6VKqK8zk",
data: %{
firstPrice: 0.00690594,
high: 0.00694493,
lastPrice: 0.00670825,
low: 0.00670806,
quoteVolume: 0.260717473404344,
txsCount: 110,
volume: 38.14271636,
volumeWaves: 2437.27163207119,
weightedAveragePrice: 0.0068353147936196
},
priceAsset: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS"
},
%{
__type: "pair",
amountAsset: "5WvPKSJXzVE2orvbkJ8wsQmmQKqTv9sGBPksV4adViw3",
data: %{
firstPrice: 0.00670577,
high: 0.00674134,
lastPrice: 0.00647507,
low: 0.00645989,
quoteVolume: 0.253438532180282,
txsCount: 77,
volume: 38.33075652,
volumeWaves: 2369.22572503907,
weightedAveragePrice: 0.00661188442884095
},
priceAsset: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS"
},
%{
__type: "pair",
amountAsset: "GSFvcF6ycBfXwPJLLKMExRsHWnvVdZQFHtGiYu4A2kZP",
data: %{
firstPrice: 9.5,
high: 10,
lastPrice: 10,
low: 9.5,
quoteVolume: 14850,
txsCount: 2,
volume: 1550,
volumeWaves: 1633.5,
weightedAveragePrice: 9.58064516129032
},
priceAsset: "FP2rjWYBQfqBpdLCDBaZvCtzikMozEyDbxsKyaWA76oB"
},
%{
__type: "pair",
amountAsset: "7x5Efh41w4k2Q2ikxHQtAa9uR91qnmGQMVkqcb2SPfde",
data: %{
firstPrice: 1.2e-5,
high: 1.2e-5,
lastPrice: 9.01e-6,
low: 8.0e-6,
quoteVolume: 1549.8450033626,
txsCount: 4,
volume: 144835275.993,
volumeWaves: 1549.8450033626,
weightedAveragePrice: 1.07007425693552e-5
},
priceAsset: "WAVES"
},
%{
__type: "pair",
amountAsset: "5WvPKSJXzVE2orvbkJ8wsQmmQKqTv9sGBPksV4adViw3",
data: %{
firstPrice: 61.51458401,
high: 62.01010243,
lastPrice: 61.46624121,
low: 58.8456866,
quoteVolume: 1376.2805447267,
txsCount: 98,
volume: 22.77978031,
volumeWaves: 1376.2805447267,
weightedAveragePrice: 60.416761092403
},
priceAsset: "WAVES"
}
}
iex(11)> volume_waves_greater_than_500 = Enum.filter(json_keys_into_atoms.data, fn pairs -> pairs.data.volumeWaves >= 500.0 end)
[
%{
__type: "pair",
amountAsset: "WAVES",
data: %{
firstPrice: 1.1026e-4,
high: 1.1383e-4,
lastPrice: 1.0499e-4,
low: 1.048e-4,
quoteVolume: 7.97039122060866,
txsCount: 1328,
volume: 74509.8062083899,
volumeWaves: 74509.8062083899,
weightedAveragePrice: 1.06971036782957e-4
},
priceAsset: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS"
},
%{
__type: "pair",
amountAsset: "3QvxP6YFBKpWJSMAfYtL8Niv8KmmKsnpb9uQwQpg8QN2",
data: %{
firstPrice: 0.15765601,
high: 0.24,
lastPrice: 0.22153331,
low: 0.15500002,
quoteVolume: 33803.1687345425,
txsCount: 5814,
volume: 157842.540000001,
volumeWaves: 33803.1687345425,
weightedAveragePrice: 0.214157531515537
},
priceAsset: "WAVES"
},
%{
__type: "pair",
amountAsset: "474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu",
data: %{
firstPrice: 207.41,
high: 213.95513488,
lastPrice: 212.46478799,
low: 198.51,
quoteVolume: 33624.4095396892,
txsCount: 700,
volume: 162.83528274,
volumeWaves: 33624.4095396892,
weightedAveragePrice: 206.493389969896
},
priceAsset: "WAVES"
},
%{
__type: "pair",
amountAsset: "4LHHvYGNKJUg5hj65aGD5vgScvCBmLpdRFtjokvCjSL8",
data: %{
firstPrice: 0.16002589,
high: 0.17780304,
lastPrice: 0.170008,
low: 0.15812475,
quoteVolume: 17823.7879570169,
txsCount: 3499,
volume: 105792.30179714,
volumeWaves: 17823.7879570169,
weightedAveragePrice: 0.168479063733717
},
priceAsset: "WAVES"
},
%{
__type: "pair",
amountAsset: "474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu",
data: %{
firstPrice: 0.02258058,
high: 0.02274066,
lastPrice: 0.02237766,
low: 0.02202483,
quoteVolume: 1.34617785510096,
txsCount: 225,
volume: 60.25300657,
volumeWaves: 12584.507877888,
weightedAveragePrice: 0.0223420860092187
},
priceAsset: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS"
},
%{
__type: "pair",
amountAsset: "WAVES",
data: %{
firstPrice: 0.99,
high: 1.02,
lastPrice: 0.95,
low: 0.93,
quoteVolume: 11397.3300006163,
txsCount: 205,
volume: 11834.11770453,
volumeWaves: 11834.11770453,
weightedAveragePrice: 0.963090809571169
},
priceAsset: "Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck"
},
%{
__type: "pair",
amountAsset: "bPWkA3MNyEr1TuDchWgdpqJZhGhfPXj7dJdr3qiW2kD",
data: %{
firstPrice: 0.00518329,
high: 0.00599983,
lastPrice: 0.00566829,
low: 0.00448786,
quoteVolume: 10224.8625401517,
txsCount: 452,
volume: 1911281.97286964,
volumeWaves: 10224.8625401517,
weightedAveragePrice: 0.00534974048062616
},
priceAsset: "WAVES"
},
%{
__type: "pair",
amountAsset: "DHgwrRvVyqJsepd32YbBqUeDH4GJ1N984X8QoekjgH8J",
data: %{
firstPrice: 0.13770998,
high: 0.14499976,
lastPrice: 0.13800957,
low: 0.136002,
quoteVolume: 8846.44825550623,
txsCount: 2739,
volume: 63667.4200000002,
volumeWaves: 8846.44825550623,
weightedAveragePrice: 0.138947804944918
},
priceAsset: "WAVES"
},
%{
__type: "pair",
amountAsset: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS",
data: %{
firstPrice: 8997.99,
high: 9149.99,
lastPrice: 9000,
low: 8800.01,
quoteVolume: 6607.3850081282,
txsCount: 119,
volume: 0.73014713,
volumeWaves: 6860.60436094312,
weightedAveragePrice: 9049.38845425333
},
priceAsset: "Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck"
},
%{
__type: "pair",
amountAsset: "474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu",
data: %{
firstPrice: 199,
high: 203.5,
lastPrice: 202.49,
low: 195.01,
quoteVolume: 6358.8500734246,
txsCount: 70,
volume: 31.41856356,
volumeWaves: 6602.54465127331,
weightedAveragePrice: 202.391495756358
},
priceAsset: "Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck"
},
%{
__type: "pair",
amountAsset: "HZk1mbfuJpmxU1Fs4AX5MWLVYtctsNcg6e2C6VKqK8zk",
data: %{
firstPrice: 62.89086962,
high: 64.34844549,
lastPrice: 63.77798951,
low: 60.70727777,
quoteVolume: 6481.62561336771,
txsCount: 236,
volume: 103.38509285,
volumeWaves: 6481.62561336771,
weightedAveragePrice: 62.6940058251126
},
priceAsset: "WAVES"
},
%{
__type: "pair",
amountAsset: "3k6vM987VAEVKJdD1J9eaXB2qi48Q7iYTEct7g9DMmtv",
data: %{
firstPrice: 1.1,
high: 1.1,
lastPrice: 0.3,
low: 0.3,
quoteVolume: 6398.75187548049,
txsCount: 81,
volume: 6917.63960238,
volumeWaves: 6398.75187548049,
weightedAveragePrice: 0.924990638899287
},
priceAsset: "WAVES"
},
%{
__type: "pair",
amountAsset: "GSFvcF6ycBfXwPJLLKMExRsHWnvVdZQFHtGiYu4A2kZP",
data: %{
firstPrice: 18,
high: 19,
lastPrice: 19,
low: 18,
quoteVolume: 55820,
txsCount: 2,
volume: 3100,
volumeWaves: 6140.2,
weightedAveragePrice: 18.0064516129032
},
priceAsset: "5f1txDysSx2fVDjgXMdNpuprpdgXKjoHPtebL3SrMGzE"
},
%{
__type: "pair",
amountAsset: "4LHHvYGNKJUg5hj65aGD5vgScvCBmLpdRFtjokvCjSL8",
data: %{
firstPrice: 1.717e-5,
high: 1.959e-5,
lastPrice: 1.704e-5,
low: 1.61e-5,
quoteVolume: 0.491020890123835,
txsCount: 1752,
volume: 27390.32552558,
volumeWaves: 4590.2227826408,
weightedAveragePrice: 1.79268000909762e-5
},
priceAsset: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS"
},
%{
__type: "pair",
amountAsset: "EYz8Zvs62D4d7F5ZgXHCWuzuFaZg63FYnfVQrTWQoLSK",
data: %{
firstPrice: 0.56969932,
high: 0.5775,
lastPrice: 0.57002529,
low: 0.5625,
quoteVolume: 3169.14150023681,
txsCount: 936,
volume: 5551.65379999999,
volumeWaves: 3169.14150023681,
weightedAveragePrice: 0.570846384592068
},
priceAsset: "WAVES"
},
%{
__type: "pair",
amountAsset: "B3uGHFRpSUuGEDWjqB9LWWxafQj8VTvpMucEyoxzws5H",
data: %{
firstPrice: 77,
high: 80.89777459,
lastPrice: 80.89777459,
low: 74.06121095,
quoteVolume: 2940.01879828528,
txsCount: 172,
volume: 37.78763376,
volumeWaves: 2940.01879828528,
weightedAveragePrice: 77.8037285149469
},
priceAsset: "WAVES"
},
%{
__type: "pair",
amountAsset: "DCveqdzoQG1h6ED28UsdHaegweRx9RMcPxLH2tzpTbCG",
data: %{
firstPrice: 1.0955e-4,
high: 1.0959e-4,
lastPrice: 1.0959e-4,
low: 1.0955e-4,
quoteVolume: 0.291925891753,
txsCount: 4,
volume: 2664.2567,
volumeWaves: 2729.01806444407,
weightedAveragePrice: 1.09571233039594e-4
},
priceAsset: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS"
},
%{
__type: "pair",
amountAsset: "EdDvbhk4wJ1kL6pMCq1V36GbQE2nGE7Metb87zbaY2JL",
data: %{
firstPrice: 1501,
high: 1750,
lastPrice: 1750,
low: 1499.99999999,
quoteVolume: 2527.59499990864,
txsCount: 14,
volume: 1.5535,
volumeWaves: 2527.59499990864,
weightedAveragePrice: 1627.0325071829
},
priceAsset: "WAVES"
},
%{
__type: "pair",
amountAsset: "HZk1mbfuJpmxU1Fs4AX5MWLVYtctsNcg6e2C6VKqK8zk",
data: %{
firstPrice: 0.00690594,
high: 0.00694493,
lastPrice: 0.00670825,
low: 0.00670806,
quoteVolume: 0.260717473404344,
txsCount: 110,
volume: 38.14271636,
volumeWaves: 2437.27163207119,
weightedAveragePrice: 0.0068353147936196
},
priceAsset: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS"
},
%{
__type: "pair",
amountAsset: "5WvPKSJXzVE2orvbkJ8wsQmmQKqTv9sGBPksV4adViw3",
data: %{
firstPrice: 0.00670577,
high: 0.00674134,
lastPrice: 0.00647507,
low: 0.00645989,
quoteVolume: 0.253438532180282,
txsCount: 77,
volume: 38.33075652,
volumeWaves: 2369.22572503907,
weightedAveragePrice: 0.00661188442884095
},
priceAsset: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS"
},
%{
__type: "pair",
amountAsset: "GSFvcF6ycBfXwPJLLKMExRsHWnvVdZQFHtGiYu4A2kZP",
data: %{
firstPrice: 9.5,
high: 10,
lastPrice: 10,
low: 9.5,
quoteVolume: 14850,
txsCount: 2,
volume: 1550,
volumeWaves: 1633.5,
weightedAveragePrice: 9.58064516129032
},
priceAsset: "FP2rjWYBQfqBpdLCDBaZvCtzikMozEyDbxsKyaWA76oB"
},
%{
__type: "pair",
amountAsset: "7x5Efh41w4k2Q2ikxHQtAa9uR91qnmGQMVkqcb2SPfde",
data: %{
firstPrice: 1.2e-5,
high: 1.2e-5,
lastPrice: 9.01e-6,
low: 8.0e-6,
quoteVolume: 1549.8450033626,
txsCount: 4,
volume: 144835275.993,
volumeWaves: 1549.8450033626,
weightedAveragePrice: 1.07007425693552e-5
},
priceAsset: "WAVES"
},
%{
__type: "pair",
amountAsset: "5WvPKSJXzVE2orvbkJ8wsQmmQKqTv9sGBPksV4adViw3",
data: %{
firstPrice: 61.51458401,
high: 62.01010243,
lastPrice: 61.46624121,
low: 58.8456866,
quoteVolume: 1376.2805447267,
txsCount: 98,
volume: 22.77978031,
volumeWaves: 1376.2805447267,
weightedAveragePrice: 60.416761092403
},
priceAsset: "WAVES"
},
%{
__type: "pair",
amountAsset: "B3uGHFRpSUuGEDWjqB9LWWxafQj8VTvpMucEyoxzws5H",
data: %{
firstPrice: 0.00861672,
high: 0.00864451,
lastPrice: 0.00846115,
low: 0.00834637,
quoteVolume: 0.107530102394846,
txsCount: 52,
volume: 12.76714001,
volumeWaves: 1005.22632694515,
weightedAveragePrice: 0.00842241115164568
},
priceAsset: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS"
},
%{
__type: "pair",
amountAsset: "EYz8Zvs62D4d7F5ZgXHCWuzuFaZg63FYnfVQrTWQoLSK",
data: %{
firstPrice: 6.323e-5,
high: 6.449e-5,
lastPrice: 6.016e-5,
low: 5.939e-5,
quoteVolume: 0.105659200611,
txsCount: 88,
volume: 1714.6867,
volumeWaves: 987.736529331595,
weightedAveragePrice: 6.16201202301272e-5
},
priceAsset: "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS"
},
%{
__type: "pair",
amountAsset: "dACACFaoLaRMNGocg5aas4Md9aFP8jdAbLJvF5rqqrV",
data: %{
firstPrice: 6.04467741,
high: 6.04467741,
lastPrice: 6.04467741,
low: 6.04467741,
quoteVolume: 916.999999972398,
txsCount: 1,
volume: 151.70371184,
volumeWaves: 916.999999972398,
weightedAveragePrice: 6.04467741
},
priceAsset: "WAVES"
}
]
Goal: To Repo.insert_all
to the postgres table Asset_Pairs with amountAsset, priceAsset and lastPrice for each trading pair.
Here’s what I’ve got so far in preparation for this-
def save_to_db([_, Asset, _, _, Last, _, _, _, _, _, _, Priced], Asset_Pairs) do
%{
amountAsset: Asset,
amountPrice: Priced,
lastPrice: Last
}
end
Enum.flat_map(volume_waves_greater_than_500)
won’t flatten this list of lists because it’s an arity 2 function. What arity 1 function can I use instead? If none exists, how do I go about flattening the results of volume_waves_greater_than_500
as quickly and efficiently as possible?
Finally, it’s my understanding that Repo.insert_all
will itterate over the entire flattened list and enter each trading pair as an individual record into Asset_Pairs
. Is this incorrect? If so, what is the recommended approach to achieve this?
Thank you all for your patience and wonderful guidance!