Update coinmarketcap error handling and tests.

This commit is contained in:
Chris Berkhout 2024-08-03 12:33:48 +02:00
parent 5fdf16edb7
commit 9dd6121d4d
8 changed files with 170 additions and 1025 deletions

View file

@ -117,21 +117,6 @@ class CoinMarketCap(BaseSource):
series.base, series.quote, self, "Bad quote ID."
)
elif code == 400 and "must be older than" in text:
if series.start <= series.end:
raise exceptions.BadResponse("The start date must be in the past.")
else:
raise exceptions.BadResponse(
"The start date must preceed or match the end date."
)
elif (
code == 400
and "must be a valid ISO 8601 timestamp or unix time" in text
and series.start < "2001-09-11"
):
raise exceptions.BadResponse("The start date can't preceed 2001-09-11.")
try:
response.raise_for_status()
except Exception as e:
@ -142,6 +127,17 @@ class CoinMarketCap(BaseSource):
except Exception as e:
raise exceptions.ResponseParsingError(str(e)) from e
if (
"status" in parsed
and "error_code" in parsed["status"]
and parsed["status"]["error_code"] == "500"
and "The system is busy" in parsed["status"]["error_message"]
):
raise exceptions.BadResponse(
"The server indicated a general error. "
"There may be problem with your request."
)
if type(parsed) is not dict or "data" not in parsed:
raise exceptions.ResponseParsingError("Unexpected content.")

View file

