Update parsing of Alphavantage digital currency response data.

This commit is contained in:
Chris Berkhout 2024-07-11 15:30:45 +02:00
parent 0b377a8d65
commit f4aee18360
2 changed files with 39 additions and 74 deletions

View file

@ -313,10 +313,10 @@ class AlphaVantage(BaseSource):
normalized_data = { normalized_data = {
day: { day: {
"open": entries[f"1a. open ({series.quote})"], "open": entries[f"1. open"],
"high": entries[f"2a. high ({series.quote})"], "high": entries[f"2. high"],
"low": entries[f"3a. low ({series.quote})"], "low": entries[f"3. low"],
"close": entries[f"4a. close ({series.quote})"], "close": entries[f"4. close"],
} }
for day, entries in reversed( for day, entries in reversed(
data["Time Series (Digital Currency Daily)"].items() data["Time Series (Digital Currency Daily)"].items()

View file

@ -10,88 +10,53 @@
}, },
"Time Series (Digital Currency Daily)": { "Time Series (Digital Currency Daily)": {
"2021-01-09": { "2021-01-09": {
"1a. open (AUD)": "55074.06950240", "1. open": "55074.06950240",
"1b. open (USD)": "40586.96000000", "2. high": "56150.17720000",
"2a. high (AUD)": "56150.17720000", "3. low": "52540.71680000",
"2b. high (USD)": "41380.00000000", "4. close": "54397.30924680",
"3a. low (AUD)": "52540.71680000", "5. volume": "75785.97967500"
"3b. low (USD)": "38720.00000000",
"4a. close (AUD)": "54397.30924680",
"4b. close (USD)": "40088.22000000",
"5. volume": "75785.97967500",
"6. market cap (USD)": "75785.97967500"
}, },
"2021-01-08": { "2021-01-08": {
"1a. open (AUD)": "53507.50941120", "1. open": "53507.50941120",
"1b. open (USD)": "39432.48000000", "2. high": "56923.63300000",
"2a. high (AUD)": "56923.63300000", "3. low": "49528.31000000",
"2b. high (USD)": "41950.00000000", "4. close": "55068.43820140",
"3a. low (AUD)": "49528.31000000", "5. volume": "139789.95749900"
"3b. low (USD)": "36500.00000000",
"4a. close (AUD)": "55068.43820140",
"4b. close (USD)": "40582.81000000",
"5. volume": "139789.95749900",
"6. market cap (USD)": "139789.95749900"
}, },
"2021-01-07": { "2021-01-07": {
"1a. open (AUD)": "49893.81535840", "1. open": "49893.81535840",
"1b. open (USD)": "36769.36000000", "2. high": "54772.88310000",
"2a. high (AUD)": "54772.88310000", "3. low": "49256.92200000",
"2b. high (USD)": "40365.00000000", "4. close": "53507.23802320",
"3a. low (AUD)": "49256.92200000", "5. volume": "132825.70043700"
"3b. low (USD)": "36300.00000000",
"4a. close (AUD)": "53507.23802320",
"4b. close (USD)": "39432.28000000",
"5. volume": "132825.70043700",
"6. market cap (USD)": "132825.70043700"
}, },
"2021-01-06": { "2021-01-06": {
"1a. open (AUD)": "46067.47523820", "1. open": "46067.47523820",
"1b. open (USD)": "33949.53000000", "2. high": "50124.29161740",
"2a. high (AUD)": "50124.29161740", "3. low": "45169.81872000",
"2b. high (USD)": "36939.21000000", "4. close": "49893.81535840",
"3a. low (AUD)": "45169.81872000", "5. volume": "127139.20131000"
"3b. low (USD)": "33288.00000000",
"4a. close (AUD)": "49893.81535840",
"4b. close (USD)": "36769.36000000",
"5. volume": "127139.20131000",
"6. market cap (USD)": "127139.20131000"
}, },
"2021-01-05": { "2021-01-05": {
"1a. open (AUD)": "43408.17136500", "1. open": "43408.17136500",
"1b. open (USD)": "31989.75000000", "2. high": "46624.45840000",
"2a. high (AUD)": "46624.45840000", "3. low": "40572.50600000",
"2b. high (USD)": "34360.00000000", "4. close": "46067.47523820",
"3a. low (AUD)": "40572.50600000", "5. volume": "116049.99703800"
"3b. low (USD)": "29900.00000000",
"4a. close (AUD)": "46067.47523820",
"4b. close (USD)": "33949.53000000",
"5. volume": "116049.99703800",
"6. market cap (USD)": "116049.99703800"
}, },
"2021-01-04": { "2021-01-04": {
"1a. open (AUD)": "44779.08784700", "1. open": "44779.08784700",
"1b. open (USD)": "33000.05000000", "2. high": "45593.18400000",
"2a. high (AUD)": "45593.18400000", "3. low": "38170.72220000",
"2b. high (USD)": "33600.00000000", "4. close": "43406.76014740",
"3a. low (AUD)": "38170.72220000", "5. volume": "140899.88569000"
"3b. low (USD)": "28130.00000000",
"4a. close (AUD)": "43406.76014740",
"4b. close (USD)": "31988.71000000",
"5. volume": "140899.88569000",
"6. market cap (USD)": "140899.88569000"
}, },
"2021-01-03": { "2021-01-03": {
"1a. open (AUD)": "43661.51206300", "1. open": "43661.51206300",
"1b. open (USD)": "32176.45000000", "2. high": "47191.80858340",
"2a. high (AUD)": "47191.80858340", "3. low": "43371.85965060",
"2b. high (USD)": "34778.11000000", "4. close": "44779.08784700",
"3a. low (AUD)": "43371.85965060", "5. volume": "120957.56675000"
"3b. low (USD)": "31962.99000000",
"4a. close (AUD)": "44779.08784700",
"4b. close (USD)": "33000.05000000",
"5. volume": "120957.56675000",
"6. market cap (USD)": "120957.56675000"
} }
} }
} }