hyperquant 1.56__tar.gz → 1.57__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.
- {hyperquant-1.56 → hyperquant-1.57}/PKG-INFO +1 -1
- {hyperquant-1.56 → hyperquant-1.57}/pyproject.toml +1 -1
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/polymarket.py +123 -22
- {hyperquant-1.56 → hyperquant-1.57}/uv.lock +1 -1
- {hyperquant-1.56 → hyperquant-1.57}/.gitignore +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/README.md +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/requirements-dev.lock +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/requirements.lock +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/__init__.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/auth.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/bitget.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/bitmart.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/coinw.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/deepcoin.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/edgex.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/hyperliquid.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/lbank.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/lib/edgex_sign.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/lib/hpstore.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/lib/hyper_types.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/lib/polymarket/ctfAbi.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/lib/polymarket/safeAbi.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/lib/util.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/lighter.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/models/apexpro.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/models/bitget.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/models/bitmart.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/models/coinw.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/models/deepcoin.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/models/edgex.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/models/hyperliquid.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/models/lbank.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/models/lighter.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/models/ourbit.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/models/polymarket.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/ourbit.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/broker/ws.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/core.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/datavison/_util.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/datavison/binance.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/datavison/coinglass.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/datavison/okx.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/db.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/draw.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/logkit.py +0 -0
- {hyperquant-1.56 → hyperquant-1.57}/src/hyperquant/notikit.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hyperquant
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.57
|
|
4
4
|
Summary: A minimal yet hyper-efficient backtesting framework for quantitative trading
|
|
5
5
|
Project-URL: Homepage, https://github.com/yourusername/hyperquant
|
|
6
6
|
Project-URL: Issues, https://github.com/yourusername/hyperquant/issues
|
|
@@ -315,7 +315,7 @@ class Polymarket:
|
|
|
315
315
|
concurrency: int = 5,
|
|
316
316
|
callback: Callable[[dict[str, Any]], Awaitable[None] | None] | None = None,
|
|
317
317
|
) -> None:
|
|
318
|
-
"""Mount forward execution for
|
|
318
|
+
"""Mount forward execution for order placement and cancellation endpoints."""
|
|
319
319
|
cfg = {
|
|
320
320
|
"mode": mode,
|
|
321
321
|
"url": url,
|
|
@@ -1549,6 +1549,33 @@ class Polymarket:
|
|
|
1549
1549
|
"count": len(requests_payload),
|
|
1550
1550
|
}
|
|
1551
1551
|
|
|
1552
|
+
def _build_forward_signed_request(
|
|
1553
|
+
self,
|
|
1554
|
+
*,
|
|
1555
|
+
method: str,
|
|
1556
|
+
path: str,
|
|
1557
|
+
payload: Any,
|
|
1558
|
+
signer_addr: str,
|
|
1559
|
+
api_key: str,
|
|
1560
|
+
api_secret: str,
|
|
1561
|
+
api_passphrase: str,
|
|
1562
|
+
) -> dict[str, Any]:
|
|
1563
|
+
headers = self._build_l2_signed_headers(
|
|
1564
|
+
signer_addr=signer_addr,
|
|
1565
|
+
api_key=api_key,
|
|
1566
|
+
api_secret=api_secret,
|
|
1567
|
+
api_passphrase=api_passphrase,
|
|
1568
|
+
method=method,
|
|
1569
|
+
path=path,
|
|
1570
|
+
payload=payload,
|
|
1571
|
+
)
|
|
1572
|
+
return {
|
|
1573
|
+
"method": method.upper(),
|
|
1574
|
+
"url": f"{self.rest_api.rstrip('/')}{path}",
|
|
1575
|
+
"headers": headers,
|
|
1576
|
+
"body": payload,
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1552
1579
|
async def post_orders(
|
|
1553
1580
|
self,
|
|
1554
1581
|
orders: Iterable[tuple[Mapping[str, Any], str]],
|
|
@@ -1679,7 +1706,35 @@ class Polymarket:
|
|
|
1679
1706
|
"""
|
|
1680
1707
|
{'not_canceled': {}, 'canceled': ['0xb3507e9fda9541c3e038afcb4f24b96efcfa667d46cf5e9e52c41620711818df', '0x4b9c3ee4dee8653f15f716653e8ac83f0a086a38597e6ec4b72be2389c79b8b4']}
|
|
1681
1708
|
"""
|
|
1682
|
-
|
|
1709
|
+
payload = {"orderID": order_id}
|
|
1710
|
+
if self._forward_orders_cfg:
|
|
1711
|
+
session: aiohttp.ClientSession = getattr(self.client, "_session", None)
|
|
1712
|
+
if session is None:
|
|
1713
|
+
raise RuntimeError("pybotters client session missing")
|
|
1714
|
+
creds = getattr(session, "_polymarket_api_creds", None)
|
|
1715
|
+
if not creds:
|
|
1716
|
+
raise RuntimeError("Polymarket API creds missing; call create_or_derive_api_creds")
|
|
1717
|
+
api_key = creds.get("api_key")
|
|
1718
|
+
api_secret = creds.get("api_secret")
|
|
1719
|
+
api_passphrase = creds.get("api_passphrase")
|
|
1720
|
+
if not (api_key and api_secret and api_passphrase):
|
|
1721
|
+
raise RuntimeError("Polymarket API creds incomplete")
|
|
1722
|
+
|
|
1723
|
+
_, _, signer_addr = self._get_signing_context()
|
|
1724
|
+
requests_payload = [
|
|
1725
|
+
self._build_forward_signed_request(
|
|
1726
|
+
method="DELETE",
|
|
1727
|
+
path="/order",
|
|
1728
|
+
payload=payload,
|
|
1729
|
+
signer_addr=signer_addr,
|
|
1730
|
+
api_key=api_key,
|
|
1731
|
+
api_secret=api_secret,
|
|
1732
|
+
api_passphrase=api_passphrase,
|
|
1733
|
+
)
|
|
1734
|
+
]
|
|
1735
|
+
return await self._submit_forward_requests(requests_payload)
|
|
1736
|
+
|
|
1737
|
+
return await self._signed_request_via_session("DELETE", "/order", payload)
|
|
1683
1738
|
|
|
1684
1739
|
async def cancel_orders(
|
|
1685
1740
|
self,
|
|
@@ -1703,22 +1758,16 @@ class Polymarket:
|
|
|
1703
1758
|
raise RuntimeError("Polymarket API creds incomplete")
|
|
1704
1759
|
|
|
1705
1760
|
_, _, signer_addr = self._get_signing_context()
|
|
1706
|
-
headers = self._build_l2_signed_headers(
|
|
1707
|
-
signer_addr=signer_addr,
|
|
1708
|
-
api_key=api_key,
|
|
1709
|
-
api_secret=api_secret,
|
|
1710
|
-
api_passphrase=api_passphrase,
|
|
1711
|
-
method="DELETE",
|
|
1712
|
-
path="/orders",
|
|
1713
|
-
payload=payload,
|
|
1714
|
-
)
|
|
1715
1761
|
requests_payload = [
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
"
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1762
|
+
self._build_forward_signed_request(
|
|
1763
|
+
method="DELETE",
|
|
1764
|
+
path="/orders",
|
|
1765
|
+
payload=payload,
|
|
1766
|
+
signer_addr=signer_addr,
|
|
1767
|
+
api_key=api_key,
|
|
1768
|
+
api_secret=api_secret,
|
|
1769
|
+
api_passphrase=api_passphrase,
|
|
1770
|
+
)
|
|
1722
1771
|
]
|
|
1723
1772
|
return await self._submit_forward_requests(requests_payload)
|
|
1724
1773
|
|
|
@@ -1728,10 +1777,65 @@ class Polymarket:
|
|
|
1728
1777
|
"""
|
|
1729
1778
|
{'not_canceled': {}, 'canceled': ['0xb3507e9fda9541c3e038afcb4f24b96efcfa667d46cf5e9e52c41620711818df', '0x4b9c3ee4dee8653f15f716653e8ac83f0a086a38597e6ec4b72be2389c79b8b4']}
|
|
1730
1779
|
"""
|
|
1731
|
-
|
|
1780
|
+
payload = None
|
|
1781
|
+
if self._forward_orders_cfg:
|
|
1782
|
+
session: aiohttp.ClientSession = getattr(self.client, "_session", None)
|
|
1783
|
+
if session is None:
|
|
1784
|
+
raise RuntimeError("pybotters client session missing")
|
|
1785
|
+
creds = getattr(session, "_polymarket_api_creds", None)
|
|
1786
|
+
if not creds:
|
|
1787
|
+
raise RuntimeError("Polymarket API creds missing; call create_or_derive_api_creds")
|
|
1788
|
+
api_key = creds.get("api_key")
|
|
1789
|
+
api_secret = creds.get("api_secret")
|
|
1790
|
+
api_passphrase = creds.get("api_passphrase")
|
|
1791
|
+
if not (api_key and api_secret and api_passphrase):
|
|
1792
|
+
raise RuntimeError("Polymarket API creds incomplete")
|
|
1793
|
+
|
|
1794
|
+
_, _, signer_addr = self._get_signing_context()
|
|
1795
|
+
requests_payload = [
|
|
1796
|
+
self._build_forward_signed_request(
|
|
1797
|
+
method="DELETE",
|
|
1798
|
+
path="/cancel-all",
|
|
1799
|
+
payload=payload,
|
|
1800
|
+
signer_addr=signer_addr,
|
|
1801
|
+
api_key=api_key,
|
|
1802
|
+
api_secret=api_secret,
|
|
1803
|
+
api_passphrase=api_passphrase,
|
|
1804
|
+
)
|
|
1805
|
+
]
|
|
1806
|
+
return await self._submit_forward_requests(requests_payload)
|
|
1807
|
+
|
|
1808
|
+
return await self._signed_request_via_session("DELETE", "/cancel-all", payload)
|
|
1732
1809
|
|
|
1733
1810
|
async def cancel_market_orders(self, market: str = "", asset_id: str = "") -> Any:
|
|
1734
1811
|
body = {"market": market, "asset_id": asset_id}
|
|
1812
|
+
if self._forward_orders_cfg:
|
|
1813
|
+
session: aiohttp.ClientSession = getattr(self.client, "_session", None)
|
|
1814
|
+
if session is None:
|
|
1815
|
+
raise RuntimeError("pybotters client session missing")
|
|
1816
|
+
creds = getattr(session, "_polymarket_api_creds", None)
|
|
1817
|
+
if not creds:
|
|
1818
|
+
raise RuntimeError("Polymarket API creds missing; call create_or_derive_api_creds")
|
|
1819
|
+
api_key = creds.get("api_key")
|
|
1820
|
+
api_secret = creds.get("api_secret")
|
|
1821
|
+
api_passphrase = creds.get("api_passphrase")
|
|
1822
|
+
if not (api_key and api_secret and api_passphrase):
|
|
1823
|
+
raise RuntimeError("Polymarket API creds incomplete")
|
|
1824
|
+
|
|
1825
|
+
_, _, signer_addr = self._get_signing_context()
|
|
1826
|
+
requests_payload = [
|
|
1827
|
+
self._build_forward_signed_request(
|
|
1828
|
+
method="DELETE",
|
|
1829
|
+
path="/cancel-market-orders",
|
|
1830
|
+
payload=body,
|
|
1831
|
+
signer_addr=signer_addr,
|
|
1832
|
+
api_key=api_key,
|
|
1833
|
+
api_secret=api_secret,
|
|
1834
|
+
api_passphrase=api_passphrase,
|
|
1835
|
+
)
|
|
1836
|
+
]
|
|
1837
|
+
return await self._submit_forward_requests(requests_payload)
|
|
1838
|
+
|
|
1735
1839
|
return await self._signed_request_via_session("DELETE", "/cancel-market-orders", body)
|
|
1736
1840
|
|
|
1737
1841
|
async def get_order(self, order_id: str) -> Any:
|
|
@@ -2711,10 +2815,7 @@ class Polymarket:
|
|
|
2711
2815
|
self.auth = True
|
|
2712
2816
|
|
|
2713
2817
|
@staticmethod
|
|
2714
|
-
def load_poly_api():
|
|
2715
|
-
from dotenv import load_dotenv
|
|
2716
|
-
|
|
2717
|
-
load_dotenv()
|
|
2818
|
+
def load_poly_api() -> list[Any]:
|
|
2718
2819
|
pk = os.getenv("PK")
|
|
2719
2820
|
api_key = os.getenv("CLOB_API_KEY")
|
|
2720
2821
|
api_secret = os.getenv("CLOB_API_SECRET")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|