@ -36,9 +36,10 @@ def requests_mock():
yield mock
crypto_url = "https://web-api.coinmarketcap.com/v1/cryptocurrency/map?sort=cmc_rank"
fiat_url = "https://web-api.coinmarketcap.com/v1/fiat/map?include_metals=true"
fetch_url = "https://web-api.coinmarketcap.com/v1/cryptocurrency/ohlcv/historical"
crypto_url = (
"https://api.coinmarketcap.com/data-api/v1/cryptocurrency/map?sort=cmc_rank"
)
fetch_url = "https://api.coinmarketcap.com/data-api/v3.1/cryptocurrency/historical"
@pytest.fixture
@ -48,13 +49,6 @@ def crypto_ok(requests_mock):
yield requests_mock
@pytest.fixture
def fiat_ok(requests_mock):
json = (Path(os.path.splitext(__file__)[0]) / "fiat-partial.json").read_text()
requests_mock.add(responses.GET, fiat_url, body=json, status=200)
yield requests_mock
@pytest.fixture
def recent_id_id_ok(requests_mock):
json = (Path(os.path.splitext(__file__)[0]) / "recent-id1-id2782.json").read_text()
@ -62,36 +56,6 @@ def recent_id_id_ok(requests_mock):
yield requests_mock
@pytest.fixture
def recent_id_sym_ok(requests_mock):
json = (Path(os.path.splitext(__file__)[0]) / "recent-id1-aud.json").read_text()
requests_mock.add(responses.GET, fetch_url, body=json, status=200)
yield requests_mock
@pytest.fixture
def recent_sym_id_ok(requests_mock):
json = (Path(os.path.splitext(__file__)[0]) / "recent-btc-id2782.json").read_text()
requests_mock.add(responses.GET, fetch_url, body=json, status=200)
yield requests_mock
@pytest.fixture
def recent_sym_sym_ok(requests_mock):
json = (Path(os.path.splitext(__file__)[0]) / "recent-btc-aud.json").read_text()
requests_mock.add(responses.GET, fetch_url, body=json, status=200)
yield requests_mock
@pytest.fixture
def long_sym_sym_ok(requests_mock):
json = (
Path(os.path.splitext(__file__)[0]) / "long-btc-aud-partial.json"
).read_text()
requests_mock.add(responses.GET, fetch_url, body=json, status=200)
yield requests_mock
def test_normalizesymbol(src):
assert src.normalizesymbol("btc") == "BTC"
assert src.normalizesymbol("id=1") == "ID=1"
@ -120,63 +84,31 @@ def test_metadata(src):
assert isinstance(src.notes(), str)
def test_symbols(src, crypto_ok, fiat_ok):
def test_symbols(src, crypto_ok):
syms = src.symbols()
assert ("id=1", "BTC Bitcoin") in syms
assert ("id=2782", "AUD Australian Dollar") in syms
assert len(syms) > 2
def test_symbols_requests_logged(src, crypto_ok, fiat_ok, caplog):
def test_symbols_request_logged(src, crypto_ok, caplog):
with caplog.at_level(logging.DEBUG):
src.symbols()
logged_requests = 0
for r in caplog.records:
if r.levelname == "DEBUG" and "curl " in r.message:
logged_requests += 1
assert logged_requests == 2
assert logged_requests == 1
def test_symbols_fiat_not_found(src, requests_mock):
requests_mock.add(responses.GET, fiat_url, body="{}", status=200)
with pytest.raises(exceptions.ResponseParsingError) as e:
src.symbols()
assert "Unexpected content" in str(e.value)
def test_symbols_fiat_network_issue(src, requests_mock):
requests_mock.add(
responses.GET,
fiat_url,
body=requests.exceptions.ConnectionError("Network issue"),
)
with pytest.raises(exceptions.RequestError) as e:
src.symbols()
assert "Network issue" in str(e.value)
def test_symbols_fiat_bad_status(src, requests_mock):
requests_mock.add(responses.GET, fiat_url, status=500)
with pytest.raises(exceptions.BadResponse) as e:
src.symbols()
assert "Server Error" in str(e.value)
def test_symbols_fiat_parsing_error(src, requests_mock):
requests_mock.add(responses.GET, fiat_url, body="NOT JSON")
with pytest.raises(exceptions.ResponseParsingError) as e:
src.symbols()
assert "while parsing data" in str(e.value)
def test_symbols_crypto_not_found(src, requests_mock, fiat_ok):
def test_symbols_crypto_not_found(src, requests_mock):
requests_mock.add(responses.GET, crypto_url, body="{}", status=200)
with pytest.raises(exceptions.ResponseParsingError) as e:
src.symbols()
assert "Unexpected content" in str(e.value)
def test_symbols_crypto_network_issue(src, requests_mock, fiat_ok):
def test_symbols_crypto_network_issue(src, requests_mock):
requests_mock.add(
responses.GET,
crypto_url,
@ -187,14 +119,14 @@ def test_symbols_crypto_network_issue(src, requests_mock, fiat_ok):
assert "Network issue" in str(e.value)
def test_symbols_crypto_bad_status(src, requests_mock, fiat_ok):
def test_symbols_crypto_bad_status(src, requests_mock):
requests_mock.add(responses.GET, crypto_url, status=500)
with pytest.raises(exceptions.BadResponse) as e:
src.symbols()
assert "Server Error" in str(e.value)
def test_symbols_crypto_parsing_error(src, requests_mock, fiat_ok):
def test_symbols_crypto_parsing_error(src, requests_mock):
requests_mock.add(responses.GET, crypto_url, body="NOT JSON")
with pytest.raises(exceptions.ResponseParsingError) as e:
src.symbols()
@ -202,59 +134,59 @@ def test_symbols_crypto_parsing_error(src, requests_mock, fiat_ok):
def test_symbols_no_data(src, type, requests_mock):
requests_mock.add(responses.GET, fiat_url, body='{"data": []}')
requests_mock.add(responses.GET, crypto_url, body='{"data": []}')
with pytest.raises(exceptions.ResponseParsingError) as e:
src.symbols()
assert "Empty data section" in str(e.value)
def test_fetch_known_pair_id_id(src, type, recent_id_id_ok, crypto_ok, fiat_ok):
def test_fetch_known_pair_id_id(src, type, recent_id_id_ok, crypto_ok):
series = src.fetch(Series("ID=1", "ID=2782", type, "2021-01-01", "2021-01-07"))
req = recent_id_id_ok.calls[0].request
assert req.params["id"] == "1"
assert req.params["convert_id"] == "2782"
assert req.params["convertId"] == "2782"
assert (series.base, series.quote) == ("BTC", "AUD")
assert len(series.prices) == 7
def test_fetch_known_pair_id_sym(src, type, recent_id_sym_ok):
def test_fetch_known_pair_id_sym(src, type, recent_id_id_ok, crypto_ok):
series = src.fetch(Series("ID=1", "AUD", type, "2021-01-01", "2021-01-07"))
req = recent_id_sym_ok.calls[0].request
req = recent_id_id_ok.calls[1].request
assert req.params["id"] == "1"
assert req.params["convert"] == "AUD"
assert req.params["convertId"] == "2782"
assert (series.base, series.quote) == ("BTC", "AUD")
assert len(series.prices) == 7
def test_fetch_known_pair_sym_id(src, type, recent_sym_id_ok, crypto_ok, fiat_ok):
def test_fetch_known_pair_sym_id(src, type, recent_id_id_ok, crypto_ok):
series = src.fetch(Series("BTC", "ID=2782", type, "2021-01-01", "2021-01-07"))
req = recent_sym_id_ok.calls[0].request
assert req.params["symbol"] == "BTC"
assert req.params["convert_id"] == "2782"
req = recent_id_id_ok.calls[1].request
assert req.params["id"] == "1"
assert req.params["convertId"] == "2782"
assert (series.base, series.quote) == ("BTC", "AUD")
assert len(series.prices) == 7
def test_fetch_known_pair_sym_sym(src, type, recent_sym_sym_ok):
def test_fetch_known_pair_sym_sym(src, type, recent_id_id_ok, crypto_ok):
series = src.fetch(Series("BTC", "AUD", type, "2021-01-01", "2021-01-07"))
req = recent_sym_sym_ok.calls[0].request
assert req.params["symbol"] == "BTC"
assert req.params["convert"] == "AUD"
req = recent_id_id_ok.calls[1].request
assert req.params["id"] == "1"
assert req.params["convertId"] == "2782"
assert len(series.prices) == 7
def test_fetch_requests_and_receives_correct_times(
src, type, recent_id_id_ok, crypto_ok, fiat_ok
src, type, recent_id_id_ok, crypto_ok
):
series = src.fetch(Series("ID=1", "ID=2782", type, "2021-01-01", "2021-01-07"))
req = recent_id_id_ok.calls[0].request
assert req.params["time_start"] == str(timestamp("2020-12-31")) # back one period
assert req.params["time_end"] == str(timestamp("2021-01-07"))
assert series.prices[0] == Price("2021-01-01", Decimal("37914.350602379853"))
assert series.prices[-1] == Price("2021-01-07", Decimal("49370.064689585612"))
assert req.params["timeStart"] == str(timestamp("2020-12-31")) # back one period
assert req.params["timeEnd"] == str(timestamp("2021-01-07"))
assert series.prices[0] == Price("2021-01-01", Decimal("37914.35060237985"))
assert series.prices[-1] == Price("2021-01-07", Decimal("49369.66288590665"))
def test_fetch_requests_logged(src, type, recent_sym_sym_ok, caplog):
def test_fetch_requests_logged(src, type, crypto_ok, recent_id_id_ok, caplog):
with caplog.at_level(logging.DEBUG):
src.fetch(Series("BTC", "AUD", type, "2021-01-01", "2021-01-07"))
assert any(
@ -262,20 +194,20 @@ def test_fetch_requests_logged(src, type, recent_sym_sym_ok, caplog):
)
def test_fetch_types_all_available(src, recent_sym_sym_ok):
def test_fetch_types_all_available(src, crypto_ok, recent_id_id_ok):
mid = src.fetch(Series("BTC", "AUD", "mid", "2021-01-01", "2021-01-07"))
opn = src.fetch(Series("BTC", "AUD", "open", "2021-01-01", "2021-01-07"))
hgh = src.fetch(Series("BTC", "AUD", "high", "2021-01-01", "2021-01-07"))
low = src.fetch(Series("BTC", "AUD", "low", "2021-01-01", "2021-01-07"))
cls = src.fetch(Series("BTC", "AUD", "close", "2021-01-01", "2021-01-07"))
assert mid.prices[0].amount == Decimal("37914.350602379853")
assert opn.prices[0].amount == Decimal("37658.83948707033")
assert mid.prices[0].amount == Decimal("37914.35060237985")
assert opn.prices[0].amount == Decimal("37658.1146368474")
assert hgh.prices[0].amount == Decimal("38417.9137031205")
assert low.prices[0].amount == Decimal("37410.787501639206")
assert cls.prices[0].amount == Decimal("38181.99133300758")
assert low.prices[0].amount == Decimal("37410.7875016392")
assert cls.prices[0].amount == Decimal("38181.9913330076")
def test_fetch_type_mid_is_mean_of_low_and_high(src, recent_sym_sym_ok):
def test_fetch_type_mid_is_mean_of_low_and_high(src, crypto_ok, recent_id_id_ok):
mid = src.fetch(Series("BTC", "AUD", "mid", "2021-01-01", "2021-01-07")).prices
low = src.fetch(Series("BTC", "AUD", "low", "2021-01-01", "2021-01-07")).prices
hgh = src.fetch(Series("BTC", "AUD", "high", "2021-01-01", "2021-01-07")).prices
@ -287,80 +219,24 @@ def test_fetch_type_mid_is_mean_of_low_and_high(src, recent_sym_sym_ok):
)
def test_fetch_long_hist_from_start(src, type, long_sym_sym_ok):
series = src.fetch(Series("BTC", "AUD", type, src.start(), "2021-01-07"))
assert series.prices[0] == Price("2013-04-28", Decimal("130.45956234123247"))
assert series.prices[-1] == Price("2021-01-07", Decimal("49370.064689585612"))
assert len(series.prices) > 13
def test_fetch_from_before_start(src, type, requests_mock):
requests_mock.add(
responses.GET,
fetch_url,
status=400,
body="""{ "status": { "error_code": 400, "error_message":
"\\"time_start\\" must be a valid ISO 8601 timestamp or unix time value",
} }""",
)
with pytest.raises(exceptions.BadResponse) as e:
src.fetch(Series("BTC", "AUD", type, "2001-09-10", "2001-10-01"))
assert "start date can't preceed" in str(e.value)
def test_fetch_to_future(src, type, recent_sym_sym_ok):
series = src.fetch(Series("BTC", "AUD", type, "2021-01-01", "2100-01-01"))
assert len(series.prices) > 0
def test_fetch_in_future(src, type, requests_mock):
requests_mock.add(
responses.GET,
fetch_url,
status=400,
body="""{
"status": {
"error_code": 400,
"error_message": "\\"time_start\\" must be older than \\"time_end\\"."
}
}""",
)
with pytest.raises(exceptions.BadResponse) as e:
src.fetch(Series("BTC", "AUD", type, "2030-01-01", "2030-01-07"))
assert "start date must be in the past" in str(e.value)
def test_fetch_reversed_dates(src, type, requests_mock):
requests_mock.add(
responses.GET,
fetch_url,
status=400,
body="""{
"status": {
"error_code": 400,
"error_message": "\\"time_start\\" must be older than \\"time_end\\"."
}
}""",
)
with pytest.raises(exceptions.BadResponse) as e:
src.fetch(Series("BTC", "AUD", type, "2021-01-07", "2021-01-01"))
assert "start date must preceed or match the end" in str(e.value)
def test_fetch_empty(src, type, requests_mock):
def test_fetch_empty(src, type, crypto_ok, requests_mock):
requests_mock.add(
responses.GET,
fetch_url,
body="""{
"status": {
"error_code": 0,
"error_message": null
},
"data": {
"id": 1,
"name": "Bitcoin",
"symbol": "BTC",
"timeEnd": "1228348799",
"quotes": []
},
"status": {
"timestamp": "2024-08-03T09:31:52.719Z",
"error_code": "0",
"error_message": "SUCCESS",
"elapsed": "14",
"credit_count": 0
}
}""",
)
@ -368,63 +244,36 @@ def test_fetch_empty(src, type, requests_mock):
assert len(series.prices) == 0
def test_fetch_bad_base_sym(src, type, requests_mock):
requests_mock.add(responses.GET, fetch_url, body='{"data":{}}')
with pytest.raises(exceptions.ResponseParsingError) as e:
def test_fetch_bad_base_sym(src, type, crypto_ok):
with pytest.raises(exceptions.InvalidPair) as e:
src.fetch(Series("NOTABASE", "USD", type, "2021-01-01", "2021-01-07"))
assert "quote currency symbol can't be found" in str(e.value)
assert "other reasons" in str(e.value)
assert "Invalid symbol 'NOTABASE'" in str(e.value)
def test_fetch_bad_quote_sym(src, type, requests_mock):
requests_mock.add(
responses.GET,
fetch_url,
status=400,
body="""{
"status": {
"error_code": 400,
"error_message": "Invalid value for \\"convert\\": \\"NOTAQUOTE\\""
}
}""",
)
def test_fetch_bad_quote_sym(src, type, crypto_ok):
with pytest.raises(exceptions.InvalidPair) as e:
src.fetch(Series("BTC", "NOTAQUOTE", type, "2021-01-01", "2021-01-07"))
assert "Bad quote symbol" in str(e.value)
assert "Invalid symbol 'NOTAQUOTE'" in str(e.value)
def test_fetch_bad_base_id(src, type, requests_mock):
def test_fetch_bad_response(src, type, crypto_ok, requests_mock):
requests_mock.add(
responses.GET,
fetch_url,
status=400,
status=200,
body="""{
"status": {
"error_code": 400,
"error_message": "No items found."
"timestamp": "2024-08-03T09:42:43.699Z",
"error_code": "500",
"error_message": "The system is busy, please try again later!",
"elapsed": "0",
"credit_count": 0
}
}""",
)
with pytest.raises(exceptions.InvalidPair) as e:
src.fetch(Series("ID=20000", "USD", type, "2021-01-01", "2021-01-07"))
assert "Bad base ID" in str(e.value)
def test_fetch_bad_quote_id(src, type, requests_mock):
requests_mock.add(
responses.GET,
fetch_url,
status=400,
body="""{
"status": {
"error_code": 400,
"error_message": "Invalid value for \\"convert_id\\": \\"20000\\""
}
}""",
)
with pytest.raises(exceptions.InvalidPair) as e:
src.fetch(Series("BTC", "ID=20000", type, "2021-01-01", "2021-01-07"))
assert "Bad quote ID" in str(e.value)
with pytest.raises(exceptions.BadResponse) as e:
src.fetch(Series("ID=987654321", "USD", type, "2021-01-01", "2021-01-07"))
assert "general error" in str(e.value)
def test_fetch_no_quote(src, type):
@ -432,7 +281,7 @@ def test_fetch_no_quote(src, type):
src.fetch(Series("BTC", "", type, "2021-01-01", "2021-01-07"))
def test_fetch_network_issue(src, type, requests_mock):
def test_fetch_network_issue(src, type, crypto_ok, requests_mock):
body = requests.exceptions.ConnectionError("Network issue")
requests_mock.add(responses.GET, fetch_url, body=body)
with pytest.raises(exceptions.RequestError) as e:
@ -440,21 +289,21 @@ def test_fetch_network_issue(src, type, requests_mock):
assert "Network issue" in str(e.value)
def test_fetch_bad_status(src, type, requests_mock):
def test_fetch_bad_status(src, type, crypto_ok, requests_mock):
requests_mock.add(responses.GET, fetch_url, status=500, body="Some other reason")
with pytest.raises(exceptions.BadResponse) as e:
src.fetch(Series("BTC", "AUD", type, "2021-01-01", "2021-01-07"))
assert "Internal Server Error" in str(e.value)
def test_fetch_parsing_error(src, type, requests_mock):
def test_fetch_parsing_error(src, type, crypto_ok, requests_mock):
requests_mock.add(responses.GET, fetch_url, body="NOT JSON")
with pytest.raises(exceptions.ResponseParsingError) as e:
src.fetch(Series("BTC", "AUD", type, "2021-01-01", "2021-01-07"))
assert "while parsing data" in str(e.value)
def test_fetch_unexpected_json(src, type, requests_mock):
def test_fetch_unexpected_json(src, type, crypto_ok, requests_mock):
requests_mock.add(responses.GET, fetch_url, body='{"notdata": []}')
with pytest.raises(exceptions.ResponseParsingError) as e:
src.fetch(Series("BTC", "AUD", type, "2021-01-01", "2021-01-07"))

