{"id":22674925,"url":"https://github.com/dineshpinto/coinglass-api","last_synced_at":"2025-04-12T13:36:08.576Z","repository":{"id":65288971,"uuid":"589303552","full_name":"dineshpinto/coinglass-api","owner":"dineshpinto","description":"RESTful Python client for Coinglass crypto derivatives API","archived":false,"fork":false,"pushed_at":"2023-11-25T05:58:13.000Z","size":985,"stargazers_count":26,"open_issues_count":0,"forks_count":8,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-04-27T01:43:09.860Z","etag":null,"topics":["binance","bitfinex","bybit","coinglass","cryptocurrency","deribit","dydx","huobi","kraken","okex","python","rest-api"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/coinglass-api/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dineshpinto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-15T18:32:22.000Z","updated_at":"2024-04-03T06:10:44.000Z","dependencies_parsed_at":"2023-11-10T21:27:57.533Z","dependency_job_id":"cf2a2231-478d-4901-b48b-d35a16bd945d","html_url":"https://github.com/dineshpinto/coinglass-api","commit_stats":{"total_commits":20,"total_committers":2,"mean_commits":10.0,"dds":0.09999999999999998,"last_synced_commit":"3237c5bb73585b26f269d23cadce6a2b0d9413f7"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dineshpinto%2Fcoinglass-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dineshpinto%2Fcoinglass-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dineshpinto%2Fcoinglass-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dineshpinto%2Fcoinglass-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dineshpinto","download_url":"https://codeload.github.com/dineshpinto/coinglass-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248573937,"owners_count":21126930,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binance","bitfinex","bybit","coinglass","cryptocurrency","deribit","dydx","huobi","kraken","okex","python","rest-api"],"created_at":"2024-12-09T17:19:26.708Z","updated_at":"2025-04-12T13:36:08.546Z","avatar_url":"https://github.com/dineshpinto.png","language":"Python","readme":"# Coinglass API\n\n[![PyPi version](https://img.shields.io/pypi/v/coinglass-api)](https://pypi.python.org/pypi/coinglass-api/)\n[![Downloads](https://static.pepy.tech/badge/coinglass-api)](https://pepy.tech/project/coinglass-api)\n[![Python 3.10](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/release/python-3100/)\n[![codecov](https://codecov.io/gh/dineshpinto/coinglass-api/branch/main/graph/badge.svg?token=XTJRRU2W1T)](https://codecov.io/gh/dineshpinto/coinglass-api)\n[![API unittest](https://github.com/dineshpinto/coinglass-api/actions/workflows/api_unitests.yml/badge.svg)](https://github.com/dineshpinto/coinglass-api/actions/workflows/api_unitests.yml)\n\n## Unofficial Python client for Coinglass API\n\nWrapper around the [Coinglass API](https://coinglass.com/pricing) to fetch data about crypto derivatives.\nAll data is output in pandas DataFrames (single or multi-index) and all time-series data uses a `DateTimeIndex`.\nSupports all Coinglass API endpoints.\n\n![Example Plot](https://github.com/dineshpinto/coinglass-api/blob/main/examples/example_plot.jpg?raw=true)\n\n## Installation\n\n```bash\npip install coinglass-api\n```\n\n## Usage\n\n```python\nfrom coinglass_api import CoinglassAPI\n\ncg = CoinglassAPI(coinglass_secret=\"abcd1234\")\n\n# Get perpetual markets for BTC\nperp_markets_btc = cg.perpetual_market(symbol=\"BTC\")\n\n# Get OI history\noi_history_btc = cg.open_interest_history(symbol=\"BTC\", time_type=\"h1\", currency=\"USD\")\n\n# Funding rate of ETH on dYdX\nfr_btc_dydx = cg.funding(ex=\"dYdX\", pair=\"ETH-USD\", interval=\"h8\")\n\n# Get average funding for BTC\nfr_avg_btc = cg.funding_average(symbol=\"BTC\", interval=\"h4\")\n\n# Get funding OHLC for ETH-USDT on Binance\nfr_ohlc_eth_binance = cg.funding_ohlc(ex=\"Binance\", pair=\"ETHUSDT\", interval=\"h4\")\n\n# Get aggregated OI OHLC data for BTC\noi_agg_eth = cg.open_interest_aggregated_ohlc(symbol=\"ETH\", interval=\"h4\")\n\n# Get OHLC liquidations data for ETH-USD on dYdX\nliq_ohlc_eth_dydx = cg.liquidation_pair(ex=\"dYdX\", pair=\"ETH-USD\", interval=\"h4\")\n\n# Get liquidation data for BTC\nliq_btc = cg.liquidation_symbol(symbol=\"BTC\", interval=\"h4\")\n\n# Get long/short ratios for BTC\nlsr_btc = cg.long_short_symbol(symbol=\"BTC\", interval=\"h4\")\n\n# Get GBTC market history\ngbtc_history = cg.grayscale_market_history()\n\n# and more...\n```\n\n## Examples\n\n```\n\u003e\u003e\u003e cg.funding(ex=\"dYdX\", pair=\"ETH-USD\", interval=\"h8\").head()\n```\n\n| \u003cbr/\u003etime           | exchangeName\u003cbr/\u003e | symbol\u003cbr/\u003e | quoteCurrency\u003cbr/\u003e | fundingRate\u003cbr/\u003e |\n|:--------------------|:------------------|:------------|:-------------------|:-----------------|\n| 2022-08-22 08:00:00 | dYdX              | ETH         | USD                | -0.001151        |\n| 2022-08-22 16:00:00 | dYdX              | ETH         | USD                | 0.001678         |\n| 2022-08-23 00:00:00 | dYdX              | ETH         | USD                | 0.003743         |\n| 2022-08-23 08:00:00 | dYdX              | ETH         | USD                | 0.003561         |\n| 2022-08-23 16:00:00 | dYdX              | ETH         | USD                | 0.000658         |\n\n```\n\u003e\u003e\u003e cg.funding(ex=\"dYdX\", pair=\"ETH-USD\", interval=\"h8\").info()\n```\n\n```\n\u003cclass 'pandas.core.frame.DataFrame'\u003e\nDatetimeIndex: 500 entries, 2022-08-22 08:00:00 to 2023-02-04 16:00:00\nData columns (total 4 columns):\n #   Column         Non-Null Count  Dtype  \n---  ------         --------------  -----  \n 0   exchangeName   500 non-null    object \n 1   symbol         500 non-null    object \n 2   quoteCurrency  500 non-null    object \n 3   fundingRate    500 non-null    float64\ndtypes: float64(1), object(3)\nmemory usage: 19.5+ KB\n```\n\n```\n\u003e\u003e\u003e cg.funding(ex=\"dYdX\", pair=\"ETH-USD\", interval=\"h8\").plot(y=\"fundingRate\")\n```\n\n![funding_rate](https://github.com/dineshpinto/coinglass-api/blob/main/examples/funding_rate.jpg?raw=true)\n\n## Disclaimer\n\nThis project is for educational purposes only. You should not construe any such information or other material as legal,\ntax, investment, financial, or other advice. Nothing contained here constitutes a solicitation, recommendation,\nendorsement, or offer by me or any third party service provider to buy or sell any securities or other financial\ninstruments in this or in any other jurisdiction in which such solicitation or offer would be unlawful under the\nsecurities laws of such jurisdiction.\n\nUnder no circumstances will I be held responsible or liable in any way for any claims, damages, losses, expenses, costs,\nor liabilities whatsoever, including, without limitation, any direct or indirect damages for loss of profits.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdineshpinto%2Fcoinglass-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdineshpinto%2Fcoinglass-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdineshpinto%2Fcoinglass-api/lists"}