diff options
| author | n1 <hrdina.pavel@gmail.com> | 2021-08-08 09:13:35 +0200 |
|---|---|---|
| committer | n1 <hrdina.pavel@gmail.com> | 2021-08-08 09:13:35 +0200 |
| commit | 8dec748abee51df2e588c62e96a1cc32dd217b20 (patch) | |
| tree | 4176004e1e7173958598005eca702ea4ad540ce2 | |
| parent | 086dec27141a76b87f5784b10d0285bdabfa19b4 (diff) | |
Updated: tests, basci data fetching, rank added.0.4.3
| -rw-r--r-- | README.rst | 77 | ||||
| -rw-r--r-- | karpet/core.py | 7 | ||||
| -rw-r--r-- | pyproject.toml | 2 | ||||
| -rw-r--r-- | test_karpet.py | 4 |
4 files changed, 50 insertions, 40 deletions
@@ -192,90 +192,97 @@ available. k = Karpet() print(k.get_basic_data(id="ethereum")) { + 'closed_issues': 5530, + 'commit_count_4_weeks': 40, + 'current_price': 3167.67, + 'forks': 11635, + 'market_cap': 371964284548, 'name': 'Ethereum', - 'current_price': 1579.4271687603093, - 'market_cap': 182133382817.63593, - 'reddit_average_posts_48h': 150.083, - 'reddit_average_comments_48h': 150.083, - 'reddit_subscribers': 704486, - 'reddit_accounts_active_48h': 2950.92307692308, - 'forks': 10546, - 'stars': 28621, - 'total_issues': 5366, - 'closed_issues': 5183, - 'pull_request_contributors': 505, - 'commit_count_4_weeks': 80, - 'open_issues': 183, - 'year_low': 110.5978978308351, - 'year_high': 1969.9797177628186, - 'yoy_change': 551.9432548470326 # growth/drop in percents + 'open_issues': 230, + 'pull_request_contributors': 552, + 'rank': 2, + 'reddit_accounts_active_48h': 2881.0, + 'reddit_average_comments_48h': 417.083, + 'reddit_average_posts_48h': 417.083, + 'reddit_subscribers': 1057875, + 'stars': 31680, + 'total_issues': 5760, + 'year_high': 4182.790285752286, + 'year_low': 321.0774351739628, + 'yoy_change': 695.9225871929757 # growth/drop in percents } Changelog --------- +0.4.3. +~~~~~~ +- fixed ``get_basic_data()`` method (different data source) +- new property in ``get_basic_data()`` return dict - ``rank`` +- tests enhanced + 0.4.2. ~~~~~~ -* fixed minor bugs +- fixed minor bugs 0.4.1 ~~~~~ -* new data in ``get_basic_data()`` method - ``year_low``, ``year_high``, ``yoy_change`` +- new data in ``get_basic_data()`` method - ``year_low``, ``year_high``, ``yoy_change`` 0.4 ~~~ -* new method ``get_basic_data()`` +- new method ``get_basic_data()`` 0.3.3. ~~~~~~ -* removed twitter integration - twitterscraper library is not up to date -* fixed news fetching +- removed twitter integration - twitterscraper library is not up to date +- fixed news fetching 0.3.2 ~~~~~ -* new method ``get_coin_ids()`` -* method ``fetch_crypto_historical_data()`` has ``id`` param now +- new method ``get_coin_ids()`` +- method ``fetch_crypto_historical_data()`` has ``id`` param now 0.3.1 ~~~~~ -* migrated to coingecko.com API (no API key needed anymore) +- migrated to coingecko.com API (no API key needed anymore) 0.3 ~~~ -* migrated to cryptocompare.com API (you need an API key now) -* requirements are now managed by Poetry +- migrated to cryptocompare.com API (you need an API key now) +- requirements are now managed by Poetry 0.2.5 ~~~~~ -* added ``fetch_top_news()`` method for top crypto news separated in 2 categories +- added ``fetch_top_news()`` method for top crypto news separated in 2 categories 0.2.4 ~~~~~ -* ``fetch_news()`` adds new "description" item and renames "image_url" to "image" -* all ``fetch_news()`` item properties are now presented even if they are ``None`` +- ``fetch_news()`` adds new "description" item and renames "image_url" to "image" +- all ``fetch_news()`` item properties are now presented even if they are ``None`` 0.2.3 ~~~~~ -* simplified import from ``from karpet.karpet import Karpet`` to ``from karpet import Karpet`` +- simplified import from ``from karpet.karpet import Karpet`` to ``from karpet import Karpet`` 0.2.2 ~~~~~ -* added ``fetch_news()`` method for retrieving crypto news +- added ``fetch_news()`` method for retrieving crypto news 0.2.1 ~~~~~ -* added ``fetch_exchanges()`` method for retrieving symbol exchange list -* removed obsolete library dependency +- added ``fetch_exchanges()`` method for retrieving symbol exchange list +- removed obsolete library dependency 0.2 ~~~ -* twitter scraping added +- twitter scraping added 0.1 ~~~ -* initial release +- initial release Credits ------- diff --git a/karpet/core.py b/karpet/core.py index 84a8264..256942d 100644 --- a/karpet/core.py +++ b/karpet/core.py @@ -513,6 +513,7 @@ class Karpet: - name - current_price - market_cap + - rank - reddit_average_posts_48h - reddit_average_comments_48h - reddit_subscribers @@ -537,9 +538,7 @@ class Karpet: id = self._get_coin_id_from_params(symbol, id) - data = self._get_json( - f"https://api.coingecko.com/api/v3/coins/{id}/history?date={date.today().strftime('%d-%m-%Y')}" - ) + data = self._get_json(f"https://api.coingecko.com/api/v3/coins/{id}") data_chart = self._get_json( f"https://api.coingecko.com/api/v3/coins/{id}/market_chart?vs_currency=usd&days=365" ) @@ -556,6 +555,7 @@ class Karpet: "name": data["name"], "current_price": data["market_data"]["current_price"]["usd"], "market_cap": data["market_data"]["market_cap"]["usd"], + "rank": data["market_data"]["market_cap_rank"], "reddit_average_posts_48h": data["community_data"][ "reddit_average_comments_48h" ], @@ -580,6 +580,7 @@ class Karpet: * (sorted_chart_by_date[-1][1] / sorted_chart_by_date[0][1] - 1), } + # Calculate open issues. if ( data["developer_data"]["total_issues"] and data["developer_data"]["closed_issues"] diff --git a/pyproject.toml b/pyproject.toml index 88698d8..c378ca5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "karpet" -version = "0.4.2" +version = "0.4.3" description = "Library for fetching coin/token historical data, trends and more." authors = ["n1 <hrdina.pavel@gmail.com>"] readme = "README.rst" diff --git a/test_karpet.py b/test_karpet.py index e5147df..697e3f8 100644 --- a/test_karpet.py +++ b/test_karpet.py @@ -115,7 +115,8 @@ def test_get_basic_data(): assert isinstance(data["name"], str) assert isinstance(data["current_price"], float) - assert isinstance(data["market_cap"], float) + assert isinstance(data["market_cap"], int) + assert isinstance(data["rank"], int) assert isinstance(data["reddit_average_posts_48h"], float) assert isinstance(data["reddit_average_comments_48h"], float) assert isinstance(data["reddit_subscribers"], int) @@ -124,6 +125,7 @@ def test_get_basic_data(): assert isinstance(data["stars"], int) assert isinstance(data["total_issues"], int) assert isinstance(data["closed_issues"], int) + assert isinstance(data["open_issues"], int) assert isinstance(data["pull_request_contributors"], int) assert isinstance(data["commit_count_4_weeks"], int) assert isinstance(data["year_low"], float) |