View file

@ -1,30 +0,0 @@
{
"status": {
"timestamp": "2021-07-16T10:08:13.272Z",
"error_code": 0,
"error_message": null,
"elapsed": 1,
"credit_count": 0,
"notice": null
},
"data": [
{
"id": 2781,
"name": "United States Dollar",
"sign": "$",
"symbol": "USD"
},
{
"id": 2782,
"name": "Australian Dollar",
"sign": "$",
"symbol": "AUD"
},
{
"id": 3575,
"name": "Gold Troy Ounce",
"symbol": "",
"code": "XAU"
}
]
}

View file

@ -1,255 +0,0 @@
{
"status": {
"timestamp": "2021-07-17T16:16:11.926Z",
"error_code": 0,
"error_message": null,
"elapsed": 2262,
"credit_count": 0,
"notice": null
},
"data": {
"id": 1,
"name": "Bitcoin",
"symbol": "BTC",
"quotes": [
{
"time_open": "2013-04-28T00:00:00.000Z",
"time_close": "2013-04-28T23:59:59.999Z",
"time_high": "2013-04-28T18:50:02.000Z",
"time_low": "2013-04-28T20:15:02.000Z",
"quote": {
"AUD": {
"open": null,
"high": 132.39216797540558,
"low": 128.52695670705936,
"close": 130.52908647526473,
"volume": 0,
"market_cap": 1447740447.626921,
"timestamp": "2013-04-28T23:59:00.000Z"
}
}
},
{
"time_open": "2013-04-29T00:00:00.000Z",
"time_close": "2013-04-29T23:59:59.999Z",
"time_high": "2013-04-29T13:15:01.000Z",
"time_low": "2013-04-29T05:20:01.000Z",
"quote": {
"AUD": {
"open": 130.75666236543535,
"high": 142.67970067891736,
"low": 129.9456943366951,
"close": 139.77370978254794,
"volume": 0,
"market_cap": 1550883729.329852,
"timestamp": "2013-04-29T23:59:00.000Z"
}
}
},
{
"time_open": "2013-04-30T00:00:00.000Z",
"time_close": "2013-04-30T23:59:59.999Z",
"time_high": "2013-04-30T08:25:02.000Z",
"time_low": "2013-04-30T18:55:01.000Z",
"quote": {
"AUD": {
"open": 139.2515230635335,
"high": 141.93391873626476,
"low": 129.37940647790543,
"close": 134.06635802469137,
"volume": 0,
"market_cap": 1488052782.6003087,
"timestamp": "2013-04-30T23:59:00.000Z"
}
}
},
{
"time_open": "2013-05-01T00:00:00.000Z",
"time_close": "2013-05-01T23:59:59.999Z",
"time_high": "2013-05-01T00:15:01.000Z",
"time_low": "2013-05-01T19:55:01.000Z",
"quote": {
"AUD": {
"open": 134.06635802469137,
"high": 134.88573849160971,
"low": 104.93911468163968,
"close": 113.79243056489595,
"volume": 0,
"market_cap": 1263451603.6864119,
"timestamp": "2013-05-01T23:59:00.000Z"
}
}
},
{
"time_open": "2013-05-02T00:00:00.000Z",
"time_close": "2013-05-02T23:59:59.999Z",
"time_high": "2013-05-02T14:25:01.000Z",
"time_low": "2013-05-02T14:30:02.000Z",
"quote": {
"AUD": {
"open": 113.19910247390133,
"high": 122.60835462135991,
"low": 90.08385249759387,
"close": 102.63388848353591,
"volume": 0,
"market_cap": 1139905858.2089553,
"timestamp": "2013-05-02T23:59:00.000Z"
}
}
},
{
"time_open": "2013-05-03T00:00:00.000Z",
"time_close": "2013-05-03T23:59:59.999Z",
"time_high": "2013-05-03T05:30:02.000Z",
"time_low": "2013-05-03T03:05:01.000Z",
"quote": {
"AUD": {
"open": 103.64842454394694,
"high": 105.43929629649027,
"low": 77.03544845551335,
"close": 94.77409346519293,
"volume": 0,
"market_cap": 1052933070.3412836,
"timestamp": "2013-05-03T23:59:00.000Z"
}
}
},
{
"time_open": "2013-05-04T00:00:00.000Z",
"time_close": "2013-05-04T23:59:59.999Z",
"time_high": "2013-05-04T07:15:01.000Z",
"time_low": "2013-05-04T06:50:01.000Z",
"quote": {
"AUD": {
"open": 95.11343656595025,
"high": 111.49893348846227,
"low": 89.68392476245879,
"close": 109.07504363001745,
"volume": 0,
"market_cap": 1212251854.2757416,
"timestamp": "2013-05-04T23:59:00.000Z"
}
}
},
{
"time_open": "2021-01-01T00:00:00.000Z",
"time_close": "2021-01-01T23:59:59.999Z",
"time_high": "2021-01-01T12:38:43.000Z",
"time_low": "2021-01-01T00:16:43.000Z",
"quote": {
"AUD": {
"open": 37658.83948707033,
"high": 38417.9137031205,
"low": 37410.787501639206,
"close": 38181.99133300758,
"volume": 52943282221.028366,
"market_cap": 709720173049.5383,
"timestamp": "2021-01-01T23:59:06.000Z"
}
}
},
{
"time_open": "2021-01-02T00:00:00.000Z",
"time_close": "2021-01-02T23:59:59.999Z",
"time_high": "2021-01-02T19:49:42.000Z",
"time_low": "2021-01-02T00:31:44.000Z",
"quote": {
"AUD": {
"open": 38184.98611600682,
"high": 43096.681197423015,
"low": 37814.17187096531,
"close": 41760.62923079505,
"volume": 88214867181.97835,
"market_cap": 776278147177.8037,
"timestamp": "2021-01-02T23:59:06.000Z"
}
}
},
{
"time_open": "2021-01-03T00:00:00.000Z",
"time_close": "2021-01-03T23:59:59.999Z",
"time_high": "2021-01-03T07:47:38.000Z",
"time_low": "2021-01-03T00:20:45.000Z",
"quote": {
"AUD": {
"open": 41763.41015117659,
"high": 44985.93247585023,
"low": 41663.204350601605,
"close": 42511.10646879765,
"volume": 102011582370.28117,
"market_cap": 790270288834.0249,
"timestamp": "2021-01-03T23:59:06.000Z"
}
}
},
{
"time_open": "2021-01-04T00:00:00.000Z",
"time_close": "2021-01-04T23:59:59.999Z",
"time_high": "2021-01-04T04:07:42.000Z",
"time_low": "2021-01-04T10:19:42.000Z",
"quote": {
"AUD": {
"open": 42548.61349648768,
"high": 43360.96165147421,
"low": 37133.98436952697,
"close": 41686.38761359174,
"volume": 105824510346.65779,
"market_cap": 774984045201.7122,
"timestamp": "2021-01-04T23:59:06.000Z"
}
}
},
{
"time_open": "2021-01-05T00:00:00.000Z",
"time_close": "2021-01-05T23:59:59.999Z",
"time_high": "2021-01-05T22:44:35.000Z",
"time_low": "2021-01-05T06:16:41.000Z",
"quote": {
"AUD": {
"open": 41693.07321807638,
"high": 44403.79487147647,
"low": 39221.81167941294,
"close": 43790.067253370056,
"volume": 87016490203.50436,
"market_cap": 814135603090.2502,
"timestamp": "2021-01-05T23:59:06.000Z"
}
}
},
{
"time_open": "2021-01-06T00:00:00.000Z",
"time_close": "2021-01-06T23:59:59.999Z",
"time_high": "2021-01-06T23:57:36.000Z",
"time_low": "2021-01-06T00:25:38.000Z",
"quote": {
"AUD": {
"open": 43817.35864984641,
"high": 47186.65232598287,
"low": 43152.60281764236,
"close": 47115.85365360005,
"volume": 96330948324.8061,
"market_cap": 876019742889.9551,
"timestamp": "2021-01-06T23:59:06.000Z"
}
}
},
{
"time_open": "2021-01-07T00:00:00.000Z",
"time_close": "2021-01-07T23:59:59.999Z",
"time_high": "2021-01-07T18:17:42.000Z",
"time_low": "2021-01-07T08:25:51.000Z",
"quote": {
"AUD": {
"open": 47128.02139328098,
"high": 51833.478207775144,
"low": 46906.65117139608,
"close": 50686.90986207153,
"volume": 109124136558.20264,
"market_cap": 942469208700.134,
"timestamp": "2021-01-07T23:59:06.000Z"
}
}
}
]
}
}

