langchain-liquidvision 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- langchain_liquidvision-0.1.0/PKG-INFO +53 -0
- langchain_liquidvision-0.1.0/README.md +36 -0
- langchain_liquidvision-0.1.0/langchain_liquidvision/__init__.py +67 -0
- langchain_liquidvision-0.1.0/langchain_liquidvision/_api.py +187 -0
- langchain_liquidvision-0.1.0/langchain_liquidvision.egg-info/PKG-INFO +53 -0
- langchain_liquidvision-0.1.0/langchain_liquidvision.egg-info/SOURCES.txt +9 -0
- langchain_liquidvision-0.1.0/langchain_liquidvision.egg-info/dependency_links.txt +1 -0
- langchain_liquidvision-0.1.0/langchain_liquidvision.egg-info/requires.txt +1 -0
- langchain_liquidvision-0.1.0/langchain_liquidvision.egg-info/top_level.txt +1 -0
- langchain_liquidvision-0.1.0/pyproject.toml +27 -0
- langchain_liquidvision-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: langchain-liquidvision
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: LangChain tools for LiquidVision.app crypto derivatives data: open interest, funding and liquidations on 13 venues, liquidation cascades, positioning regime, measured Hyperliquid liquidation maps, funding dispersion, tokenized stocks. Read-only, no key needed.
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://liquidvision.app
|
|
7
|
+
Project-URL: Documentation, https://liquidvision.app/llms.txt
|
|
8
|
+
Project-URL: Source, https://github.com/lv-analytics/liquidvision-mcp/tree/main/integrations/langchain
|
|
9
|
+
Keywords: langchain,langgraph,tools,crypto,derivatives,liquidations,open interest,funding rate,hyperliquid,trading,ai agent
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Requires-Python: >=3.9
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
Requires-Dist: langchain-core>=0.3
|
|
17
|
+
|
|
18
|
+
# langchain-liquidvision
|
|
19
|
+
|
|
20
|
+
Crypto derivatives tools for LangChain and LangGraph agents, from [LiquidVision.app](https://liquidvision.app).
|
|
21
|
+
Read-only, no key needed.
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install langchain-liquidvision
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
from langchain_liquidvision import LiquidVisionToolkit
|
|
29
|
+
from langgraph.prebuilt import create_react_agent
|
|
30
|
+
|
|
31
|
+
tools = LiquidVisionToolkit().get_tools()
|
|
32
|
+
agent = create_react_agent("anthropic:claude-sonnet-5-5", tools)
|
|
33
|
+
agent.invoke({"messages": [("user", "Is the ETH move new longs or short covering? Where are the liquidation levels?")]})
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
| Tool | Answers |
|
|
37
|
+
|---|---|
|
|
38
|
+
| `liquidvision_derivatives_brief` | One coin: price, open interest by venue, liquidations by side, funding per exchange, nearest liquidation zones |
|
|
39
|
+
| `liquidvision_positioning_regime` | New longs, short covering, new shorts or long flush: price change crossed with OI change |
|
|
40
|
+
| `liquidvision_liquidation_cascades` | Liquidation cascades as events: size, multiple of the coin's normal minute, price impact, reversion |
|
|
41
|
+
| `liquidvision_liquidation_map` | Measured Hyperliquid liquidation levels below and above price (exchange-reported, not modeled) |
|
|
42
|
+
| `liquidvision_funding_dispersion` | Cheapest venue to be long, richest to be short, across 13 exchanges |
|
|
43
|
+
| `liquidvision_tokenized_stocks` | Tokenized stocks, indices, commodities and FX perps on DEXs |
|
|
44
|
+
|
|
45
|
+
Each tool returns compact JSON. Errors come back as `{"error": ...}` so the agent keeps going.
|
|
46
|
+
|
|
47
|
+
**Limits.** 60 requests a minute per IP without a key. Set `LIQUIDVISION_API_KEY` (or
|
|
48
|
+
`LiquidVisionToolkit(api_key=...)`) with a Pro/Bot key for 600/1,200 a minute.
|
|
49
|
+
|
|
50
|
+
**More.** Raw rows, history and Parquet: the [`liquidvision`](https://pypi.org/project/liquidvision/) client.
|
|
51
|
+
MCP: `https://liquidvision.app/mcp/lite`. Docs: https://liquidvision.app/llms.txt
|
|
52
|
+
|
|
53
|
+
Data, not financial advice.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# langchain-liquidvision
|
|
2
|
+
|
|
3
|
+
Crypto derivatives tools for LangChain and LangGraph agents, from [LiquidVision.app](https://liquidvision.app).
|
|
4
|
+
Read-only, no key needed.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
pip install langchain-liquidvision
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```python
|
|
11
|
+
from langchain_liquidvision import LiquidVisionToolkit
|
|
12
|
+
from langgraph.prebuilt import create_react_agent
|
|
13
|
+
|
|
14
|
+
tools = LiquidVisionToolkit().get_tools()
|
|
15
|
+
agent = create_react_agent("anthropic:claude-sonnet-5-5", tools)
|
|
16
|
+
agent.invoke({"messages": [("user", "Is the ETH move new longs or short covering? Where are the liquidation levels?")]})
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
| Tool | Answers |
|
|
20
|
+
|---|---|
|
|
21
|
+
| `liquidvision_derivatives_brief` | One coin: price, open interest by venue, liquidations by side, funding per exchange, nearest liquidation zones |
|
|
22
|
+
| `liquidvision_positioning_regime` | New longs, short covering, new shorts or long flush: price change crossed with OI change |
|
|
23
|
+
| `liquidvision_liquidation_cascades` | Liquidation cascades as events: size, multiple of the coin's normal minute, price impact, reversion |
|
|
24
|
+
| `liquidvision_liquidation_map` | Measured Hyperliquid liquidation levels below and above price (exchange-reported, not modeled) |
|
|
25
|
+
| `liquidvision_funding_dispersion` | Cheapest venue to be long, richest to be short, across 13 exchanges |
|
|
26
|
+
| `liquidvision_tokenized_stocks` | Tokenized stocks, indices, commodities and FX perps on DEXs |
|
|
27
|
+
|
|
28
|
+
Each tool returns compact JSON. Errors come back as `{"error": ...}` so the agent keeps going.
|
|
29
|
+
|
|
30
|
+
**Limits.** 60 requests a minute per IP without a key. Set `LIQUIDVISION_API_KEY` (or
|
|
31
|
+
`LiquidVisionToolkit(api_key=...)`) with a Pro/Bot key for 600/1,200 a minute.
|
|
32
|
+
|
|
33
|
+
**More.** Raw rows, history and Parquet: the [`liquidvision`](https://pypi.org/project/liquidvision/) client.
|
|
34
|
+
MCP: `https://liquidvision.app/mcp/lite`. Docs: https://liquidvision.app/llms.txt
|
|
35
|
+
|
|
36
|
+
Data, not financial advice.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"""
|
|
2
|
+
langchain-liquidvision: crypto derivatives tools for LangChain / LangGraph agents.
|
|
3
|
+
|
|
4
|
+
from langchain_liquidvision import LiquidVisionToolkit
|
|
5
|
+
tools = LiquidVisionToolkit().get_tools() # six read-only tools, no key needed
|
|
6
|
+
|
|
7
|
+
Data from LiquidVision.app: open interest, funding and liquidations on 13
|
|
8
|
+
venues, liquidation cascades, positioning regime, measured Hyperliquid
|
|
9
|
+
liquidation maps, funding dispersion, tokenized stocks on DEXs.
|
|
10
|
+
"""
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
from typing import List, Optional
|
|
14
|
+
|
|
15
|
+
from langchain_core.tools import BaseTool, BaseToolkit, StructuredTool
|
|
16
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
17
|
+
|
|
18
|
+
from ._api import TOOL_SPECS, LiquidVisionAPI, __version__, norm_symbol, run
|
|
19
|
+
|
|
20
|
+
__all__ = ["LiquidVisionToolkit", "LiquidVisionAPI", "get_tools", "norm_symbol", "__version__"]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class _Symbol(BaseModel):
|
|
24
|
+
symbol: str = Field("BTCUSDT", description="Coin, e.g. BTC, ETH, SOLUSDT")
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class _OptSymbol(BaseModel):
|
|
28
|
+
symbol: Optional[str] = Field(None, description="Coin, e.g. BTC or ETHUSDT; omit for the whole market")
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class _Regime(_OptSymbol):
|
|
32
|
+
minutes: int = Field(240, description="Look-back window in minutes (15-1440)")
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class _Cascades(_OptSymbol):
|
|
36
|
+
hours: int = Field(24, description="Look-back window in hours (1-72)")
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class _Tokenized(BaseModel):
|
|
40
|
+
limit: int = Field(15, description="How many of the largest markets to return")
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
_SCHEMAS = {
|
|
44
|
+
"brief": _Symbol, "positioning_regime": _Regime, "liquidation_cascades": _Cascades,
|
|
45
|
+
"liquidation_map": _Symbol, "funding_dispersion": _OptSymbol, "tokenized_stocks": _Tokenized,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def get_tools(api_key: Optional[str] = None, base_url: Optional[str] = None) -> List[BaseTool]:
|
|
50
|
+
api = LiquidVisionAPI(api_key=api_key, base_url=base_url)
|
|
51
|
+
tools: List[BaseTool] = []
|
|
52
|
+
for name, method, description in TOOL_SPECS:
|
|
53
|
+
tools.append(StructuredTool.from_function(
|
|
54
|
+
func=lambda _m=method, **kw: run(api, _m, **kw),
|
|
55
|
+
name=name, description=description, args_schema=_SCHEMAS[method]))
|
|
56
|
+
return tools
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class LiquidVisionToolkit(BaseToolkit):
|
|
60
|
+
"""Six read-only LiquidVision.app tools. api_key is optional (raises the rate limit)."""
|
|
61
|
+
|
|
62
|
+
model_config = ConfigDict(arbitrary_types_allowed=True)
|
|
63
|
+
api_key: Optional[str] = None
|
|
64
|
+
base_url: Optional[str] = None
|
|
65
|
+
|
|
66
|
+
def get_tools(self) -> List[BaseTool]:
|
|
67
|
+
return get_tools(self.api_key, self.base_url)
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Shared core for the LiquidVision.app agent-framework wrappers.
|
|
3
|
+
|
|
4
|
+
Six read-only questions an agent asks about crypto derivatives, each answered
|
|
5
|
+
from LiquidVision.app's free "conclusion" endpoints and trimmed to a compact
|
|
6
|
+
JSON answer an LLM can read in one pass. No key needed (60 requests a minute
|
|
7
|
+
per IP); LIQUIDVISION_API_KEY raises the limit. Standard library only.
|
|
8
|
+
"""
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import json
|
|
12
|
+
import os
|
|
13
|
+
import re
|
|
14
|
+
import urllib.error
|
|
15
|
+
import urllib.parse
|
|
16
|
+
import urllib.request
|
|
17
|
+
from typing import Any, Dict, Optional
|
|
18
|
+
|
|
19
|
+
__version__ = "0.1.0"
|
|
20
|
+
DEFAULT_BASE = "https://liquidvision.app/api/v1"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def norm_symbol(symbol: Optional[str]) -> Optional[str]:
|
|
24
|
+
"""'btc', 'BTC/USDT', 'BTC-USDT-SWAP', '$BTC' -> 'BTCUSDT'."""
|
|
25
|
+
if not symbol:
|
|
26
|
+
return None
|
|
27
|
+
s = re.sub(r"[^A-Za-z0-9]", "", symbol.upper().replace("SWAP", ""))
|
|
28
|
+
if s.endswith("USDC"):
|
|
29
|
+
s = s[:-4]
|
|
30
|
+
return s if s.endswith("USDT") else s + "USDT"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class LiquidVisionAPI:
|
|
34
|
+
def __init__(self, api_key: Optional[str] = None, base_url: Optional[str] = None, timeout: float = 15.0):
|
|
35
|
+
self.api_key = api_key or os.environ.get("LIQUIDVISION_API_KEY")
|
|
36
|
+
self.base = (base_url or os.environ.get("LIQUIDVISION_BASE_URL") or DEFAULT_BASE).rstrip("/")
|
|
37
|
+
self.timeout = timeout
|
|
38
|
+
|
|
39
|
+
def get(self, path: str, **params: Any) -> Any:
|
|
40
|
+
q = {k: v for k, v in params.items() if v is not None}
|
|
41
|
+
url = self.base + path + ("?" + urllib.parse.urlencode(q) if q else "")
|
|
42
|
+
headers = {"User-Agent": f"liquidvision-agent-tools/{__version__}", "Accept": "application/json"}
|
|
43
|
+
if self.api_key:
|
|
44
|
+
headers["X-API-Key"] = self.api_key
|
|
45
|
+
req = urllib.request.Request(url, headers=headers)
|
|
46
|
+
try:
|
|
47
|
+
with urllib.request.urlopen(req, timeout=self.timeout) as r:
|
|
48
|
+
return json.loads(r.read())
|
|
49
|
+
except urllib.error.HTTPError as e:
|
|
50
|
+
if e.code == 429:
|
|
51
|
+
raise RuntimeError("LiquidVision rate limit reached (60/min without a key); retry in a minute") from None
|
|
52
|
+
raise RuntimeError(f"LiquidVision returned HTTP {e.code} for {path}") from None
|
|
53
|
+
|
|
54
|
+
# ------------------------------------------------------------ the six tools
|
|
55
|
+
|
|
56
|
+
def brief(self, symbol: str = "BTCUSDT") -> Dict[str, Any]:
|
|
57
|
+
b = self.get(f"/brief/{norm_symbol(symbol) or 'BTCUSDT'}")
|
|
58
|
+
liq = b.get("liquidations") or {}
|
|
59
|
+
return {
|
|
60
|
+
"symbol": b.get("symbol"),
|
|
61
|
+
"asset": b.get("asset"),
|
|
62
|
+
"liquidations_this_symbol_24h": liq.get("this_symbol_24h"),
|
|
63
|
+
"liquidations_market_wide_usd": liq.get("windows_usd"),
|
|
64
|
+
"funding_pct_by_exchange": (b.get("funding") or {}).get("current_pct_by_exchange"),
|
|
65
|
+
"open_interest_by_venue": b.get("open_interest_by_venue"),
|
|
66
|
+
"position_flows_usd": b.get("position_flows_usd"),
|
|
67
|
+
"next_risk_zones": b.get("next_risk_zones"),
|
|
68
|
+
"top_traders_positioning": b.get("top_traders_positioning"),
|
|
69
|
+
"data_age_s": b.get("age_s"),
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
def positioning_regime(self, symbol: Optional[str] = None, minutes: int = 240, limit: int = 15) -> Dict[str, Any]:
|
|
73
|
+
r = self.get("/oi/regime", minutes=minutes)
|
|
74
|
+
rows = r.get("rows") or []
|
|
75
|
+
sym = norm_symbol(symbol)
|
|
76
|
+
if sym:
|
|
77
|
+
rows = [x for x in rows if x.get("symbol") == sym]
|
|
78
|
+
else:
|
|
79
|
+
rows = sorted(rows, key=lambda x: abs(x.get("oi_delta_usd") or 0), reverse=True)[:limit]
|
|
80
|
+
return {
|
|
81
|
+
"window_minutes": r.get("minutes"),
|
|
82
|
+
"meaning": "price up + OI up = new longs; price up + OI down = short covering; "
|
|
83
|
+
"price down + OI up = new shorts; price down + OI down = long flush",
|
|
84
|
+
"market_summary": r.get("summary"),
|
|
85
|
+
"coins": rows,
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
def liquidation_cascades(self, symbol: Optional[str] = None, hours: int = 24, limit: int = 10) -> Dict[str, Any]:
|
|
89
|
+
c = self.get("/liquidations/cascades", hours=hours, limit=200)
|
|
90
|
+
ev = c.get("events") or []
|
|
91
|
+
sym = norm_symbol(symbol)
|
|
92
|
+
if sym:
|
|
93
|
+
ev = [e for e in ev if e.get("symbol") == sym]
|
|
94
|
+
ev = sorted(ev, key=lambda e: e.get("usd") or 0, reverse=True)[:limit]
|
|
95
|
+
keep = ("symbol", "side", "start", "minutes", "usd", "peak_usd", "x_normal", "impact_pct", "reversion_pct")
|
|
96
|
+
return {
|
|
97
|
+
"hours": c.get("hours"),
|
|
98
|
+
"events_total": c.get("events_total"),
|
|
99
|
+
"market_wide_minutes": len(c.get("market_wide") or []),
|
|
100
|
+
"largest": [{k: e.get(k) for k in keep} for e in ev],
|
|
101
|
+
"notes": "side = which side was liquidated; x_normal = multiples of the coin's own normal minute; "
|
|
102
|
+
"start is epoch ms; reversion_pct = how much of the move came back in the next hour. "
|
|
103
|
+
+ ((c.get("detector") or {}).get("caveat") or ""),
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
def liquidation_map(self, symbol: str = "BTCUSDT", top: int = 5) -> Dict[str, Any]:
|
|
107
|
+
m = self.get(f"/liqmap/hl/{norm_symbol(symbol) or 'BTCUSDT'}", range="1d")
|
|
108
|
+
px = m.get("current_price") or 0
|
|
109
|
+
bins, lo, sh = m.get("bins") or [], m.get("long") or [], m.get("short") or []
|
|
110
|
+
below = sorted(((b, v) for b, v in zip(bins, lo) if b < px and v > 0), key=lambda t: -t[1])[:top]
|
|
111
|
+
above = sorted(((b, v) for b, v in zip(bins, sh) if b > px and v > 0), key=lambda t: -t[1])[:top]
|
|
112
|
+
fmt = lambda t: {"price": round(t[0], 6), "usd": round(t[1]), "dist_pct": round((t[0] / px - 1) * 100, 2) if px else None}
|
|
113
|
+
return {
|
|
114
|
+
"symbol": m.get("symbol"),
|
|
115
|
+
"source": "measured Hyperliquid positions, binned by the liquidation price the exchange reports (not a model)",
|
|
116
|
+
"current_price": px,
|
|
117
|
+
"long_liquidations_below": [fmt(t) for t in sorted(below, key=lambda t: -t[0])],
|
|
118
|
+
"short_liquidations_above": [fmt(t) for t in sorted(above, key=lambda t: t[0])],
|
|
119
|
+
"total_long_below_usd": m.get("total_long_below"),
|
|
120
|
+
"total_short_above_usd": m.get("total_short_above"),
|
|
121
|
+
"coverage": m.get("coverage"),
|
|
122
|
+
"positions": m.get("positions"),
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
def funding_dispersion(self, symbol: Optional[str] = None, limit: int = 10) -> Dict[str, Any]:
|
|
126
|
+
sym = norm_symbol(symbol)
|
|
127
|
+
d = self.get("/funding/dispersion", limit=200 if sym else None)
|
|
128
|
+
rows = d.get("rows") or []
|
|
129
|
+
if sym:
|
|
130
|
+
rows = [r for r in rows if r.get("symbol") == sym]
|
|
131
|
+
out = []
|
|
132
|
+
for r in rows[:limit]:
|
|
133
|
+
x = {k: r.get(k) for k in ("symbol", "venues", "spread_apr", "long_venue", "long_apr",
|
|
134
|
+
"short_venue", "short_apr", "median_apr")}
|
|
135
|
+
if sym:
|
|
136
|
+
x["legs"] = [{k: l.get(k) for k in ("exchange", "apr", "funding_hours")} for l in r.get("legs") or []]
|
|
137
|
+
out.append(x)
|
|
138
|
+
return {
|
|
139
|
+
"window_minutes": d.get("window_minutes"),
|
|
140
|
+
"meaning": "APR in percent, each leg annualized on its own settlement cycle. long_venue is the cheapest "
|
|
141
|
+
"place to hold a long, short_venue the richest place to hold a short.",
|
|
142
|
+
"coins": out,
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
def tokenized_stocks(self, limit: int = 15) -> Dict[str, Any]:
|
|
146
|
+
t = self.get("/stocks/tokenized")
|
|
147
|
+
rows = sorted(t.get("rows") or [], key=lambda r: r.get("oi_usd") or 0, reverse=True)[:limit]
|
|
148
|
+
keep = ("id", "name", "class_label", "venues", "oi_usd", "volume_24h_usd", "change_24h_pct", "mark")
|
|
149
|
+
return {
|
|
150
|
+
"what": "tokenized stocks, indices, commodities and FX traded as perps on DEXs",
|
|
151
|
+
"underlyings": t.get("underlyings"),
|
|
152
|
+
"total_oi_usd": t.get("total_oi_usd"),
|
|
153
|
+
"total_volume_24h_usd": t.get("total_volume_24h_usd"),
|
|
154
|
+
"by_class": t.get("by_class"),
|
|
155
|
+
"largest": [{k: r.get(k) for k in keep} for r in rows],
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
TOOL_SPECS = [
|
|
160
|
+
("liquidvision_derivatives_brief", "brief",
|
|
161
|
+
"One-coin crypto derivatives snapshot: price, open interest by venue, liquidations by side, funding per "
|
|
162
|
+
"exchange, nearest liquidation zones, top-trader positioning. Input: symbol like BTC or ETHUSDT."),
|
|
163
|
+
("liquidvision_positioning_regime", "positioning_regime",
|
|
164
|
+
"Is a move new money or positions closing? Per coin: price change crossed with open-interest change "
|
|
165
|
+
"(new longs, short covering, new shorts, long flush). Optional symbol; without it, the biggest OI movers."),
|
|
166
|
+
("liquidvision_liquidation_cascades", "liquidation_cascades",
|
|
167
|
+
"Liquidation cascades as events over the last hours: coin, side liquidated, size, multiple of normal, "
|
|
168
|
+
"price impact and what price did after. Optional symbol."),
|
|
169
|
+
("liquidvision_liquidation_map", "liquidation_map",
|
|
170
|
+
"Where leverage would break: measured Hyperliquid positions by exchange-reported liquidation price, the "
|
|
171
|
+
"densest long-liquidation levels below price and short-liquidation levels above. Input: symbol."),
|
|
172
|
+
("liquidvision_funding_dispersion", "funding_dispersion",
|
|
173
|
+
"Where the same coin pays very different funding across 13 exchanges: cheapest venue to be long, richest "
|
|
174
|
+
"to be short, spread in APR. Optional symbol for per-venue legs."),
|
|
175
|
+
("liquidvision_tokenized_stocks", "tokenized_stocks",
|
|
176
|
+
"Tokenized stocks, indices, commodities and FX traded as perps on DEXs (Hyperliquid, Lighter, Ostium, "
|
|
177
|
+
"gTrade): open interest, volume, 24h change, largest markets."),
|
|
178
|
+
]
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def run(api: LiquidVisionAPI, method: str, **kwargs: Any) -> str:
|
|
182
|
+
"""Call a tool and return JSON text; errors come back as text so the agent can carry on."""
|
|
183
|
+
try:
|
|
184
|
+
return json.dumps(getattr(api, method)(**{k: v for k, v in kwargs.items() if v is not None}),
|
|
185
|
+
separators=(",", ":"), default=str)
|
|
186
|
+
except Exception as e: # noqa: BLE001
|
|
187
|
+
return json.dumps({"error": str(e)})
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: langchain-liquidvision
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: LangChain tools for LiquidVision.app crypto derivatives data: open interest, funding and liquidations on 13 venues, liquidation cascades, positioning regime, measured Hyperliquid liquidation maps, funding dispersion, tokenized stocks. Read-only, no key needed.
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://liquidvision.app
|
|
7
|
+
Project-URL: Documentation, https://liquidvision.app/llms.txt
|
|
8
|
+
Project-URL: Source, https://github.com/lv-analytics/liquidvision-mcp/tree/main/integrations/langchain
|
|
9
|
+
Keywords: langchain,langgraph,tools,crypto,derivatives,liquidations,open interest,funding rate,hyperliquid,trading,ai agent
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Requires-Python: >=3.9
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
Requires-Dist: langchain-core>=0.3
|
|
17
|
+
|
|
18
|
+
# langchain-liquidvision
|
|
19
|
+
|
|
20
|
+
Crypto derivatives tools for LangChain and LangGraph agents, from [LiquidVision.app](https://liquidvision.app).
|
|
21
|
+
Read-only, no key needed.
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install langchain-liquidvision
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
from langchain_liquidvision import LiquidVisionToolkit
|
|
29
|
+
from langgraph.prebuilt import create_react_agent
|
|
30
|
+
|
|
31
|
+
tools = LiquidVisionToolkit().get_tools()
|
|
32
|
+
agent = create_react_agent("anthropic:claude-sonnet-5-5", tools)
|
|
33
|
+
agent.invoke({"messages": [("user", "Is the ETH move new longs or short covering? Where are the liquidation levels?")]})
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
| Tool | Answers |
|
|
37
|
+
|---|---|
|
|
38
|
+
| `liquidvision_derivatives_brief` | One coin: price, open interest by venue, liquidations by side, funding per exchange, nearest liquidation zones |
|
|
39
|
+
| `liquidvision_positioning_regime` | New longs, short covering, new shorts or long flush: price change crossed with OI change |
|
|
40
|
+
| `liquidvision_liquidation_cascades` | Liquidation cascades as events: size, multiple of the coin's normal minute, price impact, reversion |
|
|
41
|
+
| `liquidvision_liquidation_map` | Measured Hyperliquid liquidation levels below and above price (exchange-reported, not modeled) |
|
|
42
|
+
| `liquidvision_funding_dispersion` | Cheapest venue to be long, richest to be short, across 13 exchanges |
|
|
43
|
+
| `liquidvision_tokenized_stocks` | Tokenized stocks, indices, commodities and FX perps on DEXs |
|
|
44
|
+
|
|
45
|
+
Each tool returns compact JSON. Errors come back as `{"error": ...}` so the agent keeps going.
|
|
46
|
+
|
|
47
|
+
**Limits.** 60 requests a minute per IP without a key. Set `LIQUIDVISION_API_KEY` (or
|
|
48
|
+
`LiquidVisionToolkit(api_key=...)`) with a Pro/Bot key for 600/1,200 a minute.
|
|
49
|
+
|
|
50
|
+
**More.** Raw rows, history and Parquet: the [`liquidvision`](https://pypi.org/project/liquidvision/) client.
|
|
51
|
+
MCP: `https://liquidvision.app/mcp/lite`. Docs: https://liquidvision.app/llms.txt
|
|
52
|
+
|
|
53
|
+
Data, not financial advice.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
langchain_liquidvision/__init__.py
|
|
4
|
+
langchain_liquidvision/_api.py
|
|
5
|
+
langchain_liquidvision.egg-info/PKG-INFO
|
|
6
|
+
langchain_liquidvision.egg-info/SOURCES.txt
|
|
7
|
+
langchain_liquidvision.egg-info/dependency_links.txt
|
|
8
|
+
langchain_liquidvision.egg-info/requires.txt
|
|
9
|
+
langchain_liquidvision.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
langchain-core>=0.3
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
langchain_liquidvision
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "langchain-liquidvision"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "LangChain tools for LiquidVision.app crypto derivatives data: open interest, funding and liquidations on 13 venues, liquidation cascades, positioning regime, measured Hyperliquid liquidation maps, funding dispersion, tokenized stocks. Read-only, no key needed."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
dependencies = ["langchain-core>=0.3"]
|
|
13
|
+
keywords = ["langchain", "langgraph", "tools", "crypto", "derivatives", "liquidations", "open interest", "funding rate", "hyperliquid", "trading", "ai agent"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Topic :: Office/Business :: Financial",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.urls]
|
|
22
|
+
Homepage = "https://liquidvision.app"
|
|
23
|
+
Documentation = "https://liquidvision.app/llms.txt"
|
|
24
|
+
Source = "https://github.com/lv-analytics/liquidvision-mcp/tree/main/integrations/langchain"
|
|
25
|
+
|
|
26
|
+
[tool.setuptools]
|
|
27
|
+
packages = ["langchain_liquidvision"]
|