diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index adbbe6e..a7f612e 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -211,6 +211,7 @@ lighter/models/binary_option_market_stats.py lighter/models/block.py lighter/models/blocks.py lighter/models/bo_event_pn_l.py +lighter/models/bo_fee_tier.py lighter/models/bo_outcome_pn_l.py lighter/models/bridge_supported_network.py lighter/models/bridge_supported_networks.py @@ -232,6 +233,7 @@ lighter/models/exchange_metric.py lighter/models/exchange_stats.py lighter/models/execute_stat.py lighter/models/export_data.py +lighter/models/fee_tiers.py lighter/models/funding.py lighter/models/funding_rate.py lighter/models/funding_rates.py @@ -322,6 +324,7 @@ lighter/models/share_price.py lighter/models/simple_order.py lighter/models/slippage_result.py lighter/models/spot_order_book_detail.py +lighter/models/staking_fee_tier.py lighter/models/status.py lighter/models/strategy.py lighter/models/sub_account_metadata.py @@ -339,6 +342,7 @@ lighter/models/tx.py lighter/models/tx_hash.py lighter/models/txs.py lighter/models/up_down_candle.py +lighter/models/user_fee_tier.py lighter/models/user_referrals.py lighter/models/validator_info.py lighter/models/withdraw_history.py diff --git a/README.md b/README.md index 4018156..c409005 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,7 @@ Class | Method | HTTP request | Description *AccountApi* | [**accounts_by_l1_address**](docs/AccountApi.md#accounts_by_l1_address) | **GET** /api/v1/accountsByL1Address | accountsByL1Address *AccountApi* | [**apikeys**](docs/AccountApi.md#apikeys) | **GET** /api/v1/apikeys | apikeys *AccountApi* | [**change_account_tier**](docs/AccountApi.md#change_account_tier) | **POST** /api/v1/changeAccountTier | changeAccountTier +*AccountApi* | [**fee_tiers**](docs/AccountApi.md#fee_tiers) | **GET** /api/v1/feeTiers | feeTiers *AccountApi* | [**get_maker_only_api_keys**](docs/AccountApi.md#get_maker_only_api_keys) | **GET** /api/v1/getMakerOnlyApiKeys | getMakerOnlyApiKeys *AccountApi* | [**l1_metadata**](docs/AccountApi.md#l1_metadata) | **GET** /api/v1/l1Metadata | l1Metadata *AccountApi* | [**leaderboard**](docs/AccountApi.md#leaderboard) | **GET** /api/v1/leaderboard | leaderboard @@ -167,6 +168,7 @@ Class | Method | HTTP request | Description - [Block](docs/Block.md) - [Blocks](docs/Blocks.md) - [BoEventPnL](docs/BoEventPnL.md) + - [BoFeeTier](docs/BoFeeTier.md) - [BoOutcomePnL](docs/BoOutcomePnL.md) - [BridgeSupportedNetwork](docs/BridgeSupportedNetwork.md) - [BridgeSupportedNetworks](docs/BridgeSupportedNetworks.md) @@ -188,6 +190,7 @@ Class | Method | HTTP request | Description - [ExchangeStats](docs/ExchangeStats.md) - [ExecuteStat](docs/ExecuteStat.md) - [ExportData](docs/ExportData.md) + - [FeeTiers](docs/FeeTiers.md) - [Funding](docs/Funding.md) - [FundingRate](docs/FundingRate.md) - [FundingRates](docs/FundingRates.md) @@ -278,6 +281,7 @@ Class | Method | HTTP request | Description - [SimpleOrder](docs/SimpleOrder.md) - [SlippageResult](docs/SlippageResult.md) - [SpotOrderBookDetail](docs/SpotOrderBookDetail.md) + - [StakingFeeTier](docs/StakingFeeTier.md) - [Status](docs/Status.md) - [Strategy](docs/Strategy.md) - [SubAccountMetadata](docs/SubAccountMetadata.md) @@ -295,6 +299,7 @@ Class | Method | HTTP request | Description - [TxHash](docs/TxHash.md) - [Txs](docs/Txs.md) - [UpDownCandle](docs/UpDownCandle.md) + - [UserFeeTier](docs/UserFeeTier.md) - [UserReferrals](docs/UserReferrals.md) - [ValidatorInfo](docs/ValidatorInfo.md) - [WithdrawHistory](docs/WithdrawHistory.md) diff --git a/docs/AccountApi.md b/docs/AccountApi.md index 34edadf..d39d537 100644 --- a/docs/AccountApi.md +++ b/docs/AccountApi.md @@ -10,6 +10,7 @@ Method | HTTP request | Description [**accounts_by_l1_address**](AccountApi.md#accounts_by_l1_address) | **GET** /api/v1/accountsByL1Address | accountsByL1Address [**apikeys**](AccountApi.md#apikeys) | **GET** /api/v1/apikeys | apikeys [**change_account_tier**](AccountApi.md#change_account_tier) | **POST** /api/v1/changeAccountTier | changeAccountTier +[**fee_tiers**](AccountApi.md#fee_tiers) | **GET** /api/v1/feeTiers | feeTiers [**get_maker_only_api_keys**](AccountApi.md#get_maker_only_api_keys) | **GET** /api/v1/getMakerOnlyApiKeys | getMakerOnlyApiKeys [**l1_metadata**](AccountApi.md#l1_metadata) | **GET** /api/v1/l1Metadata | l1Metadata [**leaderboard**](AccountApi.md#leaderboard) | **GET** /api/v1/leaderboard | leaderboard @@ -470,6 +471,75 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **fee_tiers** +> FeeTiers fee_tiers(filter=filter) + +feeTiers + +Get fee tiers. filter=perps|spot returns the regular user tiers (both market types share them). filter=bo returns BO volume tiers and LIT staking discount tiers; filter=all returns everything. An account's BO multiplier is the BO tier fee_rate times the staking fee_rate, applied to each BO market's maker/taker fee (see /api/v1/events) and then scaled by 1 - trade_price / settlement_cap. + +### Example + + +```python +import lighter +from lighter.models.fee_tiers import FeeTiers +from lighter.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://mainnet.zklighter.elliot.ai +# See configuration.py for a list of all supported configuration parameters. +configuration = lighter.Configuration( + host = "https://mainnet.zklighter.elliot.ai" +) + + +# Enter a context with an instance of the API client +async with lighter.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = lighter.AccountApi(api_client) + filter = all # str | (optional) (default to all) + + try: + # feeTiers + api_response = await api_instance.fee_tiers(filter=filter) + print("The response of AccountApi->fee_tiers:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AccountApi->fee_tiers: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **filter** | **str**| | [optional] [default to all] + +### Return type + +[**FeeTiers**](FeeTiers.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | A successful response. | - | +**400** | Bad request | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **get_maker_only_api_keys** > RespGetMakerOnlyApiKeys get_maker_only_api_keys(authorization, account_index) diff --git a/docs/BoFeeTier.md b/docs/BoFeeTier.md new file mode 100644 index 0000000..96eccdc --- /dev/null +++ b/docs/BoFeeTier.md @@ -0,0 +1,31 @@ +# BoFeeTier + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | +**required_volume** | **int** | | +**fee_rate** | **float** | | + +## Example + +```python +from lighter.models.bo_fee_tier import BoFeeTier + +# TODO update the JSON string below +json = "{}" +# create an instance of BoFeeTier from a JSON string +bo_fee_tier_instance = BoFeeTier.from_json(json) +# print the JSON string representation of the object +print(BoFeeTier.to_json()) + +# convert the object into a dict +bo_fee_tier_dict = bo_fee_tier_instance.to_dict() +# create an instance of BoFeeTier from a dict +bo_fee_tier_from_dict = BoFeeTier.from_dict(bo_fee_tier_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/EventApi.md b/docs/EventApi.md index bb84480..7b4c840 100644 --- a/docs/EventApi.md +++ b/docs/EventApi.md @@ -12,7 +12,7 @@ Method | HTTP request | Description events -Get events and registered order books, including scheduled events with no books. event_ids and market_ids accept up to 50 comma-separated positive IDs, are mutually exclusive, and use the same filters, sorting and pagination. market_ids returns each related event once with all its order books. Defaults to descending id. Occurrence sorting uses (occurrence_start_at, event_id); cursor identifies an existing event and excludes it in the requested direction. tag filters across creators; creator_account_index is an optional additional filter. active=true requires a tradeable outcome; active=false includes scheduled and closed events. +Get events and registered order books, including scheduled events with no books. event_ids and market_ids accept up to 50 comma-separated positive IDs, are mutually exclusive, and use the same filters, sorting and pagination. market_ids returns each related event once with all its order books. Defaults to descending id. start_at sorting uses (start_at, event_id); cursor identifies an existing event and excludes it in the requested direction. tag filters across creators; creator_account_index is an optional additional filter. active=true requires a tradeable outcome; active=false includes scheduled and closed events. ### Example @@ -42,8 +42,8 @@ async with lighter.ApiClient(configuration) as api_client: limit = 56 # int | (optional) tag = 'tag_example' # str | series tag; creator filter is optional (optional) event_kind = 'event_kind_example' # str | (optional) - start_from = 56 # int | inclusive occurrence start, Unix milliseconds (optional) - start_before = 56 # int | exclusive occurrence start, Unix milliseconds (optional) + start_from = 56 # int | inclusive start_at, Unix milliseconds (optional) + start_before = 56 # int | exclusive start_at, Unix milliseconds (optional) sort = id # str | (optional) (default to id) order = desc # str | (optional) (default to desc) @@ -71,8 +71,8 @@ Name | Type | Description | Notes **limit** | **int**| | [optional] **tag** | **str**| series tag; creator filter is optional | [optional] **event_kind** | **str**| | [optional] - **start_from** | **int**| inclusive occurrence start, Unix milliseconds | [optional] - **start_before** | **int**| exclusive occurrence start, Unix milliseconds | [optional] + **start_from** | **int**| inclusive start_at, Unix milliseconds | [optional] + **start_before** | **int**| exclusive start_at, Unix milliseconds | [optional] **sort** | **str**| | [optional] [default to id] **order** | **str**| | [optional] [default to desc] diff --git a/docs/EventDetail.md b/docs/EventDetail.md index 8aa6206..149bac4 100644 --- a/docs/EventDetail.md +++ b/docs/EventDetail.md @@ -13,8 +13,8 @@ Name | Type | Description | Notes **tag** | **str** | | **event_kind** | **str** | | **recurrence_period_seconds** | **int** | | -**occurrence_start_at** | **int** | | -**occurrence_end_at** | **int** | | +**start_at** | **int** | | +**end_at** | **int** | | **metadata** | **Dict[str, object]** | | **order_books** | [**List[EventOrderBookEntry]**](EventOrderBookEntry.md) | | **lifetime_quote_token_volume** | **float** | | diff --git a/docs/EventOrderBookEntry.md b/docs/EventOrderBookEntry.md index 153771a..2e76566 100644 --- a/docs/EventOrderBookEntry.md +++ b/docs/EventOrderBookEntry.md @@ -11,7 +11,7 @@ Name | Type | Description | Notes **market_type** | **str** | | **base_asset_id** | **int** | | **quote_asset_id** | **int** | | -**status** | **str** | | +**status** | **str** | waiting-for-settlement and settled are binary options only | **taker_fee** | **str** | | **is_taker_fee_enabled** | **bool** | | **maker_fee** | **str** | | diff --git a/docs/FeeTiers.md b/docs/FeeTiers.md new file mode 100644 index 0000000..0db6180 --- /dev/null +++ b/docs/FeeTiers.md @@ -0,0 +1,31 @@ +# FeeTiers + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**user_tiers** | [**List[UserFeeTier]**](UserFeeTier.md) | | +**bo_tiers** | [**List[BoFeeTier]**](BoFeeTier.md) | | +**staking_tiers** | [**List[StakingFeeTier]**](StakingFeeTier.md) | | + +## Example + +```python +from lighter.models.fee_tiers import FeeTiers + +# TODO update the JSON string below +json = "{}" +# create an instance of FeeTiers from a JSON string +fee_tiers_instance = FeeTiers.from_json(json) +# print the JSON string representation of the object +print(FeeTiers.to_json()) + +# convert the object into a dict +fee_tiers_dict = fee_tiers_instance.to_dict() +# create an instance of FeeTiers from a dict +fee_tiers_from_dict = FeeTiers.from_dict(fee_tiers_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/StakingFeeTier.md b/docs/StakingFeeTier.md new file mode 100644 index 0000000..22c40ae --- /dev/null +++ b/docs/StakingFeeTier.md @@ -0,0 +1,31 @@ +# StakingFeeTier + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | +**required_lit_stakes** | **int** | | +**fee_rate** | **float** | | + +## Example + +```python +from lighter.models.staking_fee_tier import StakingFeeTier + +# TODO update the JSON string below +json = "{}" +# create an instance of StakingFeeTier from a JSON string +staking_fee_tier_instance = StakingFeeTier.from_json(json) +# print the JSON string representation of the object +print(StakingFeeTier.to_json()) + +# convert the object into a dict +staking_fee_tier_dict = staking_fee_tier_instance.to_dict() +# create an instance of StakingFeeTier from a dict +staking_fee_tier_from_dict = StakingFeeTier.from_dict(staking_fee_tier_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/UserFeeTier.md b/docs/UserFeeTier.md new file mode 100644 index 0000000..b5c5982 --- /dev/null +++ b/docs/UserFeeTier.md @@ -0,0 +1,34 @@ +# UserFeeTier + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | +**level** | **int** | | +**maker_fee_ticks** | **int** | | +**taker_fee_ticks** | **int** | | +**required_lit_stakes** | **int** | | +**required_volume** | **int** | | + +## Example + +```python +from lighter.models.user_fee_tier import UserFeeTier + +# TODO update the JSON string below +json = "{}" +# create an instance of UserFeeTier from a JSON string +user_fee_tier_instance = UserFeeTier.from_json(json) +# print the JSON string representation of the object +print(UserFeeTier.to_json()) + +# convert the object into a dict +user_fee_tier_dict = user_fee_tier_instance.to_dict() +# create an instance of UserFeeTier from a dict +user_fee_tier_from_dict = UserFeeTier.from_dict(user_fee_tier_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/lighter/__init__.py b/lighter/__init__.py index 3e2a9b7..ab53d4d 100644 --- a/lighter/__init__.py +++ b/lighter/__init__.py @@ -66,6 +66,7 @@ from lighter.models.block import Block from lighter.models.blocks import Blocks from lighter.models.bo_event_pn_l import BoEventPnL +from lighter.models.bo_fee_tier import BoFeeTier from lighter.models.bo_outcome_pn_l import BoOutcomePnL from lighter.models.bridge_supported_network import BridgeSupportedNetwork from lighter.models.bridge_supported_networks import BridgeSupportedNetworks @@ -87,6 +88,7 @@ from lighter.models.exchange_stats import ExchangeStats from lighter.models.execute_stat import ExecuteStat from lighter.models.export_data import ExportData +from lighter.models.fee_tiers import FeeTiers from lighter.models.funding import Funding from lighter.models.funding_rate import FundingRate from lighter.models.funding_rates import FundingRates @@ -177,6 +179,7 @@ from lighter.models.simple_order import SimpleOrder from lighter.models.slippage_result import SlippageResult from lighter.models.spot_order_book_detail import SpotOrderBookDetail +from lighter.models.staking_fee_tier import StakingFeeTier from lighter.models.status import Status from lighter.models.strategy import Strategy from lighter.models.sub_account_metadata import SubAccountMetadata @@ -194,6 +197,7 @@ from lighter.models.tx_hash import TxHash from lighter.models.txs import Txs from lighter.models.up_down_candle import UpDownCandle +from lighter.models.user_fee_tier import UserFeeTier from lighter.models.user_referrals import UserReferrals from lighter.models.validator_info import ValidatorInfo from lighter.models.withdraw_history import WithdrawHistory diff --git a/lighter/api/account_api.py b/lighter/api/account_api.py index b670050..13c7ea5 100644 --- a/lighter/api/account_api.py +++ b/lighter/api/account_api.py @@ -24,6 +24,7 @@ from lighter.models.account_metadatas import AccountMetadatas from lighter.models.account_pn_l import AccountPnL from lighter.models.detailed_accounts import DetailedAccounts +from lighter.models.fee_tiers import FeeTiers from lighter.models.l1_metadata import L1Metadata from lighter.models.leaderboard import Leaderboard from lighter.models.liquidation_infos import LiquidationInfos @@ -1816,6 +1817,266 @@ def _change_account_tier_serialize( + async def fee_tiers( + self, + filter: Optional[StrictStr] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> FeeTiers: + """feeTiers + + Get fee tiers. filter=perps|spot returns the regular user tiers (both market types share them). filter=bo returns BO volume tiers and LIT staking discount tiers; filter=all returns everything. An account's BO multiplier is the BO tier fee_rate times the staking fee_rate, applied to each BO market's maker/taker fee (see /api/v1/events) and then scaled by 1 - trade_price / settlement_cap. + + :param filter: + :type filter: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._fee_tiers_serialize( + filter=filter, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FeeTiers", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + async def fee_tiers_with_http_info( + self, + filter: Optional[StrictStr] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[FeeTiers]: + """feeTiers + + Get fee tiers. filter=perps|spot returns the regular user tiers (both market types share them). filter=bo returns BO volume tiers and LIT staking discount tiers; filter=all returns everything. An account's BO multiplier is the BO tier fee_rate times the staking fee_rate, applied to each BO market's maker/taker fee (see /api/v1/events) and then scaled by 1 - trade_price / settlement_cap. + + :param filter: + :type filter: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._fee_tiers_serialize( + filter=filter, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FeeTiers", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + async def fee_tiers_without_preload_content( + self, + filter: Optional[StrictStr] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """feeTiers + + Get fee tiers. filter=perps|spot returns the regular user tiers (both market types share them). filter=bo returns BO volume tiers and LIT staking discount tiers; filter=all returns everything. An account's BO multiplier is the BO tier fee_rate times the staking fee_rate, applied to each BO market's maker/taker fee (see /api/v1/events) and then scaled by 1 - trade_price / settlement_cap. + + :param filter: + :type filter: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._fee_tiers_serialize( + filter=filter, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FeeTiers", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _fee_tiers_serialize( + self, + filter, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if filter is not None: + + _query_params.append(('filter', filter)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/api/v1/feeTiers', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + async def get_maker_only_api_keys( self, authorization: StrictStr, diff --git a/lighter/api/event_api.py b/lighter/api/event_api.py index 8f4c362..eadd833 100644 --- a/lighter/api/event_api.py +++ b/lighter/api/event_api.py @@ -49,8 +49,8 @@ async def events( limit: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = None, tag: Annotated[Optional[StrictStr], Field(description=" series tag; creator filter is optional")] = None, event_kind: Optional[StrictStr] = None, - start_from: Annotated[Optional[StrictInt], Field(description=" inclusive occurrence start, Unix milliseconds")] = None, - start_before: Annotated[Optional[StrictInt], Field(description=" exclusive occurrence start, Unix milliseconds")] = None, + start_from: Annotated[Optional[StrictInt], Field(description=" inclusive start_at, Unix milliseconds")] = None, + start_before: Annotated[Optional[StrictInt], Field(description=" exclusive start_at, Unix milliseconds")] = None, sort: Optional[StrictStr] = None, order: Optional[StrictStr] = None, _request_timeout: Union[ @@ -68,7 +68,7 @@ async def events( ) -> RespGetEvents: """events - Get events and registered order books, including scheduled events with no books. event_ids and market_ids accept up to 50 comma-separated positive IDs, are mutually exclusive, and use the same filters, sorting and pagination. market_ids returns each related event once with all its order books. Defaults to descending id. Occurrence sorting uses (occurrence_start_at, event_id); cursor identifies an existing event and excludes it in the requested direction. tag filters across creators; creator_account_index is an optional additional filter. active=true requires a tradeable outcome; active=false includes scheduled and closed events. + Get events and registered order books, including scheduled events with no books. event_ids and market_ids accept up to 50 comma-separated positive IDs, are mutually exclusive, and use the same filters, sorting and pagination. market_ids returns each related event once with all its order books. Defaults to descending id. start_at sorting uses (start_at, event_id); cursor identifies an existing event and excludes it in the requested direction. tag filters across creators; creator_account_index is an optional additional filter. active=true requires a tradeable outcome; active=false includes scheduled and closed events. :param event_ids: comma-separated positive IDs, max 50 :type event_ids: str @@ -86,9 +86,9 @@ async def events( :type tag: str :param event_kind: :type event_kind: str - :param start_from: inclusive occurrence start, Unix milliseconds + :param start_from: inclusive start_at, Unix milliseconds :type start_from: int - :param start_before: exclusive occurrence start, Unix milliseconds + :param start_before: exclusive start_at, Unix milliseconds :type start_before: int :param sort: :type sort: str @@ -160,8 +160,8 @@ async def events_with_http_info( limit: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = None, tag: Annotated[Optional[StrictStr], Field(description=" series tag; creator filter is optional")] = None, event_kind: Optional[StrictStr] = None, - start_from: Annotated[Optional[StrictInt], Field(description=" inclusive occurrence start, Unix milliseconds")] = None, - start_before: Annotated[Optional[StrictInt], Field(description=" exclusive occurrence start, Unix milliseconds")] = None, + start_from: Annotated[Optional[StrictInt], Field(description=" inclusive start_at, Unix milliseconds")] = None, + start_before: Annotated[Optional[StrictInt], Field(description=" exclusive start_at, Unix milliseconds")] = None, sort: Optional[StrictStr] = None, order: Optional[StrictStr] = None, _request_timeout: Union[ @@ -179,7 +179,7 @@ async def events_with_http_info( ) -> ApiResponse[RespGetEvents]: """events - Get events and registered order books, including scheduled events with no books. event_ids and market_ids accept up to 50 comma-separated positive IDs, are mutually exclusive, and use the same filters, sorting and pagination. market_ids returns each related event once with all its order books. Defaults to descending id. Occurrence sorting uses (occurrence_start_at, event_id); cursor identifies an existing event and excludes it in the requested direction. tag filters across creators; creator_account_index is an optional additional filter. active=true requires a tradeable outcome; active=false includes scheduled and closed events. + Get events and registered order books, including scheduled events with no books. event_ids and market_ids accept up to 50 comma-separated positive IDs, are mutually exclusive, and use the same filters, sorting and pagination. market_ids returns each related event once with all its order books. Defaults to descending id. start_at sorting uses (start_at, event_id); cursor identifies an existing event and excludes it in the requested direction. tag filters across creators; creator_account_index is an optional additional filter. active=true requires a tradeable outcome; active=false includes scheduled and closed events. :param event_ids: comma-separated positive IDs, max 50 :type event_ids: str @@ -197,9 +197,9 @@ async def events_with_http_info( :type tag: str :param event_kind: :type event_kind: str - :param start_from: inclusive occurrence start, Unix milliseconds + :param start_from: inclusive start_at, Unix milliseconds :type start_from: int - :param start_before: exclusive occurrence start, Unix milliseconds + :param start_before: exclusive start_at, Unix milliseconds :type start_before: int :param sort: :type sort: str @@ -271,8 +271,8 @@ async def events_without_preload_content( limit: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = None, tag: Annotated[Optional[StrictStr], Field(description=" series tag; creator filter is optional")] = None, event_kind: Optional[StrictStr] = None, - start_from: Annotated[Optional[StrictInt], Field(description=" inclusive occurrence start, Unix milliseconds")] = None, - start_before: Annotated[Optional[StrictInt], Field(description=" exclusive occurrence start, Unix milliseconds")] = None, + start_from: Annotated[Optional[StrictInt], Field(description=" inclusive start_at, Unix milliseconds")] = None, + start_before: Annotated[Optional[StrictInt], Field(description=" exclusive start_at, Unix milliseconds")] = None, sort: Optional[StrictStr] = None, order: Optional[StrictStr] = None, _request_timeout: Union[ @@ -290,7 +290,7 @@ async def events_without_preload_content( ) -> RESTResponseType: """events - Get events and registered order books, including scheduled events with no books. event_ids and market_ids accept up to 50 comma-separated positive IDs, are mutually exclusive, and use the same filters, sorting and pagination. market_ids returns each related event once with all its order books. Defaults to descending id. Occurrence sorting uses (occurrence_start_at, event_id); cursor identifies an existing event and excludes it in the requested direction. tag filters across creators; creator_account_index is an optional additional filter. active=true requires a tradeable outcome; active=false includes scheduled and closed events. + Get events and registered order books, including scheduled events with no books. event_ids and market_ids accept up to 50 comma-separated positive IDs, are mutually exclusive, and use the same filters, sorting and pagination. market_ids returns each related event once with all its order books. Defaults to descending id. start_at sorting uses (start_at, event_id); cursor identifies an existing event and excludes it in the requested direction. tag filters across creators; creator_account_index is an optional additional filter. active=true requires a tradeable outcome; active=false includes scheduled and closed events. :param event_ids: comma-separated positive IDs, max 50 :type event_ids: str @@ -308,9 +308,9 @@ async def events_without_preload_content( :type tag: str :param event_kind: :type event_kind: str - :param start_from: inclusive occurrence start, Unix milliseconds + :param start_from: inclusive start_at, Unix milliseconds :type start_from: int - :param start_before: exclusive occurrence start, Unix milliseconds + :param start_before: exclusive start_at, Unix milliseconds :type start_before: int :param sort: :type sort: str diff --git a/lighter/models/__init__.py b/lighter/models/__init__.py index 2a21bdf..979d0cb 100644 --- a/lighter/models/__init__.py +++ b/lighter/models/__init__.py @@ -33,6 +33,7 @@ from lighter.models.block import Block from lighter.models.blocks import Blocks from lighter.models.bo_event_pn_l import BoEventPnL +from lighter.models.bo_fee_tier import BoFeeTier from lighter.models.bo_outcome_pn_l import BoOutcomePnL from lighter.models.bridge_supported_network import BridgeSupportedNetwork from lighter.models.bridge_supported_networks import BridgeSupportedNetworks @@ -54,6 +55,7 @@ from lighter.models.exchange_stats import ExchangeStats from lighter.models.execute_stat import ExecuteStat from lighter.models.export_data import ExportData +from lighter.models.fee_tiers import FeeTiers from lighter.models.funding import Funding from lighter.models.funding_rate import FundingRate from lighter.models.funding_rates import FundingRates @@ -144,6 +146,7 @@ from lighter.models.simple_order import SimpleOrder from lighter.models.slippage_result import SlippageResult from lighter.models.spot_order_book_detail import SpotOrderBookDetail +from lighter.models.staking_fee_tier import StakingFeeTier from lighter.models.status import Status from lighter.models.strategy import Strategy from lighter.models.sub_account_metadata import SubAccountMetadata @@ -161,6 +164,7 @@ from lighter.models.tx_hash import TxHash from lighter.models.txs import Txs from lighter.models.up_down_candle import UpDownCandle +from lighter.models.user_fee_tier import UserFeeTier from lighter.models.user_referrals import UserReferrals from lighter.models.validator_info import ValidatorInfo from lighter.models.withdraw_history import WithdrawHistory diff --git a/lighter/models/account_limits.py b/lighter/models/account_limits.py index c5a6fd5..9005151 100644 --- a/lighter/models/account_limits.py +++ b/lighter/models/account_limits.py @@ -17,8 +17,8 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr -from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union from typing import Optional, Set from typing_extensions import Self @@ -38,8 +38,10 @@ class AccountLimits(BaseModel): leased_lit: StrictStr = Field(description="Total actively leased LIT.") user_tier_name: StrictStr user_tier_last_update: Optional[StrictInt] = None + bo_user_tier_name: StrictStr + bo_fee_rate: Union[StrictFloat, StrictInt] = Field(description=" Product of the staking and BO volume multipliers; 0.72 means a 28% discount.") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["code", "message", "max_llp_percentage", "user_tier", "can_create_public_pool", "max_llp_amount", "current_maker_fee_tick", "current_taker_fee_tick", "effective_lit_stakes", "leased_lit", "user_tier_name", "user_tier_last_update"] + __properties: ClassVar[List[str]] = ["code", "message", "max_llp_percentage", "user_tier", "can_create_public_pool", "max_llp_amount", "current_maker_fee_tick", "current_taker_fee_tick", "effective_lit_stakes", "leased_lit", "user_tier_name", "user_tier_last_update", "bo_user_tier_name", "bo_fee_rate"] model_config = ConfigDict( populate_by_name=True, @@ -110,7 +112,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "effective_lit_stakes": obj.get("effective_lit_stakes"), "leased_lit": obj.get("leased_lit"), "user_tier_name": obj.get("user_tier_name"), - "user_tier_last_update": obj.get("user_tier_last_update") + "user_tier_last_update": obj.get("user_tier_last_update"), + "bo_user_tier_name": obj.get("bo_user_tier_name"), + "bo_fee_rate": obj.get("bo_fee_rate") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/binary_option_market_stats.py b/lighter/models/binary_option_market_stats.py index 4125438..01865c5 100644 --- a/lighter/models/binary_option_market_stats.py +++ b/lighter/models/binary_option_market_stats.py @@ -40,7 +40,7 @@ class BinaryOptionMarketStats(BaseModel): lifetime_quote_token_volume: Union[StrictFloat, StrictInt] lifetime_base_token_volume: Union[StrictFloat, StrictInt] = Field(description=" outcome shares traded over the market's life") open_interest: StrictStr - status: StrictStr = Field(description=" inactive once the trading window closes") + status: StrictStr = Field(description=" inactive before the trading window opens, waiting-for-settlement once it closes") outcome: StrictInt additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["symbol", "market_id", "mid_price", "best_ask_price", "best_bid_price", "last_trade_price", "daily_base_token_volume", "daily_quote_token_volume", "daily_price_low", "daily_price_high", "daily_price_change", "lifetime_quote_token_volume", "lifetime_base_token_volume", "open_interest", "status", "outcome"] @@ -48,8 +48,8 @@ class BinaryOptionMarketStats(BaseModel): @field_validator('status') def status_validate_enum(cls, value): """Validates the enum""" - if value not in set(['inactive', 'active', 'in-settlement']): - raise ValueError("must be one of enum values ('inactive', 'active', 'in-settlement')") + if value not in set(['inactive', 'active', 'waiting-for-settlement', 'in-settlement', 'settled']): + raise ValueError("must be one of enum values ('inactive', 'active', 'waiting-for-settlement', 'in-settlement', 'settled')") return value @field_validator('outcome') diff --git a/lighter/models/bo_fee_tier.py b/lighter/models/bo_fee_tier.py new file mode 100644 index 0000000..fd70329 --- /dev/null +++ b/lighter/models/bo_fee_tier.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self + +class BoFeeTier(BaseModel): + """ + BoFeeTier + """ # noqa: E501 + name: StrictStr + required_volume: StrictInt + fee_rate: Union[StrictFloat, StrictInt] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name", "required_volume", "fee_rate"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BoFeeTier from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BoFeeTier from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_construct(**{ + "name": obj.get("name"), + "required_volume": obj.get("required_volume"), + "fee_rate": obj.get("fee_rate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/lighter/models/event_detail.py b/lighter/models/event_detail.py index 6221395..cf05493 100644 --- a/lighter/models/event_detail.py +++ b/lighter/models/event_detail.py @@ -35,13 +35,13 @@ class EventDetail(BaseModel): tag: StrictStr event_kind: StrictStr recurrence_period_seconds: StrictInt - occurrence_start_at: StrictInt - occurrence_end_at: StrictInt + start_at: StrictInt + end_at: StrictInt metadata: Dict[str, Any] order_books: List[EventOrderBookEntry] lifetime_quote_token_volume: Union[StrictFloat, StrictInt] additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["event_id", "title", "description", "creator_account_index", "created_at", "tag", "event_kind", "recurrence_period_seconds", "occurrence_start_at", "occurrence_end_at", "metadata", "order_books", "lifetime_quote_token_volume"] + __properties: ClassVar[List[str]] = ["event_id", "title", "description", "creator_account_index", "created_at", "tag", "event_kind", "recurrence_period_seconds", "start_at", "end_at", "metadata", "order_books", "lifetime_quote_token_volume"] @field_validator('event_kind') def event_kind_validate_enum(cls, value): @@ -123,8 +123,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "tag": obj.get("tag"), "event_kind": obj.get("event_kind"), "recurrence_period_seconds": obj.get("recurrence_period_seconds"), - "occurrence_start_at": obj.get("occurrence_start_at"), - "occurrence_end_at": obj.get("occurrence_end_at"), + "start_at": obj.get("start_at"), + "end_at": obj.get("end_at"), "metadata": obj.get("metadata"), "order_books": [EventOrderBookEntry.from_dict(_item) for _item in obj["order_books"]] if obj.get("order_books") is not None else None, "lifetime_quote_token_volume": obj.get("lifetime_quote_token_volume") diff --git a/lighter/models/event_order_book_entry.py b/lighter/models/event_order_book_entry.py index 138e080..cc60a4c 100644 --- a/lighter/models/event_order_book_entry.py +++ b/lighter/models/event_order_book_entry.py @@ -33,7 +33,7 @@ class EventOrderBookEntry(BaseModel): market_type: StrictStr base_asset_id: StrictInt quote_asset_id: StrictInt - status: StrictStr + status: StrictStr = Field(description=" waiting-for-settlement and settled are binary options only") taker_fee: StrictStr is_taker_fee_enabled: StrictBool maker_fee: StrictStr @@ -73,8 +73,8 @@ def market_type_validate_enum(cls, value): @field_validator('status') def status_validate_enum(cls, value): """Validates the enum""" - if value not in set(['inactive', 'active']): - raise ValueError("must be one of enum values ('inactive', 'active')") + if value not in set(['inactive', 'active', 'in-settlement', 'waiting-for-settlement', 'settled']): + raise ValueError("must be one of enum values ('inactive', 'active', 'in-settlement', 'waiting-for-settlement', 'settled')") return value @field_validator('outcome') diff --git a/lighter/models/fee_tiers.py b/lighter/models/fee_tiers.py new file mode 100644 index 0000000..7ce5620 --- /dev/null +++ b/lighter/models/fee_tiers.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List +from lighter.models.bo_fee_tier import BoFeeTier +from lighter.models.staking_fee_tier import StakingFeeTier +from lighter.models.user_fee_tier import UserFeeTier +from typing import Optional, Set +from typing_extensions import Self + +class FeeTiers(BaseModel): + """ + FeeTiers + """ # noqa: E501 + user_tiers: List[UserFeeTier] + bo_tiers: List[BoFeeTier] + staking_tiers: List[StakingFeeTier] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["user_tiers", "bo_tiers", "staking_tiers"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FeeTiers from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in user_tiers (list) + _items = [] + if self.user_tiers: + for _item in self.user_tiers: + if _item: + _items.append(_item.to_dict()) + _dict['user_tiers'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in bo_tiers (list) + _items = [] + if self.bo_tiers: + for _item in self.bo_tiers: + if _item: + _items.append(_item.to_dict()) + _dict['bo_tiers'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in staking_tiers (list) + _items = [] + if self.staking_tiers: + for _item in self.staking_tiers: + if _item: + _items.append(_item.to_dict()) + _dict['staking_tiers'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FeeTiers from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_construct(**{ + "user_tiers": [UserFeeTier.from_dict(_item) for _item in obj["user_tiers"]] if obj.get("user_tiers") is not None else None, + "bo_tiers": [BoFeeTier.from_dict(_item) for _item in obj["bo_tiers"]] if obj.get("bo_tiers") is not None else None, + "staking_tiers": [StakingFeeTier.from_dict(_item) for _item in obj["staking_tiers"]] if obj.get("staking_tiers") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/lighter/models/staking_fee_tier.py b/lighter/models/staking_fee_tier.py new file mode 100644 index 0000000..5e479aa --- /dev/null +++ b/lighter/models/staking_fee_tier.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self + +class StakingFeeTier(BaseModel): + """ + StakingFeeTier + """ # noqa: E501 + name: StrictStr + required_lit_stakes: StrictInt + fee_rate: Union[StrictFloat, StrictInt] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name", "required_lit_stakes", "fee_rate"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of StakingFeeTier from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of StakingFeeTier from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_construct(**{ + "name": obj.get("name"), + "required_lit_stakes": obj.get("required_lit_stakes"), + "fee_rate": obj.get("fee_rate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/lighter/models/user_fee_tier.py b/lighter/models/user_fee_tier.py new file mode 100644 index 0000000..2cab05d --- /dev/null +++ b/lighter/models/user_fee_tier.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class UserFeeTier(BaseModel): + """ + UserFeeTier + """ # noqa: E501 + name: StrictStr + level: StrictInt + maker_fee_ticks: StrictInt + taker_fee_ticks: StrictInt + required_lit_stakes: StrictInt + required_volume: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name", "level", "maker_fee_ticks", "taker_fee_ticks", "required_lit_stakes", "required_volume"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of UserFeeTier from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of UserFeeTier from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_construct(**{ + "name": obj.get("name"), + "level": obj.get("level"), + "maker_fee_ticks": obj.get("maker_fee_ticks"), + "taker_fee_ticks": obj.get("taker_fee_ticks"), + "required_lit_stakes": obj.get("required_lit_stakes"), + "required_volume": obj.get("required_volume") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/openapi.json b/openapi.json index 9edf81b..59cd6cd 100644 --- a/openapi.json +++ b/openapi.json @@ -5353,108 +5353,6 @@ } } }, - "/api/v1/upDownCandles": { - "get": { - "summary": "upDownCandles", - "operationId": "upDownCandles", - "tags": [ - "updown" - ], - "description": "Get the OHLC candles (1s = the exact price observations, or 30s) of an up/down market series (symbol + duration, e.g. btc/5m) in a bounded time range (at most 24h), oldest first. Pass next_cursor as start_timestamp to page forward; live candles are on the up_down_candle/// websocket channel.", - "parameters": [ - { - "name": "symbol", - "in": "query", - "description": " market series: underlying (case-insensitive) ...", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "duration", - "in": "query", - "description": " ... and market duration, e.g. 30s or 5m", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "resolution", - "in": "query", - "description": " 1s candles are the observations themselves", - "required": false, - "schema": { - "type": "string", - "enum": [ - "1s", - "30s" - ], - "default": "1s" - } - }, - { - "name": "start_timestamp", - "in": "query", - "description": " inclusive bucket start, seconds", - "required": true, - "schema": { - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 5000000000 - } - }, - { - "name": "end_timestamp", - "in": "query", - "description": " inclusive, seconds; at most 24h after start_timestamp", - "required": true, - "schema": { - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 5000000000 - } - }, - { - "name": "limit", - "in": "query", - "required": false, - "schema": { - "type": "integer", - "format": "int64", - "default": "1000", - "minimum": 1, - "maximum": 3600 - } - } - ], - "responses": { - "200": { - "description": "A successful response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RespGetUpDownCandles" - } - } - } - }, - "400": { - "description": "Bad request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ResultCode" - } - } - } - } - } - } - }, "/api/v1/events": { "get": { "summary": "events", @@ -5462,7 +5360,7 @@ "tags": [ "event" ], - "description": "Get events and registered order books, including scheduled events with no books. event_ids and market_ids accept up to 50 comma-separated positive IDs, are mutually exclusive, and use the same filters, sorting and pagination. market_ids returns each related event once with all its order books. Defaults to descending id. Occurrence sorting uses (occurrence_start_at, event_id); cursor identifies an existing event and excludes it in the requested direction. tag filters across creators; creator_account_index is an optional additional filter. active=true requires a tradeable outcome; active=false includes scheduled and closed events.", + "description": "Get events and registered order books, including scheduled events with no books. event_ids and market_ids accept up to 50 comma-separated positive IDs, are mutually exclusive, and use the same filters, sorting and pagination. market_ids returns each related event once with all its order books. Defaults to descending id. start_at sorting uses (start_at, event_id); cursor identifies an existing event and excludes it in the requested direction. tag filters across creators; creator_account_index is an optional additional filter. active=true requires a tradeable outcome; active=false includes scheduled and closed events.", "parameters": [ { "name": "event_ids", @@ -5545,7 +5443,7 @@ { "name": "start_from", "in": "query", - "description": " inclusive occurrence start, Unix milliseconds", + "description": " inclusive start_at, Unix milliseconds", "required": false, "schema": { "type": "integer", @@ -5555,7 +5453,7 @@ { "name": "start_before", "in": "query", - "description": " exclusive occurrence start, Unix milliseconds", + "description": " exclusive start_at, Unix milliseconds", "required": false, "schema": { "type": "integer", @@ -5570,7 +5468,7 @@ "type": "string", "enum": [ "id", - "occurrence_start_at" + "start_at" ], "default": "id" } @@ -5703,6 +5601,157 @@ } } } + }, + "/api/v1/upDownCandles": { + "get": { + "summary": "upDownCandles", + "operationId": "upDownCandles", + "tags": [ + "updown" + ], + "description": "Get the OHLC candles (1s = the exact price observations, or 30s) of an up/down market series (symbol + duration, e.g. btc/5m) in a bounded time range (at most 24h), oldest first. Pass next_cursor as start_timestamp to page forward; live candles are on the up_down_candle/// websocket channel.", + "parameters": [ + { + "name": "symbol", + "in": "query", + "description": " market series: underlying (case-insensitive) ...", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "duration", + "in": "query", + "description": " ... and market duration, e.g. 30s or 5m", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "resolution", + "in": "query", + "description": " 1s candles are the observations themselves", + "required": false, + "schema": { + "type": "string", + "enum": [ + "1s", + "30s" + ], + "default": "1s" + } + }, + { + "name": "start_timestamp", + "in": "query", + "description": " inclusive bucket start, seconds", + "required": true, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 5000000000 + } + }, + { + "name": "end_timestamp", + "in": "query", + "description": " inclusive, seconds; at most 24h after start_timestamp", + "required": true, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 5000000000 + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "default": "1000", + "minimum": 1, + "maximum": 3600 + } + } + ], + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RespGetUpDownCandles" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + } + } + } + }, + "/api/v1/feeTiers": { + "get": { + "summary": "feeTiers", + "operationId": "feeTiers", + "tags": [ + "account" + ], + "description": "Get fee tiers. filter=perps|spot returns the regular user tiers (both market types share them). filter=bo returns BO volume tiers and LIT staking discount tiers; filter=all returns everything. An account's BO multiplier is the BO tier fee_rate times the staking fee_rate, applied to each BO market's maker/taker fee (see /api/v1/events) and then scaled by 1 - trade_price / settlement_cap.", + "parameters": [ + { + "name": "filter", + "in": "query", + "required": false, + "schema": { + "type": "string", + "enum": [ + "all", + "bo", + "perps", + "spot" + ], + "default": "all" + } + } + ], + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FeeTiers" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + } + } + } } }, "servers": [ @@ -5932,20 +5981,32 @@ "user_tier_last_update": { "type": "integer", "format": "int64" + }, + "bo_user_tier_name": { + "type": "string", + "example": "bo_standard" + }, + "bo_fee_rate": { + "type": "number", + "format": "double", + "example": "0.72", + "description": " Product of the staking and BO volume multipliers; 0.72 means a 28% discount." } }, "title": "AccountLimits", "required": [ "code", "max_llp_percentage", + "max_llp_amount", "user_tier", "can_create_public_pool", - "max_llp_amount", + "user_tier_name", + "bo_user_tier_name", + "bo_fee_rate", "current_maker_fee_tick", "current_taker_fee_tick", - "effective_lit_stakes", "leased_lit", - "user_tier_name" + "effective_lit_stakes" ] }, "AccountMetadata": { @@ -12667,106 +12728,7 @@ "price_cap_reference_price" ] }, - "RespGetUpDownCandles": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "candles": { - "type": "array", - "items": { - "$ref": "#/components/schemas/UpDownCandle" - }, - "description": " ascending by timestamp" - }, - "next_cursor": { - "type": "integer", - "format": "int64", - "example": "0", - "description": " start_timestamp of the next page; 0 when the range is exhausted" - } - }, - "title": "RespGetUpDownCandles", - "required": [ - "code", - "candles" - ] - }, - "UpDownCandle": { - "type": "object", - "properties": { - "symbol": { - "type": "string", - "example": "btc" - }, - "duration": { - "type": "string", - "example": "5m" - }, - "resolution": { - "type": "string", - "example": "30s" - }, - "timestamp": { - "type": "integer", - "format": "int64", - "example": "1789551600", - "description": " bucket start, unix seconds" - }, - "open": { - "type": "string", - "example": "115342.123456789012345678", - "description": " exact provider prices, decimal strings" - }, - "high": { - "type": "string", - "example": "115350.5" - }, - "low": { - "type": "string", - "example": "115300.25" - }, - "close": { - "type": "string", - "example": "115340.123456789012345678" - }, - "sampleCount": { - "type": "integer", - "format": "int64", - "description": " observations in the candle: orders live updates of the same bucket, not served" - }, - "provider": { - "type": "string", - "example": "chainlink", - "description": " provider feed of the last observation of the candle" - }, - "feed_id": { - "type": "string", - "example": "0x0002ee6757e8822c00d273bc340fc24c9cafe123a4ff2ea1dbdb31944bc7d95f" - } - }, - "title": "UpDownCandle", - "required": [ - "symbol", - "duration", - "resolution", - "timestamp", - "open", - "high", - "low", - "close", - "sampleCount", - "provider", - "feed_id" - ] - }, - "RespGetEvents": { + "RespGetEvents": { "type": "object", "properties": { "code": { @@ -12833,11 +12795,11 @@ "type": "integer", "format": "int32" }, - "occurrence_start_at": { + "start_at": { "type": "integer", "format": "int64" }, - "occurrence_end_at": { + "end_at": { "type": "integer", "format": "int64" }, @@ -12867,8 +12829,8 @@ "tag", "event_kind", "recurrence_period_seconds", - "occurrence_start_at", - "occurrence_end_at", + "start_at", + "end_at", "metadata", "order_books", "lifetime_quote_token_volume" @@ -12913,8 +12875,12 @@ "type": "string", "enum": [ "inactive", - "active" - ] + "active", + "in-settlement", + "waiting-for-settlement", + "settled" + ], + "description": " waiting-for-settlement and settled are binary options only" }, "taker_fee": { "type": "string", @@ -13162,9 +13128,11 @@ "enum": [ "inactive", "active", - "in-settlement" + "waiting-for-settlement", + "in-settlement", + "settled" ], - "description": " inactive once the trading window closes" + "description": " inactive before the trading window opens, waiting-for-settlement once it closes" }, "outcome": { "type": "integer", @@ -13311,6 +13279,227 @@ "last_trade_id", "total_pnl" ] + }, + "RespGetUpDownCandles": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "candles": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UpDownCandle" + }, + "description": " ascending by timestamp" + }, + "next_cursor": { + "type": "integer", + "format": "int64", + "example": "0", + "description": " start_timestamp of the next page; 0 when the range is exhausted" + } + }, + "title": "RespGetUpDownCandles", + "required": [ + "code", + "candles" + ] + }, + "UpDownCandle": { + "type": "object", + "properties": { + "symbol": { + "type": "string", + "example": "btc" + }, + "duration": { + "type": "string", + "example": "5m" + }, + "resolution": { + "type": "string", + "example": "30s" + }, + "timestamp": { + "type": "integer", + "format": "int64", + "example": "1789551600", + "description": " bucket start, unix seconds" + }, + "open": { + "type": "string", + "example": "115342.123456789012345678", + "description": " exact provider prices, decimal strings" + }, + "high": { + "type": "string", + "example": "115350.5" + }, + "low": { + "type": "string", + "example": "115300.25" + }, + "close": { + "type": "string", + "example": "115340.123456789012345678" + }, + "sampleCount": { + "type": "integer", + "format": "int64", + "description": " observations in the candle: orders live updates of the same bucket, not served" + }, + "provider": { + "type": "string", + "example": "chainlink", + "description": " provider feed of the last observation of the candle" + }, + "feed_id": { + "type": "string", + "example": "0x0002ee6757e8822c00d273bc340fc24c9cafe123a4ff2ea1dbdb31944bc7d95f" + } + }, + "title": "UpDownCandle", + "required": [ + "symbol", + "duration", + "resolution", + "timestamp", + "open", + "high", + "low", + "close", + "sampleCount", + "provider", + "feed_id" + ] + }, + "FeeTiers": { + "type": "object", + "properties": { + "user_tiers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserFeeTier" + } + }, + "bo_tiers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BoFeeTier" + } + }, + "staking_tiers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/StakingFeeTier" + } + } + }, + "title": "FeeTiers", + "required": [ + "user_tiers", + "bo_tiers", + "staking_tiers" + ] + }, + "UserFeeTier": { + "type": "object", + "properties": { + "name": { + "type": "string", + "example": "premium_1" + }, + "level": { + "type": "integer", + "format": "int32", + "example": "2" + }, + "maker_fee_ticks": { + "type": "integer", + "format": "int32", + "example": "0" + }, + "taker_fee_ticks": { + "type": "integer", + "format": "int32", + "example": "0" + }, + "required_lit_stakes": { + "type": "integer", + "format": "int64", + "example": "1000" + }, + "required_volume": { + "type": "integer", + "format": "int64", + "example": "0" + } + }, + "title": "UserFeeTier", + "required": [ + "name", + "level", + "maker_fee_ticks", + "taker_fee_ticks", + "required_lit_stakes", + "required_volume" + ] + }, + "BoFeeTier": { + "type": "object", + "properties": { + "name": { + "type": "string", + "example": "level1" + }, + "required_volume": { + "type": "integer", + "format": "int64", + "example": "5000000" + }, + "fee_rate": { + "type": "number", + "format": "double", + "example": "0.9" + } + }, + "title": "BoFeeTier", + "required": [ + "name", + "required_volume", + "fee_rate" + ] + }, + "StakingFeeTier": { + "type": "object", + "properties": { + "name": { + "type": "string", + "example": "level1" + }, + "required_lit_stakes": { + "type": "integer", + "format": "int64", + "example": "10" + }, + "fee_rate": { + "type": "number", + "format": "double", + "example": "0.95" + } + }, + "title": "StakingFeeTier", + "required": [ + "name", + "required_lit_stakes", + "fee_rate" + ] } } }