View file

@ -1,136 +0,0 @@
{
"status": {
"timestamp": "2021-07-16T10:42:32.013Z",
"error_code": 0,
"error_message": null,
"elapsed": 20,
"credit_count": 0,
"notice": null
},
"data": {
"id": 1,
"name": "Bitcoin",
"symbol": "BTC",
"quotes": [
{
"time_open": "2021-01-01T00:00:00.000Z",
"time_close": "2021-01-01T23:59:59.999Z",
"time_high": "2021-01-01T12:38:43.000Z",
"time_low": "2021-01-01T00:16:43.000Z",
"quote": {
"AUD": {
"open": 37658.83948707033,
"high": 38417.9137031205,
"low": 37410.787501639206,
"close": 38181.99133300758,
"volume": 52943282221.028366,
"market_cap": 709720173049.5383,
"timestamp": "2021-01-01T23:59:06.000Z"
}
}
},
{
"time_open": "2021-01-02T00:00:00.000Z",
"time_close": "2021-01-02T23:59:59.999Z",
"time_high": "2021-01-02T19:49:42.000Z",
"time_low": "2021-01-02T00:31:44.000Z",
"quote": {
"AUD": {
"open": 38184.98611600682,
"high": 43096.681197423015,
"low": 37814.17187096531,
"close": 41760.62923079505,
"volume": 88214867181.97835,
"market_cap": 776278147177.8037,
"timestamp": "2021-01-02T23:59:06.000Z"
}
}
},
{
"time_open": "2021-01-03T00:00:00.000Z",
"time_close": "2021-01-03T23:59:59.999Z",
"time_high": "2021-01-03T07:47:38.000Z",
"time_low": "2021-01-03T00:20:45.000Z",
"quote": {
"AUD": {
"open": 41763.41015117659,
"high": 44985.93247585023,
"low": 41663.204350601605,
"close": 42511.10646879765,
"volume": 102011582370.28117,
"market_cap": 790270288834.0249,
"timestamp": "2021-01-03T23:59:06.000Z"
}
}
},
{
"time_open": "2021-01-04T00:00:00.000Z",
"time_close": "2021-01-04T23:59:59.999Z",
"time_high": "2021-01-04T04:07:42.000Z",
"time_low": "2021-01-04T10:19:42.000Z",
"quote": {
"AUD": {
"open": 42548.61349648768,
"high": 43360.96165147421,
"low": 37133.98436952697,
"close": 41686.38761359174,
"volume": 105824510346.65779,
"market_cap": 774984045201.7122,
"timestamp": "2021-01-04T23:59:06.000Z"
}
}
},
{
"time_open": "2021-01-05T00:00:00.000Z",
"time_close": "2021-01-05T23:59:59.999Z",
"time_high": "2021-01-05T22:44:35.000Z",
"time_low": "2021-01-05T06:16:41.000Z",
"quote": {
"AUD": {
"open": 41693.07321807638,
"high": 44403.79487147647,
"low": 39221.81167941294,
"close": 43790.067253370056,
"volume": 87016490203.50436,
"market_cap": 814135603090.2502,
"timestamp": "2021-01-05T23:59:06.000Z"
}
}
},
{
"time_open": "2021-01-06T00:00:00.000Z",
"time_close": "2021-01-06T23:59:59.999Z",
"time_high": "2021-01-06T23:57:36.000Z",
"time_low": "2021-01-06T00:25:38.000Z",
"quote": {
"AUD": {
"open": 43817.35864984641,
"high": 47186.65232598287,
"low": 43152.60281764236,
"close": 47115.85365360005,
"volume": 96330948324.8061,
"market_cap": 876019742889.9551,
"timestamp": "2021-01-06T23:59:06.000Z"
}
}
},
{
"time_open": "2021-01-07T00:00:00.000Z",
"time_close": "2021-01-07T23:59:59.999Z",
"time_high": "2021-01-07T18:17:42.000Z",
"time_low": "2021-01-07T08:25:51.000Z",
"quote": {
"AUD": {
"open": 47128.02139328098,
"high": 51833.478207775144,
"low": 46906.65117139608,
"close": 50686.90986207153,
"volume": 109124136558.20264,
"market_cap": 942469208700.134,
"timestamp": "2021-01-07T23:59:06.000Z"
}
}
}
]
}
}

View file

@ -1,136 +0,0 @@
{
"status": {
"timestamp": "2021-07-16T10:42:27.169Z",
"error_code": 0,
"error_message": null,
"elapsed": 19,
"credit_count": 0,
"notice": null
},
"data": {
"id": 1,
"name": "Bitcoin",
"symbol": "BTC",
"quotes": [
{
"time_open": "2021-01-01T00:00:00.000Z",
"time_close": "2021-01-01T23:59:59.999Z",
"time_high": "2021-01-01T12:38:43.000Z",
"time_low": "2021-01-01T00:16:43.000Z",
"quote": {
"2782": {
"open": 37658.83948707033,
"high": 38417.9137031205,
"low": 37410.787501639206,
"close": 38181.99133300758,
"volume": 52943282221.028366,
"market_cap": 709720173049.5383,
"timestamp": "2021-01-01T23:59:06.000Z"
}
}
},
{
"time_open": "2021-01-02T00:00:00.000Z",
"time_close": "2021-01-02T23:59:59.999Z",
"time_high": "2021-01-02T19:49:42.000Z",
"time_low": "2021-01-02T00:31:44.000Z",
"quote": {
"2782": {
"open": 38184.98611600682,
"high": 43096.681197423015,
"low": 37814.17187096531,
"close": 41760.62923079505,
"volume": 88214867181.97835,
"market_cap": 776278147177.8037,
"timestamp": "2021-01-02T23:59:06.000Z"
}
}
},
{
"time_open": "2021-01-03T00:00:00.000Z",
"time_close": "2021-01-03T23:59:59.999Z",
"time_high": "2021-01-03T07:47:38.000Z",
"time_low": "2021-01-03T00:20:45.000Z",
"quote": {
"2782": {
"open": 41763.41015117659,
"high": 44985.93247585023,
"low": 41663.204350601605,
"close": 42511.10646879765,
"volume": 102011582370.28117,
"market_cap": 790270288834.0249,
"timestamp": "2021-01-03T23:59:06.000Z"
}
}
},
{
"time_open": "2021-01-04T00:00:00.000Z",
"time_close": "2021-01-04T23:59:59.999Z",
"time_high": "2021-01-04T04:07:42.000Z",
"time_low": "2021-01-04T10:19:42.000Z",
"quote": {
"2782": {
"open": 42548.61349648768,
"high": 43360.96165147421,
"low": 37133.98436952697,
"close": 41686.38761359174,
"volume": 105824510346.65779,
"market_cap": 774984045201.7122,
"timestamp": "2021-01-04T23:59:06.000Z"
}
}
},
{
"time_open": "2021-01-05T00:00:00.000Z",
"time_close": "2021-01-05T23:59:59.999Z",
"time_high": "2021-01-05T22:44:35.000Z",
"time_low": "2021-01-05T06:16:41.000Z",
"quote": {
"2782": {
"open": 41693.07321807638,
"high": 44403.79487147647,
"low": 39221.81167941294,
"close": 43790.067253370056,
"volume": 87016490203.50436,
"market_cap": 814135603090.2502,
"timestamp": "2021-01-05T23:59:06.000Z"
}
}
},
{
"time_open": "2021-01-06T00:00:00.000Z",
"time_close": "2021-01-06T23:59:59.999Z",
"time_high": "2021-01-06T23:57:36.000Z",
"time_low": "2021-01-06T00:25:38.000Z",
"quote": {
"2782": {
"open": 43817.35864984641,
"high": 47186.65232598287,
"low": 43152.60281764236,
"close": 47115.85365360005,
"volume": 96330948324.8061,
"market_cap": 876019742889.9551,
"timestamp": "2021-01-06T23:59:06.000Z"
}
}
},
{
"time_open": "2021-01-07T00:00:00.000Z",
"time_close": "2021-01-07T23:59:59.999Z",
"time_high": "2021-01-07T18:17:42.000Z",
"time_low": "2021-01-07T08:25:51.000Z",
"quote": {
"2782": {
"open": 47128.02139328098,
"high": 51833.478207775144,
"low": 46906.65117139608,
"close": 50686.90986207153,
"volume": 109124136558.20264,
"market_cap": 942469208700.134,
"timestamp": "2021-01-07T23:59:06.000Z"
}
}
}
]
}
}

