compass_api_sdk 0.9.39__py3-none-any.whl → 0.9.41__py3-none-any.whl
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.
Potentially problematic release.
This version of compass_api_sdk might be problematic. Click here for more details.
- compass_api_sdk/_version.py +3 -3
- compass_api_sdk/models/__init__.py +31 -0
- compass_api_sdk/models/pendle_quoteop.py +128 -0
- compass_api_sdk/models/pendlegetquoteresponse.py +15 -0
- compass_api_sdk/models/vaultgetvaultresponse.py +11 -5
- compass_api_sdk/pendle.py +218 -0
- {compass_api_sdk-0.9.39.dist-info → compass_api_sdk-0.9.41.dist-info}/METADATA +2 -1
- {compass_api_sdk-0.9.39.dist-info → compass_api_sdk-0.9.41.dist-info}/RECORD +9 -7
- {compass_api_sdk-0.9.39.dist-info → compass_api_sdk-0.9.41.dist-info}/WHEEL +0 -0
compass_api_sdk/_version.py
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import importlib.metadata
|
|
4
4
|
|
|
5
5
|
__title__: str = "compass_api_sdk"
|
|
6
|
-
__version__: str = "0.9.
|
|
6
|
+
__version__: str = "0.9.41"
|
|
7
7
|
__openapi_doc_version__: str = "0.0.1"
|
|
8
|
-
__gen_version__: str = "2.648.
|
|
9
|
-
__user_agent__: str = "speakeasy-sdk/python 0.9.
|
|
8
|
+
__gen_version__: str = "2.648.7"
|
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 0.9.41 2.648.7 0.0.1 compass_api_sdk"
|
|
10
10
|
|
|
11
11
|
try:
|
|
12
12
|
if __package__ is not None:
|
|
@@ -524,6 +524,15 @@ if TYPE_CHECKING:
|
|
|
524
524
|
PendlePositionsRequest,
|
|
525
525
|
PendlePositionsRequestTypedDict,
|
|
526
526
|
)
|
|
527
|
+
from .pendle_quoteop import (
|
|
528
|
+
PendleQuoteAmount,
|
|
529
|
+
PendleQuoteAmountTypedDict,
|
|
530
|
+
PendleQuoteChain,
|
|
531
|
+
PendleQuoteRequest,
|
|
532
|
+
PendleQuoteRequestTypedDict,
|
|
533
|
+
TokenType,
|
|
534
|
+
TradeType,
|
|
535
|
+
)
|
|
527
536
|
from .pendleaddliquidityparams import (
|
|
528
537
|
PendleAddLiquidityParams,
|
|
529
538
|
PendleAddLiquidityParamsAmount,
|
|
@@ -564,6 +573,10 @@ if TYPE_CHECKING:
|
|
|
564
573
|
PendleGetMarketResponse,
|
|
565
574
|
PendleGetMarketResponseTypedDict,
|
|
566
575
|
)
|
|
576
|
+
from .pendlegetquoteresponse import (
|
|
577
|
+
PendleGetQuoteResponse,
|
|
578
|
+
PendleGetQuoteResponseTypedDict,
|
|
579
|
+
)
|
|
567
580
|
from .pendlegetuserpositionresponse import (
|
|
568
581
|
PendleGetUserPositionResponse,
|
|
569
582
|
PendleGetUserPositionResponseTypedDict,
|
|
@@ -1353,6 +1366,8 @@ __all__ = [
|
|
|
1353
1366
|
"PendleBuyYtRequestTypedDict",
|
|
1354
1367
|
"PendleGetMarketResponse",
|
|
1355
1368
|
"PendleGetMarketResponseTypedDict",
|
|
1369
|
+
"PendleGetQuoteResponse",
|
|
1370
|
+
"PendleGetQuoteResponseTypedDict",
|
|
1356
1371
|
"PendleGetUserPositionResponse",
|
|
1357
1372
|
"PendleGetUserPositionResponseTypedDict",
|
|
1358
1373
|
"PendleListMarketsResponse",
|
|
@@ -1373,6 +1388,11 @@ __all__ = [
|
|
|
1373
1388
|
"PendlePositionsChain",
|
|
1374
1389
|
"PendlePositionsRequest",
|
|
1375
1390
|
"PendlePositionsRequestTypedDict",
|
|
1391
|
+
"PendleQuoteAmount",
|
|
1392
|
+
"PendleQuoteAmountTypedDict",
|
|
1393
|
+
"PendleQuoteChain",
|
|
1394
|
+
"PendleQuoteRequest",
|
|
1395
|
+
"PendleQuoteRequestTypedDict",
|
|
1376
1396
|
"PendleRedeemYieldParams",
|
|
1377
1397
|
"PendleRedeemYieldParamsTypedDict",
|
|
1378
1398
|
"PendleRedeemYieldRequest",
|
|
@@ -1513,6 +1533,8 @@ __all__ = [
|
|
|
1513
1533
|
"TokenTransferRequestToken",
|
|
1514
1534
|
"TokenTransferRequestTokenTypedDict",
|
|
1515
1535
|
"TokenTransferRequestTypedDict",
|
|
1536
|
+
"TokenType",
|
|
1537
|
+
"TradeType",
|
|
1516
1538
|
"Transaction",
|
|
1517
1539
|
"TransactionTypedDict",
|
|
1518
1540
|
"TxResponse",
|
|
@@ -2039,6 +2061,13 @@ _dynamic_imports: dict[str, str] = {
|
|
|
2039
2061
|
"PendlePositionsChain": ".pendle_positionsop",
|
|
2040
2062
|
"PendlePositionsRequest": ".pendle_positionsop",
|
|
2041
2063
|
"PendlePositionsRequestTypedDict": ".pendle_positionsop",
|
|
2064
|
+
"PendleQuoteAmount": ".pendle_quoteop",
|
|
2065
|
+
"PendleQuoteAmountTypedDict": ".pendle_quoteop",
|
|
2066
|
+
"PendleQuoteChain": ".pendle_quoteop",
|
|
2067
|
+
"PendleQuoteRequest": ".pendle_quoteop",
|
|
2068
|
+
"PendleQuoteRequestTypedDict": ".pendle_quoteop",
|
|
2069
|
+
"TokenType": ".pendle_quoteop",
|
|
2070
|
+
"TradeType": ".pendle_quoteop",
|
|
2042
2071
|
"PendleAddLiquidityParams": ".pendleaddliquidityparams",
|
|
2043
2072
|
"PendleAddLiquidityParamsAmount": ".pendleaddliquidityparams",
|
|
2044
2073
|
"PendleAddLiquidityParamsAmountTypedDict": ".pendleaddliquidityparams",
|
|
@@ -2065,6 +2094,8 @@ _dynamic_imports: dict[str, str] = {
|
|
|
2065
2094
|
"PendleBuyYtRequestTypedDict": ".pendlebuyytrequest",
|
|
2066
2095
|
"PendleGetMarketResponse": ".pendlegetmarketresponse",
|
|
2067
2096
|
"PendleGetMarketResponseTypedDict": ".pendlegetmarketresponse",
|
|
2097
|
+
"PendleGetQuoteResponse": ".pendlegetquoteresponse",
|
|
2098
|
+
"PendleGetQuoteResponseTypedDict": ".pendlegetquoteresponse",
|
|
2068
2099
|
"PendleGetUserPositionResponse": ".pendlegetuserpositionresponse",
|
|
2069
2100
|
"PendleGetUserPositionResponseTypedDict": ".pendlegetuserpositionresponse",
|
|
2070
2101
|
"PendleListMarketsResponse": ".pendlelistmarketsresponse",
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from compass_api_sdk.types import (
|
|
5
|
+
BaseModel,
|
|
6
|
+
Nullable,
|
|
7
|
+
OptionalNullable,
|
|
8
|
+
UNSET,
|
|
9
|
+
UNSET_SENTINEL,
|
|
10
|
+
)
|
|
11
|
+
from compass_api_sdk.utils import FieldMetadata, QueryParamMetadata
|
|
12
|
+
from enum import Enum
|
|
13
|
+
from pydantic import model_serializer
|
|
14
|
+
from typing import Union
|
|
15
|
+
from typing_extensions import Annotated, NotRequired, TypeAliasType, TypedDict
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class PendleQuoteChain(str, Enum):
|
|
19
|
+
r"""The chain to use."""
|
|
20
|
+
|
|
21
|
+
BASE_MAINNET = "base:mainnet"
|
|
22
|
+
ETHEREUM_MAINNET = "ethereum:mainnet"
|
|
23
|
+
ARBITRUM_MAINNET = "arbitrum:mainnet"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
PendleQuoteAmountTypedDict = TypeAliasType(
|
|
27
|
+
"PendleQuoteAmountTypedDict", Union[float, str]
|
|
28
|
+
)
|
|
29
|
+
r"""The quantity to trade."""
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
PendleQuoteAmount = TypeAliasType("PendleQuoteAmount", Union[float, str])
|
|
33
|
+
r"""The quantity to trade."""
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class TokenType(str, Enum):
|
|
37
|
+
r"""Specifies the token to quote (`PT`, `YT`, or `LP`)"""
|
|
38
|
+
|
|
39
|
+
PT = "PT"
|
|
40
|
+
YT = "YT"
|
|
41
|
+
LP = "LP"
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class TradeType(str, Enum):
|
|
45
|
+
r"""Specifies the trade direction (`BUY` or `SELL`)"""
|
|
46
|
+
|
|
47
|
+
BUY = "BUY"
|
|
48
|
+
SELL = "SELL"
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class PendleQuoteRequestTypedDict(TypedDict):
|
|
52
|
+
amount: PendleQuoteAmountTypedDict
|
|
53
|
+
r"""The quantity to trade."""
|
|
54
|
+
chain: PendleQuoteChain
|
|
55
|
+
r"""The chain to use."""
|
|
56
|
+
block: NotRequired[Nullable[int]]
|
|
57
|
+
r"""Optional block number (defaults to latest)."""
|
|
58
|
+
market_address: str
|
|
59
|
+
r"""The market address of the desired position."""
|
|
60
|
+
token_type: TokenType
|
|
61
|
+
r"""Specifies the token to quote (`PT`, `YT`, or `LP`)"""
|
|
62
|
+
trade_type: TradeType
|
|
63
|
+
r"""Specifies the trade direction (`BUY` or `SELL`)"""
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class PendleQuoteRequest(BaseModel):
|
|
67
|
+
amount: Annotated[
|
|
68
|
+
PendleQuoteAmount,
|
|
69
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
70
|
+
]
|
|
71
|
+
r"""The quantity to trade."""
|
|
72
|
+
|
|
73
|
+
chain: Annotated[
|
|
74
|
+
PendleQuoteChain,
|
|
75
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
76
|
+
] = PendleQuoteChain.ARBITRUM_MAINNET
|
|
77
|
+
r"""The chain to use."""
|
|
78
|
+
|
|
79
|
+
block: Annotated[
|
|
80
|
+
OptionalNullable[int],
|
|
81
|
+
FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
|
|
82
|
+
] = UNSET
|
|
83
|
+
r"""Optional block number (defaults to latest)."""
|
|
84
|
+
|
|
85
|
+
market_address: Annotated[
|
|
86
|
+
str, FieldMetadata(query=QueryParamMetadata(style="form", explode=True))
|
|
87
|
+
] = "0x46d62a8dede1bf2d0de04f2ed863245cbba5e538"
|
|
88
|
+
r"""The market address of the desired position."""
|
|
89
|
+
|
|
90
|
+
token_type: Annotated[
|
|
91
|
+
TokenType, FieldMetadata(query=QueryParamMetadata(style="form", explode=True))
|
|
92
|
+
] = TokenType.PT
|
|
93
|
+
r"""Specifies the token to quote (`PT`, `YT`, or `LP`)"""
|
|
94
|
+
|
|
95
|
+
trade_type: Annotated[
|
|
96
|
+
TradeType, FieldMetadata(query=QueryParamMetadata(style="form", explode=True))
|
|
97
|
+
] = TradeType.BUY
|
|
98
|
+
r"""Specifies the trade direction (`BUY` or `SELL`)"""
|
|
99
|
+
|
|
100
|
+
@model_serializer(mode="wrap")
|
|
101
|
+
def serialize_model(self, handler):
|
|
102
|
+
optional_fields = ["block"]
|
|
103
|
+
nullable_fields = ["block"]
|
|
104
|
+
null_default_fields = []
|
|
105
|
+
|
|
106
|
+
serialized = handler(self)
|
|
107
|
+
|
|
108
|
+
m = {}
|
|
109
|
+
|
|
110
|
+
for n, f in type(self).model_fields.items():
|
|
111
|
+
k = f.alias or n
|
|
112
|
+
val = serialized.get(k)
|
|
113
|
+
serialized.pop(k, None)
|
|
114
|
+
|
|
115
|
+
optional_nullable = k in optional_fields and k in nullable_fields
|
|
116
|
+
is_set = (
|
|
117
|
+
self.__pydantic_fields_set__.intersection({n})
|
|
118
|
+
or k in null_default_fields
|
|
119
|
+
) # pylint: disable=no-member
|
|
120
|
+
|
|
121
|
+
if val is not None and val != UNSET_SENTINEL:
|
|
122
|
+
m[k] = val
|
|
123
|
+
elif val != UNSET_SENTINEL and (
|
|
124
|
+
not k in optional_fields or (optional_nullable and is_set)
|
|
125
|
+
):
|
|
126
|
+
m[k] = val
|
|
127
|
+
|
|
128
|
+
return m
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from compass_api_sdk.types import BaseModel
|
|
5
|
+
from typing_extensions import TypedDict
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class PendleGetQuoteResponseTypedDict(TypedDict):
|
|
9
|
+
quote: str
|
|
10
|
+
r"""A quote for the specified trade, detailing the expected amount of tokens received based on the `trade_type` and `token_type`."""
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class PendleGetQuoteResponse(BaseModel):
|
|
14
|
+
quote: str
|
|
15
|
+
r"""A quote for the specified trade, detailing the expected amount of tokens received based on the `trade_type` and `token_type`."""
|
|
@@ -7,9 +7,15 @@ from .compass_api_backend_models_vaults_read_response_vault_asset import (
|
|
|
7
7
|
CompassAPIBackendModelsVaultsReadResponseVaultAssetTypedDict,
|
|
8
8
|
)
|
|
9
9
|
from .userposition import UserPosition, UserPositionTypedDict
|
|
10
|
-
from compass_api_sdk.types import
|
|
10
|
+
from compass_api_sdk.types import (
|
|
11
|
+
BaseModel,
|
|
12
|
+
Nullable,
|
|
13
|
+
OptionalNullable,
|
|
14
|
+
UNSET,
|
|
15
|
+
UNSET_SENTINEL,
|
|
16
|
+
)
|
|
11
17
|
from pydantic import model_serializer
|
|
12
|
-
from typing_extensions import TypedDict
|
|
18
|
+
from typing_extensions import NotRequired, TypedDict
|
|
13
19
|
|
|
14
20
|
|
|
15
21
|
class VaultGetVaultResponseTypedDict(TypedDict):
|
|
@@ -27,7 +33,7 @@ class VaultGetVaultResponseTypedDict(TypedDict):
|
|
|
27
33
|
r"""The price of one vault share in terms of the underlying asset."""
|
|
28
34
|
asset: CompassAPIBackendModelsVaultsReadResponseVaultAssetTypedDict
|
|
29
35
|
apy: ApyTypedDict
|
|
30
|
-
user_position: Nullable[UserPositionTypedDict]
|
|
36
|
+
user_position: NotRequired[Nullable[UserPositionTypedDict]]
|
|
31
37
|
r"""The user's position in the vault."""
|
|
32
38
|
|
|
33
39
|
|
|
@@ -54,12 +60,12 @@ class VaultGetVaultResponse(BaseModel):
|
|
|
54
60
|
|
|
55
61
|
apy: Apy
|
|
56
62
|
|
|
57
|
-
user_position:
|
|
63
|
+
user_position: OptionalNullable[UserPosition] = UNSET
|
|
58
64
|
r"""The user's position in the vault."""
|
|
59
65
|
|
|
60
66
|
@model_serializer(mode="wrap")
|
|
61
67
|
def serialize_model(self, handler):
|
|
62
|
-
optional_fields = []
|
|
68
|
+
optional_fields = ["user_position"]
|
|
63
69
|
nullable_fields = ["user_position"]
|
|
64
70
|
null_default_fields = []
|
|
65
71
|
|
compass_api_sdk/pendle.py
CHANGED
|
@@ -756,6 +756,224 @@ class Pendle(BaseSDK):
|
|
|
756
756
|
|
|
757
757
|
raise errors.APIError("Unexpected response received", http_res)
|
|
758
758
|
|
|
759
|
+
def quote(
|
|
760
|
+
self,
|
|
761
|
+
*,
|
|
762
|
+
chain: models.PendleQuoteChain = models.PendleQuoteChain.ARBITRUM_MAINNET,
|
|
763
|
+
market_address: str = "0x46d62a8dede1bf2d0de04f2ed863245cbba5e538",
|
|
764
|
+
amount: Union[models.PendleQuoteAmount, models.PendleQuoteAmountTypedDict],
|
|
765
|
+
token_type: models.TokenType = models.TokenType.PT,
|
|
766
|
+
trade_type: models.TradeType = models.TradeType.BUY,
|
|
767
|
+
block: OptionalNullable[int] = UNSET,
|
|
768
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
769
|
+
server_url: Optional[str] = None,
|
|
770
|
+
timeout_ms: Optional[int] = None,
|
|
771
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
772
|
+
) -> models.PendleGetQuoteResponse:
|
|
773
|
+
r"""Get Quote
|
|
774
|
+
|
|
775
|
+
Retrieve a quote for trading Principal Token (PT), Yield Token (YT), or Liquidity
|
|
776
|
+
Provider Token (LP) on Pendle.
|
|
777
|
+
|
|
778
|
+
For `BUY`, `amount` is the quantity of the Underlying Token to spend, and the quote returns the amount of `token_type` received.
|
|
779
|
+
|
|
780
|
+
For `SELL`, `amount` is the quantity of `token_type` to sell, and the quote returns the amount of Underlying Token received.
|
|
781
|
+
|
|
782
|
+
:param chain: The chain to use.
|
|
783
|
+
:param market_address: The market address of the desired position.
|
|
784
|
+
:param amount: The quantity to trade.
|
|
785
|
+
:param token_type: Specifies the token to quote (`PT`, `YT`, or `LP`)
|
|
786
|
+
:param trade_type: Specifies the trade direction (`BUY` or `SELL`)
|
|
787
|
+
:param block: Optional block number (defaults to latest).
|
|
788
|
+
:param retries: Override the default retry configuration for this method
|
|
789
|
+
:param server_url: Override the default server URL for this method
|
|
790
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
791
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
792
|
+
"""
|
|
793
|
+
base_url = None
|
|
794
|
+
url_variables = None
|
|
795
|
+
if timeout_ms is None:
|
|
796
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
797
|
+
|
|
798
|
+
if server_url is not None:
|
|
799
|
+
base_url = server_url
|
|
800
|
+
else:
|
|
801
|
+
base_url = self._get_url(base_url, url_variables)
|
|
802
|
+
|
|
803
|
+
request = models.PendleQuoteRequest(
|
|
804
|
+
chain=chain,
|
|
805
|
+
block=block,
|
|
806
|
+
market_address=market_address,
|
|
807
|
+
amount=amount,
|
|
808
|
+
token_type=token_type,
|
|
809
|
+
trade_type=trade_type,
|
|
810
|
+
)
|
|
811
|
+
|
|
812
|
+
req = self._build_request(
|
|
813
|
+
method="GET",
|
|
814
|
+
path="/v0/pendle/quote",
|
|
815
|
+
base_url=base_url,
|
|
816
|
+
url_variables=url_variables,
|
|
817
|
+
request=request,
|
|
818
|
+
request_body_required=False,
|
|
819
|
+
request_has_path_params=False,
|
|
820
|
+
request_has_query_params=True,
|
|
821
|
+
user_agent_header="user-agent",
|
|
822
|
+
accept_header_value="application/json",
|
|
823
|
+
http_headers=http_headers,
|
|
824
|
+
security=self.sdk_configuration.security,
|
|
825
|
+
timeout_ms=timeout_ms,
|
|
826
|
+
)
|
|
827
|
+
|
|
828
|
+
if retries == UNSET:
|
|
829
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
830
|
+
retries = self.sdk_configuration.retry_config
|
|
831
|
+
|
|
832
|
+
retry_config = None
|
|
833
|
+
if isinstance(retries, utils.RetryConfig):
|
|
834
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
835
|
+
|
|
836
|
+
http_res = self.do_request(
|
|
837
|
+
hook_ctx=HookContext(
|
|
838
|
+
config=self.sdk_configuration,
|
|
839
|
+
base_url=base_url or "",
|
|
840
|
+
operation_id="pendle_quote",
|
|
841
|
+
oauth2_scopes=[],
|
|
842
|
+
security_source=self.sdk_configuration.security,
|
|
843
|
+
),
|
|
844
|
+
request=req,
|
|
845
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
846
|
+
retry_config=retry_config,
|
|
847
|
+
)
|
|
848
|
+
|
|
849
|
+
response_data: Any = None
|
|
850
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
851
|
+
return utils.unmarshal_json_response(
|
|
852
|
+
models.PendleGetQuoteResponse, http_res
|
|
853
|
+
)
|
|
854
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
855
|
+
response_data = utils.unmarshal_json_response(
|
|
856
|
+
errors.HTTPValidationErrorData, http_res
|
|
857
|
+
)
|
|
858
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
859
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
860
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
861
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
862
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
863
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
864
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
865
|
+
|
|
866
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
867
|
+
|
|
868
|
+
async def quote_async(
|
|
869
|
+
self,
|
|
870
|
+
*,
|
|
871
|
+
chain: models.PendleQuoteChain = models.PendleQuoteChain.ARBITRUM_MAINNET,
|
|
872
|
+
market_address: str = "0x46d62a8dede1bf2d0de04f2ed863245cbba5e538",
|
|
873
|
+
amount: Union[models.PendleQuoteAmount, models.PendleQuoteAmountTypedDict],
|
|
874
|
+
token_type: models.TokenType = models.TokenType.PT,
|
|
875
|
+
trade_type: models.TradeType = models.TradeType.BUY,
|
|
876
|
+
block: OptionalNullable[int] = UNSET,
|
|
877
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
878
|
+
server_url: Optional[str] = None,
|
|
879
|
+
timeout_ms: Optional[int] = None,
|
|
880
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
881
|
+
) -> models.PendleGetQuoteResponse:
|
|
882
|
+
r"""Get Quote
|
|
883
|
+
|
|
884
|
+
Retrieve a quote for trading Principal Token (PT), Yield Token (YT), or Liquidity
|
|
885
|
+
Provider Token (LP) on Pendle.
|
|
886
|
+
|
|
887
|
+
For `BUY`, `amount` is the quantity of the Underlying Token to spend, and the quote returns the amount of `token_type` received.
|
|
888
|
+
|
|
889
|
+
For `SELL`, `amount` is the quantity of `token_type` to sell, and the quote returns the amount of Underlying Token received.
|
|
890
|
+
|
|
891
|
+
:param chain: The chain to use.
|
|
892
|
+
:param market_address: The market address of the desired position.
|
|
893
|
+
:param amount: The quantity to trade.
|
|
894
|
+
:param token_type: Specifies the token to quote (`PT`, `YT`, or `LP`)
|
|
895
|
+
:param trade_type: Specifies the trade direction (`BUY` or `SELL`)
|
|
896
|
+
:param block: Optional block number (defaults to latest).
|
|
897
|
+
:param retries: Override the default retry configuration for this method
|
|
898
|
+
:param server_url: Override the default server URL for this method
|
|
899
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
900
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
901
|
+
"""
|
|
902
|
+
base_url = None
|
|
903
|
+
url_variables = None
|
|
904
|
+
if timeout_ms is None:
|
|
905
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
906
|
+
|
|
907
|
+
if server_url is not None:
|
|
908
|
+
base_url = server_url
|
|
909
|
+
else:
|
|
910
|
+
base_url = self._get_url(base_url, url_variables)
|
|
911
|
+
|
|
912
|
+
request = models.PendleQuoteRequest(
|
|
913
|
+
chain=chain,
|
|
914
|
+
block=block,
|
|
915
|
+
market_address=market_address,
|
|
916
|
+
amount=amount,
|
|
917
|
+
token_type=token_type,
|
|
918
|
+
trade_type=trade_type,
|
|
919
|
+
)
|
|
920
|
+
|
|
921
|
+
req = self._build_request_async(
|
|
922
|
+
method="GET",
|
|
923
|
+
path="/v0/pendle/quote",
|
|
924
|
+
base_url=base_url,
|
|
925
|
+
url_variables=url_variables,
|
|
926
|
+
request=request,
|
|
927
|
+
request_body_required=False,
|
|
928
|
+
request_has_path_params=False,
|
|
929
|
+
request_has_query_params=True,
|
|
930
|
+
user_agent_header="user-agent",
|
|
931
|
+
accept_header_value="application/json",
|
|
932
|
+
http_headers=http_headers,
|
|
933
|
+
security=self.sdk_configuration.security,
|
|
934
|
+
timeout_ms=timeout_ms,
|
|
935
|
+
)
|
|
936
|
+
|
|
937
|
+
if retries == UNSET:
|
|
938
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
939
|
+
retries = self.sdk_configuration.retry_config
|
|
940
|
+
|
|
941
|
+
retry_config = None
|
|
942
|
+
if isinstance(retries, utils.RetryConfig):
|
|
943
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
944
|
+
|
|
945
|
+
http_res = await self.do_request_async(
|
|
946
|
+
hook_ctx=HookContext(
|
|
947
|
+
config=self.sdk_configuration,
|
|
948
|
+
base_url=base_url or "",
|
|
949
|
+
operation_id="pendle_quote",
|
|
950
|
+
oauth2_scopes=[],
|
|
951
|
+
security_source=self.sdk_configuration.security,
|
|
952
|
+
),
|
|
953
|
+
request=req,
|
|
954
|
+
error_status_codes=["422", "4XX", "5XX"],
|
|
955
|
+
retry_config=retry_config,
|
|
956
|
+
)
|
|
957
|
+
|
|
958
|
+
response_data: Any = None
|
|
959
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
960
|
+
return utils.unmarshal_json_response(
|
|
961
|
+
models.PendleGetQuoteResponse, http_res
|
|
962
|
+
)
|
|
963
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
964
|
+
response_data = utils.unmarshal_json_response(
|
|
965
|
+
errors.HTTPValidationErrorData, http_res
|
|
966
|
+
)
|
|
967
|
+
raise errors.HTTPValidationError(response_data, http_res)
|
|
968
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
969
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
970
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
971
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
972
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
973
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
974
|
+
|
|
975
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
976
|
+
|
|
759
977
|
def buy_pt(
|
|
760
978
|
self,
|
|
761
979
|
*,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: compass_api_sdk
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.41
|
|
4
4
|
Summary: Compass API SDK.
|
|
5
5
|
Author: royalnine
|
|
6
6
|
Requires-Python: >=3.9.2
|
|
@@ -245,6 +245,7 @@ with CompassAPI(
|
|
|
245
245
|
* [positions](https://github.com/CompassLabs/mono/blob/master/docs/sdks/pendle/README.md#positions) - List User's Market Positions
|
|
246
246
|
* [market](https://github.com/CompassLabs/mono/blob/master/docs/sdks/pendle/README.md#market) - Get Market Data
|
|
247
247
|
* [markets](https://github.com/CompassLabs/mono/blob/master/docs/sdks/pendle/README.md#markets) - List Market Data
|
|
248
|
+
* [quote](https://github.com/CompassLabs/mono/blob/master/docs/sdks/pendle/README.md#quote) - Get Quote
|
|
248
249
|
* [buy_pt](https://github.com/CompassLabs/mono/blob/master/docs/sdks/pendle/README.md#buy_pt) - Buy Principal Token (PT)
|
|
249
250
|
* [sell_pt](https://github.com/CompassLabs/mono/blob/master/docs/sdks/pendle/README.md#sell_pt) - Sell Principal Token (PT)
|
|
250
251
|
* [buy_yt](https://github.com/CompassLabs/mono/blob/master/docs/sdks/pendle/README.md#buy_yt) - Buy Yield Token (YT)
|
|
@@ -2,7 +2,7 @@ compass_api_sdk/__init__.py,sha256=w2u919V3Tzv4zEPQ-OYJ79gQ_4_SyW7GOFFoHtqXDFA,4
|
|
|
2
2
|
compass_api_sdk/_hooks/__init__.py,sha256=p5J13DeYuISQyQWirjJAObHIf2VtIlOtFqnIpvjjVwk,118
|
|
3
3
|
compass_api_sdk/_hooks/sdkhooks.py,sha256=eVxHB2Q_JG6zZx5xn74i208ij-fpTHqq2jod6fbghRQ,2503
|
|
4
4
|
compass_api_sdk/_hooks/types.py,sha256=4qXm6dEntJOC2QeOdTklcc53oFzTU3HBb1xGdZ-kBXY,3059
|
|
5
|
-
compass_api_sdk/_version.py,sha256=
|
|
5
|
+
compass_api_sdk/_version.py,sha256=5vXl6ksiS6tvY2ZG7yAJYC_hNysWYfx-6WPFq8HcR_I,474
|
|
6
6
|
compass_api_sdk/aave_v3.py,sha256=HGztClaMj2E00gESokwbsZ9aiNGV1-okkrDzxUIZtJA,117024
|
|
7
7
|
compass_api_sdk/aerodrome_slipstream.py,sha256=_-tqCHmWlvbMfVl2hHvMpJfRKJVHAHEhB30oYwcqEY8,78375
|
|
8
8
|
compass_api_sdk/basesdk.py,sha256=PQNcMD7BiLruZwOuU2TeWIE_zQ0iO--XYUFmIDr5zX0,11844
|
|
@@ -14,7 +14,7 @@ compass_api_sdk/errors/httpvalidationerror.py,sha256=ebdzfILwY0BltW3MqxCpHipluRS
|
|
|
14
14
|
compass_api_sdk/errors/no_response_error.py,sha256=FQG44Lq6uF7uUlzbUYfM3dJon6sbqXzJ0Ri6YrDdsEs,380
|
|
15
15
|
compass_api_sdk/errors/responsevalidationerror.py,sha256=baMAkfmUhcPt_cxzyOCBCGBOzlXAeTHwcn5AUCsAgOw,702
|
|
16
16
|
compass_api_sdk/httpclient.py,sha256=Eu73urOAiZQtdUIyOUnPccxCiBbWEKrXG-JrRG3SLM4,3946
|
|
17
|
-
compass_api_sdk/models/__init__.py,sha256=
|
|
17
|
+
compass_api_sdk/models/__init__.py,sha256=h6GNTaXppmElG7_-dmLtx78CxvwBzGZZC-ZjJk5-XJA,118103
|
|
18
18
|
compass_api_sdk/models/aave_avg_rateop.py,sha256=Qn7IkBwZv5zY_L15V_LONkANzQPTbtmK2Wwhc2iqYz8,3718
|
|
19
19
|
compass_api_sdk/models/aave_historical_transactionsop.py,sha256=oWOjaRhNyjddZPqr5RfhNYf6V4Ye4gOQ0BDIXoqZGSs,1785
|
|
20
20
|
compass_api_sdk/models/aave_liquidity_changeop.py,sha256=o9G4dD2foyhbunziTv_177Qr2AK37KTIQsQfvPxo5Fs,2785
|
|
@@ -128,6 +128,7 @@ compass_api_sdk/models/pendle_marketop.py,sha256=LL4aKSGuJM3-iWujEqTLl1F4D89UzlI
|
|
|
128
128
|
compass_api_sdk/models/pendle_marketsop.py,sha256=LHFiQt07oujjdLItscPDEkOCh282rsc_Q2W0jYnkXXM,830
|
|
129
129
|
compass_api_sdk/models/pendle_positionop.py,sha256=UQi58V5JAeDqHeEXWeRgfqeD1zQoYgDaDFgT4aZXi8s,2754
|
|
130
130
|
compass_api_sdk/models/pendle_positionsop.py,sha256=TVqsZ_DuXi9Osl8vtETb33BrSc4tEMccLnqevU30avk,1134
|
|
131
|
+
compass_api_sdk/models/pendle_quoteop.py,sha256=924Xt5q0tkmB1thM5Y6wELh7EZ4y8uEFyfBoCj8F26o,3787
|
|
131
132
|
compass_api_sdk/models/pendleaddliquidityparams.py,sha256=03Jo5eLXbA-78187BU1LolAsE9pjKQ9VizwmlHYwkxM,2056
|
|
132
133
|
compass_api_sdk/models/pendleaddliquidityrequest.py,sha256=7N0XoGFfFvlqSqenjRMaRxt5TJrnNhGvCkj5W__plEQ,2315
|
|
133
134
|
compass_api_sdk/models/pendlebuyptparams.py,sha256=Y_3zGoBomfP1EFK1Gl6DKAOv7C3vSEsKw40xMTsVshk,1950
|
|
@@ -135,6 +136,7 @@ compass_api_sdk/models/pendlebuyptrequest.py,sha256=NQkaQ2HqjGeVx8yNwFz6a_r0ZrMm
|
|
|
135
136
|
compass_api_sdk/models/pendlebuyytparams.py,sha256=KNPS0zRlcr9R44jARza_nDoZNinHc4j34EuReii8JvI,1926
|
|
136
137
|
compass_api_sdk/models/pendlebuyytrequest.py,sha256=EzpfmTGzWLCuG2C6tFMeHXxdP5L7R6XzWEbMJDOy1Tk,2185
|
|
137
138
|
compass_api_sdk/models/pendlegetmarketresponse.py,sha256=zUnoLIjfGt-39sByJHW72l8N0GhcZe18JfV9UgXpuzI,899
|
|
139
|
+
compass_api_sdk/models/pendlegetquoteresponse.py,sha256=v-xQTnffKHix-tYuGnxCSiFU1HHs1cag492rB6B_1X4,591
|
|
138
140
|
compass_api_sdk/models/pendlegetuserpositionresponse.py,sha256=lGYK1LRI6osNYz5043uGO2aBYojDzXKK4cVnyvaFdmA,1913
|
|
139
141
|
compass_api_sdk/models/pendlelistmarketsresponse.py,sha256=-DlImGBzAP-yc0B1F9Cfer1ruFHLUEsRv2F1MQt2-hE,570
|
|
140
142
|
compass_api_sdk/models/pendlelistuserpositionsresponse.py,sha256=7QQ5xeGxlPo1mPrzR9LRwSlx7veUN3u2qnZDi6iVWj0,572
|
|
@@ -213,7 +215,7 @@ compass_api_sdk/models/userstate.py,sha256=uwoWC0y2Bv5jHW-F2MInZx0RwMihH6WxcXmem
|
|
|
213
215
|
compass_api_sdk/models/validationerror.py,sha256=01WnpU7Tgin0B_poO97_hl6b5CNJ_9VGzpcmoeJs4GU,532
|
|
214
216
|
compass_api_sdk/models/vault.py,sha256=ttepBiKO4o7-C97oALWOYAcN7ALDXmBFBcbQV_nfwO4,1849
|
|
215
217
|
compass_api_sdk/models/vaultdepositrequest.py,sha256=GXYfXNlMmExOxjgabMDFjRS4kjHovuofGNz9DHO1TDQ,3136
|
|
216
|
-
compass_api_sdk/models/vaultgetvaultresponse.py,sha256=
|
|
218
|
+
compass_api_sdk/models/vaultgetvaultresponse.py,sha256=WQov_CAnyMi9ihqiSTJa3rZ0gi5rDA0WksH5Sh5m0vU,2885
|
|
217
219
|
compass_api_sdk/models/vaultposition.py,sha256=o_Nyjc7GB5lLi11yCO6cp8nZpIvJcZzGB1iL_oCJUA0,801
|
|
218
220
|
compass_api_sdk/models/vaults_vaultop.py,sha256=4LE8AgOUsfDBDNcupsAnhbY_s20oMTRsHRazsF-slAY,2989
|
|
219
221
|
compass_api_sdk/models/vaultwithdrawrequest.py,sha256=w4STTo4hqAZ6OtCgflHlaKquFCDWyTEa399tURyFgTo,2758
|
|
@@ -222,7 +224,7 @@ compass_api_sdk/models/wrapethparams.py,sha256=nw1fZiDrj5wZnI25Vmg0DcNI01k-uhot6
|
|
|
222
224
|
compass_api_sdk/models/wrapethrequest.py,sha256=pjo0BZtzdOZKuwgnc05LsCWO1A6ZAGLwFixLuXQNKDg,1476
|
|
223
225
|
compass_api_sdk/models/yieldrange.py,sha256=WEpZR24JddnCS1_13y2P1CdD0lBi6dPktysCNu3TUic,324
|
|
224
226
|
compass_api_sdk/morpho.py,sha256=UPBNlW0DQDEDNOH0n2OJw1rHyw1KyigWB_Qr-Zw4NYA,108156
|
|
225
|
-
compass_api_sdk/pendle.py,sha256=
|
|
227
|
+
compass_api_sdk/pendle.py,sha256=W5GwVAK79VNVf0ASYXmmpuVLaL0vLYjyoT2kdfAR1P4,101746
|
|
226
228
|
compass_api_sdk/py.typed,sha256=zrp19r0G21lr2yRiMC0f8MFkQFGj9wMpSbboePMg8KM,59
|
|
227
229
|
compass_api_sdk/sdk.py,sha256=rQ3ANGf0BxHoZc9hCQvsxkNc9qOW3DbGAuOz_sy3o7g,7865
|
|
228
230
|
compass_api_sdk/sdkconfiguration.py,sha256=5nec4ViMLCsNWBd3DyEv8zWqU5Z77YZfzwX69jkdSnM,1607
|
|
@@ -250,6 +252,6 @@ compass_api_sdk/utils/security.py,sha256=ktep3HKwbFs-MLxUYTM8Jd4v-ZBum5_Z0u1PFId
|
|
|
250
252
|
compass_api_sdk/utils/serializers.py,sha256=_I2LpPIXnaN9LFxgBFUKj5w38Dd9TcOhNYL_sH6bIo8,6439
|
|
251
253
|
compass_api_sdk/utils/url.py,sha256=BgGPgcTA6MRK4bF8fjP2dUopN3NzEzxWMXPBVg8NQUA,5254
|
|
252
254
|
compass_api_sdk/utils/values.py,sha256=CcaCXEa3xHhkUDROyXZocN8f0bdITftv9Y0P9lTf0YM,3517
|
|
253
|
-
compass_api_sdk-0.9.
|
|
254
|
-
compass_api_sdk-0.9.
|
|
255
|
-
compass_api_sdk-0.9.
|
|
255
|
+
compass_api_sdk-0.9.41.dist-info/METADATA,sha256=PqGE2N2KmYpnoxXvMTxYYA9UGewvX9bCc9wmf5j0B9c,28625
|
|
256
|
+
compass_api_sdk-0.9.41.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
257
|
+
compass_api_sdk-0.9.41.dist-info/RECORD,,
|
|
File without changes
|