Skip to main content

Unofficial Python client for Coinglass API

Project description

Coinglass API

PyPi version Python 3.10 Python 3.11 codecov

Unofficial Python client for Coinglass API

Wrapper around the Coinglass API to fetch data about the crypto markets. All data is output in pandas DataFrames (single or multi-index) and all time series data uses a DateTimeIndex.

Note: Currently only supports the indicator API endpoint.

Example Plot

Installation

pip install coinglass-api

Usage

from coinglass_api import CoinglassAPI

cg = CoinglassAPI(coinglass_secret="abcd1234")

# Funding rate of ETH on dYdX
fr_btc_dydx = cg.funding(ex="dYdX", pair="ETH-USD", interval="h8")

# Get average funding for BTC
fr_avg_btc = cg.funding_average(symbol="BTC", interval="h4")

# Get funding OHLC for ETHUSDT on Binance
fr_ohlc_eth_binance = cg.funding_ohlc(ex="Binance", pair="ETHUSDT", interval="h4")

# Get aggregated OI OHLC data for BTC
oi_agg_eth = cg.open_interest_aggregated_ohlc(symbol="ETH", interval="h4")

# Get OHLC liquidations data for ETHUSDT on dYdX
liq_ohlc_eth_dydx = cg.liquidation_pair(ex="dYdX", pair="ETH-USD", interval="h4")

# Get liquidation data for BTC
liq_btc = cg.liquidation_symbol(symbol="BTC", interval="h4")

# Get long/short ratios for BTC
lsr_btc = cg.long_short_symbol(symbol="BTC", interval="h4")

Examples

>>> cg.funding(ex="dYdX", pair="ETH-USD", interval="h8").head()

time
exchangeName
symbol
quoteCurrency
fundingRate
2022-08-22 08:00:00 dYdX ETH USD -0.001151
2022-08-22 16:00:00 dYdX ETH USD 0.001678
2022-08-23 00:00:00 dYdX ETH USD 0.003743
2022-08-23 08:00:00 dYdX ETH USD 0.003561
2022-08-23 16:00:00 dYdX ETH USD 0.000658
>>> cg.funding(ex="dYdX", pair="ETH-USD", interval="h8").info()
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 500 entries, 2022-08-22 08:00:00 to 2023-02-04 16:00:00
Data columns (total 4 columns):
 #   Column         Non-Null Count  Dtype  
---  ------         --------------  -----  
 0   exchangeName   500 non-null    object 
 1   symbol         500 non-null    object 
 2   quoteCurrency  500 non-null    object 
 3   fundingRate    500 non-null    float64
dtypes: float64(1), object(3)
memory usage: 19.5+ KB
>>> cg.funding(ex="dYdX", pair="ETH-USD", interval="h8").plot(y="fundingRate")

funding_rate

Disclaimer

This project is for educational purposes only. You should not construe any such information or other material as legal, tax, investment, financial, or other advice. Nothing contained here constitutes a solicitation, recommendation, endorsement, or offer by me or any third party service provider to buy or sell any securities or other financial instruments in this or in any other jurisdiction in which such solicitation or offer would be unlawful under the securities laws of such jurisdiction.

Under no circumstances will I be held responsible or liable in any way for any claims, damages, losses, expenses, costs, or liabilities whatsoever, including, without limitation, any direct or indirect damages for loss of profits.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

coinglass_api-0.4.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

coinglass_api-0.4.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file coinglass_api-0.4.0.tar.gz.

File metadata

  • Download URL: coinglass_api-0.4.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.11.2 Darwin/22.4.0

File hashes

Hashes for coinglass_api-0.4.0.tar.gz
Algorithm Hash digest
SHA256 6bf305eeda0dd5c1860a77f95fb240cbf16c8e0226f5b5fdf21deb2dcb2dc84a
MD5 07e6033683c0b211de24d7f86bf5ea43
BLAKE2b-256 75d01a321b20703b05b235f46fa392799558f8ae62f654e5bdebca4b22a76881

See more details on using hashes here.

Provenance

File details

Details for the file coinglass_api-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: coinglass_api-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.11.2 Darwin/22.4.0

File hashes

Hashes for coinglass_api-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb93f5075087a2128a864c5bc1676531ae2a808f2a1b92709b48dbbf5a35dd34
MD5 727657e668941cbbe728827b433625b3
BLAKE2b-256 06d86f276ff7c861febd2ef43521ef94e68084590a4f4958fb7052f3d5011448

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page