示例#1
0
def test_convert():
    exc = random_exchange(pym)["website_slug"]
    print('(<exchange>["website_slug"] == "%s")' % exc, end=" ")
    res = pym.exchange(exc, convert="BTC")

    assert_types(res)
    assert_consistence(res)
示例#2
0
def test_types():
    exc = random_exchange(pym)["website_slug"]
    print('(<exchange>["website_slug"] == "%s")' % exc, end=" ")
    res = pym.exchange(exc)
    assert_types(res)
示例#3
0
def test_consistence():
    exc = random_exchange(pym)["website_slug"]
    print('(<exchange>["website_slug"] == "%s")' % exc, end=" ")
    res = pym.exchange(exc)
    assert_consistence(res)
    assert_number_of_markets(res)
示例#4
0
from time import sleep
from urllib.request import urlopen

import pytest
from tqdm import tqdm

from pymarketcap import Pymarketcap
from pymarketcap.tests.utils import (
    random_cryptocurrency,
    random_exchange,
)

pym = Pymarketcap()

cryptocurrency = random_cryptocurrency(pym)
exchange = random_exchange(pym)["website_slug"]

base_public_api_url = "https://api.coinmarketcap.com/v2/"
base_web_url = "https://coinmarketcap.com/"
base_internal_api_url = "https://s2.coinmarketcap.com/"
base_graphs_api_url = "https://graphs2.coinmarketcap.com/"

endpoints = [
    ("_quick_search",
     "%sgenerated/search/quick_search.json" % base_internal_api_url),
    ("_quick_search_exchanges",
     "%sgenerated/search/quick_search_exchanges.json" % base_internal_api_url),
    ("download_logo",
     "%sstatic/img/coins/64x64/1.png" % base_internal_api_url),
    ("download_exchange_logo",
     "%sstatic/img/exchanges/64x64/270.png" % base_internal_api_url),