View file

@ -1,136 +0,0 @@
{
"status": {
"timestamp": "2021-07-16T10:42:24.612Z",
"error_code": 0,
"error_message": null,
"elapsed": 57,
"credit_count": 0,
"notice": null
},
"data": {
"id": 1,
"name": "Bitcoin",
"symbol": "BTC",
"quotes": [
{
"time_open": "2021-01-01T00:00:00.000Z",
"time_close": "2021-01-01T23:59:59.999Z",
"time_high": "2021-01-01T12:38:43.000Z",
"time_low": "2021-01-01T00:16:43.000Z",
"quote": {
"AUD": {
"open": 37658.83948707033,
"high": 38417.9137031205,
"low": 37410.787501639206,
"close": 38181.99133300758,
"volume": 52943282221.028366,
"market_cap": 709720173049.5383,
"timestamp": "2021-01-01T23:59:06.000Z"
}
}
},
{
"time_open": "2021-01-02T00:00:00.000Z",
"time_close": "2021-01-02T23:59:59.999Z",
"time_high": "2021-01-02T19:49:42.000Z",
"time_low": "2021-01-02T00:31:44.000Z",
"quote": {
"AUD": {
"open": 38184.98611600682,
"high": 43096.681197423015,
"low": 37814.17187096531,
"close": 41760.62923079505,
"volume": 88214867181.97835,
"market_cap": 776278147177.8037,
"timestamp": "2021-01-02T23:59:06.000Z"
}
}
},
{
"time_open": "2021-01-03T00:00:00.000Z",
"time_close": "2021-01-03T23:59:59.999Z",
"time_high": "2021-01-03T07:47:38.000Z",
"time_low": "2021-01-03T00:20:45.000Z",
"quote": {
"AUD": {
"open": 41763.41015117659,
"high": 44985.93247585023,
"low": 41663.204350601605,
"close": 42511.10646879765,
"volume": 102011582370.28117,
"market_cap": 790270288834.0249,
"timestamp": "2021-01-03T23:59:06.000Z"
}
}
},
{
"time_open": "2021-01-04T00:00:00.000Z",
"time_close": "2021-01-04T23:59:59.999Z",
"time_high": "2021-01-04T04:07:42.000Z",
"time_low": "2021-01-04T10:19:42.000Z",
"quote": {
"AUD": {
"open": 42548.61349648768,
"high": 43360.96165147421,
"low": 37133.98436952697,
"close": 41686.38761359174,
"volume": 105824510346.65779,
"market_cap": 774984045201.7122,
"timestamp": "2021-01-04T23:59:06.000Z"
}
}
},
{
"time_open": "2021-01-05T00:00:00.000Z",
"time_close": "2021-01-05T23:59:59.999Z",
"time_high": "2021-01-05T22:44:35.000Z",
"time_low": "2021-01-05T06:16:41.000Z",
"quote": {
"AUD": {
"open": 41693.07321807638,
"high": 44403.79487147647,
"low": 39221.81167941294,
"close": 43790.067253370056,
"volume": 87016490203.50436,
"market_cap": 814135603090.2502,
"timestamp": "2021-01-05T23:59:06.000Z"
}
}
},
{
"time_open": "2021-01-06T00:00:00.000Z",
"time_close": "2021-01-06T23:59:59.999Z",
"time_high": "2021-01-06T23:57:36.000Z",
"time_low": "2021-01-06T00:25:38.000Z",
"quote": {
"AUD": {
"open": 43817.35864984641,
"high": 47186.65232598287,
"low": 43152.60281764236,
"close": 47115.85365360005,
"volume": 96330948324.8061,
"market_cap": 876019742889.9551,
"timestamp": "2021-01-06T23:59:06.000Z"
}
}
},
{
"time_open": "2021-01-07T00:00:00.000Z",
"time_close": "2021-01-07T23:59:59.999Z",
"time_high": "2021-01-07T18:17:42.000Z",
"time_low": "2021-01-07T08:25:51.000Z",
"quote": {
"AUD": {
"open": 47128.02139328098,
"high": 51833.478207775144,
"low": 46906.65117139608,
"close": 50686.90986207153,
"volume": 109124136558.20264,
"market_cap": 942469208700.134,
"timestamp": "2021-01-07T23:59:06.000Z"
}
}
}
]
}
}

View file

@ -1,136 +1,129 @@
{
"status": {
"timestamp": "2021-07-16T10:42:21.065Z",
"error_code": 0,
"error_message": null,
"elapsed": 17,
"credit_count": 0,
"notice": null
},
"data": {
"id": 1,
"name": "Bitcoin",
"symbol": "BTC",
"timeEnd": "1575503999",
"quotes": [
{
"time_open": "2021-01-01T00:00:00.000Z",
"time_close": "2021-01-01T23:59:59.999Z",
"time_high": "2021-01-01T12:38:43.000Z",
"time_low": "2021-01-01T00:16:43.000Z",
"timeOpen": "2021-01-01T00:00:00.000Z",
"timeClose": "2021-01-01T23:59:59.999Z",
"timeHigh": "2021-01-01T12:38:43.000Z",
"timeLow": "2021-01-01T00:16:43.000Z",
"quote": {
"2782": {
"open": 37658.83948707033,
"name": "2782",
"open": 37658.1146368474,
"high": 38417.9137031205,
"low": 37410.787501639206,
"close": 38181.99133300758,
"volume": 52943282221.028366,
"market_cap": 709720173049.5383,
"timestamp": "2021-01-01T23:59:06.000Z"
}
"low": 37410.7875016392,
"close": 38181.9913330076,
"volume": 52901492931.8344367080,
"marketCap": 709159975413.2388897949,
"timestamp": "2021-01-01T23:59:59.999Z"
}
},
{
"time_open": "2021-01-02T00:00:00.000Z",
"time_close": "2021-01-02T23:59:59.999Z",
"time_high": "2021-01-02T19:49:42.000Z",
"time_low": "2021-01-02T00:31:44.000Z",
"timeOpen": "2021-01-02T00:00:00.000Z",
"timeClose": "2021-01-02T23:59:59.999Z",
"timeHigh": "2021-01-02T19:49:42.000Z",
"timeLow": "2021-01-02T00:31:44.000Z",
"quote": {
"2782": {
"open": 38184.98611600682,
"high": 43096.681197423015,
"low": 37814.17187096531,
"close": 41760.62923079505,
"volume": 88214867181.97835,
"market_cap": 776278147177.8037,
"timestamp": "2021-01-02T23:59:06.000Z"
}
"name": "2782",
"open": 38184.9861160068,
"high": 43096.6811974230,
"low": 37814.1718709653,
"close": 41760.6292307951,
"volume": 88214867181.9830439141,
"marketCap": 776278147177.8037261338,
"timestamp": "2021-01-02T23:59:59.999Z"
}
},
{
"time_open": "2021-01-03T00:00:00.000Z",
"time_close": "2021-01-03T23:59:59.999Z",
"time_high": "2021-01-03T07:47:38.000Z",
"time_low": "2021-01-03T00:20:45.000Z",
"timeOpen": "2021-01-03T00:00:00.000Z",
"timeClose": "2021-01-03T23:59:59.999Z",
"timeHigh": "2021-01-03T07:47:38.000Z",
"timeLow": "2021-01-03T00:20:45.000Z",
"quote": {
"2782": {
"open": 41763.41015117659,
"high": 44985.93247585023,
"low": 41663.204350601605,
"close": 42511.10646879765,
"volume": 102011582370.28117,
"market_cap": 790270288834.0249,
"timestamp": "2021-01-03T23:59:06.000Z"
}
"name": "2782",
"open": 41763.4101511766,
"high": 44985.9324758502,
"low": 41663.2043506016,
"close": 42534.0538859236,
"volume": 102253005977.1115650988,
"marketCap": 792140565709.1701340036,
"timestamp": "2021-01-03T23:59:59.999Z"
}
},
{
"time_open": "2021-01-04T00:00:00.000Z",
"time_close": "2021-01-04T23:59:59.999Z",
"time_high": "2021-01-04T04:07:42.000Z",
"time_low": "2021-01-04T10:19:42.000Z",
"timeOpen": "2021-01-04T00:00:00.000Z",
"timeClose": "2021-01-04T23:59:59.999Z",
"timeHigh": "2021-01-04T04:07:42.000Z",
"timeLow": "2021-01-04T10:19:42.000Z",
"quote": {
"2782": {
"open": 42548.61349648768,
"high": 43360.96165147421,
"low": 37133.98436952697,
"close": 41686.38761359174,
"volume": 105824510346.65779,
"market_cap": 774984045201.7122,
"timestamp": "2021-01-04T23:59:06.000Z"
}
"name": "2782",
"open": 42548.6134964877,
"high": 43347.7527651400,
"low": 37111.8678479690,
"close": 41707.4890765162,
"volume": 105251252720.3013091567,
"marketCap": 770785910830.3801120744,
"timestamp": "2021-01-04T23:59:59.999Z"
}
},
{
"time_open": "2021-01-05T00:00:00.000Z",
"time_close": "2021-01-05T23:59:59.999Z",
"time_high": "2021-01-05T22:44:35.000Z",
"time_low": "2021-01-05T06:16:41.000Z",
"timeOpen": "2021-01-05T00:00:00.000Z",
"timeClose": "2021-01-05T23:59:59.999Z",
"timeHigh": "2021-01-05T22:44:35.000Z",
"timeLow": "2021-01-05T06:16:41.000Z",
"quote": {
"2782": {
"open": 41693.07321807638,
"high": 44403.79487147647,
"low": 39221.81167941294,
"close": 43790.067253370056,
"volume": 87016490203.50436,
"market_cap": 814135603090.2502,
"timestamp": "2021-01-05T23:59:06.000Z"
}
"name": "2782",
"open": 41693.0732180764,
"high": 44406.6531914952,
"low": 39220.9654861842,
"close": 43777.4560620835,
"volume": 88071174132.6445648582,
"marketCap": 824003338903.4613958343,
"timestamp": "2021-01-05T23:59:59.999Z"
}
},
{
"time_open": "2021-01-06T00:00:00.000Z",
"time_close": "2021-01-06T23:59:59.999Z",
"time_high": "2021-01-06T23:57:36.000Z",
"time_low": "2021-01-06T00:25:38.000Z",
"timeOpen": "2021-01-06T00:00:00.000Z",
"timeClose": "2021-01-06T23:59:59.999Z",
"timeHigh": "2021-01-06T23:57:36.000Z",
"timeLow": "2021-01-06T00:25:38.000Z",
"quote": {
"2782": {
"open": 43817.35864984641,
"high": 47186.65232598287,
"low": 43152.60281764236,
"close": 47115.85365360005,
"volume": 96330948324.8061,
"market_cap": 876019742889.9551,
"timestamp": "2021-01-06T23:59:06.000Z"
}
"name": "2782",
"open": 43798.3790529373,
"high": 47185.7303335186,
"low": 43152.6028176424,
"close": 47114.9330444897,
"volume": 96948095813.7503737302,
"marketCap": 881631993096.0701475336,
"timestamp": "2021-01-06T23:59:59.999Z"
}
},
{
"time_open": "2021-01-07T00:00:00.000Z",
"time_close": "2021-01-07T23:59:59.999Z",
"time_high": "2021-01-07T18:17:42.000Z",
"time_low": "2021-01-07T08:25:51.000Z",
"timeOpen": "2021-01-07T00:00:00.000Z",
"timeClose": "2021-01-07T23:59:59.999Z",
"timeHigh": "2021-01-07T18:17:42.000Z",
"timeLow": "2021-01-07T08:25:51.000Z",
"quote": {
"2782": {
"open": 47128.02139328098,
"high": 51833.478207775144,
"low": 46906.65117139608,
"close": 50686.90986207153,
"volume": 109124136558.20264,
"market_cap": 942469208700.134,
"timestamp": "2021-01-07T23:59:06.000Z"
}
"name": "2782",
"open": 47128.0213932810,
"high": 51832.6746004172,
"low": 46906.6511713961,
"close": 50660.9643451606,
"volume": 108451040396.2660095877,
"marketCap": 936655898949.2177196744,
"timestamp": "2021-01-07T23:59:59.999Z"
}
}
]
},
"status": {
"timestamp": "2024-08-02T18:23:21.586Z",
"error_code": "0",
"error_message": "SUCCESS",
"elapsed": "212",
"credit_count": 0
}
}