From e8b89e78ef6067fa12001d559805a889d1fc3fe2 Mon Sep 17 00:00:00 2001 From: Pat Doyle Date: Thu, 10 Feb 2022 09:53:57 -0600 Subject: [PATCH] adding utility realitime option book --- docs/source/conf.py | 2 +- gvol/__init__.py | 2 +- gvol/client.py | 24 +++++++++++++++++++++++- gvol/queries.py | 27 +++++++++++++++++++++++++++ pyproject.toml | 2 +- 5 files changed, 53 insertions(+), 4 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 40a1532..83eadea 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -23,7 +23,7 @@ author = "Denys Halenok" # The full version, including alpha/beta/rc tags -release = "0.2.21" +release = "0.2.22" # -- General configuration --------------------------------------------------- diff --git a/gvol/__init__.py b/gvol/__init__.py index b9657e9..c77a861 100644 --- a/gvol/__init__.py +++ b/gvol/__init__.py @@ -1,4 +1,4 @@ __all__ = ("__version__", "GVol") -__version__ = "0.2.21" +__version__ = "0.2.22" from gvol.client import GVol diff --git a/gvol/client.py b/gvol/client.py index cf4a178..d368624 100644 --- a/gvol/client.py +++ b/gvol/client.py @@ -1825,7 +1825,7 @@ def HifiVolSurfaceStrikesGreeksMinute( ) -> Dict: """This endpoint returns a volatility surface represented by option strike prices. - This is a "model-free" volatility surface, meaning no interpolation or fitting of any kind is present. + This is a "model-free" volatility surface, meaning no interpolation or fitting of any kind is present. Currently supports: Deribit @@ -1894,3 +1894,25 @@ def dVolVariancePremium( "symbol": symbol, }, ) + + def UtilityRealtimeOptionbook( + self, + symbol: types.SymbolEnumType, + ) -> Dict: + """ + This endpoint will return the option orderbook, index prices, underlying prices and open interest for the entire exchange. + All crypto options, regardless of underlying coin, are returned. + This endpoint is real-time and will return live prices when requested. + Supported exchanges are |Deribit|Bitcom|Okex|Delta| + + Args: + exchange: (types.ExchangeEnumType) + Returns: + dict + """ + return self._client.execute( + gql(queries.UtilityRealtimeOptionbook), + variable_values={ + "exchange": symbol, + }, + ) \ No newline at end of file diff --git a/gvol/queries.py b/gvol/queries.py index b631e60..96a7db0 100644 --- a/gvol/queries.py +++ b/gvol/queries.py @@ -1208,3 +1208,30 @@ } } """ + + +UtilityRealtimeOptionbook = """ +query UtilityRealtimeOptionbook( + $exchange: ExchangeEnumType + ) { + UtilityRealtimeOptionbook: genericUtilityRealtimeOptionbook( + exchange: $exchange + ) { + date + instrumentName + currency + expiration + strike + putCall + isAtm + oi + bestBidPrice + usdBid + bidIV + markIv + askIv + indexPrice + underlyingPrice + } + } + """ diff --git a/pyproject.toml b/pyproject.toml index cb30d7f..d3e38cc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "gvol" -version = "0.2.21" +version = "0.2.22" description = "GVol is a Python library to access the GVol API" authors = ["Denys Halenok "]