From 5c50b19e03dbe9492915e3b5a23480e07c6d9c89 Mon Sep 17 00:00:00 2001 From: mihai Date: Thu, 5 Nov 2026 08:47:19 +0000 Subject: [PATCH 1/2] Add event create, update and registerOrderBook endpoints --- README.md | 5 + docs/AccountLimits.md | 2 + docs/BinaryOptionMarketStats.md | 2 +- docs/EventApi.md | 254 ++++ docs/RespCreateEvent.md | 31 + docs/RespRegisterEventOrderBook.md | 31 + lighter/__init__.py | 2 + lighter/api/event_api.py | 1146 +++++++++++++++++ lighter/models/__init__.py | 2 + lighter/models/resp_create_event.py | 104 ++ .../models/resp_register_event_order_book.py | 104 ++ openapi.json | 336 +++++ 12 files changed, 2018 insertions(+), 1 deletion(-) create mode 100644 docs/RespCreateEvent.md create mode 100644 docs/RespRegisterEventOrderBook.md create mode 100644 lighter/models/resp_create_event.py create mode 100644 lighter/models/resp_register_event_order_book.py diff --git a/README.md b/README.md index 1239094..cff7be6 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,9 @@ Class | Method | HTTP request | Description *CandlestickApi* | [**fundings**](docs/CandlestickApi.md#fundings) | **GET** /api/v1/fundings | fundings *CandlestickApi* | [**mark_price_candles**](docs/CandlestickApi.md#mark_price_candles) | **GET** /api/v1/markPriceCandles | markPriceCandles *CandlestickApi* | [**market_price_charts**](docs/CandlestickApi.md#market_price_charts) | **GET** /api/v1/marketPriceCharts | marketPriceCharts +*EventApi* | [**event_create**](docs/EventApi.md#event_create) | **POST** /api/v1/event/create | event_create +*EventApi* | [**event_register_order_book**](docs/EventApi.md#event_register_order_book) | **POST** /api/v1/event/registerOrderBook | event_registerOrderBook +*EventApi* | [**event_update**](docs/EventApi.md#event_update) | **POST** /api/v1/event/update | event_update *EventApi* | [**events**](docs/EventApi.md#events) | **GET** /api/v1/events | events *FundingApi* | [**funding_rates**](docs/FundingApi.md#funding_rates) | **GET** /api/v1/funding-rates | funding-rates *InfoApi* | [**layer1_basic_info**](docs/InfoApi.md#layer1_basic_info) | **GET** /api/v1/layer1BasicInfo | layer1BasicInfo @@ -248,6 +251,7 @@ Class | Method | HTTP request | Description - [ReferralTotals](docs/ReferralTotals.md) - [ReqSetAccountMetadata](docs/ReqSetAccountMetadata.md) - [RespChangeAccountTier](docs/RespChangeAccountTier.md) + - [RespCreateEvent](docs/RespCreateEvent.md) - [RespCreateRFQ](docs/RespCreateRFQ.md) - [RespGetApiTokens](docs/RespGetApiTokens.md) - [RespGetBoPnL](docs/RespGetBoPnL.md) @@ -265,6 +269,7 @@ Class | Method | HTTP request | Description - [RespPostApiToken](docs/RespPostApiToken.md) - [RespPriceOracleInfo](docs/RespPriceOracleInfo.md) - [RespPublicPoolsMetadata](docs/RespPublicPoolsMetadata.md) + - [RespRegisterEventOrderBook](docs/RespRegisterEventOrderBook.md) - [RespRespondToRFQ](docs/RespRespondToRFQ.md) - [RespRevokeApiToken](docs/RespRevokeApiToken.md) - [RespSendTx](docs/RespSendTx.md) diff --git a/docs/AccountLimits.md b/docs/AccountLimits.md index 6c2334e..8b2f702 100644 --- a/docs/AccountLimits.md +++ b/docs/AccountLimits.md @@ -17,6 +17,8 @@ Name | Type | Description | Notes **leased_lit** | **str** | Total actively leased LIT. | **user_tier_name** | **str** | | **user_tier_last_update** | **int** | | [optional] +**bo_user_tier_name** | **str** | | +**bo_fee_rate** | **float** | Product of the staking and BO volume multipliers; 0.72 means a 28% discount. | ## Example diff --git a/docs/BinaryOptionMarketStats.md b/docs/BinaryOptionMarketStats.md index a67db34..c64459f 100644 --- a/docs/BinaryOptionMarketStats.md +++ b/docs/BinaryOptionMarketStats.md @@ -19,7 +19,7 @@ Name | Type | Description | Notes **lifetime_quote_token_volume** | **float** | | **lifetime_base_token_volume** | **float** | outcome shares traded over the market's life | **open_interest** | **str** | | -**status** | **str** | inactive once the trading window closes | +**status** | **str** | inactive before the trading window opens, waiting-for-settlement once it closes | **outcome** | **int** | | ## Example diff --git a/docs/EventApi.md b/docs/EventApi.md index 7b4c840..1d735a0 100644 --- a/docs/EventApi.md +++ b/docs/EventApi.md @@ -4,9 +4,263 @@ All URIs are relative to *https://mainnet.zklighter.elliot.ai* Method | HTTP request | Description ------------- | ------------- | ------------- +[**event_create**](EventApi.md#event_create) | **POST** /api/v1/event/create | event_create +[**event_register_order_book**](EventApi.md#event_register_order_book) | **POST** /api/v1/event/registerOrderBook | event_registerOrderBook +[**event_update**](EventApi.md#event_update) | **POST** /api/v1/event/update | event_update [**events**](EventApi.md#events) | **GET** /api/v1/events | events +# **event_create** +> RespCreateEvent event_create(authorization, account_index, title, start_at, end_at, description=description, tag=tag, event_kind=event_kind, recurrence_period_seconds=recurrence_period_seconds, metadata=metadata) + +event_create + +Create a binary options event + +### Example + + +```python +import lighter +from lighter.models.resp_create_event import RespCreateEvent +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.EventApi(api_client) + authorization = 'authorization_example' # str | + account_index = 56 # int | + title = 'title_example' # str | + start_at = 56 # int | Unix milliseconds; observation time, not trading time + end_at = 56 # int | Unix milliseconds; must be after start_at + description = 'description_example' # str | (optional) + tag = 'tag_example' # str | series tag; may be shared by different creators (optional) + event_kind = one_off # str | (optional) (default to one_off) + recurrence_period_seconds = 56 # int | 0 for one-off events (optional) + metadata = 'metadata_example' # str | JSON object, max 16 KiB; presentation only (optional) + + try: + # event_create + api_response = await api_instance.event_create(authorization, account_index, title, start_at, end_at, description=description, tag=tag, event_kind=event_kind, recurrence_period_seconds=recurrence_period_seconds, metadata=metadata) + print("The response of EventApi->event_create:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling EventApi->event_create: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **authorization** | **str**| | + **account_index** | **int**| | + **title** | **str**| | + **start_at** | **int**| Unix milliseconds; observation time, not trading time | + **end_at** | **int**| Unix milliseconds; must be after start_at | + **description** | **str**| | [optional] + **tag** | **str**| series tag; may be shared by different creators | [optional] + **event_kind** | **str**| | [optional] [default to one_off] + **recurrence_period_seconds** | **int**| 0 for one-off events | [optional] + **metadata** | **str**| JSON object, max 16 KiB; presentation only | [optional] + +### Return type + +[**RespCreateEvent**](RespCreateEvent.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **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) + +# **event_register_order_book** +> RespRegisterEventOrderBook event_register_order_book(authorization, account_index, event_id, market_index) + +event_registerOrderBook + +Register an already deployed order book to an event + +### Example + + +```python +import lighter +from lighter.models.resp_register_event_order_book import RespRegisterEventOrderBook +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.EventApi(api_client) + authorization = 'authorization_example' # str | + account_index = 56 # int | + event_id = 56 # int | + market_index = 56 # int | + + try: + # event_registerOrderBook + api_response = await api_instance.event_register_order_book(authorization, account_index, event_id, market_index) + print("The response of EventApi->event_register_order_book:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling EventApi->event_register_order_book: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **authorization** | **str**| | + **account_index** | **int**| | + **event_id** | **int**| | + **market_index** | **int**| | + +### Return type + +[**RespRegisterEventOrderBook**](RespRegisterEventOrderBook.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **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) + +# **event_update** +> ResultCode event_update(authorization, account_index, title, start_at, end_at, event_id, description=description, tag=tag, event_kind=event_kind, recurrence_period_seconds=recurrence_period_seconds, metadata=metadata) + +event_update + +Replace event details as its creator; rejected while any attached unsettled market is within its trading window. Market bindings are unchanged. + +### Example + + +```python +import lighter +from lighter.models.result_code import ResultCode +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.EventApi(api_client) + authorization = 'authorization_example' # str | + account_index = 56 # int | + title = 'title_example' # str | + start_at = 56 # int | Unix milliseconds; observation time, not trading time + end_at = 56 # int | Unix milliseconds; must be after start_at + event_id = 56 # int | + description = 'description_example' # str | (optional) + tag = 'tag_example' # str | series tag; may be shared by different creators (optional) + event_kind = one_off # str | (optional) (default to one_off) + recurrence_period_seconds = 56 # int | 0 for one-off events (optional) + metadata = 'metadata_example' # str | JSON object, max 16 KiB; presentation only (optional) + + try: + # event_update + api_response = await api_instance.event_update(authorization, account_index, title, start_at, end_at, event_id, description=description, tag=tag, event_kind=event_kind, recurrence_period_seconds=recurrence_period_seconds, metadata=metadata) + print("The response of EventApi->event_update:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling EventApi->event_update: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **authorization** | **str**| | + **account_index** | **int**| | + **title** | **str**| | + **start_at** | **int**| Unix milliseconds; observation time, not trading time | + **end_at** | **int**| Unix milliseconds; must be after start_at | + **event_id** | **int**| | + **description** | **str**| | [optional] + **tag** | **str**| series tag; may be shared by different creators | [optional] + **event_kind** | **str**| | [optional] [default to one_off] + **recurrence_period_seconds** | **int**| 0 for one-off events | [optional] + **metadata** | **str**| JSON object, max 16 KiB; presentation only | [optional] + +### Return type + +[**ResultCode**](ResultCode.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **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) + # **events** > RespGetEvents events(event_ids=event_ids, market_ids=market_ids, creator_account_index=creator_account_index, cursor=cursor, active=active, limit=limit, tag=tag, event_kind=event_kind, start_from=start_from, start_before=start_before, sort=sort, order=order) diff --git a/docs/RespCreateEvent.md b/docs/RespCreateEvent.md new file mode 100644 index 0000000..5aec0bd --- /dev/null +++ b/docs/RespCreateEvent.md @@ -0,0 +1,31 @@ +# RespCreateEvent + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**event_id** | **int** | | + +## Example + +```python +from lighter.models.resp_create_event import RespCreateEvent + +# TODO update the JSON string below +json = "{}" +# create an instance of RespCreateEvent from a JSON string +resp_create_event_instance = RespCreateEvent.from_json(json) +# print the JSON string representation of the object +print(RespCreateEvent.to_json()) + +# convert the object into a dict +resp_create_event_dict = resp_create_event_instance.to_dict() +# create an instance of RespCreateEvent from a dict +resp_create_event_from_dict = RespCreateEvent.from_dict(resp_create_event_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/RespRegisterEventOrderBook.md b/docs/RespRegisterEventOrderBook.md new file mode 100644 index 0000000..c96b8a0 --- /dev/null +++ b/docs/RespRegisterEventOrderBook.md @@ -0,0 +1,31 @@ +# RespRegisterEventOrderBook + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**success** | **bool** | | + +## Example + +```python +from lighter.models.resp_register_event_order_book import RespRegisterEventOrderBook + +# TODO update the JSON string below +json = "{}" +# create an instance of RespRegisterEventOrderBook from a JSON string +resp_register_event_order_book_instance = RespRegisterEventOrderBook.from_json(json) +# print the JSON string representation of the object +print(RespRegisterEventOrderBook.to_json()) + +# convert the object into a dict +resp_register_event_order_book_dict = resp_register_event_order_book_instance.to_dict() +# create an instance of RespRegisterEventOrderBook from a dict +resp_register_event_order_book_from_dict = RespRegisterEventOrderBook.from_dict(resp_register_event_order_book_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 6c1229e..3cee8f5 100644 --- a/lighter/__init__.py +++ b/lighter/__init__.py @@ -150,6 +150,7 @@ from lighter.models.referral_totals import ReferralTotals from lighter.models.req_set_account_metadata import ReqSetAccountMetadata from lighter.models.resp_change_account_tier import RespChangeAccountTier +from lighter.models.resp_create_event import RespCreateEvent from lighter.models.resp_create_rfq import RespCreateRFQ from lighter.models.resp_get_api_tokens import RespGetApiTokens from lighter.models.resp_get_exchange_metrics import RespGetExchangeMetrics @@ -163,6 +164,7 @@ from lighter.models.resp_list_rfqs import RespListRFQs from lighter.models.resp_post_api_token import RespPostApiToken from lighter.models.resp_public_pools_metadata import RespPublicPoolsMetadata +from lighter.models.resp_register_event_order_book import RespRegisterEventOrderBook from lighter.models.resp_respond_to_rfq import RespRespondToRFQ from lighter.models.resp_revoke_api_token import RespRevokeApiToken from lighter.models.resp_send_tx import RespSendTx diff --git a/lighter/api/event_api.py b/lighter/api/event_api.py index eadd833..51b54d3 100644 --- a/lighter/api/event_api.py +++ b/lighter/api/event_api.py @@ -19,7 +19,10 @@ from pydantic import Field, StrictBool, StrictInt, StrictStr, field_validator from typing import Optional from typing_extensions import Annotated +from lighter.models.resp_create_event import RespCreateEvent from lighter.models.resp_get_events import RespGetEvents +from lighter.models.resp_register_event_order_book import RespRegisterEventOrderBook +from lighter.models.result_code import ResultCode from lighter.api_client import ApiClient, RequestSerialized from lighter.api_response import ApiResponse @@ -39,6 +42,1149 @@ def __init__(self, api_client=None) -> None: self.api_client = api_client + async def event_create( + self, + authorization: StrictStr, + account_index: StrictInt, + title: StrictStr, + start_at: Annotated[StrictInt, Field(description=" Unix milliseconds; observation time, not trading time")], + end_at: Annotated[StrictInt, Field(description=" Unix milliseconds; must be after start_at")], + description: Optional[StrictStr] = None, + tag: Annotated[Optional[StrictStr], Field(description=" series tag; may be shared by different creators")] = None, + event_kind: Optional[StrictStr] = None, + recurrence_period_seconds: Annotated[Optional[StrictInt], Field(description=" 0 for one-off events")] = None, + metadata: Annotated[Optional[StrictStr], Field(description=" JSON object, max 16 KiB; presentation only")] = 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, + ) -> RespCreateEvent: + """event_create + + Create a binary options event + + :param authorization: (required) + :type authorization: str + :param account_index: (required) + :type account_index: int + :param title: (required) + :type title: str + :param start_at: Unix milliseconds; observation time, not trading time (required) + :type start_at: int + :param end_at: Unix milliseconds; must be after start_at (required) + :type end_at: int + :param description: + :type description: str + :param tag: series tag; may be shared by different creators + :type tag: str + :param event_kind: + :type event_kind: str + :param recurrence_period_seconds: 0 for one-off events + :type recurrence_period_seconds: int + :param metadata: JSON object, max 16 KiB; presentation only + :type metadata: 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._event_create_serialize( + authorization=authorization, + account_index=account_index, + title=title, + start_at=start_at, + end_at=end_at, + description=description, + tag=tag, + event_kind=event_kind, + recurrence_period_seconds=recurrence_period_seconds, + metadata=metadata, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespCreateEvent", + '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 event_create_with_http_info( + self, + authorization: StrictStr, + account_index: StrictInt, + title: StrictStr, + start_at: Annotated[StrictInt, Field(description=" Unix milliseconds; observation time, not trading time")], + end_at: Annotated[StrictInt, Field(description=" Unix milliseconds; must be after start_at")], + description: Optional[StrictStr] = None, + tag: Annotated[Optional[StrictStr], Field(description=" series tag; may be shared by different creators")] = None, + event_kind: Optional[StrictStr] = None, + recurrence_period_seconds: Annotated[Optional[StrictInt], Field(description=" 0 for one-off events")] = None, + metadata: Annotated[Optional[StrictStr], Field(description=" JSON object, max 16 KiB; presentation only")] = 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[RespCreateEvent]: + """event_create + + Create a binary options event + + :param authorization: (required) + :type authorization: str + :param account_index: (required) + :type account_index: int + :param title: (required) + :type title: str + :param start_at: Unix milliseconds; observation time, not trading time (required) + :type start_at: int + :param end_at: Unix milliseconds; must be after start_at (required) + :type end_at: int + :param description: + :type description: str + :param tag: series tag; may be shared by different creators + :type tag: str + :param event_kind: + :type event_kind: str + :param recurrence_period_seconds: 0 for one-off events + :type recurrence_period_seconds: int + :param metadata: JSON object, max 16 KiB; presentation only + :type metadata: 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._event_create_serialize( + authorization=authorization, + account_index=account_index, + title=title, + start_at=start_at, + end_at=end_at, + description=description, + tag=tag, + event_kind=event_kind, + recurrence_period_seconds=recurrence_period_seconds, + metadata=metadata, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespCreateEvent", + '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 event_create_without_preload_content( + self, + authorization: StrictStr, + account_index: StrictInt, + title: StrictStr, + start_at: Annotated[StrictInt, Field(description=" Unix milliseconds; observation time, not trading time")], + end_at: Annotated[StrictInt, Field(description=" Unix milliseconds; must be after start_at")], + description: Optional[StrictStr] = None, + tag: Annotated[Optional[StrictStr], Field(description=" series tag; may be shared by different creators")] = None, + event_kind: Optional[StrictStr] = None, + recurrence_period_seconds: Annotated[Optional[StrictInt], Field(description=" 0 for one-off events")] = None, + metadata: Annotated[Optional[StrictStr], Field(description=" JSON object, max 16 KiB; presentation only")] = 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: + """event_create + + Create a binary options event + + :param authorization: (required) + :type authorization: str + :param account_index: (required) + :type account_index: int + :param title: (required) + :type title: str + :param start_at: Unix milliseconds; observation time, not trading time (required) + :type start_at: int + :param end_at: Unix milliseconds; must be after start_at (required) + :type end_at: int + :param description: + :type description: str + :param tag: series tag; may be shared by different creators + :type tag: str + :param event_kind: + :type event_kind: str + :param recurrence_period_seconds: 0 for one-off events + :type recurrence_period_seconds: int + :param metadata: JSON object, max 16 KiB; presentation only + :type metadata: 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._event_create_serialize( + authorization=authorization, + account_index=account_index, + title=title, + start_at=start_at, + end_at=end_at, + description=description, + tag=tag, + event_kind=event_kind, + recurrence_period_seconds=recurrence_period_seconds, + metadata=metadata, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespCreateEvent", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _event_create_serialize( + self, + authorization, + account_index, + title, + start_at, + end_at, + description, + tag, + event_kind, + recurrence_period_seconds, + metadata, + _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 + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + if account_index is not None: + _form_params.append(('account_index', account_index)) + if title is not None: + _form_params.append(('title', title)) + if description is not None: + _form_params.append(('description', description)) + if tag is not None: + _form_params.append(('tag', tag)) + if event_kind is not None: + _form_params.append(('event_kind', event_kind)) + if recurrence_period_seconds is not None: + _form_params.append(('recurrence_period_seconds', recurrence_period_seconds)) + if start_at is not None: + _form_params.append(('start_at', start_at)) + if end_at is not None: + _form_params.append(('end_at', end_at)) + if metadata is not None: + _form_params.append(('metadata', metadata)) + # 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' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/x-www-form-urlencoded' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/api/v1/event/create', + 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 event_register_order_book( + self, + authorization: StrictStr, + account_index: StrictInt, + event_id: StrictInt, + market_index: StrictInt, + _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, + ) -> RespRegisterEventOrderBook: + """event_registerOrderBook + + Register an already deployed order book to an event + + :param authorization: (required) + :type authorization: str + :param account_index: (required) + :type account_index: int + :param event_id: (required) + :type event_id: int + :param market_index: (required) + :type market_index: int + :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._event_register_order_book_serialize( + authorization=authorization, + account_index=account_index, + event_id=event_id, + market_index=market_index, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespRegisterEventOrderBook", + '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 event_register_order_book_with_http_info( + self, + authorization: StrictStr, + account_index: StrictInt, + event_id: StrictInt, + market_index: StrictInt, + _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[RespRegisterEventOrderBook]: + """event_registerOrderBook + + Register an already deployed order book to an event + + :param authorization: (required) + :type authorization: str + :param account_index: (required) + :type account_index: int + :param event_id: (required) + :type event_id: int + :param market_index: (required) + :type market_index: int + :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._event_register_order_book_serialize( + authorization=authorization, + account_index=account_index, + event_id=event_id, + market_index=market_index, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespRegisterEventOrderBook", + '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 event_register_order_book_without_preload_content( + self, + authorization: StrictStr, + account_index: StrictInt, + event_id: StrictInt, + market_index: StrictInt, + _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: + """event_registerOrderBook + + Register an already deployed order book to an event + + :param authorization: (required) + :type authorization: str + :param account_index: (required) + :type account_index: int + :param event_id: (required) + :type event_id: int + :param market_index: (required) + :type market_index: int + :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._event_register_order_book_serialize( + authorization=authorization, + account_index=account_index, + event_id=event_id, + market_index=market_index, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespRegisterEventOrderBook", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _event_register_order_book_serialize( + self, + authorization, + account_index, + event_id, + market_index, + _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 + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + if account_index is not None: + _form_params.append(('account_index', account_index)) + if event_id is not None: + _form_params.append(('event_id', event_id)) + if market_index is not None: + _form_params.append(('market_index', market_index)) + # 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' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/x-www-form-urlencoded' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/api/v1/event/registerOrderBook', + 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 event_update( + self, + authorization: StrictStr, + account_index: StrictInt, + title: StrictStr, + start_at: Annotated[StrictInt, Field(description=" Unix milliseconds; observation time, not trading time")], + end_at: Annotated[StrictInt, Field(description=" Unix milliseconds; must be after start_at")], + event_id: StrictInt, + description: Optional[StrictStr] = None, + tag: Annotated[Optional[StrictStr], Field(description=" series tag; may be shared by different creators")] = None, + event_kind: Optional[StrictStr] = None, + recurrence_period_seconds: Annotated[Optional[StrictInt], Field(description=" 0 for one-off events")] = None, + metadata: Annotated[Optional[StrictStr], Field(description=" JSON object, max 16 KiB; presentation only")] = 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, + ) -> ResultCode: + """event_update + + Replace event details as its creator; rejected while any attached unsettled market is within its trading window. Market bindings are unchanged. + + :param authorization: (required) + :type authorization: str + :param account_index: (required) + :type account_index: int + :param title: (required) + :type title: str + :param start_at: Unix milliseconds; observation time, not trading time (required) + :type start_at: int + :param end_at: Unix milliseconds; must be after start_at (required) + :type end_at: int + :param event_id: (required) + :type event_id: int + :param description: + :type description: str + :param tag: series tag; may be shared by different creators + :type tag: str + :param event_kind: + :type event_kind: str + :param recurrence_period_seconds: 0 for one-off events + :type recurrence_period_seconds: int + :param metadata: JSON object, max 16 KiB; presentation only + :type metadata: 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._event_update_serialize( + authorization=authorization, + account_index=account_index, + title=title, + start_at=start_at, + end_at=end_at, + event_id=event_id, + description=description, + tag=tag, + event_kind=event_kind, + recurrence_period_seconds=recurrence_period_seconds, + metadata=metadata, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ResultCode", + '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 event_update_with_http_info( + self, + authorization: StrictStr, + account_index: StrictInt, + title: StrictStr, + start_at: Annotated[StrictInt, Field(description=" Unix milliseconds; observation time, not trading time")], + end_at: Annotated[StrictInt, Field(description=" Unix milliseconds; must be after start_at")], + event_id: StrictInt, + description: Optional[StrictStr] = None, + tag: Annotated[Optional[StrictStr], Field(description=" series tag; may be shared by different creators")] = None, + event_kind: Optional[StrictStr] = None, + recurrence_period_seconds: Annotated[Optional[StrictInt], Field(description=" 0 for one-off events")] = None, + metadata: Annotated[Optional[StrictStr], Field(description=" JSON object, max 16 KiB; presentation only")] = 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[ResultCode]: + """event_update + + Replace event details as its creator; rejected while any attached unsettled market is within its trading window. Market bindings are unchanged. + + :param authorization: (required) + :type authorization: str + :param account_index: (required) + :type account_index: int + :param title: (required) + :type title: str + :param start_at: Unix milliseconds; observation time, not trading time (required) + :type start_at: int + :param end_at: Unix milliseconds; must be after start_at (required) + :type end_at: int + :param event_id: (required) + :type event_id: int + :param description: + :type description: str + :param tag: series tag; may be shared by different creators + :type tag: str + :param event_kind: + :type event_kind: str + :param recurrence_period_seconds: 0 for one-off events + :type recurrence_period_seconds: int + :param metadata: JSON object, max 16 KiB; presentation only + :type metadata: 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._event_update_serialize( + authorization=authorization, + account_index=account_index, + title=title, + start_at=start_at, + end_at=end_at, + event_id=event_id, + description=description, + tag=tag, + event_kind=event_kind, + recurrence_period_seconds=recurrence_period_seconds, + metadata=metadata, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ResultCode", + '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 event_update_without_preload_content( + self, + authorization: StrictStr, + account_index: StrictInt, + title: StrictStr, + start_at: Annotated[StrictInt, Field(description=" Unix milliseconds; observation time, not trading time")], + end_at: Annotated[StrictInt, Field(description=" Unix milliseconds; must be after start_at")], + event_id: StrictInt, + description: Optional[StrictStr] = None, + tag: Annotated[Optional[StrictStr], Field(description=" series tag; may be shared by different creators")] = None, + event_kind: Optional[StrictStr] = None, + recurrence_period_seconds: Annotated[Optional[StrictInt], Field(description=" 0 for one-off events")] = None, + metadata: Annotated[Optional[StrictStr], Field(description=" JSON object, max 16 KiB; presentation only")] = 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: + """event_update + + Replace event details as its creator; rejected while any attached unsettled market is within its trading window. Market bindings are unchanged. + + :param authorization: (required) + :type authorization: str + :param account_index: (required) + :type account_index: int + :param title: (required) + :type title: str + :param start_at: Unix milliseconds; observation time, not trading time (required) + :type start_at: int + :param end_at: Unix milliseconds; must be after start_at (required) + :type end_at: int + :param event_id: (required) + :type event_id: int + :param description: + :type description: str + :param tag: series tag; may be shared by different creators + :type tag: str + :param event_kind: + :type event_kind: str + :param recurrence_period_seconds: 0 for one-off events + :type recurrence_period_seconds: int + :param metadata: JSON object, max 16 KiB; presentation only + :type metadata: 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._event_update_serialize( + authorization=authorization, + account_index=account_index, + title=title, + start_at=start_at, + end_at=end_at, + event_id=event_id, + description=description, + tag=tag, + event_kind=event_kind, + recurrence_period_seconds=recurrence_period_seconds, + metadata=metadata, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ResultCode", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _event_update_serialize( + self, + authorization, + account_index, + title, + start_at, + end_at, + event_id, + description, + tag, + event_kind, + recurrence_period_seconds, + metadata, + _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 + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + if account_index is not None: + _form_params.append(('account_index', account_index)) + if title is not None: + _form_params.append(('title', title)) + if description is not None: + _form_params.append(('description', description)) + if tag is not None: + _form_params.append(('tag', tag)) + if event_kind is not None: + _form_params.append(('event_kind', event_kind)) + if recurrence_period_seconds is not None: + _form_params.append(('recurrence_period_seconds', recurrence_period_seconds)) + if start_at is not None: + _form_params.append(('start_at', start_at)) + if end_at is not None: + _form_params.append(('end_at', end_at)) + if metadata is not None: + _form_params.append(('metadata', metadata)) + if event_id is not None: + _form_params.append(('event_id', event_id)) + # 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' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/x-www-form-urlencoded' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/api/v1/event/update', + 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 events( self, event_ids: Annotated[Optional[StrictStr], Field(description=" comma-separated positive IDs, max 50")] = None, diff --git a/lighter/models/__init__.py b/lighter/models/__init__.py index 0ef66c4..f292a56 100644 --- a/lighter/models/__init__.py +++ b/lighter/models/__init__.py @@ -113,6 +113,7 @@ from lighter.models.referral_totals import ReferralTotals from lighter.models.req_set_account_metadata import ReqSetAccountMetadata from lighter.models.resp_change_account_tier import RespChangeAccountTier +from lighter.models.resp_create_event import RespCreateEvent from lighter.models.resp_create_rfq import RespCreateRFQ from lighter.models.resp_get_api_tokens import RespGetApiTokens from lighter.models.resp_get_bo_pn_l import RespGetBoPnL @@ -130,6 +131,7 @@ from lighter.models.resp_post_api_token import RespPostApiToken from lighter.models.resp_price_oracle_info import RespPriceOracleInfo from lighter.models.resp_public_pools_metadata import RespPublicPoolsMetadata +from lighter.models.resp_register_event_order_book import RespRegisterEventOrderBook from lighter.models.resp_respond_to_rfq import RespRespondToRFQ from lighter.models.resp_revoke_api_token import RespRevokeApiToken from lighter.models.resp_send_tx import RespSendTx diff --git a/lighter/models/resp_create_event.py b/lighter/models/resp_create_event.py new file mode 100644 index 0000000..1446219 --- /dev/null +++ b/lighter/models/resp_create_event.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, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RespCreateEvent(BaseModel): + """ + RespCreateEvent + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + event_id: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "event_id"] + + 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 RespCreateEvent 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 RespCreateEvent from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_construct(**{ + "code": obj.get("code"), + "message": obj.get("message"), + "event_id": obj.get("event_id") + }) + # 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/resp_register_event_order_book.py b/lighter/models/resp_register_event_order_book.py new file mode 100644 index 0000000..3ca35ac --- /dev/null +++ b/lighter/models/resp_register_event_order_book.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, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RespRegisterEventOrderBook(BaseModel): + """ + RespRegisterEventOrderBook + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + success: StrictBool + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "success"] + + 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 RespRegisterEventOrderBook 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 RespRegisterEventOrderBook from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_construct(**{ + "code": obj.get("code"), + "message": obj.get("message"), + "success": obj.get("success") + }) + # 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 74746ea..41e0972 100644 --- a/openapi.json +++ b/openapi.json @@ -5355,6 +5355,162 @@ } } }, + "/api/v1/event/create": { + "post": { + "summary": "event_create", + "operationId": "event_create", + "tags": [ + "event" + ], + "description": "Create a binary options event", + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/ReqCreateEvent" + } + } + } + }, + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RespCreateEvent" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + } + } + } + }, + "/api/v1/event/update": { + "post": { + "summary": "event_update", + "operationId": "event_update", + "tags": [ + "event" + ], + "description": "Replace event details as its creator; rejected while any attached unsettled market is within its trading window. Market bindings are unchanged.", + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/ReqUpdateEvent" + } + } + } + }, + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + } + } + } + }, + "/api/v1/event/registerOrderBook": { + "post": { + "summary": "event_registerOrderBook", + "operationId": "event_registerOrderBook", + "tags": [ + "event" + ], + "description": "Register an already deployed order book to an event", + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/ReqRegisterEventOrderBook" + } + } + } + }, + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RespRegisterEventOrderBook" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + } + } + } + }, "/api/v1/events": { "get": { "summary": "events", @@ -12993,6 +13149,186 @@ "price_cap_reference_price" ] }, + "ReqCreateEvent": { + "type": "object", + "properties": { + "account_index": { + "type": "integer", + "format": "int64" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "tag": { + "type": "string", + "description": " series tag; may be shared by different creators" + }, + "event_kind": { + "type": "string", + "enum": [ + "one_off", + "recurrent" + ], + "default": "one_off" + }, + "recurrence_period_seconds": { + "type": "integer", + "format": "int32", + "description": " 0 for one-off events" + }, + "start_at": { + "type": "integer", + "format": "int64", + "description": " Unix milliseconds; observation time, not trading time" + }, + "end_at": { + "type": "integer", + "format": "int64", + "description": " Unix milliseconds; must be after start_at" + }, + "metadata": { + "type": "string", + "description": " JSON object, max 16 KiB; presentation only" + } + }, + "title": "ReqCreateEvent", + "required": [ + "account_index", + "title", + "start_at", + "end_at" + ] + }, + "ReqUpdateEvent": { + "type": "object", + "properties": { + "account_index": { + "type": "integer", + "format": "int64" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "tag": { + "type": "string", + "description": " series tag; may be shared by different creators" + }, + "event_kind": { + "type": "string", + "enum": [ + "one_off", + "recurrent" + ], + "default": "one_off" + }, + "recurrence_period_seconds": { + "type": "integer", + "format": "int32", + "description": " 0 for one-off events" + }, + "start_at": { + "type": "integer", + "format": "int64", + "description": " Unix milliseconds; observation time, not trading time" + }, + "end_at": { + "type": "integer", + "format": "int64", + "description": " Unix milliseconds; must be after start_at" + }, + "metadata": { + "type": "string", + "description": " JSON object, max 16 KiB; presentation only" + }, + "event_id": { + "type": "integer", + "format": "int64" + } + }, + "title": "ReqUpdateEvent", + "required": [ + "account_index", + "title", + "start_at", + "end_at", + "event_id" + ] + }, + "RespCreateEvent": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "event_id": { + "type": "integer", + "format": "int64", + "example": "1" + } + }, + "title": "RespCreateEvent", + "required": [ + "code", + "event_id" + ] + }, + "ReqRegisterEventOrderBook": { + "type": "object", + "properties": { + "account_index": { + "type": "integer", + "format": "int64" + }, + "event_id": { + "type": "integer", + "format": "int64" + }, + "market_index": { + "type": "integer", + "format": "int64" + } + }, + "title": "ReqRegisterEventOrderBook", + "required": [ + "account_index", + "event_id", + "market_index" + ] + }, + "RespRegisterEventOrderBook": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "success": { + "type": "boolean", + "format": "boolean", + "example": "true" + } + }, + "title": "RespRegisterEventOrderBook", + "required": [ + "code", + "success" + ] + }, "RespGetEvents": { "type": "object", "properties": { From faf8ce87ba6eef4b541975421bd27151ad720323 Mon Sep 17 00:00:00 2001 From: mihai Date: Thu, 5 Nov 2026 10:47:42 +0000 Subject: [PATCH 2/2] README: fix example links after directory reorganization --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index cff7be6..6c0b2fb 100644 --- a/README.md +++ b/README.md @@ -42,10 +42,10 @@ if __name__ == "__main__": The [`examples/`](examples) directory contains end-to-end scripts for the common flows. A few starting points: -- [Read public REST endpoints](examples/get_info.py) -- [Stream order books and account state over websocket](examples/ws.py) -- [Create / modify / cancel an order over HTTP](examples/create_modify_cancel_order_http.py) -- [Create / modify / cancel an order over websocket](examples/create_modify_cancel_order_ws.py) +- [Read public REST endpoints](examples/market-data/get_info.py) +- [Stream order books and account state over websocket](examples/websocket/ws.py) +- [Create / modify / cancel an order over HTTP](examples/orders/create_modify_cancel_order_http.py) +- [Create / modify / cancel an order over websocket](examples/orders/create_modify_cancel_order_ws.py) - [System setup (API key, signer)](examples/system_setup.py) See [`examples/README.md`](examples/README.md) for the full annotated list.