diff --git a/docs/about/hbot.md b/docs/about/hbot.md index f0012024..126e4897 100644 --- a/docs/about/hbot.md +++ b/docs/about/hbot.md @@ -19,10 +19,10 @@ Learn more about the HBOT token in the [original launch post](../blog/posts/intr | Symbol | HBOT | | Name | Hummingbot Governance Token | | Total Supply (fixed at genesis) | 1,000,000,000 HBOT | -| Circulating Supply | {{ circulating_supply() }} HBOT | -| Current Price (CoinGecko) | ${{ hbot_price() }} | -| Market Capitalization | ${{ market_cap() }} | -| Fully Diluted Valuation | ${{ fully_diluted_value() }} | +| Circulating Supply | ... HBOT | +| Current Price (CoinGecko) | $... | +| Market Capitalization | $... | +| Fully Diluted Valuation | $... | ## HBOT Data Sites diff --git a/docs/assets/js/hbot-stats.js b/docs/assets/js/hbot-stats.js new file mode 100644 index 00000000..7665b068 --- /dev/null +++ b/docs/assets/js/hbot-stats.js @@ -0,0 +1,40 @@ +async function updateHBOTStats() { + try { + // Get HBOT price + const priceResponse = await fetch('https://api.coingecko.com/api/v3/simple/price?ids=hummingbot&vs_currencies=usd'); + const priceData = await priceResponse.json(); + const price = priceData.hummingbot.usd; + + // Get circulating supply + const supplyResponse = await fetch('https://script.googleusercontent.com/macros/echo?user_content_key=N4n4qQVTKApqGc2int0KWqnepzV2kV38ue_DhxNyGkX-q4V6BwcSbcUYRulrmn3J4-m-9-rbax0QtMuLYtcEvnwE87sOlQEgm5_BxDlH2jW0nuo2oDemN9CCS2h10ox_1xSncGQajx_ryfhECjZEnH1LtfJpvsx6ko-sqM14URZmZ3jYd3cBL80m9K3ehDaYBabPl9oGCLEKQlYYtvNTgmPDw6d8UvRjIjfxHAj5tMsQoE6T5t6l9Q&lib=M0hBf2ltttBRyRQ7geRilVBeMw4PaOM-o'); + const supplyData = await supplyResponse.json(); + const supply = parseFloat(supplyData.circulating_supply); + + // Calculate market cap and fully diluted value + const TOTAL_SUPPLY = 1000000000; + const marketCap = price * supply; + const fdv = price * TOTAL_SUPPLY; + + // Update DOM elements + const elements = { + 'hbot-price': price.toFixed(4), + 'circulating-supply': Math.round(supply).toLocaleString(), + 'market-cap': Math.round(marketCap).toLocaleString(), + 'fdv': Math.round(fdv).toLocaleString() + }; + + for (const [id, value] of Object.entries(elements)) { + const element = document.getElementById(id); + if (element) element.textContent = value; + } + } catch (error) { + console.error('Error updating HBOT stats:', error); + } +} + +// Wait for DOM to be ready +document.addEventListener('DOMContentLoaded', () => { + // Update immediately and then every 30 seconds + updateHBOTStats(); + setInterval(updateHBOTStats, 30000); +}); \ No newline at end of file diff --git a/environment.yml b/environment.yml index 8dcfcca9..b7543ed5 100644 --- a/environment.yml +++ b/environment.yml @@ -9,8 +9,6 @@ dependencies: - mkdocs-git-revision-date-localized-plugin - mkdocs-table-reader-plugin - mkdocs-charts-plugin - - mkdocs-macros-plugin - - requests - pip - pip: - git+ssh://git@github.com/hummingbot/mkdocs-material-insiders diff --git a/main.py b/main.py deleted file mode 100644 index 3943d35d..00000000 --- a/main.py +++ /dev/null @@ -1,32 +0,0 @@ -import requests - -def define_env(env): - """ - This is the hook for the variables, macros and filters. - """ - - @env.macro - def hbot_price(): - "Get HBOT price from CoinGecko" - coingecko_response = requests.get("https://api.coingecko.com/api/v3/simple/price?ids=hummingbot&vs_currencies=usd") - return float(coingecko_response.json()['hummingbot']['usd']) - - @env.macro - def circulating_supply(): - "Get HBOT circulating supply" - response = requests.get("https://script.googleusercontent.com/macros/echo?user_content_key=N4n4qQVTKApqGc2int0KWqnepzV2kV38ue_DhxNyGkX-q4V6BwcSbcUYRulrmn3J4-m-9-rbax0QtMuLYtcEvnwE87sOlQEgm5_BxDlH2jW0nuo2oDemN9CCS2h10ox_1xSncGQajx_ryfhECjZEnH1LtfJpvsx6ko-sqM14URZmZ3jYd3cBL80m9K3ehDaYBabPl9oGCLEKQlYYtvNTgmPDw6d8UvRjIjfxHAj5tMsQoE6T5t6l9Q&lib=M0hBf2ltttBRyRQ7geRilVBeMw4PaOM-o") - supply = float(response.json()['circulating_supply']) - return f"{round(supply):,}" - - @env.macro - def fully_diluted_value(): - "Calculate fully diluted value" - TOTAL_SUPPLY = 1000000000 # 1 billion HBOT total supply - return f"{round(hbot_price() * TOTAL_SUPPLY):,}" - - @env.macro - def market_cap(): - "Calculate circulating market cap" - response = requests.get("https://script.googleusercontent.com/macros/echo?user_content_key=N4n4qQVTKApqGc2int0KWqnepzV2kV38ue_DhxNyGkX-q4V6BwcSbcUYRulrmn3J4-m-9-rbax0QtMuLYtcEvnwE87sOlQEgm5_BxDlH2jW0nuo2oDemN9CCS2h10ox_1xSncGQajx_ryfhECjZEnH1LtfJpvsx6ko-sqM14URZmZ3jYd3cBL80m9K3ehDaYBabPl9oGCLEKQlYYtvNTgmPDw6d8UvRjIjfxHAj5tMsQoE6T5t6l9Q&lib=M0hBf2ltttBRyRQ7geRilVBeMw4PaOM-o") - supply = float(response.json()['circulating_supply']) - return f"{round(hbot_price() * supply):,}" diff --git a/mkdocs.yml b/mkdocs.yml index e72f9759..ec6a551a 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -57,7 +57,6 @@ theme: plugins: - search - charts - - macros - table-reader - git-revision-date-localized - social: @@ -115,6 +114,7 @@ extra_javascript: - https://cdn.jsdelivr.net/npm/vega@5 - https://cdn.jsdelivr.net/npm/vega-lite@5 - https://cdn.jsdelivr.net/npm/vega-embed@6 + - assets/js/hbot-stats.js # Extensions markdown_extensions: