From cfecf8444b70c721b6b74e3c981843ec9ec0e986 Mon Sep 17 00:00:00 2001 From: Mihail Lavric Date: Thu, 5 Jun 2025 16:36:35 +0200 Subject: [PATCH] update-info-endpoints-5-june --- docs/AccountApi.md | 284 ++- docs/{IsWhitelisted.md => AccountLimits.md} | 19 +- docs/AccountMarketStats.md | 9 + docs/AccountMetadata.md | 3 + docs/AccountMetadatas.md | 31 + docs/AccountPosition.md | 2 + docs/AccountTradeStats.md | 36 + docs/Announcement.md | 31 + docs/AnnouncementApi.md | 74 + docs/Announcements.md | 31 + docs/{InfoApi.md => BridgeApi.md} | 26 +- docs/{FeeBucket.md => DailyReturn.md} | 21 +- docs/DepositHistoryItem.md | 1 + docs/DetailedAccount.md | 4 +- docs/{Accounts.md => ExportData.md} | 19 +- docs/FundingApi.md | 74 + docs/FundingRate.md | 32 + docs/FundingRates.md | 31 + docs/{ReqIsWhitelisted.md => L1Metadata.md} | 18 +- docs/L1ProviderInfo.md | 1 - docs/Layer2BasicInfo.md | 33 - docs/LiqTrade.md | 32 + docs/Liquidation.md | 11 +- docs/LiquidationInfo.md | 32 + docs/LiquidationInfos.md | 32 + docs/NotificationApi.md | 84 + docs/Order.md | 7 + docs/OrderApi.md | 228 +- docs/OrderBookOrders.md | 34 - docs/PnLEntry.md | 7 +- docs/PositionFundings.md | 32 + docs/PublicPool.md | 5 +- docs/PublicPoolInfo.md | 5 + docs/ReferralApi.md | 82 + docs/ReferralPointEntry.md | 34 + docs/ReferralPoints.md | 34 + docs/ReqExportData.md | 32 + docs/ReqGetAccountActiveOrders.md | 31 - docs/ReqGetAccountApiKeys.md | 2 +- docs/ReqGetAccountInactiveOrders.md | 1 + docs/ReqGetAccountLimits.md | 30 + docs/ReqGetAccountMetadata.md | 31 + docs/ReqGetAccountOrders.md | 32 - docs/ReqGetAccountPnL.md | 1 + docs/ReqGetDepositHistory.md | 2 + docs/ReqGetFastWithdrawInfo.md | 30 + docs/ReqGetFeeBucket.md | 29 - docs/ReqGetL1Metadata.md | 30 + docs/ReqGetLiquidationInfos.md | 33 + docs/ReqGetOrderBookOrders.md | 30 - docs/ReqGetPositionFunding.md | 34 + docs/ReqGetPublicPools.md | 1 + docs/ReqGetReferralPoints.md | 30 + docs/ReqGetTrades.md | 3 +- docs/ReqGetWithdrawHistory.md | 1 + docs/RespGetFastBridgeInfo.md | 31 + docs/RiskInfo.md | 33 + docs/SimpleOrder.md | 1 + docs/Status.md | 1 + docs/Trade.md | 6 + docs/TransactionApi.md | 166 +- docs/WithdrawHistory.md | 2 +- docs/WithdrawHistoryCursor.md | 30 - docs/WithdrawHistoryItem.md | 1 + examples/create_cancel_order.py | 15 +- examples/create_market_order.py | 4 +- examples/get_info.py | 21 +- examples/send_tx_batch.py | 8 +- lighter/__init__.py | 78 +- lighter/api/__init__.py | 5 + lighter/api/account_api.py | 1884 ++++++++++++++--- .../api/{info_api.py => announcement_api.py} | 42 +- lighter/api/bridge_api.py | 282 +++ lighter/api/funding_api.py | 282 +++ lighter/api/notification_api.py | 358 ++++ lighter/api/order_api.py | 979 ++------- lighter/api/referral_api.py | 334 +++ lighter/api/transaction_api.py | 68 +- lighter/models/__init__.py | 70 +- ...layer2_basic_info.py => account_limits.py} | 18 +- lighter/models/account_market_stats.py | 124 ++ lighter/models/account_metadata.py | 108 + lighter/models/account_metadatas.py | 112 + lighter/models/account_stats.py | 110 + lighter/models/account_trade_stats.py | 114 + lighter/models/announcement.py | 104 + lighter/models/announcements.py | 112 + lighter/models/bridge_supported_network.py | 104 + lighter/models/contract_address.py | 102 + lighter/models/cursor.py | 100 + lighter/models/detailed_account.py | 12 +- lighter/models/detailed_candlestick.py | 116 + lighter/models/export_data.py | 104 + lighter/models/funding_rate.py | 113 + lighter/models/funding_rates.py | 112 + lighter/models/l1_metadata.py | 104 + lighter/models/l1_provider_info.py | 104 + lighter/models/liq_trade.py | 106 + lighter/models/liquidation.py | 125 ++ lighter/models/liquidation_info.py | 121 ++ lighter/models/liquidation_infos.py | 114 + lighter/models/market_info.py | 124 ++ ...der_book_orders.py => order_book_depth.py} | 26 +- lighter/models/pn_l_entry.py | 14 +- lighter/models/position_funding.py | 119 ++ lighter/models/position_fundings.py | 114 + lighter/models/price_level.py | 102 + lighter/models/public_pool.py | 12 +- lighter/models/referral_point_entry.py | 110 + lighter/models/referral_points.py | 118 ++ lighter/models/req_export_data.py | 113 + lighter/models/req_get_account.py | 109 + lighter/models/req_get_account_api_keys.py | 102 + .../models/req_get_account_by_l1_address.py | 100 + .../models/req_get_account_inactive_orders.py | 113 + lighter/models/req_get_account_limits.py | 102 + lighter/models/req_get_account_metadata.py | 111 + lighter/models/req_get_account_pending_txs.py | 114 + lighter/models/req_get_account_pn_l.py | 129 ++ lighter/models/req_get_account_txs.py | 119 ++ lighter/models/req_get_block.py | 109 + lighter/models/req_get_block_txs.py | 109 + lighter/models/req_get_by_account.py | 109 + lighter/models/req_get_candlesticks.py | 118 ++ lighter/models/req_get_deposit_history.py | 118 ++ lighter/models/req_get_fast_withdraw_info.py | 102 + lighter/models/req_get_fundings.py | 116 + lighter/models/req_get_l1_metadata.py | 102 + lighter/models/req_get_l1_tx.py | 100 + lighter/models/req_get_latest_deposit.py | 100 + lighter/models/req_get_liquidation_infos.py | 109 + .../{fee_bucket.py => req_get_next_nonce.py} | 20 +- lighter/models/req_get_order_book_details.py | 100 + lighter/models/req_get_order_books.py | 100 + lighter/models/req_get_position_funding.py | 121 ++ lighter/models/req_get_public_pools.py | 119 ++ lighter/models/req_get_range_with_cursor.py | 103 + lighter/models/req_get_range_with_index.py | 103 + .../req_get_range_with_index_sortable.py | 115 + lighter/models/req_get_recent_trades.py | 103 + lighter/models/req_get_referral_points.py | 102 + lighter/models/req_get_trades.py | 136 ++ lighter/models/req_get_tx.py | 109 + lighter/models/req_get_withdraw_history.py | 116 + lighter/models/resp_get_fast_bridge_info.py | 104 + lighter/models/result_code.py | 102 + lighter/models/risk_info.py | 108 + lighter/models/ticker.py | 111 + lighter/models/trade.py | 20 +- lighter/models/validator_info.py | 102 + 150 files changed, 11875 insertions(+), 1824 deletions(-) rename docs/{IsWhitelisted.md => AccountLimits.md} (51%) create mode 100644 docs/AccountMetadatas.md create mode 100644 docs/AccountTradeStats.md create mode 100644 docs/Announcement.md create mode 100644 docs/AnnouncementApi.md create mode 100644 docs/Announcements.md rename docs/{InfoApi.md => BridgeApi.md} (66%) rename docs/{FeeBucket.md => DailyReturn.md} (50%) rename docs/{Accounts.md => ExportData.md} (55%) create mode 100644 docs/FundingApi.md create mode 100644 docs/FundingRate.md create mode 100644 docs/FundingRates.md rename docs/{ReqIsWhitelisted.md => L1Metadata.md} (51%) delete mode 100644 docs/Layer2BasicInfo.md create mode 100644 docs/LiqTrade.md create mode 100644 docs/LiquidationInfo.md create mode 100644 docs/LiquidationInfos.md create mode 100644 docs/NotificationApi.md delete mode 100644 docs/OrderBookOrders.md create mode 100644 docs/PositionFundings.md create mode 100644 docs/ReferralApi.md create mode 100644 docs/ReferralPointEntry.md create mode 100644 docs/ReferralPoints.md create mode 100644 docs/ReqExportData.md delete mode 100644 docs/ReqGetAccountActiveOrders.md create mode 100644 docs/ReqGetAccountLimits.md create mode 100644 docs/ReqGetAccountMetadata.md delete mode 100644 docs/ReqGetAccountOrders.md create mode 100644 docs/ReqGetFastWithdrawInfo.md delete mode 100644 docs/ReqGetFeeBucket.md create mode 100644 docs/ReqGetL1Metadata.md create mode 100644 docs/ReqGetLiquidationInfos.md delete mode 100644 docs/ReqGetOrderBookOrders.md create mode 100644 docs/ReqGetPositionFunding.md create mode 100644 docs/ReqGetReferralPoints.md create mode 100644 docs/RespGetFastBridgeInfo.md create mode 100644 docs/RiskInfo.md delete mode 100644 docs/WithdrawHistoryCursor.md rename lighter/api/{info_api.py => announcement_api.py} (91%) create mode 100644 lighter/api/bridge_api.py create mode 100644 lighter/api/funding_api.py create mode 100644 lighter/api/notification_api.py create mode 100644 lighter/api/referral_api.py rename lighter/models/{layer2_basic_info.py => account_limits.py} (82%) create mode 100644 lighter/models/account_market_stats.py create mode 100644 lighter/models/account_metadata.py create mode 100644 lighter/models/account_metadatas.py create mode 100644 lighter/models/account_stats.py create mode 100644 lighter/models/account_trade_stats.py create mode 100644 lighter/models/announcement.py create mode 100644 lighter/models/announcements.py create mode 100644 lighter/models/bridge_supported_network.py create mode 100644 lighter/models/contract_address.py create mode 100644 lighter/models/cursor.py create mode 100644 lighter/models/detailed_candlestick.py create mode 100644 lighter/models/export_data.py create mode 100644 lighter/models/funding_rate.py create mode 100644 lighter/models/funding_rates.py create mode 100644 lighter/models/l1_metadata.py create mode 100644 lighter/models/l1_provider_info.py create mode 100644 lighter/models/liq_trade.py create mode 100644 lighter/models/liquidation.py create mode 100644 lighter/models/liquidation_info.py create mode 100644 lighter/models/liquidation_infos.py create mode 100644 lighter/models/market_info.py rename lighter/models/{order_book_orders.py => order_book_depth.py} (81%) create mode 100644 lighter/models/position_funding.py create mode 100644 lighter/models/position_fundings.py create mode 100644 lighter/models/price_level.py create mode 100644 lighter/models/referral_point_entry.py create mode 100644 lighter/models/referral_points.py create mode 100644 lighter/models/req_export_data.py create mode 100644 lighter/models/req_get_account.py create mode 100644 lighter/models/req_get_account_api_keys.py create mode 100644 lighter/models/req_get_account_by_l1_address.py create mode 100644 lighter/models/req_get_account_inactive_orders.py create mode 100644 lighter/models/req_get_account_limits.py create mode 100644 lighter/models/req_get_account_metadata.py create mode 100644 lighter/models/req_get_account_pending_txs.py create mode 100644 lighter/models/req_get_account_pn_l.py create mode 100644 lighter/models/req_get_account_txs.py create mode 100644 lighter/models/req_get_block.py create mode 100644 lighter/models/req_get_block_txs.py create mode 100644 lighter/models/req_get_by_account.py create mode 100644 lighter/models/req_get_candlesticks.py create mode 100644 lighter/models/req_get_deposit_history.py create mode 100644 lighter/models/req_get_fast_withdraw_info.py create mode 100644 lighter/models/req_get_fundings.py create mode 100644 lighter/models/req_get_l1_metadata.py create mode 100644 lighter/models/req_get_l1_tx.py create mode 100644 lighter/models/req_get_latest_deposit.py create mode 100644 lighter/models/req_get_liquidation_infos.py rename lighter/models/{fee_bucket.py => req_get_next_nonce.py} (85%) create mode 100644 lighter/models/req_get_order_book_details.py create mode 100644 lighter/models/req_get_order_books.py create mode 100644 lighter/models/req_get_position_funding.py create mode 100644 lighter/models/req_get_public_pools.py create mode 100644 lighter/models/req_get_range_with_cursor.py create mode 100644 lighter/models/req_get_range_with_index.py create mode 100644 lighter/models/req_get_range_with_index_sortable.py create mode 100644 lighter/models/req_get_recent_trades.py create mode 100644 lighter/models/req_get_referral_points.py create mode 100644 lighter/models/req_get_trades.py create mode 100644 lighter/models/req_get_tx.py create mode 100644 lighter/models/req_get_withdraw_history.py create mode 100644 lighter/models/resp_get_fast_bridge_info.py create mode 100644 lighter/models/result_code.py create mode 100644 lighter/models/risk_info.py create mode 100644 lighter/models/ticker.py create mode 100644 lighter/models/validator_info.py diff --git a/docs/AccountApi.md b/docs/AccountApi.md index 268285e..869552e 100644 --- a/docs/AccountApi.md +++ b/docs/AccountApi.md @@ -5,12 +5,14 @@ All URIs are relative to *https://mainnet.zklighter.elliot.ai* Method | HTTP request | Description ------------- | ------------- | ------------- [**account**](AccountApi.md#account) | **GET** /api/v1/account | account -[**accounts**](AccountApi.md#accounts) | **GET** /api/v1/accounts | accounts +[**account_limits**](AccountApi.md#account_limits) | **GET** /api/v1/accountLimits | accountLimits +[**account_metadata**](AccountApi.md#account_metadata) | **GET** /api/v1/accountMetadata | accountMetadata [**accounts_by_l1_address**](AccountApi.md#accounts_by_l1_address) | **GET** /api/v1/accountsByL1Address | accountsByL1Address [**apikeys**](AccountApi.md#apikeys) | **GET** /api/v1/apikeys | apikeys -[**fee_bucket**](AccountApi.md#fee_bucket) | **GET** /api/v1/feeBucket | feeBucket -[**is_whitelisted**](AccountApi.md#is_whitelisted) | **GET** /api/v1/isWhitelisted | isWhitelisted +[**l1_metadata**](AccountApi.md#l1_metadata) | **GET** /api/v1/l1Metadata | l1Metadata +[**liquidations**](AccountApi.md#liquidations) | **GET** /api/v1/liquidations | liquidations [**pnl**](AccountApi.md#pnl) | **GET** /api/v1/pnl | pnl +[**position_funding**](AccountApi.md#position_funding) | **GET** /api/v1/positionFunding | positionFunding [**public_pools**](AccountApi.md#public_pools) | **GET** /api/v1/publicPools | publicPools @@ -85,19 +87,19 @@ 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) -# **accounts** -> Accounts accounts(limit, index=index, sort=sort) +# **account_limits** +> AccountLimits account_limits(account_index, authorization=authorization, auth=auth) -accounts +accountLimits -Get accounts returns accounts by account index +Get account limits ### Example ```python import lighter -from lighter.models.accounts import Accounts +from lighter.models.account_limits import AccountLimits from lighter.rest import ApiException from pprint import pprint @@ -112,17 +114,17 @@ configuration = lighter.Configuration( async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.AccountApi(api_client) - limit = 56 # int | - index = 56 # int | (optional) - sort = asc # str | (optional) (default to asc) + account_index = 56 # int | + authorization = 'authorization_example' # str | make required after integ is done (optional) + auth = 'auth_example' # str | made optional to support header auth clients (optional) try: - # accounts - api_response = await api_instance.accounts(limit, index=index, sort=sort) - print("The response of AccountApi->accounts:\n") + # accountLimits + api_response = await api_instance.account_limits(account_index, authorization=authorization, auth=auth) + print("The response of AccountApi->account_limits:\n") pprint(api_response) except Exception as e: - print("Exception when calling AccountApi->accounts: %s\n" % e) + print("Exception when calling AccountApi->account_limits: %s\n" % e) ``` @@ -132,13 +134,88 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **limit** | **int**| | - **index** | **int**| | [optional] - **sort** | **str**| | [optional] [default to asc] + **account_index** | **int**| | + **authorization** | **str**| make required after integ is done | [optional] + **auth** | **str**| made optional to support header auth clients | [optional] + +### Return type + +[**AccountLimits**](AccountLimits.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) + +# **account_metadata** +> AccountMetadatas account_metadata(by, value, authorization=authorization, auth=auth) + +accountMetadata + +Get account metadatas + +### Example + + +```python +import lighter +from lighter.models.account_metadatas import AccountMetadatas +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) + by = 'by_example' # str | + value = 'value_example' # str | + authorization = 'authorization_example' # str | (optional) + auth = 'auth_example' # str | (optional) + + try: + # accountMetadata + api_response = await api_instance.account_metadata(by, value, authorization=authorization, auth=auth) + print("The response of AccountApi->account_metadata:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AccountApi->account_metadata: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **by** | **str**| | + **value** | **str**| | + **authorization** | **str**| | [optional] + **auth** | **str**| | [optional] ### Return type -[**Accounts**](Accounts.md) +[**AccountMetadatas**](AccountMetadatas.md) ### Authorization @@ -228,11 +305,11 @@ 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) # **apikeys** -> AccountApiKeys apikeys(account_index, api_key_index) +> AccountApiKeys apikeys(account_index, api_key_index=api_key_index) apikeys -Get account api key +Get account api key. Set `api_key_index` to 255 to retrieve all api keys associated with the account. ### Example @@ -255,11 +332,11 @@ async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.AccountApi(api_client) account_index = 56 # int | - api_key_index = 255 # int | (default to 255) + api_key_index = 255 # int | (optional) (default to 255) try: # apikeys - api_response = await api_instance.apikeys(account_index, api_key_index) + api_response = await api_instance.apikeys(account_index, api_key_index=api_key_index) print("The response of AccountApi->apikeys:\n") pprint(api_response) except Exception as e: @@ -274,7 +351,7 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **account_index** | **int**| | - **api_key_index** | **int**| | [default to 255] + **api_key_index** | **int**| | [optional] [default to 255] ### Return type @@ -298,19 +375,19 @@ 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_bucket** -> FeeBucket fee_bucket(account_index) +# **l1_metadata** +> L1Metadata l1_metadata(l1_address, authorization=authorization, auth=auth) -feeBucket +l1Metadata -Get account fee bucket +Get L1 metadata ### Example ```python import lighter -from lighter.models.fee_bucket import FeeBucket +from lighter.models.l1_metadata import L1Metadata from lighter.rest import ApiException from pprint import pprint @@ -325,15 +402,17 @@ configuration = lighter.Configuration( async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.AccountApi(api_client) - account_index = 56 # int | + l1_address = 'l1_address_example' # str | + authorization = 'authorization_example' # str | make required after integ is done (optional) + auth = 'auth_example' # str | made optional to support header auth clients (optional) try: - # feeBucket - api_response = await api_instance.fee_bucket(account_index) - print("The response of AccountApi->fee_bucket:\n") + # l1Metadata + api_response = await api_instance.l1_metadata(l1_address, authorization=authorization, auth=auth) + print("The response of AccountApi->l1_metadata:\n") pprint(api_response) except Exception as e: - print("Exception when calling AccountApi->fee_bucket: %s\n" % e) + print("Exception when calling AccountApi->l1_metadata: %s\n" % e) ``` @@ -343,11 +422,13 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **account_index** | **int**| | + **l1_address** | **str**| | + **authorization** | **str**| make required after integ is done | [optional] + **auth** | **str**| made optional to support header auth clients | [optional] ### Return type -[**FeeBucket**](FeeBucket.md) +[**L1Metadata**](L1Metadata.md) ### Authorization @@ -367,19 +448,19 @@ 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) -# **is_whitelisted** -> IsWhitelisted is_whitelisted(l1_address) +# **liquidations** +> LiquidationInfos liquidations(account_index, limit, authorization=authorization, auth=auth, market_id=market_id, cursor=cursor) -isWhitelisted +liquidations -Get is account whitelisted +Get liquidation infos ### Example ```python import lighter -from lighter.models.is_whitelisted import IsWhitelisted +from lighter.models.liquidation_infos import LiquidationInfos from lighter.rest import ApiException from pprint import pprint @@ -394,15 +475,20 @@ configuration = lighter.Configuration( async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.AccountApi(api_client) - l1_address = 'l1_address_example' # str | + account_index = 56 # int | + limit = 56 # int | + authorization = 'authorization_example' # str | make required after integ is done (optional) + auth = 'auth_example' # str | made optional to support header auth clients (optional) + market_id = 255 # int | (optional) (default to 255) + cursor = 'cursor_example' # str | (optional) try: - # isWhitelisted - api_response = await api_instance.is_whitelisted(l1_address) - print("The response of AccountApi->is_whitelisted:\n") + # liquidations + api_response = await api_instance.liquidations(account_index, limit, authorization=authorization, auth=auth, market_id=market_id, cursor=cursor) + print("The response of AccountApi->liquidations:\n") pprint(api_response) except Exception as e: - print("Exception when calling AccountApi->is_whitelisted: %s\n" % e) + print("Exception when calling AccountApi->liquidations: %s\n" % e) ``` @@ -412,11 +498,16 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **l1_address** | **str**| | + **account_index** | **int**| | + **limit** | **int**| | + **authorization** | **str**| make required after integ is done | [optional] + **auth** | **str**| made optional to support header auth clients | [optional] + **market_id** | **int**| | [optional] [default to 255] + **cursor** | **str**| | [optional] ### Return type -[**IsWhitelisted**](IsWhitelisted.md) +[**LiquidationInfos**](LiquidationInfos.md) ### Authorization @@ -437,7 +528,7 @@ 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) # **pnl** -> AccountPnL pnl(by, value, resolution, start_timestamp, end_timestamp, count_back, ignore_transfers=ignore_transfers) +> AccountPnL pnl(by, value, resolution, start_timestamp, end_timestamp, count_back, authorization=authorization, auth=auth, ignore_transfers=ignore_transfers) pnl @@ -469,11 +560,13 @@ async with lighter.ApiClient(configuration) as api_client: start_timestamp = 56 # int | end_timestamp = 56 # int | count_back = 56 # int | + authorization = 'authorization_example' # str | (optional) + auth = 'auth_example' # str | (optional) ignore_transfers = False # bool | (optional) (default to False) try: # pnl - api_response = await api_instance.pnl(by, value, resolution, start_timestamp, end_timestamp, count_back, ignore_transfers=ignore_transfers) + api_response = await api_instance.pnl(by, value, resolution, start_timestamp, end_timestamp, count_back, authorization=authorization, auth=auth, ignore_transfers=ignore_transfers) print("The response of AccountApi->pnl:\n") pprint(api_response) except Exception as e: @@ -493,6 +586,8 @@ Name | Type | Description | Notes **start_timestamp** | **int**| | **end_timestamp** | **int**| | **count_back** | **int**| | + **authorization** | **str**| | [optional] + **auth** | **str**| | [optional] **ignore_transfers** | **bool**| | [optional] [default to False] ### Return type @@ -517,8 +612,89 @@ 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) +# **position_funding** +> PositionFundings position_funding(account_index, limit, authorization=authorization, auth=auth, market_id=market_id, cursor=cursor, side=side) + +positionFunding + +Get accounts position fundings + +### Example + + +```python +import lighter +from lighter.models.position_fundings import PositionFundings +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) + account_index = 56 # int | + limit = 56 # int | + authorization = 'authorization_example' # str | (optional) + auth = 'auth_example' # str | (optional) + market_id = 255 # int | (optional) (default to 255) + cursor = 'cursor_example' # str | (optional) + side = all # str | (optional) (default to all) + + try: + # positionFunding + api_response = await api_instance.position_funding(account_index, limit, authorization=authorization, auth=auth, market_id=market_id, cursor=cursor, side=side) + print("The response of AccountApi->position_funding:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AccountApi->position_funding: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_index** | **int**| | + **limit** | **int**| | + **authorization** | **str**| | [optional] + **auth** | **str**| | [optional] + **market_id** | **int**| | [optional] [default to 255] + **cursor** | **str**| | [optional] + **side** | **str**| | [optional] [default to all] + +### Return type + +[**PositionFundings**](PositionFundings.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) + # **public_pools** -> PublicPools public_pools(index, limit, filter=filter, account_index=account_index) +> PublicPools public_pools(index, limit, authorization=authorization, auth=auth, filter=filter, account_index=account_index) publicPools @@ -546,12 +722,14 @@ async with lighter.ApiClient(configuration) as api_client: api_instance = lighter.AccountApi(api_client) index = 56 # int | limit = 56 # int | + authorization = 'authorization_example' # str | (optional) + auth = 'auth_example' # str | (optional) filter = 'filter_example' # str | (optional) account_index = 56 # int | (optional) try: # publicPools - api_response = await api_instance.public_pools(index, limit, filter=filter, account_index=account_index) + api_response = await api_instance.public_pools(index, limit, authorization=authorization, auth=auth, filter=filter, account_index=account_index) print("The response of AccountApi->public_pools:\n") pprint(api_response) except Exception as e: @@ -567,6 +745,8 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **index** | **int**| | **limit** | **int**| | + **authorization** | **str**| | [optional] + **auth** | **str**| | [optional] **filter** | **str**| | [optional] **account_index** | **int**| | [optional] diff --git a/docs/IsWhitelisted.md b/docs/AccountLimits.md similarity index 51% rename from docs/IsWhitelisted.md rename to docs/AccountLimits.md index 2d36cc2..8dbe1f8 100644 --- a/docs/IsWhitelisted.md +++ b/docs/AccountLimits.md @@ -1,4 +1,4 @@ -# IsWhitelisted +# AccountLimits ## Properties @@ -7,25 +7,24 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **code** | **int** | | **message** | **str** | | [optional] -**whitelisted** | **bool** | | -**deposit_amount_left** | **str** | | +**max_llp_percentage** | **int** | | ## Example ```python -from lighter.models.is_whitelisted import IsWhitelisted +from lighter.models.account_limits import AccountLimits # TODO update the JSON string below json = "{}" -# create an instance of IsWhitelisted from a JSON string -is_whitelisted_instance = IsWhitelisted.from_json(json) +# create an instance of AccountLimits from a JSON string +account_limits_instance = AccountLimits.from_json(json) # print the JSON string representation of the object -print(IsWhitelisted.to_json()) +print(AccountLimits.to_json()) # convert the object into a dict -is_whitelisted_dict = is_whitelisted_instance.to_dict() -# create an instance of IsWhitelisted from a dict -is_whitelisted_from_dict = IsWhitelisted.from_dict(is_whitelisted_dict) +account_limits_dict = account_limits_instance.to_dict() +# create an instance of AccountLimits from a dict +account_limits_from_dict = AccountLimits.from_dict(account_limits_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/AccountMarketStats.md b/docs/AccountMarketStats.md index 91c2087..c365818 100644 --- a/docs/AccountMarketStats.md +++ b/docs/AccountMarketStats.md @@ -9,6 +9,15 @@ Name | Type | Description | Notes **daily_trades_count** | **int** | | **daily_base_token_volume** | **float** | | **daily_quote_token_volume** | **float** | | +**weekly_trades_count** | **int** | | +**weekly_base_token_volume** | **float** | | +**weekly_quote_token_volume** | **float** | | +**monthly_trades_count** | **int** | | +**monthly_base_token_volume** | **float** | | +**monthly_quote_token_volume** | **float** | | +**total_trades_count** | **int** | | +**total_base_token_volume** | **float** | | +**total_quote_token_volume** | **float** | | ## Example diff --git a/docs/AccountMetadata.md b/docs/AccountMetadata.md index 30cf736..35089cf 100644 --- a/docs/AccountMetadata.md +++ b/docs/AccountMetadata.md @@ -5,8 +5,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**account_index** | **int** | | **name** | **str** | | **description** | **str** | | +**can_invite** | **bool** | Remove After FE uses L1 meta endpoint | +**referral_points_percentage** | **str** | Remove After FE uses L1 meta endpoint | ## Example diff --git a/docs/AccountMetadatas.md b/docs/AccountMetadatas.md new file mode 100644 index 0000000..2eaa6c2 --- /dev/null +++ b/docs/AccountMetadatas.md @@ -0,0 +1,31 @@ +# AccountMetadatas + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**account_metadatas** | [**List[AccountMetadata]**](AccountMetadata.md) | | + +## Example + +```python +from lighter.models.account_metadatas import AccountMetadatas + +# TODO update the JSON string below +json = "{}" +# create an instance of AccountMetadatas from a JSON string +account_metadatas_instance = AccountMetadatas.from_json(json) +# print the JSON string representation of the object +print(AccountMetadatas.to_json()) + +# convert the object into a dict +account_metadatas_dict = account_metadatas_instance.to_dict() +# create an instance of AccountMetadatas from a dict +account_metadatas_from_dict = AccountMetadatas.from_dict(account_metadatas_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/AccountPosition.md b/docs/AccountPosition.md index cdae747..4b30c56 100644 --- a/docs/AccountPosition.md +++ b/docs/AccountPosition.md @@ -10,12 +10,14 @@ Name | Type | Description | Notes **initial_margin_fraction** | **str** | | **open_order_count** | **int** | | **pending_order_count** | **int** | | +**position_tied_order_count** | **int** | | **sign** | **int** | | **position** | **str** | | **avg_entry_price** | **str** | | **position_value** | **str** | | **unrealized_pnl** | **str** | | **realized_pnl** | **str** | | +**total_funding_paid_out** | **str** | | [optional] ## Example diff --git a/docs/AccountTradeStats.md b/docs/AccountTradeStats.md new file mode 100644 index 0000000..e42f167 --- /dev/null +++ b/docs/AccountTradeStats.md @@ -0,0 +1,36 @@ +# AccountTradeStats + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**daily_trades_count** | **int** | | +**daily_volume** | **float** | | +**weekly_trades_count** | **int** | | +**weekly_volume** | **float** | | +**monthly_trades_count** | **int** | | +**monthly_volume** | **float** | | +**total_trades_count** | **int** | | +**total_volume** | **float** | | + +## Example + +```python +from lighter.models.account_trade_stats import AccountTradeStats + +# TODO update the JSON string below +json = "{}" +# create an instance of AccountTradeStats from a JSON string +account_trade_stats_instance = AccountTradeStats.from_json(json) +# print the JSON string representation of the object +print(AccountTradeStats.to_json()) + +# convert the object into a dict +account_trade_stats_dict = account_trade_stats_instance.to_dict() +# create an instance of AccountTradeStats from a dict +account_trade_stats_from_dict = AccountTradeStats.from_dict(account_trade_stats_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/Announcement.md b/docs/Announcement.md new file mode 100644 index 0000000..271e6d9 --- /dev/null +++ b/docs/Announcement.md @@ -0,0 +1,31 @@ +# Announcement + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **str** | | +**content** | **str** | | +**created_at** | **int** | | + +## Example + +```python +from lighter.models.announcement import Announcement + +# TODO update the JSON string below +json = "{}" +# create an instance of Announcement from a JSON string +announcement_instance = Announcement.from_json(json) +# print the JSON string representation of the object +print(Announcement.to_json()) + +# convert the object into a dict +announcement_dict = announcement_instance.to_dict() +# create an instance of Announcement from a dict +announcement_from_dict = Announcement.from_dict(announcement_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/AnnouncementApi.md b/docs/AnnouncementApi.md new file mode 100644 index 0000000..11d1f03 --- /dev/null +++ b/docs/AnnouncementApi.md @@ -0,0 +1,74 @@ +# lighter.AnnouncementApi + +All URIs are relative to *https://mainnet.zklighter.elliot.ai* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**announcement**](AnnouncementApi.md#announcement) | **GET** /api/v1/announcement | announcement + + +# **announcement** +> Announcements announcement() + +announcement + +Get announcement + +### Example + + +```python +import lighter +from lighter.models.announcements import Announcements +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.AnnouncementApi(api_client) + + try: + # announcement + api_response = await api_instance.announcement() + print("The response of AnnouncementApi->announcement:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AnnouncementApi->announcement: %s\n" % e) +``` + + + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**Announcements**](Announcements.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) + diff --git a/docs/Announcements.md b/docs/Announcements.md new file mode 100644 index 0000000..5b77c2e --- /dev/null +++ b/docs/Announcements.md @@ -0,0 +1,31 @@ +# Announcements + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**announcements** | [**List[Announcement]**](Announcement.md) | | + +## Example + +```python +from lighter.models.announcements import Announcements + +# TODO update the JSON string below +json = "{}" +# create an instance of Announcements from a JSON string +announcements_instance = Announcements.from_json(json) +# print the JSON string representation of the object +print(Announcements.to_json()) + +# convert the object into a dict +announcements_dict = announcements_instance.to_dict() +# create an instance of Announcements from a dict +announcements_from_dict = Announcements.from_dict(announcements_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/InfoApi.md b/docs/BridgeApi.md similarity index 66% rename from docs/InfoApi.md rename to docs/BridgeApi.md index dbc2750..4180a8f 100644 --- a/docs/InfoApi.md +++ b/docs/BridgeApi.md @@ -1,25 +1,25 @@ -# lighter.InfoApi +# lighter.BridgeApi All URIs are relative to *https://mainnet.zklighter.elliot.ai* Method | HTTP request | Description ------------- | ------------- | ------------- -[**layer2_basic_info**](InfoApi.md#layer2_basic_info) | **GET** /api/v1/layer2BasicInfo | layer2BasicInfo +[**fastbridge_info**](BridgeApi.md#fastbridge_info) | **GET** /api/v1/fastbridge/info | fastbridge_info -# **layer2_basic_info** -> Layer2BasicInfo layer2_basic_info() +# **fastbridge_info** +> RespGetFastBridgeInfo fastbridge_info() -layer2BasicInfo +fastbridge_info -Get zklighter general info, including contract address, and count of transactions and active users +Get fast bridge info ### Example ```python import lighter -from lighter.models.layer2_basic_info import Layer2BasicInfo +from lighter.models.resp_get_fast_bridge_info import RespGetFastBridgeInfo from lighter.rest import ApiException from pprint import pprint @@ -33,15 +33,15 @@ configuration = lighter.Configuration( # 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.InfoApi(api_client) + api_instance = lighter.BridgeApi(api_client) try: - # layer2BasicInfo - api_response = await api_instance.layer2_basic_info() - print("The response of InfoApi->layer2_basic_info:\n") + # fastbridge_info + api_response = await api_instance.fastbridge_info() + print("The response of BridgeApi->fastbridge_info:\n") pprint(api_response) except Exception as e: - print("Exception when calling InfoApi->layer2_basic_info: %s\n" % e) + print("Exception when calling BridgeApi->fastbridge_info: %s\n" % e) ``` @@ -52,7 +52,7 @@ This endpoint does not need any parameter. ### Return type -[**Layer2BasicInfo**](Layer2BasicInfo.md) +[**RespGetFastBridgeInfo**](RespGetFastBridgeInfo.md) ### Authorization diff --git a/docs/FeeBucket.md b/docs/DailyReturn.md similarity index 50% rename from docs/FeeBucket.md rename to docs/DailyReturn.md index e9e24f1..225d246 100644 --- a/docs/FeeBucket.md +++ b/docs/DailyReturn.md @@ -1,30 +1,29 @@ -# FeeBucket +# DailyReturn ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**vip_tier** | **int** | | -**taker_fee** | **int** | | -**maker_fee** | **int** | | +**timestamp** | **int** | | +**daily_return** | **float** | | ## Example ```python -from lighter.models.fee_bucket import FeeBucket +from lighter.models.daily_return import DailyReturn # TODO update the JSON string below json = "{}" -# create an instance of FeeBucket from a JSON string -fee_bucket_instance = FeeBucket.from_json(json) +# create an instance of DailyReturn from a JSON string +daily_return_instance = DailyReturn.from_json(json) # print the JSON string representation of the object -print(FeeBucket.to_json()) +print(DailyReturn.to_json()) # convert the object into a dict -fee_bucket_dict = fee_bucket_instance.to_dict() -# create an instance of FeeBucket from a dict -fee_bucket_from_dict = FeeBucket.from_dict(fee_bucket_dict) +daily_return_dict = daily_return_instance.to_dict() +# create an instance of DailyReturn from a dict +daily_return_from_dict = DailyReturn.from_dict(daily_return_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/DepositHistoryItem.md b/docs/DepositHistoryItem.md index 51a8e45..3e850fe 100644 --- a/docs/DepositHistoryItem.md +++ b/docs/DepositHistoryItem.md @@ -9,6 +9,7 @@ Name | Type | Description | Notes **amount** | **str** | | **timestamp** | **int** | | **status** | **str** | | +**l1_tx_hash** | **str** | | ## Example diff --git a/docs/DetailedAccount.md b/docs/DetailedAccount.md index 39e11f8..eef0ef4 100644 --- a/docs/DetailedAccount.md +++ b/docs/DetailedAccount.md @@ -15,11 +15,13 @@ Name | Type | Description | Notes **pending_order_count** | **int** | | **status** | **int** | | **collateral** | **str** | | +**account_index** | **int** | | **name** | **str** | | **description** | **str** | | +**can_invite** | **bool** | Remove After FE uses L1 meta endpoint | +**referral_points_percentage** | **str** | Remove After FE uses L1 meta endpoint | **positions** | [**List[AccountPosition]**](AccountPosition.md) | | **total_asset_value** | **str** | | -**market_stats** | [**List[AccountMarketStats]**](AccountMarketStats.md) | | **pool_info** | [**PublicPoolInfo**](PublicPoolInfo.md) | | **shares** | [**List[PublicPoolShare]**](PublicPoolShare.md) | | diff --git a/docs/Accounts.md b/docs/ExportData.md similarity index 55% rename from docs/Accounts.md rename to docs/ExportData.md index 9c3b5e4..2770b68 100644 --- a/docs/Accounts.md +++ b/docs/ExportData.md @@ -1,4 +1,4 @@ -# Accounts +# ExportData ## Properties @@ -7,25 +7,24 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **code** | **int** | | **message** | **str** | | [optional] -**total** | **int** | | -**accounts** | [**List[Account]**](Account.md) | | +**data_url** | **str** | | ## Example ```python -from lighter.models.accounts import Accounts +from lighter.models.export_data import ExportData # TODO update the JSON string below json = "{}" -# create an instance of Accounts from a JSON string -accounts_instance = Accounts.from_json(json) +# create an instance of ExportData from a JSON string +export_data_instance = ExportData.from_json(json) # print the JSON string representation of the object -print(Accounts.to_json()) +print(ExportData.to_json()) # convert the object into a dict -accounts_dict = accounts_instance.to_dict() -# create an instance of Accounts from a dict -accounts_from_dict = Accounts.from_dict(accounts_dict) +export_data_dict = export_data_instance.to_dict() +# create an instance of ExportData from a dict +export_data_from_dict = ExportData.from_dict(export_data_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/FundingApi.md b/docs/FundingApi.md new file mode 100644 index 0000000..7f1ab04 --- /dev/null +++ b/docs/FundingApi.md @@ -0,0 +1,74 @@ +# lighter.FundingApi + +All URIs are relative to *https://mainnet.zklighter.elliot.ai* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**funding_rates**](FundingApi.md#funding_rates) | **GET** /api/v1/funding-rates | funding-rates + + +# **funding_rates** +> FundingRates funding_rates() + +funding-rates + +Get funding rates + +### Example + + +```python +import lighter +from lighter.models.funding_rates import FundingRates +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.FundingApi(api_client) + + try: + # funding-rates + api_response = await api_instance.funding_rates() + print("The response of FundingApi->funding_rates:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FundingApi->funding_rates: %s\n" % e) +``` + + + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**FundingRates**](FundingRates.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) + diff --git a/docs/FundingRate.md b/docs/FundingRate.md new file mode 100644 index 0000000..dc3886f --- /dev/null +++ b/docs/FundingRate.md @@ -0,0 +1,32 @@ +# FundingRate + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**market_id** | **int** | | +**exchange** | **str** | | +**symbol** | **str** | | +**rate** | **float** | | + +## Example + +```python +from lighter.models.funding_rate import FundingRate + +# TODO update the JSON string below +json = "{}" +# create an instance of FundingRate from a JSON string +funding_rate_instance = FundingRate.from_json(json) +# print the JSON string representation of the object +print(FundingRate.to_json()) + +# convert the object into a dict +funding_rate_dict = funding_rate_instance.to_dict() +# create an instance of FundingRate from a dict +funding_rate_from_dict = FundingRate.from_dict(funding_rate_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/FundingRates.md b/docs/FundingRates.md new file mode 100644 index 0000000..27f6fe1 --- /dev/null +++ b/docs/FundingRates.md @@ -0,0 +1,31 @@ +# FundingRates + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**funding_rates** | [**List[FundingRate]**](FundingRate.md) | | + +## Example + +```python +from lighter.models.funding_rates import FundingRates + +# TODO update the JSON string below +json = "{}" +# create an instance of FundingRates from a JSON string +funding_rates_instance = FundingRates.from_json(json) +# print the JSON string representation of the object +print(FundingRates.to_json()) + +# convert the object into a dict +funding_rates_dict = funding_rates_instance.to_dict() +# create an instance of FundingRates from a dict +funding_rates_from_dict = FundingRates.from_dict(funding_rates_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/ReqIsWhitelisted.md b/docs/L1Metadata.md similarity index 51% rename from docs/ReqIsWhitelisted.md rename to docs/L1Metadata.md index 69141d5..2d277c4 100644 --- a/docs/ReqIsWhitelisted.md +++ b/docs/L1Metadata.md @@ -1,4 +1,4 @@ -# ReqIsWhitelisted +# L1Metadata ## Properties @@ -6,23 +6,25 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **l1_address** | **str** | | +**can_invite** | **bool** | | +**referral_points_percentage** | **str** | | ## Example ```python -from lighter.models.req_is_whitelisted import ReqIsWhitelisted +from lighter.models.l1_metadata import L1Metadata # TODO update the JSON string below json = "{}" -# create an instance of ReqIsWhitelisted from a JSON string -req_is_whitelisted_instance = ReqIsWhitelisted.from_json(json) +# create an instance of L1Metadata from a JSON string +l1_metadata_instance = L1Metadata.from_json(json) # print the JSON string representation of the object -print(ReqIsWhitelisted.to_json()) +print(L1Metadata.to_json()) # convert the object into a dict -req_is_whitelisted_dict = req_is_whitelisted_instance.to_dict() -# create an instance of ReqIsWhitelisted from a dict -req_is_whitelisted_from_dict = ReqIsWhitelisted.from_dict(req_is_whitelisted_dict) +l1_metadata_dict = l1_metadata_instance.to_dict() +# create an instance of L1Metadata from a dict +l1_metadata_from_dict = L1Metadata.from_dict(l1_metadata_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/L1ProviderInfo.md b/docs/L1ProviderInfo.md index 4413ba8..1ba41f0 100644 --- a/docs/L1ProviderInfo.md +++ b/docs/L1ProviderInfo.md @@ -8,7 +8,6 @@ Name | Type | Description | Notes **chain_id** | **int** | | **network_id** | **int** | | **latest_block_number** | **int** | | -**network_rpc** | **str** | | ## Example diff --git a/docs/Layer2BasicInfo.md b/docs/Layer2BasicInfo.md deleted file mode 100644 index 26e905f..0000000 --- a/docs/Layer2BasicInfo.md +++ /dev/null @@ -1,33 +0,0 @@ -# Layer2BasicInfo - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**code** | **int** | | -**message** | **str** | | [optional] -**block_committed** | **int** | | -**block_verified** | **int** | | -**total_transaction_count** | **int** | | - -## Example - -```python -from lighter.models.layer2_basic_info import Layer2BasicInfo - -# TODO update the JSON string below -json = "{}" -# create an instance of Layer2BasicInfo from a JSON string -layer2_basic_info_instance = Layer2BasicInfo.from_json(json) -# print the JSON string representation of the object -print(Layer2BasicInfo.to_json()) - -# convert the object into a dict -layer2_basic_info_dict = layer2_basic_info_instance.to_dict() -# create an instance of Layer2BasicInfo from a dict -layer2_basic_info_from_dict = Layer2BasicInfo.from_dict(layer2_basic_info_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/LiqTrade.md b/docs/LiqTrade.md new file mode 100644 index 0000000..d9761c4 --- /dev/null +++ b/docs/LiqTrade.md @@ -0,0 +1,32 @@ +# LiqTrade + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**price** | **str** | | +**size** | **str** | | +**taker_fee** | **str** | | +**maker_fee** | **str** | | + +## Example + +```python +from lighter.models.liq_trade import LiqTrade + +# TODO update the JSON string below +json = "{}" +# create an instance of LiqTrade from a JSON string +liq_trade_instance = LiqTrade.from_json(json) +# print the JSON string representation of the object +print(LiqTrade.to_json()) + +# convert the object into a dict +liq_trade_dict = liq_trade_instance.to_dict() +# create an instance of LiqTrade from a dict +liq_trade_from_dict = LiqTrade.from_dict(liq_trade_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/Liquidation.md b/docs/Liquidation.md index 4f86484..6b6ad54 100644 --- a/docs/Liquidation.md +++ b/docs/Liquidation.md @@ -5,11 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**liquidation_id** | **int** | | -**account_index** | **int** | | -**liquidation_type** | **int** | | -**portfolio_value** | **str** | | -**margin_requirement** | **str** | | +**id** | **int** | | +**market_id** | **int** | | +**type** | **str** | | +**trade** | [**LiqTrade**](LiqTrade.md) | | +**info** | [**LiquidationInfo**](LiquidationInfo.md) | | +**executed_at** | **int** | | ## Example diff --git a/docs/LiquidationInfo.md b/docs/LiquidationInfo.md new file mode 100644 index 0000000..6f388dc --- /dev/null +++ b/docs/LiquidationInfo.md @@ -0,0 +1,32 @@ +# LiquidationInfo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**positions** | [**List[AccountPosition]**](AccountPosition.md) | | +**risk_info_before** | [**RiskInfo**](RiskInfo.md) | | +**risk_info_after** | [**RiskInfo**](RiskInfo.md) | | +**mark_prices** | **Dict[str, float]** | | + +## Example + +```python +from lighter.models.liquidation_info import LiquidationInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of LiquidationInfo from a JSON string +liquidation_info_instance = LiquidationInfo.from_json(json) +# print the JSON string representation of the object +print(LiquidationInfo.to_json()) + +# convert the object into a dict +liquidation_info_dict = liquidation_info_instance.to_dict() +# create an instance of LiquidationInfo from a dict +liquidation_info_from_dict = LiquidationInfo.from_dict(liquidation_info_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/LiquidationInfos.md b/docs/LiquidationInfos.md new file mode 100644 index 0000000..e9b6c0b --- /dev/null +++ b/docs/LiquidationInfos.md @@ -0,0 +1,32 @@ +# LiquidationInfos + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**liquidations** | [**List[Liquidation]**](Liquidation.md) | | +**next_cursor** | **str** | | [optional] + +## Example + +```python +from lighter.models.liquidation_infos import LiquidationInfos + +# TODO update the JSON string below +json = "{}" +# create an instance of LiquidationInfos from a JSON string +liquidation_infos_instance = LiquidationInfos.from_json(json) +# print the JSON string representation of the object +print(LiquidationInfos.to_json()) + +# convert the object into a dict +liquidation_infos_dict = liquidation_infos_instance.to_dict() +# create an instance of LiquidationInfos from a dict +liquidation_infos_from_dict = LiquidationInfos.from_dict(liquidation_infos_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/NotificationApi.md b/docs/NotificationApi.md new file mode 100644 index 0000000..4bdc22d --- /dev/null +++ b/docs/NotificationApi.md @@ -0,0 +1,84 @@ +# lighter.NotificationApi + +All URIs are relative to *https://mainnet.zklighter.elliot.ai* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**notification_ack**](NotificationApi.md#notification_ack) | **POST** /api/v1/notification/ack | notification_ack + + +# **notification_ack** +> ResultCode notification_ack(notif_id, account_index, authorization=authorization, auth=auth) + +notification_ack + +Ack notification + +### 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.NotificationApi(api_client) + notif_id = 'notif_id_example' # str | + account_index = 56 # int | + authorization = 'authorization_example' # str | make required after integ is done (optional) + auth = 'auth_example' # str | made optional to support header auth clients (optional) + + try: + # notification_ack + api_response = await api_instance.notification_ack(notif_id, account_index, authorization=authorization, auth=auth) + print("The response of NotificationApi->notification_ack:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling NotificationApi->notification_ack: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **notif_id** | **str**| | + **account_index** | **int**| | + **authorization** | **str**| make required after integ is done | [optional] + **auth** | **str**| made optional to support header auth clients | [optional] + +### Return type + +[**ResultCode**](ResultCode.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **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) + diff --git a/docs/Order.md b/docs/Order.md index 981098a..a3415f4 100644 --- a/docs/Order.md +++ b/docs/Order.md @@ -7,6 +7,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **order_index** | **int** | | **client_order_index** | **int** | | +**order_id** | **str** | | +**client_order_id** | **str** | | **market_index** | **int** | | **owner_account_index** | **int** | | **initial_base_amount** | **str** | | @@ -25,8 +27,13 @@ Name | Type | Description | Notes **trigger_price** | **str** | | **order_expiry** | **int** | | **status** | **str** | | +**trigger_status** | **str** | | **trigger_time** | **int** | | **parent_order_index** | **int** | | +**parent_order_id** | **str** | | +**to_trigger_order_id_0** | **str** | | +**to_trigger_order_id_1** | **str** | | +**to_cancel_order_id_0** | **str** | | **block_height** | **int** | | **timestamp** | **int** | | diff --git a/docs/OrderApi.md b/docs/OrderApi.md index 7bd17d0..3c7deb3 100644 --- a/docs/OrderApi.md +++ b/docs/OrderApi.md @@ -4,96 +4,21 @@ All URIs are relative to *https://mainnet.zklighter.elliot.ai* Method | HTTP request | Description ------------- | ------------- | ------------- -[**account_active_orders**](OrderApi.md#account_active_orders) | **GET** /api/v1/accountActiveOrders | accountActiveOrders [**account_inactive_orders**](OrderApi.md#account_inactive_orders) | **GET** /api/v1/accountInactiveOrders | accountInactiveOrders -[**account_orders**](OrderApi.md#account_orders) | **GET** /api/v1/accountOrders | accountOrders [**exchange_stats**](OrderApi.md#exchange_stats) | **GET** /api/v1/exchangeStats | exchangeStats +[**export**](OrderApi.md#export) | **GET** /api/v1/export | export [**order_book_details**](OrderApi.md#order_book_details) | **GET** /api/v1/orderBookDetails | orderBookDetails -[**order_book_orders**](OrderApi.md#order_book_orders) | **GET** /api/v1/orderBookOrders | orderBookOrders [**order_books**](OrderApi.md#order_books) | **GET** /api/v1/orderBooks | orderBooks [**recent_trades**](OrderApi.md#recent_trades) | **GET** /api/v1/recentTrades | recentTrades [**trades**](OrderApi.md#trades) | **GET** /api/v1/trades | trades -# **account_active_orders** -> Orders account_active_orders(account_index, market_id, auth) - -accountActiveOrders - -Get account active orders - -### Example - - -```python -import lighter -from lighter.models.orders import Orders -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.OrderApi(api_client) - account_index = 56 # int | - market_id = 56 # int | - auth = 'auth_example' # str | - - try: - # accountActiveOrders - api_response = await api_instance.account_active_orders(account_index, market_id, auth) - print("The response of OrderApi->account_active_orders:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling OrderApi->account_active_orders: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **account_index** | **int**| | - **market_id** | **int**| | - **auth** | **str**| | - -### Return type - -[**Orders**](Orders.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) - # **account_inactive_orders** -> Orders account_inactive_orders(account_index, limit, market_id=market_id, ask_filter=ask_filter, between_timestamps=between_timestamps, cursor=cursor) +> Orders account_inactive_orders(account_index, limit, authorization=authorization, auth=auth, market_id=market_id, ask_filter=ask_filter, between_timestamps=between_timestamps, cursor=cursor) accountInactiveOrders -Get account active orders +Get account inactive orders ### Example @@ -117,6 +42,8 @@ async with lighter.ApiClient(configuration) as api_client: api_instance = lighter.OrderApi(api_client) account_index = 56 # int | limit = 56 # int | + authorization = 'authorization_example' # str | make required after integ is done (optional) + auth = 'auth_example' # str | made optional to support header auth clients (optional) market_id = 255 # int | (optional) (default to 255) ask_filter = -1 # int | (optional) (default to -1) between_timestamps = 'between_timestamps_example' # str | (optional) @@ -124,7 +51,7 @@ async with lighter.ApiClient(configuration) as api_client: try: # accountInactiveOrders - api_response = await api_instance.account_inactive_orders(account_index, limit, market_id=market_id, ask_filter=ask_filter, between_timestamps=between_timestamps, cursor=cursor) + api_response = await api_instance.account_inactive_orders(account_index, limit, authorization=authorization, auth=auth, market_id=market_id, ask_filter=ask_filter, between_timestamps=between_timestamps, cursor=cursor) print("The response of OrderApi->account_inactive_orders:\n") pprint(api_response) except Exception as e: @@ -140,6 +67,8 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **account_index** | **int**| | **limit** | **int**| | + **authorization** | **str**| make required after integ is done | [optional] + **auth** | **str**| made optional to support header auth clients | [optional] **market_id** | **int**| | [optional] [default to 255] **ask_filter** | **int**| | [optional] [default to -1] **between_timestamps** | **str**| | [optional] @@ -167,81 +96,6 @@ 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) -# **account_orders** -> Orders account_orders(account_index, market_id, limit, cursor=cursor) - -accountOrders - -Get account orders - -### Example - - -```python -import lighter -from lighter.models.orders import Orders -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.OrderApi(api_client) - account_index = 56 # int | - market_id = 56 # int | - limit = 56 # int | - cursor = 'cursor_example' # str | (optional) - - try: - # accountOrders - api_response = await api_instance.account_orders(account_index, market_id, limit, cursor=cursor) - print("The response of OrderApi->account_orders:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling OrderApi->account_orders: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **account_index** | **int**| | - **market_id** | **int**| | - **limit** | **int**| | - **cursor** | **str**| | [optional] - -### Return type - -[**Orders**](Orders.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) - # **exchange_stats** > ExchangeStats exchange_stats() @@ -307,19 +161,19 @@ 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) -# **order_book_details** -> OrderBookDetails order_book_details(market_id=market_id) +# **export** +> ExportData export(type, authorization=authorization, auth=auth, account_index=account_index, market_id=market_id) -orderBookDetails +export -Get order books metadata +Export data ### Example ```python import lighter -from lighter.models.order_book_details import OrderBookDetails +from lighter.models.export_data import ExportData from lighter.rest import ApiException from pprint import pprint @@ -334,15 +188,19 @@ configuration = lighter.Configuration( async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.OrderApi(api_client) + type = 'type_example' # str | + authorization = 'authorization_example' # str | (optional) + auth = 'auth_example' # str | (optional) + account_index = -1 # int | (optional) (default to -1) market_id = 255 # int | (optional) (default to 255) try: - # orderBookDetails - api_response = await api_instance.order_book_details(market_id=market_id) - print("The response of OrderApi->order_book_details:\n") + # export + api_response = await api_instance.export(type, authorization=authorization, auth=auth, account_index=account_index, market_id=market_id) + print("The response of OrderApi->export:\n") pprint(api_response) except Exception as e: - print("Exception when calling OrderApi->order_book_details: %s\n" % e) + print("Exception when calling OrderApi->export: %s\n" % e) ``` @@ -352,11 +210,15 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **type** | **str**| | + **authorization** | **str**| | [optional] + **auth** | **str**| | [optional] + **account_index** | **int**| | [optional] [default to -1] **market_id** | **int**| | [optional] [default to 255] ### Return type -[**OrderBookDetails**](OrderBookDetails.md) +[**ExportData**](ExportData.md) ### Authorization @@ -376,19 +238,19 @@ 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) -# **order_book_orders** -> OrderBookOrders order_book_orders(market_id, limit) +# **order_book_details** +> OrderBookDetails order_book_details(market_id=market_id) -orderBookOrders +orderBookDetails -Get order book orders +Get order books metadata ### Example ```python import lighter -from lighter.models.order_book_orders import OrderBookOrders +from lighter.models.order_book_details import OrderBookDetails from lighter.rest import ApiException from pprint import pprint @@ -403,16 +265,15 @@ configuration = lighter.Configuration( async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.OrderApi(api_client) - market_id = 56 # int | - limit = 56 # int | + market_id = 255 # int | (optional) (default to 255) try: - # orderBookOrders - api_response = await api_instance.order_book_orders(market_id, limit) - print("The response of OrderApi->order_book_orders:\n") + # orderBookDetails + api_response = await api_instance.order_book_details(market_id=market_id) + print("The response of OrderApi->order_book_details:\n") pprint(api_response) except Exception as e: - print("Exception when calling OrderApi->order_book_orders: %s\n" % e) + print("Exception when calling OrderApi->order_book_details: %s\n" % e) ``` @@ -422,12 +283,11 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **market_id** | **int**| | - **limit** | **int**| | + **market_id** | **int**| | [optional] [default to 255] ### Return type -[**OrderBookOrders**](OrderBookOrders.md) +[**OrderBookDetails**](OrderBookDetails.md) ### Authorization @@ -588,7 +448,7 @@ 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) # **trades** -> Trades trades(sort_by, limit, market_id=market_id, account_index=account_index, order_index=order_index, sort_dir=sort_dir, cursor=cursor, var_from=var_from, ask_filter=ask_filter) +> Trades trades(sort_by, limit, authorization=authorization, auth=auth, market_id=market_id, account_index=account_index, order_index=order_index, sort_dir=sort_dir, cursor=cursor, var_from=var_from, ask_filter=ask_filter) trades @@ -616,17 +476,19 @@ async with lighter.ApiClient(configuration) as api_client: api_instance = lighter.OrderApi(api_client) sort_by = 'sort_by_example' # str | limit = 56 # int | + authorization = 'authorization_example' # str | (optional) + auth = 'auth_example' # str | (optional) market_id = 255 # int | (optional) (default to 255) account_index = -1 # int | (optional) (default to -1) order_index = 56 # int | (optional) - sort_dir = asc # str | (optional) (default to asc) + sort_dir = desc # str | (optional) (default to desc) cursor = 'cursor_example' # str | (optional) var_from = -1 # int | (optional) (default to -1) ask_filter = -1 # int | (optional) (default to -1) try: # trades - api_response = await api_instance.trades(sort_by, limit, market_id=market_id, account_index=account_index, order_index=order_index, sort_dir=sort_dir, cursor=cursor, var_from=var_from, ask_filter=ask_filter) + api_response = await api_instance.trades(sort_by, limit, authorization=authorization, auth=auth, market_id=market_id, account_index=account_index, order_index=order_index, sort_dir=sort_dir, cursor=cursor, var_from=var_from, ask_filter=ask_filter) print("The response of OrderApi->trades:\n") pprint(api_response) except Exception as e: @@ -642,10 +504,12 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **sort_by** | **str**| | **limit** | **int**| | + **authorization** | **str**| | [optional] + **auth** | **str**| | [optional] **market_id** | **int**| | [optional] [default to 255] **account_index** | **int**| | [optional] [default to -1] **order_index** | **int**| | [optional] - **sort_dir** | **str**| | [optional] [default to asc] + **sort_dir** | **str**| | [optional] [default to desc] **cursor** | **str**| | [optional] **var_from** | **int**| | [optional] [default to -1] **ask_filter** | **int**| | [optional] [default to -1] diff --git a/docs/OrderBookOrders.md b/docs/OrderBookOrders.md deleted file mode 100644 index 960e274..0000000 --- a/docs/OrderBookOrders.md +++ /dev/null @@ -1,34 +0,0 @@ -# OrderBookOrders - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**code** | **int** | | -**message** | **str** | | [optional] -**total_asks** | **int** | | -**asks** | [**List[SimpleOrder]**](SimpleOrder.md) | | -**total_bids** | **int** | | -**bids** | [**List[SimpleOrder]**](SimpleOrder.md) | | - -## Example - -```python -from lighter.models.order_book_orders import OrderBookOrders - -# TODO update the JSON string below -json = "{}" -# create an instance of OrderBookOrders from a JSON string -order_book_orders_instance = OrderBookOrders.from_json(json) -# print the JSON string representation of the object -print(OrderBookOrders.to_json()) - -# convert the object into a dict -order_book_orders_dict = order_book_orders_instance.to_dict() -# create an instance of OrderBookOrders from a dict -order_book_orders_from_dict = OrderBookOrders.from_dict(order_book_orders_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/PnLEntry.md b/docs/PnLEntry.md index 91d626a..10a71ce 100644 --- a/docs/PnLEntry.md +++ b/docs/PnLEntry.md @@ -6,7 +6,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **timestamp** | **int** | | -**value** | **float** | | +**trade_pnl** | **float** | | +**inflow** | **float** | | +**outflow** | **float** | | +**pool_pnl** | **float** | | +**pool_inflow** | **float** | | +**pool_outflow** | **float** | | ## Example diff --git a/docs/PositionFundings.md b/docs/PositionFundings.md new file mode 100644 index 0000000..ea40d9e --- /dev/null +++ b/docs/PositionFundings.md @@ -0,0 +1,32 @@ +# PositionFundings + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**position_fundings** | [**List[PositionFunding]**](PositionFunding.md) | | +**next_cursor** | **str** | | [optional] + +## Example + +```python +from lighter.models.position_fundings import PositionFundings + +# TODO update the JSON string below +json = "{}" +# create an instance of PositionFundings from a JSON string +position_fundings_instance = PositionFundings.from_json(json) +# print the JSON string representation of the object +print(PositionFundings.to_json()) + +# convert the object into a dict +position_fundings_dict = position_fundings_instance.to_dict() +# create an instance of PositionFundings from a dict +position_fundings_from_dict = PositionFundings.from_dict(position_fundings_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/PublicPool.md b/docs/PublicPool.md index 766fe15..35bac90 100644 --- a/docs/PublicPool.md +++ b/docs/PublicPool.md @@ -15,11 +15,14 @@ Name | Type | Description | Notes **pending_order_count** | **int** | | **status** | **int** | | **collateral** | **str** | | +**account_index** | **int** | | **name** | **str** | | **description** | **str** | | +**can_invite** | **bool** | Remove After FE uses L1 meta endpoint | +**referral_points_percentage** | **str** | Remove After FE uses L1 meta endpoint | **total_asset_value** | **str** | | **pool_info** | [**PublicPoolInfo**](PublicPoolInfo.md) | | -**account_share** | [**PublicPoolShare**](PublicPoolShare.md) | | +**account_share** | [**PublicPoolShare**](PublicPoolShare.md) | | [optional] ## Example diff --git a/docs/PublicPoolInfo.md b/docs/PublicPoolInfo.md index 6ac8ab2..1d8cc8f 100644 --- a/docs/PublicPoolInfo.md +++ b/docs/PublicPoolInfo.md @@ -10,6 +10,11 @@ Name | Type | Description | Notes **min_operator_share_rate** | **str** | | **total_shares** | **int** | | **operator_shares** | **int** | | +**share_price_1d** | **float** | | +**share_price_7d** | **float** | | +**share_price_30d** | **float** | | +**annual_percentage_yield** | **float** | | +**daily_returns** | [**List[DailyReturn]**](DailyReturn.md) | | ## Example diff --git a/docs/ReferralApi.md b/docs/ReferralApi.md new file mode 100644 index 0000000..0ee3c8b --- /dev/null +++ b/docs/ReferralApi.md @@ -0,0 +1,82 @@ +# lighter.ReferralApi + +All URIs are relative to *https://mainnet.zklighter.elliot.ai* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**referral_points**](ReferralApi.md#referral_points) | **GET** /api/v1/referral/points | referral_points + + +# **referral_points** +> ReferralPoints referral_points(account_index, authorization=authorization, auth=auth) + +referral_points + +Get referral points + +### Example + + +```python +import lighter +from lighter.models.referral_points import ReferralPoints +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.ReferralApi(api_client) + account_index = 56 # int | + authorization = 'authorization_example' # str | make required after integ is done (optional) + auth = 'auth_example' # str | made optional to support header auth clients (optional) + + try: + # referral_points + api_response = await api_instance.referral_points(account_index, authorization=authorization, auth=auth) + print("The response of ReferralApi->referral_points:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ReferralApi->referral_points: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_index** | **int**| | + **authorization** | **str**| make required after integ is done | [optional] + **auth** | **str**| made optional to support header auth clients | [optional] + +### Return type + +[**ReferralPoints**](ReferralPoints.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) + diff --git a/docs/ReferralPointEntry.md b/docs/ReferralPointEntry.md new file mode 100644 index 0000000..2bb70bb --- /dev/null +++ b/docs/ReferralPointEntry.md @@ -0,0 +1,34 @@ +# ReferralPointEntry + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**l1_address** | **str** | | +**total_points** | **int** | | +**week_points** | **int** | | +**total_reward_points** | **int** | | +**week_reward_points** | **int** | | +**reward_point_multiplier** | **str** | | + +## Example + +```python +from lighter.models.referral_point_entry import ReferralPointEntry + +# TODO update the JSON string below +json = "{}" +# create an instance of ReferralPointEntry from a JSON string +referral_point_entry_instance = ReferralPointEntry.from_json(json) +# print the JSON string representation of the object +print(ReferralPointEntry.to_json()) + +# convert the object into a dict +referral_point_entry_dict = referral_point_entry_instance.to_dict() +# create an instance of ReferralPointEntry from a dict +referral_point_entry_from_dict = ReferralPointEntry.from_dict(referral_point_entry_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/ReferralPoints.md b/docs/ReferralPoints.md new file mode 100644 index 0000000..3ed5f35 --- /dev/null +++ b/docs/ReferralPoints.md @@ -0,0 +1,34 @@ +# ReferralPoints + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**referrals** | [**List[ReferralPointEntry]**](ReferralPointEntry.md) | | +**user_total_points** | **int** | | +**user_last_week_points** | **int** | | +**user_total_referral_reward_points** | **int** | | +**user_last_week_referral_reward_points** | **int** | | +**reward_point_multiplier** | **str** | | + +## Example + +```python +from lighter.models.referral_points import ReferralPoints + +# TODO update the JSON string below +json = "{}" +# create an instance of ReferralPoints from a JSON string +referral_points_instance = ReferralPoints.from_json(json) +# print the JSON string representation of the object +print(ReferralPoints.to_json()) + +# convert the object into a dict +referral_points_dict = referral_points_instance.to_dict() +# create an instance of ReferralPoints from a dict +referral_points_from_dict = ReferralPoints.from_dict(referral_points_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/ReqExportData.md b/docs/ReqExportData.md new file mode 100644 index 0000000..0222e94 --- /dev/null +++ b/docs/ReqExportData.md @@ -0,0 +1,32 @@ +# ReqExportData + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**auth** | **str** | | [optional] +**account_index** | **int** | | [optional] [default to -1] +**market_id** | **int** | | [optional] +**type** | **str** | | + +## Example + +```python +from lighter.models.req_export_data import ReqExportData + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqExportData from a JSON string +req_export_data_instance = ReqExportData.from_json(json) +# print the JSON string representation of the object +print(ReqExportData.to_json()) + +# convert the object into a dict +req_export_data_dict = req_export_data_instance.to_dict() +# create an instance of ReqExportData from a dict +req_export_data_from_dict = ReqExportData.from_dict(req_export_data_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/ReqGetAccountActiveOrders.md b/docs/ReqGetAccountActiveOrders.md deleted file mode 100644 index d8f6687..0000000 --- a/docs/ReqGetAccountActiveOrders.md +++ /dev/null @@ -1,31 +0,0 @@ -# ReqGetAccountActiveOrders - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**account_index** | **int** | | -**market_id** | **int** | | -**auth** | **str** | | - -## Example - -```python -from lighter.models.req_get_account_active_orders import ReqGetAccountActiveOrders - -# TODO update the JSON string below -json = "{}" -# create an instance of ReqGetAccountActiveOrders from a JSON string -req_get_account_active_orders_instance = ReqGetAccountActiveOrders.from_json(json) -# print the JSON string representation of the object -print(ReqGetAccountActiveOrders.to_json()) - -# convert the object into a dict -req_get_account_active_orders_dict = req_get_account_active_orders_instance.to_dict() -# create an instance of ReqGetAccountActiveOrders from a dict -req_get_account_active_orders_from_dict = ReqGetAccountActiveOrders.from_dict(req_get_account_active_orders_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/ReqGetAccountApiKeys.md b/docs/ReqGetAccountApiKeys.md index b2be43a..6f3ceaa 100644 --- a/docs/ReqGetAccountApiKeys.md +++ b/docs/ReqGetAccountApiKeys.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **account_index** | **int** | | -**api_key_index** | **int** | | +**api_key_index** | **int** | | [optional] ## Example diff --git a/docs/ReqGetAccountInactiveOrders.md b/docs/ReqGetAccountInactiveOrders.md index 51b1843..d23b114 100644 --- a/docs/ReqGetAccountInactiveOrders.md +++ b/docs/ReqGetAccountInactiveOrders.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**auth** | **str** | made optional to support header auth clients | [optional] **account_index** | **int** | | **market_id** | **int** | | [optional] **ask_filter** | **int** | | [optional] diff --git a/docs/ReqGetAccountLimits.md b/docs/ReqGetAccountLimits.md new file mode 100644 index 0000000..9459c9e --- /dev/null +++ b/docs/ReqGetAccountLimits.md @@ -0,0 +1,30 @@ +# ReqGetAccountLimits + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_index** | **int** | | +**auth** | **str** | made optional to support header auth clients | [optional] + +## Example + +```python +from lighter.models.req_get_account_limits import ReqGetAccountLimits + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetAccountLimits from a JSON string +req_get_account_limits_instance = ReqGetAccountLimits.from_json(json) +# print the JSON string representation of the object +print(ReqGetAccountLimits.to_json()) + +# convert the object into a dict +req_get_account_limits_dict = req_get_account_limits_instance.to_dict() +# create an instance of ReqGetAccountLimits from a dict +req_get_account_limits_from_dict = ReqGetAccountLimits.from_dict(req_get_account_limits_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/ReqGetAccountMetadata.md b/docs/ReqGetAccountMetadata.md new file mode 100644 index 0000000..1674b09 --- /dev/null +++ b/docs/ReqGetAccountMetadata.md @@ -0,0 +1,31 @@ +# ReqGetAccountMetadata + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**by** | **str** | | +**value** | **str** | | +**auth** | **str** | | [optional] + +## Example + +```python +from lighter.models.req_get_account_metadata import ReqGetAccountMetadata + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetAccountMetadata from a JSON string +req_get_account_metadata_instance = ReqGetAccountMetadata.from_json(json) +# print the JSON string representation of the object +print(ReqGetAccountMetadata.to_json()) + +# convert the object into a dict +req_get_account_metadata_dict = req_get_account_metadata_instance.to_dict() +# create an instance of ReqGetAccountMetadata from a dict +req_get_account_metadata_from_dict = ReqGetAccountMetadata.from_dict(req_get_account_metadata_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/ReqGetAccountOrders.md b/docs/ReqGetAccountOrders.md deleted file mode 100644 index 0d228a6..0000000 --- a/docs/ReqGetAccountOrders.md +++ /dev/null @@ -1,32 +0,0 @@ -# ReqGetAccountOrders - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**account_index** | **int** | | -**market_id** | **int** | | -**cursor** | **str** | | [optional] -**limit** | **int** | | - -## Example - -```python -from lighter.models.req_get_account_orders import ReqGetAccountOrders - -# TODO update the JSON string below -json = "{}" -# create an instance of ReqGetAccountOrders from a JSON string -req_get_account_orders_instance = ReqGetAccountOrders.from_json(json) -# print the JSON string representation of the object -print(ReqGetAccountOrders.to_json()) - -# convert the object into a dict -req_get_account_orders_dict = req_get_account_orders_instance.to_dict() -# create an instance of ReqGetAccountOrders from a dict -req_get_account_orders_from_dict = ReqGetAccountOrders.from_dict(req_get_account_orders_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/ReqGetAccountPnL.md b/docs/ReqGetAccountPnL.md index 61837f7..4f5f48d 100644 --- a/docs/ReqGetAccountPnL.md +++ b/docs/ReqGetAccountPnL.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**auth** | **str** | | [optional] **by** | **str** | | **value** | **str** | | **resolution** | **str** | | diff --git a/docs/ReqGetDepositHistory.md b/docs/ReqGetDepositHistory.md index a981469..d0f0cc1 100644 --- a/docs/ReqGetDepositHistory.md +++ b/docs/ReqGetDepositHistory.md @@ -5,6 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**account_index** | **int** | | +**auth** | **str** | made optional to support header auth clients | [optional] **l1_address** | **str** | | **cursor** | **str** | | [optional] **filter** | **str** | | [optional] diff --git a/docs/ReqGetFastWithdrawInfo.md b/docs/ReqGetFastWithdrawInfo.md new file mode 100644 index 0000000..99a79ec --- /dev/null +++ b/docs/ReqGetFastWithdrawInfo.md @@ -0,0 +1,30 @@ +# ReqGetFastWithdrawInfo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_index** | **int** | | +**auth** | **str** | made optional to support header auth clients | [optional] + +## Example + +```python +from lighter.models.req_get_fast_withdraw_info import ReqGetFastWithdrawInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetFastWithdrawInfo from a JSON string +req_get_fast_withdraw_info_instance = ReqGetFastWithdrawInfo.from_json(json) +# print the JSON string representation of the object +print(ReqGetFastWithdrawInfo.to_json()) + +# convert the object into a dict +req_get_fast_withdraw_info_dict = req_get_fast_withdraw_info_instance.to_dict() +# create an instance of ReqGetFastWithdrawInfo from a dict +req_get_fast_withdraw_info_from_dict = ReqGetFastWithdrawInfo.from_dict(req_get_fast_withdraw_info_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/ReqGetFeeBucket.md b/docs/ReqGetFeeBucket.md deleted file mode 100644 index 108fa33..0000000 --- a/docs/ReqGetFeeBucket.md +++ /dev/null @@ -1,29 +0,0 @@ -# ReqGetFeeBucket - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**account_index** | **int** | | - -## Example - -```python -from lighter.models.req_get_fee_bucket import ReqGetFeeBucket - -# TODO update the JSON string below -json = "{}" -# create an instance of ReqGetFeeBucket from a JSON string -req_get_fee_bucket_instance = ReqGetFeeBucket.from_json(json) -# print the JSON string representation of the object -print(ReqGetFeeBucket.to_json()) - -# convert the object into a dict -req_get_fee_bucket_dict = req_get_fee_bucket_instance.to_dict() -# create an instance of ReqGetFeeBucket from a dict -req_get_fee_bucket_from_dict = ReqGetFeeBucket.from_dict(req_get_fee_bucket_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/ReqGetL1Metadata.md b/docs/ReqGetL1Metadata.md new file mode 100644 index 0000000..e66cc76 --- /dev/null +++ b/docs/ReqGetL1Metadata.md @@ -0,0 +1,30 @@ +# ReqGetL1Metadata + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**auth** | **str** | made optional to support header auth clients | [optional] +**l1_address** | **str** | | + +## Example + +```python +from lighter.models.req_get_l1_metadata import ReqGetL1Metadata + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetL1Metadata from a JSON string +req_get_l1_metadata_instance = ReqGetL1Metadata.from_json(json) +# print the JSON string representation of the object +print(ReqGetL1Metadata.to_json()) + +# convert the object into a dict +req_get_l1_metadata_dict = req_get_l1_metadata_instance.to_dict() +# create an instance of ReqGetL1Metadata from a dict +req_get_l1_metadata_from_dict = ReqGetL1Metadata.from_dict(req_get_l1_metadata_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/ReqGetLiquidationInfos.md b/docs/ReqGetLiquidationInfos.md new file mode 100644 index 0000000..20e45af --- /dev/null +++ b/docs/ReqGetLiquidationInfos.md @@ -0,0 +1,33 @@ +# ReqGetLiquidationInfos + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**auth** | **str** | made optional to support header auth clients | [optional] +**account_index** | **int** | | +**market_id** | **int** | | [optional] +**cursor** | **str** | | [optional] +**limit** | **int** | | + +## Example + +```python +from lighter.models.req_get_liquidation_infos import ReqGetLiquidationInfos + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetLiquidationInfos from a JSON string +req_get_liquidation_infos_instance = ReqGetLiquidationInfos.from_json(json) +# print the JSON string representation of the object +print(ReqGetLiquidationInfos.to_json()) + +# convert the object into a dict +req_get_liquidation_infos_dict = req_get_liquidation_infos_instance.to_dict() +# create an instance of ReqGetLiquidationInfos from a dict +req_get_liquidation_infos_from_dict = ReqGetLiquidationInfos.from_dict(req_get_liquidation_infos_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/ReqGetOrderBookOrders.md b/docs/ReqGetOrderBookOrders.md deleted file mode 100644 index 7f543eb..0000000 --- a/docs/ReqGetOrderBookOrders.md +++ /dev/null @@ -1,30 +0,0 @@ -# ReqGetOrderBookOrders - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**market_id** | **int** | | -**limit** | **int** | | - -## Example - -```python -from lighter.models.req_get_order_book_orders import ReqGetOrderBookOrders - -# TODO update the JSON string below -json = "{}" -# create an instance of ReqGetOrderBookOrders from a JSON string -req_get_order_book_orders_instance = ReqGetOrderBookOrders.from_json(json) -# print the JSON string representation of the object -print(ReqGetOrderBookOrders.to_json()) - -# convert the object into a dict -req_get_order_book_orders_dict = req_get_order_book_orders_instance.to_dict() -# create an instance of ReqGetOrderBookOrders from a dict -req_get_order_book_orders_from_dict = ReqGetOrderBookOrders.from_dict(req_get_order_book_orders_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/ReqGetPositionFunding.md b/docs/ReqGetPositionFunding.md new file mode 100644 index 0000000..83399b2 --- /dev/null +++ b/docs/ReqGetPositionFunding.md @@ -0,0 +1,34 @@ +# ReqGetPositionFunding + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**auth** | **str** | | [optional] +**account_index** | **int** | | +**market_id** | **int** | | [optional] +**cursor** | **str** | | [optional] +**limit** | **int** | | +**side** | **str** | | [optional] [default to 'all'] + +## Example + +```python +from lighter.models.req_get_position_funding import ReqGetPositionFunding + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetPositionFunding from a JSON string +req_get_position_funding_instance = ReqGetPositionFunding.from_json(json) +# print the JSON string representation of the object +print(ReqGetPositionFunding.to_json()) + +# convert the object into a dict +req_get_position_funding_dict = req_get_position_funding_instance.to_dict() +# create an instance of ReqGetPositionFunding from a dict +req_get_position_funding_from_dict = ReqGetPositionFunding.from_dict(req_get_position_funding_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/ReqGetPublicPools.md b/docs/ReqGetPublicPools.md index 9af8e31..367eef0 100644 --- a/docs/ReqGetPublicPools.md +++ b/docs/ReqGetPublicPools.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**auth** | **str** | | [optional] **filter** | **str** | | [optional] **index** | **int** | | **limit** | **int** | | diff --git a/docs/ReqGetReferralPoints.md b/docs/ReqGetReferralPoints.md new file mode 100644 index 0000000..609ae7b --- /dev/null +++ b/docs/ReqGetReferralPoints.md @@ -0,0 +1,30 @@ +# ReqGetReferralPoints + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**auth** | **str** | made optional to support header auth clients | [optional] +**account_index** | **int** | | + +## Example + +```python +from lighter.models.req_get_referral_points import ReqGetReferralPoints + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetReferralPoints from a JSON string +req_get_referral_points_instance = ReqGetReferralPoints.from_json(json) +# print the JSON string representation of the object +print(ReqGetReferralPoints.to_json()) + +# convert the object into a dict +req_get_referral_points_dict = req_get_referral_points_instance.to_dict() +# create an instance of ReqGetReferralPoints from a dict +req_get_referral_points_from_dict = ReqGetReferralPoints.from_dict(req_get_referral_points_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/ReqGetTrades.md b/docs/ReqGetTrades.md index 08eaea1..947005c 100644 --- a/docs/ReqGetTrades.md +++ b/docs/ReqGetTrades.md @@ -5,11 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**auth** | **str** | | [optional] **market_id** | **int** | | [optional] **account_index** | **int** | | [optional] [default to -1] **order_index** | **int** | | [optional] **sort_by** | **str** | | -**sort_dir** | **str** | | [optional] [default to 'asc'] +**sort_dir** | **str** | | [optional] [default to 'desc'] **cursor** | **str** | | [optional] **var_from** | **int** | | [optional] [default to -1] **ask_filter** | **int** | | [optional] diff --git a/docs/ReqGetWithdrawHistory.md b/docs/ReqGetWithdrawHistory.md index 2bf292f..a8297ba 100644 --- a/docs/ReqGetWithdrawHistory.md +++ b/docs/ReqGetWithdrawHistory.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **account_index** | **int** | | +**auth** | **str** | made optional to support header auth clients | [optional] **cursor** | **str** | | [optional] **filter** | **str** | | [optional] diff --git a/docs/RespGetFastBridgeInfo.md b/docs/RespGetFastBridgeInfo.md new file mode 100644 index 0000000..f0dfc09 --- /dev/null +++ b/docs/RespGetFastBridgeInfo.md @@ -0,0 +1,31 @@ +# RespGetFastBridgeInfo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**fast_bridge_limit** | **str** | | + +## Example + +```python +from lighter.models.resp_get_fast_bridge_info import RespGetFastBridgeInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of RespGetFastBridgeInfo from a JSON string +resp_get_fast_bridge_info_instance = RespGetFastBridgeInfo.from_json(json) +# print the JSON string representation of the object +print(RespGetFastBridgeInfo.to_json()) + +# convert the object into a dict +resp_get_fast_bridge_info_dict = resp_get_fast_bridge_info_instance.to_dict() +# create an instance of RespGetFastBridgeInfo from a dict +resp_get_fast_bridge_info_from_dict = RespGetFastBridgeInfo.from_dict(resp_get_fast_bridge_info_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/RiskInfo.md b/docs/RiskInfo.md new file mode 100644 index 0000000..065091b --- /dev/null +++ b/docs/RiskInfo.md @@ -0,0 +1,33 @@ +# RiskInfo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**collateral** | **str** | | +**total_account_value** | **str** | | +**initial_margin_req** | **str** | | +**maintenance_margin_req** | **str** | | +**close_out_margin_req** | **str** | | + +## Example + +```python +from lighter.models.risk_info import RiskInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of RiskInfo from a JSON string +risk_info_instance = RiskInfo.from_json(json) +# print the JSON string representation of the object +print(RiskInfo.to_json()) + +# convert the object into a dict +risk_info_dict = risk_info_instance.to_dict() +# create an instance of RiskInfo from a dict +risk_info_from_dict = RiskInfo.from_dict(risk_info_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/SimpleOrder.md b/docs/SimpleOrder.md index a2e0e7b..c32315e 100644 --- a/docs/SimpleOrder.md +++ b/docs/SimpleOrder.md @@ -6,6 +6,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **order_index** | **int** | | +**order_id** | **str** | | **owner_account_index** | **int** | | **initial_base_amount** | **str** | | **remaining_base_amount** | **str** | | diff --git a/docs/Status.md b/docs/Status.md index a48f983..2b1027e 100644 --- a/docs/Status.md +++ b/docs/Status.md @@ -7,6 +7,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **status** | **int** | | **network_id** | **int** | | +**timestamp** | **int** | | ## Example diff --git a/docs/Trade.md b/docs/Trade.md index 9f44932..35203a1 100644 --- a/docs/Trade.md +++ b/docs/Trade.md @@ -19,6 +19,12 @@ Name | Type | Description | Notes **is_maker_ask** | **bool** | | **block_height** | **int** | | **timestamp** | **int** | | +**taker_position_size_before** | **str** | | +**taker_entry_quote_before** | **str** | | +**taker_initial_margin_fraction_before** | **int** | | +**maker_position_size_before** | **str** | | +**maker_entry_quote_before** | **str** | | +**maker_initial_margin_fraction_before** | **int** | | ## Example diff --git a/docs/TransactionApi.md b/docs/TransactionApi.md index adde56d..c9e472f 100644 --- a/docs/TransactionApi.md +++ b/docs/TransactionApi.md @@ -4,12 +4,10 @@ All URIs are relative to *https://mainnet.zklighter.elliot.ai* Method | HTTP request | Description ------------- | ------------- | ------------- -[**account_pending_txs**](TransactionApi.md#account_pending_txs) | **GET** /api/v1/accountPendingTxs | accountPendingTxs [**account_txs**](TransactionApi.md#account_txs) | **GET** /api/v1/accountTxs | accountTxs [**block_txs**](TransactionApi.md#block_txs) | **GET** /api/v1/blockTxs | blockTxs [**deposit_history**](TransactionApi.md#deposit_history) | **GET** /api/v1/deposit/history | deposit_history [**next_nonce**](TransactionApi.md#next_nonce) | **GET** /api/v1/nextNonce | nextNonce -[**pending_txs**](TransactionApi.md#pending_txs) | **GET** /api/v1/pendingTxs | pendingTxs [**send_tx**](TransactionApi.md#send_tx) | **POST** /api/v1/sendTx | sendTx [**send_tx_batch**](TransactionApi.md#send_tx_batch) | **POST** /api/v1/sendTxBatch | sendTxBatch [**tx**](TransactionApi.md#tx) | **GET** /api/v1/tx | tx @@ -18,79 +16,6 @@ Method | HTTP request | Description [**withdraw_history**](TransactionApi.md#withdraw_history) | **GET** /api/v1/withdraw/history | withdraw_history -# **account_pending_txs** -> Txs account_pending_txs(by, value, types=types) - -accountPendingTxs - -Get pending transactions of a specific account - -### Example - - -```python -import lighter -from lighter.models.txs import Txs -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.TransactionApi(api_client) - by = 'by_example' # str | - value = 'value_example' # str | - types = [56] # List[int] | (optional) - - try: - # accountPendingTxs - api_response = await api_instance.account_pending_txs(by, value, types=types) - print("The response of TransactionApi->account_pending_txs:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling TransactionApi->account_pending_txs: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **by** | **str**| | - **value** | **str**| | - **types** | [**List[int]**](int.md)| | [optional] - -### Return type - -[**Txs**](Txs.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) - # **account_txs** > Txs account_txs(limit, by, value, index=index, types=types) @@ -240,7 +165,7 @@ 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) # **deposit_history** -> DepositHistory deposit_history(l1_address, cursor=cursor, filter=filter) +> DepositHistory deposit_history(account_index, l1_address, authorization=authorization, auth=auth, cursor=cursor, filter=filter) deposit_history @@ -266,13 +191,16 @@ configuration = lighter.Configuration( async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.TransactionApi(api_client) + account_index = 56 # int | l1_address = 'l1_address_example' # str | + authorization = 'authorization_example' # str | make required after integ is done (optional) + auth = 'auth_example' # str | made optional to support header auth clients (optional) cursor = 'cursor_example' # str | (optional) filter = 'filter_example' # str | (optional) try: # deposit_history - api_response = await api_instance.deposit_history(l1_address, cursor=cursor, filter=filter) + api_response = await api_instance.deposit_history(account_index, l1_address, authorization=authorization, auth=auth, cursor=cursor, filter=filter) print("The response of TransactionApi->deposit_history:\n") pprint(api_response) except Exception as e: @@ -286,7 +214,10 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **account_index** | **int**| | **l1_address** | **str**| | + **authorization** | **str**| make required after integ is done | [optional] + **auth** | **str**| made optional to support header auth clients | [optional] **cursor** | **str**| | [optional] **filter** | **str**| | [optional] @@ -317,7 +248,7 @@ No authorization required nextNonce -Get next nonce for a specific account +Get next nonce for a specific account and api key ### Example @@ -383,77 +314,6 @@ 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) -# **pending_txs** -> Txs pending_txs(limit, index=index) - -pendingTxs - -Get pending transactions - -### Example - - -```python -import lighter -from lighter.models.txs import Txs -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.TransactionApi(api_client) - limit = 56 # int | - index = 56 # int | (optional) - - try: - # pendingTxs - api_response = await api_instance.pending_txs(limit, index=index) - print("The response of TransactionApi->pending_txs:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling TransactionApi->pending_txs: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **limit** | **int**| | - **index** | **int**| | [optional] - -### Return type - -[**Txs**](Txs.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) - # **send_tx** > TxHash send_tx(tx_type, tx_info, price_protection=price_protection) @@ -810,7 +670,7 @@ 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) # **withdraw_history** -> WithdrawHistory withdraw_history(account_index, cursor=cursor, filter=filter) +> WithdrawHistory withdraw_history(account_index, authorizatio=authorizatio, auth=auth, cursor=cursor, filter=filter) withdraw_history @@ -837,12 +697,14 @@ async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.TransactionApi(api_client) account_index = 56 # int | + authorizatio = 'authorizatio_example' # str | make required after integ is done (optional) + auth = 'auth_example' # str | made optional to support header auth clients (optional) cursor = 'cursor_example' # str | (optional) filter = 'filter_example' # str | (optional) try: # withdraw_history - api_response = await api_instance.withdraw_history(account_index, cursor=cursor, filter=filter) + api_response = await api_instance.withdraw_history(account_index, authorizatio=authorizatio, auth=auth, cursor=cursor, filter=filter) print("The response of TransactionApi->withdraw_history:\n") pprint(api_response) except Exception as e: @@ -857,6 +719,8 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **account_index** | **int**| | + **authorizatio** | **str**| make required after integ is done | [optional] + **auth** | **str**| made optional to support header auth clients | [optional] **cursor** | **str**| | [optional] **filter** | **str**| | [optional] diff --git a/docs/WithdrawHistory.md b/docs/WithdrawHistory.md index 3f198a7..f0d34c5 100644 --- a/docs/WithdrawHistory.md +++ b/docs/WithdrawHistory.md @@ -8,7 +8,7 @@ Name | Type | Description | Notes **code** | **int** | | **message** | **str** | | [optional] **withdraws** | [**List[WithdrawHistoryItem]**](WithdrawHistoryItem.md) | | -**cursor** | [**WithdrawHistoryCursor**](WithdrawHistoryCursor.md) | | +**cursor** | **str** | | ## Example diff --git a/docs/WithdrawHistoryCursor.md b/docs/WithdrawHistoryCursor.md deleted file mode 100644 index ede993f..0000000 --- a/docs/WithdrawHistoryCursor.md +++ /dev/null @@ -1,30 +0,0 @@ -# WithdrawHistoryCursor - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**secure_id** | **str** | | -**fast_id** | **str** | | - -## Example - -```python -from lighter.models.withdraw_history_cursor import WithdrawHistoryCursor - -# TODO update the JSON string below -json = "{}" -# create an instance of WithdrawHistoryCursor from a JSON string -withdraw_history_cursor_instance = WithdrawHistoryCursor.from_json(json) -# print the JSON string representation of the object -print(WithdrawHistoryCursor.to_json()) - -# convert the object into a dict -withdraw_history_cursor_dict = withdraw_history_cursor_instance.to_dict() -# create an instance of WithdrawHistoryCursor from a dict -withdraw_history_cursor_from_dict = WithdrawHistoryCursor.from_dict(withdraw_history_cursor_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/WithdrawHistoryItem.md b/docs/WithdrawHistoryItem.md index 150e3f8..1ae6002 100644 --- a/docs/WithdrawHistoryItem.md +++ b/docs/WithdrawHistoryItem.md @@ -10,6 +10,7 @@ Name | Type | Description | Notes **timestamp** | **int** | | **status** | **str** | | **type** | **str** | | +**l1_tx_hash** | **str** | | ## Example diff --git a/examples/create_cancel_order.py b/examples/create_cancel_order.py index 485a029..a9e8ce5 100644 --- a/examples/create_cancel_order.py +++ b/examples/create_cancel_order.py @@ -7,8 +7,8 @@ # The API_KEY_PRIVATE_KEY provided belongs to a dummy account registered on Testnet. # It was generated using the setup_system.py script, and servers as an example. BASE_URL = "https://testnet.zklighter.elliot.ai" -API_KEY_PRIVATE_KEY = "0xc0a06468a5bbc9a7b785065a8b227a37fdfa18e2b81d51b018cb03ddd99bfbef4b7551f0f0765639" -ACCOUNT_INDEX = 595 +API_KEY_PRIVATE_KEY = "0xed636277f3753b6c0275f7a28c2678a7f3a95655e09deaebec15179b50c5da7f903152e50f594f7b" +ACCOUNT_INDEX = 65 API_KEY_INDEX = 1 @@ -36,7 +36,7 @@ async def main(): market_index=0, client_order_index=123, base_amount=100000, - price=200000, + price=270000, is_ask=True, order_type=lighter.SignerClient.ORDER_TYPE_LIMIT, time_in_force=lighter.SignerClient.ORDER_TIME_IN_FORCE_GOOD_TILL_TIME, @@ -52,15 +52,6 @@ async def main(): if err is not None: raise Exception(err) - active_orders = await lighter.OrderApi(api_client).account_active_orders( - account_index=client.account_index, market_id=0, auth=auth - ) - if len(active_orders.orders) == 0: - print("No active orders") - return - - print(f"{active_orders.orders=}") - # cancel order tx, tx_hash, err = await client.cancel_order( market_index=0, diff --git a/examples/create_market_order.py b/examples/create_market_order.py index 1dcea08..62be835 100644 --- a/examples/create_market_order.py +++ b/examples/create_market_order.py @@ -7,8 +7,8 @@ # The API_KEY_PRIVATE_KEY provided belongs to a dummy account registered on Testnet. # It was generated using the setup_system.py script, and servers as an example. BASE_URL = "https://testnet.zklighter.elliot.ai" -API_KEY_PRIVATE_KEY = "0xc0a06468a5bbc9a7b785065a8b227a37fdfa18e2b81d51b018cb03ddd99bfbef4b7551f0f0765639" -ACCOUNT_INDEX = 595 +API_KEY_PRIVATE_KEY = "0xed636277f3753b6c0275f7a28c2678a7f3a95655e09deaebec15179b50c5da7f903152e50f594f7b" +ACCOUNT_INDEX = 65 API_KEY_INDEX = 1 diff --git a/examples/get_info.py b/examples/get_info.py index bd16072..30187b0 100644 --- a/examples/get_info.py +++ b/examples/get_info.py @@ -8,7 +8,7 @@ # The address provided belongs to a dummy account registered on Testnet. L1_ADDRESS = "0x8D7f03FdE1A626223364E592740a233b72395235" -ACCOUNT_INDEX = 595 +ACCOUNT_INDEX = 65 async def print_api(method, *args, **kwargs): @@ -22,16 +22,6 @@ async def account_apis(client: lighter.ApiClient): await print_api(account_instance.account, by="index", value=str(ACCOUNT_INDEX)) await print_api(account_instance.accounts_by_l1_address, l1_address=L1_ADDRESS) await print_api(account_instance.apikeys, account_index=ACCOUNT_INDEX, api_key_index=1) - await print_api(account_instance.fee_bucket, account_index=ACCOUNT_INDEX) - await print_api( - account_instance.pnl, - by="index", - value=str(ACCOUNT_INDEX), - resolution="1h", - start_timestamp=int(datetime.datetime.now().timestamp() - 60 * 60 * 24), - end_timestamp=int(datetime.datetime.now().timestamp()), - count_back=2, - ) await print_api(account_instance.public_pools, filter="all", limit=1, index=0) @@ -64,21 +54,13 @@ async def candlestick_apis(client: lighter.ApiClient): ) -async def info_apis(client: lighter.ApiClient): - logging.info("INFO APIS") - info_instance = lighter.InfoApi(client) - await print_api(info_instance.layer2_basic_info) - - async def order_apis(client: lighter.ApiClient): logging.info("ORDER APIS") order_instance = lighter.OrderApi(client) await print_api(order_instance.exchange_stats) await print_api(order_instance.order_book_details, market_id=0) - await print_api(order_instance.order_book_orders, market_id=0, limit=2) await print_api(order_instance.order_books) await print_api(order_instance.recent_trades, market_id=0, limit=2) - await print_api(order_instance.trades, sort_by="timestamp", market_id=0, limit=2) async def transaction_apis(client: lighter.ApiClient): @@ -100,7 +82,6 @@ async def main(): await account_apis(client) await block_apis(client) await candlestick_apis(client) - await info_apis(client) await order_apis(client) await transaction_apis(client) await client.close() diff --git a/examples/send_tx_batch.py b/examples/send_tx_batch.py index 79e2b42..b6bc3e7 100644 --- a/examples/send_tx_batch.py +++ b/examples/send_tx_batch.py @@ -8,8 +8,8 @@ # The API_KEY_PRIVATE_KEY provided belongs to a dummy account registered on Testnet. # It was generated using the setup_system.py script, and servers as an example. BASE_URL = "https://testnet.zklighter.elliot.ai" -API_KEY_PRIVATE_KEY = "0xc0a06468a5bbc9a7b785065a8b227a37fdfa18e2b81d51b018cb03ddd99bfbef4b7551f0f0765639" -ACCOUNT_INDEX = 595 +API_KEY_PRIVATE_KEY = "0xed636277f3753b6c0275f7a28c2678a7f3a95655e09deaebec15179b50c5da7f903152e50f594f7b" +ACCOUNT_INDEX = 65 API_KEY_INDEX = 1 def trim_exception(e: Exception) -> str: @@ -44,7 +44,7 @@ async def main(): market_index=0, client_order_index=1001, # Unique identifier for this order base_amount=100000, - price=300000, + price=280000, is_ask=True, order_type=client.ORDER_TYPE_LIMIT, time_in_force=client.ORDER_TIME_IN_FORCE_GOOD_TILL_TIME, @@ -63,7 +63,7 @@ async def main(): market_index=0, client_order_index=1002, # Different unique identifier base_amount=200000, - price=51000, + price=200000, is_ask=False, order_type=client.ORDER_TYPE_LIMIT, time_in_force=client.ORDER_TIME_IN_FORCE_GOOD_TILL_TIME, diff --git a/lighter/__init__.py b/lighter/__init__.py index 0801e32..47e98fc 100644 --- a/lighter/__init__.py +++ b/lighter/__init__.py @@ -18,10 +18,14 @@ # import apis into sdk package from lighter.api.account_api import AccountApi +from lighter.api.announcement_api import AnnouncementApi from lighter.api.block_api import BlockApi +from lighter.api.bridge_api import BridgeApi from lighter.api.candlestick_api import CandlestickApi -from lighter.api.info_api import InfoApi +from lighter.api.funding_api import FundingApi +from lighter.api.notification_api import NotificationApi from lighter.api.order_api import OrderApi +from lighter.api.referral_api import ReferralApi from lighter.api.root_api import RootApi from lighter.api.transaction_api import TransactionApi @@ -39,50 +43,114 @@ # import models into sdk package from lighter.models.account import Account from lighter.models.account_api_keys import AccountApiKeys +from lighter.models.account_limits import AccountLimits +from lighter.models.account_market_stats import AccountMarketStats +from lighter.models.account_metadata import AccountMetadata +from lighter.models.account_metadatas import AccountMetadatas from lighter.models.account_pn_l import AccountPnL from lighter.models.account_position import AccountPosition +from lighter.models.account_stats import AccountStats +from lighter.models.account_trade_stats import AccountTradeStats +from lighter.models.announcement import Announcement +from lighter.models.announcements import Announcements from lighter.models.api_key import ApiKey from lighter.models.block import Block from lighter.models.blocks import Blocks +from lighter.models.bridge_supported_network import BridgeSupportedNetwork from lighter.models.candlestick import Candlestick from lighter.models.candlesticks import Candlesticks +from lighter.models.contract_address import ContractAddress from lighter.models.current_height import CurrentHeight +from lighter.models.cursor import Cursor from lighter.models.daily_return import DailyReturn from lighter.models.deposit_history import DepositHistory from lighter.models.deposit_history_item import DepositHistoryItem from lighter.models.detailed_account import DetailedAccount from lighter.models.detailed_accounts import DetailedAccounts +from lighter.models.detailed_candlestick import DetailedCandlestick from lighter.models.enriched_tx import EnrichedTx from lighter.models.exchange_stats import ExchangeStats -from lighter.models.fee_bucket import FeeBucket +from lighter.models.export_data import ExportData from lighter.models.funding import Funding +from lighter.models.funding_rate import FundingRate +from lighter.models.funding_rates import FundingRates from lighter.models.fundings import Fundings +from lighter.models.l1_metadata import L1Metadata +from lighter.models.l1_provider_info import L1ProviderInfo +from lighter.models.liq_trade import LiqTrade +from lighter.models.liquidation import Liquidation +from lighter.models.liquidation_info import LiquidationInfo +from lighter.models.liquidation_infos import LiquidationInfos +from lighter.models.market_info import MarketInfo from lighter.models.next_nonce import NextNonce from lighter.models.order import Order from lighter.models.order_book import OrderBook +from lighter.models.order_book_depth import OrderBookDepth from lighter.models.order_book_detail import OrderBookDetail from lighter.models.order_book_details import OrderBookDetails -from lighter.models.order_book_orders import OrderBookOrders from lighter.models.order_book_stats import OrderBookStats from lighter.models.order_books import OrderBooks from lighter.models.orders import Orders from lighter.models.pn_l_entry import PnLEntry +from lighter.models.position_funding import PositionFunding +from lighter.models.position_fundings import PositionFundings +from lighter.models.price_level import PriceLevel from lighter.models.public_pool import PublicPool from lighter.models.public_pool_info import PublicPoolInfo from lighter.models.public_pool_share import PublicPoolShare from lighter.models.public_pools import PublicPools +from lighter.models.referral_point_entry import ReferralPointEntry +from lighter.models.referral_points import ReferralPoints +from lighter.models.req_export_data import ReqExportData +from lighter.models.req_get_account import ReqGetAccount +from lighter.models.req_get_account_api_keys import ReqGetAccountApiKeys +from lighter.models.req_get_account_by_l1_address import ReqGetAccountByL1Address +from lighter.models.req_get_account_inactive_orders import ReqGetAccountInactiveOrders +from lighter.models.req_get_account_limits import ReqGetAccountLimits +from lighter.models.req_get_account_metadata import ReqGetAccountMetadata +from lighter.models.req_get_account_pending_txs import ReqGetAccountPendingTxs +from lighter.models.req_get_account_pn_l import ReqGetAccountPnL +from lighter.models.req_get_account_txs import ReqGetAccountTxs +from lighter.models.req_get_block import ReqGetBlock +from lighter.models.req_get_block_txs import ReqGetBlockTxs +from lighter.models.req_get_by_account import ReqGetByAccount +from lighter.models.req_get_candlesticks import ReqGetCandlesticks +from lighter.models.req_get_deposit_history import ReqGetDepositHistory +from lighter.models.req_get_fast_withdraw_info import ReqGetFastWithdrawInfo +from lighter.models.req_get_fundings import ReqGetFundings +from lighter.models.req_get_l1_metadata import ReqGetL1Metadata +from lighter.models.req_get_l1_tx import ReqGetL1Tx +from lighter.models.req_get_latest_deposit import ReqGetLatestDeposit +from lighter.models.req_get_liquidation_infos import ReqGetLiquidationInfos +from lighter.models.req_get_next_nonce import ReqGetNextNonce +from lighter.models.req_get_order_book_details import ReqGetOrderBookDetails +from lighter.models.req_get_order_books import ReqGetOrderBooks +from lighter.models.req_get_position_funding import ReqGetPositionFunding +from lighter.models.req_get_public_pools import ReqGetPublicPools +from lighter.models.req_get_range_with_cursor import ReqGetRangeWithCursor +from lighter.models.req_get_range_with_index import ReqGetRangeWithIndex +from lighter.models.req_get_range_with_index_sortable import ReqGetRangeWithIndexSortable +from lighter.models.req_get_recent_trades import ReqGetRecentTrades +from lighter.models.req_get_referral_points import ReqGetReferralPoints +from lighter.models.req_get_trades import ReqGetTrades +from lighter.models.req_get_tx import ReqGetTx +from lighter.models.req_get_withdraw_history import ReqGetWithdrawHistory +from lighter.models.resp_get_fast_bridge_info import RespGetFastBridgeInfo +from lighter.models.result_code import ResultCode +from lighter.models.risk_info import RiskInfo from lighter.models.simple_order import SimpleOrder from lighter.models.status import Status from lighter.models.sub_accounts import SubAccounts +from lighter.models.ticker import Ticker from lighter.models.trade import Trade from lighter.models.trades import Trades from lighter.models.tx import Tx from lighter.models.tx_hash import TxHash from lighter.models.tx_hashes import TxHashes from lighter.models.txs import Txs +from lighter.models.validator_info import ValidatorInfo from lighter.models.withdraw_history import WithdrawHistory from lighter.models.withdraw_history_item import WithdrawHistoryItem from lighter.models.zk_lighter_info import ZkLighterInfo - from lighter.ws_client import WsClient -from lighter.signer_client import SignerClient, create_api_key +from lighter.signer_client import SignerClient, create_api_key \ No newline at end of file diff --git a/lighter/api/__init__.py b/lighter/api/__init__.py index 2903967..5b548eb 100644 --- a/lighter/api/__init__.py +++ b/lighter/api/__init__.py @@ -2,9 +2,14 @@ # import apis into api package from lighter.api.account_api import AccountApi +from lighter.api.announcement_api import AnnouncementApi from lighter.api.block_api import BlockApi +from lighter.api.bridge_api import BridgeApi from lighter.api.candlestick_api import CandlestickApi +from lighter.api.funding_api import FundingApi +from lighter.api.notification_api import NotificationApi from lighter.api.order_api import OrderApi +from lighter.api.referral_api import ReferralApi from lighter.api.root_api import RootApi from lighter.api.transaction_api import TransactionApi diff --git a/lighter/api/account_api.py b/lighter/api/account_api.py index 2d7efcb..a0f00da 100644 --- a/lighter/api/account_api.py +++ b/lighter/api/account_api.py @@ -20,9 +20,13 @@ from typing import Optional from typing_extensions import Annotated from lighter.models.account_api_keys import AccountApiKeys +from lighter.models.account_limits import AccountLimits +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_bucket import FeeBucket +from lighter.models.l1_metadata import L1Metadata +from lighter.models.liquidation_infos import LiquidationInfos +from lighter.models.position_fundings import PositionFundings from lighter.models.public_pools import PublicPools from lighter.models.sub_accounts import SubAccounts @@ -325,9 +329,11 @@ def _account_serialize( @validate_call - async def accounts_by_l1_address( + async def account_limits( self, - l1_address: StrictStr, + account_index: StrictInt, + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -340,13 +346,17 @@ async def accounts_by_l1_address( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> SubAccounts: - """accountsByL1Address + ) -> AccountLimits: + """accountLimits - Get accounts by l1_address returns all accounts associated with the given L1 address + Get account limits - :param l1_address: (required) - :type l1_address: str + :param account_index: (required) + :type account_index: int + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: 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 @@ -369,8 +379,10 @@ async def accounts_by_l1_address( :return: Returns the result object. """ # noqa: E501 - _param = self._accounts_by_l1_address_serialize( - l1_address=l1_address, + _param = self._account_limits_serialize( + account_index=account_index, + authorization=authorization, + auth=auth, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -378,7 +390,7 @@ async def accounts_by_l1_address( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "SubAccounts", + '200': "AccountLimits", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -393,9 +405,11 @@ async def accounts_by_l1_address( @validate_call - async def accounts_by_l1_address_with_http_info( + async def account_limits_with_http_info( self, - l1_address: StrictStr, + account_index: StrictInt, + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -408,13 +422,17 @@ async def accounts_by_l1_address_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[SubAccounts]: - """accountsByL1Address + ) -> ApiResponse[AccountLimits]: + """accountLimits - Get accounts by l1_address returns all accounts associated with the given L1 address + Get account limits - :param l1_address: (required) - :type l1_address: str + :param account_index: (required) + :type account_index: int + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: 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 @@ -437,8 +455,10 @@ async def accounts_by_l1_address_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._accounts_by_l1_address_serialize( - l1_address=l1_address, + _param = self._account_limits_serialize( + account_index=account_index, + authorization=authorization, + auth=auth, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -446,7 +466,7 @@ async def accounts_by_l1_address_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "SubAccounts", + '200': "AccountLimits", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -461,9 +481,11 @@ async def accounts_by_l1_address_with_http_info( @validate_call - async def accounts_by_l1_address_without_preload_content( + async def account_limits_without_preload_content( self, - l1_address: StrictStr, + account_index: StrictInt, + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -477,12 +499,16 @@ async def accounts_by_l1_address_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """accountsByL1Address + """accountLimits - Get accounts by l1_address returns all accounts associated with the given L1 address + Get account limits - :param l1_address: (required) - :type l1_address: str + :param account_index: (required) + :type account_index: int + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: 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 @@ -505,8 +531,10 @@ async def accounts_by_l1_address_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._accounts_by_l1_address_serialize( - l1_address=l1_address, + _param = self._account_limits_serialize( + account_index=account_index, + authorization=authorization, + auth=auth, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -514,7 +542,7 @@ async def accounts_by_l1_address_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "SubAccounts", + '200': "AccountLimits", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -524,9 +552,11 @@ async def accounts_by_l1_address_without_preload_content( return response_data.response - def _accounts_by_l1_address_serialize( + def _account_limits_serialize( self, - l1_address, + account_index, + authorization, + auth, _request_auth, _content_type, _headers, @@ -547,11 +577,17 @@ def _accounts_by_l1_address_serialize( # process the path parameters # process the query parameters - if l1_address is not None: + if account_index is not None: - _query_params.append(('l1_address', l1_address)) + _query_params.append(('account_index', account_index)) + + if auth is not None: + + _query_params.append(('auth', auth)) # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization # process the form parameters # process the body parameter @@ -571,7 +607,7 @@ def _accounts_by_l1_address_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/accountsByL1Address', + resource_path='/api/v1/accountLimits', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -588,10 +624,12 @@ def _accounts_by_l1_address_serialize( @validate_call - async def apikeys( + async def account_metadata( self, - account_index: StrictInt, - api_key_index: Optional[StrictInt] = None, + by: StrictStr, + value: StrictStr, + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -604,15 +642,19 @@ async def apikeys( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> AccountApiKeys: - """apikeys + ) -> AccountMetadatas: + """accountMetadata - Get account api key. Set `api_key_index` to 255 to retrieve all api keys associated with the account. + Get account metadatas - :param account_index: (required) - :type account_index: int - :param api_key_index: - :type api_key_index: int + :param by: (required) + :type by: str + :param value: (required) + :type value: str + :param authorization: + :type authorization: str + :param auth: + :type auth: 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 @@ -635,9 +677,11 @@ async def apikeys( :return: Returns the result object. """ # noqa: E501 - _param = self._apikeys_serialize( - account_index=account_index, - api_key_index=api_key_index, + _param = self._account_metadata_serialize( + by=by, + value=value, + authorization=authorization, + auth=auth, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -645,7 +689,7 @@ async def apikeys( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "AccountApiKeys", + '200': "AccountMetadatas", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -660,10 +704,12 @@ async def apikeys( @validate_call - async def apikeys_with_http_info( + async def account_metadata_with_http_info( self, - account_index: StrictInt, - api_key_index: Optional[StrictInt] = None, + by: StrictStr, + value: StrictStr, + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -676,15 +722,19 @@ async def apikeys_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[AccountApiKeys]: - """apikeys + ) -> ApiResponse[AccountMetadatas]: + """accountMetadata - Get account api key. Set `api_key_index` to 255 to retrieve all api keys associated with the account. + Get account metadatas - :param account_index: (required) - :type account_index: int - :param api_key_index: - :type api_key_index: int + :param by: (required) + :type by: str + :param value: (required) + :type value: str + :param authorization: + :type authorization: str + :param auth: + :type auth: 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 @@ -707,9 +757,11 @@ async def apikeys_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._apikeys_serialize( - account_index=account_index, - api_key_index=api_key_index, + _param = self._account_metadata_serialize( + by=by, + value=value, + authorization=authorization, + auth=auth, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -717,7 +769,7 @@ async def apikeys_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "AccountApiKeys", + '200': "AccountMetadatas", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -732,10 +784,12 @@ async def apikeys_with_http_info( @validate_call - async def apikeys_without_preload_content( + async def account_metadata_without_preload_content( self, - account_index: StrictInt, - api_key_index: Optional[StrictInt] = None, + by: StrictStr, + value: StrictStr, + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -749,14 +803,18 @@ async def apikeys_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """apikeys + """accountMetadata - Get account api key. Set `api_key_index` to 255 to retrieve all api keys associated with the account. + Get account metadatas - :param account_index: (required) - :type account_index: int - :param api_key_index: - :type api_key_index: int + :param by: (required) + :type by: str + :param value: (required) + :type value: str + :param authorization: + :type authorization: str + :param auth: + :type auth: 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 @@ -779,9 +837,11 @@ async def apikeys_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._apikeys_serialize( - account_index=account_index, - api_key_index=api_key_index, + _param = self._account_metadata_serialize( + by=by, + value=value, + authorization=authorization, + auth=auth, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -789,7 +849,7 @@ async def apikeys_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "AccountApiKeys", + '200': "AccountMetadatas", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -799,10 +859,12 @@ async def apikeys_without_preload_content( return response_data.response - def _apikeys_serialize( + def _account_metadata_serialize( self, - account_index, - api_key_index, + by, + value, + authorization, + auth, _request_auth, _content_type, _headers, @@ -823,15 +885,21 @@ def _apikeys_serialize( # process the path parameters # process the query parameters - if account_index is not None: + if by is not None: - _query_params.append(('account_index', account_index)) + _query_params.append(('by', by)) - if api_key_index is not None: + if value is not None: - _query_params.append(('api_key_index', api_key_index)) + _query_params.append(('value', value)) + + if auth is not None: + + _query_params.append(('auth', auth)) # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization # process the form parameters # process the body parameter @@ -851,7 +919,7 @@ def _apikeys_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/apikeys', + resource_path='/api/v1/accountMetadata', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -868,9 +936,9 @@ def _apikeys_serialize( @validate_call - async def fee_bucket( + async def accounts_by_l1_address( self, - account_index: StrictInt, + l1_address: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -883,13 +951,13 @@ async def fee_bucket( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> FeeBucket: - """feeBucket + ) -> SubAccounts: + """accountsByL1Address - Get account fee bucket + Get accounts by l1_address returns all accounts associated with the given L1 address - :param account_index: (required) - :type account_index: int + :param l1_address: (required) + :type l1_address: 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 @@ -912,8 +980,8 @@ async def fee_bucket( :return: Returns the result object. """ # noqa: E501 - _param = self._fee_bucket_serialize( - account_index=account_index, + _param = self._accounts_by_l1_address_serialize( + l1_address=l1_address, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -921,7 +989,7 @@ async def fee_bucket( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "FeeBucket", + '200': "SubAccounts", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -936,9 +1004,9 @@ async def fee_bucket( @validate_call - async def fee_bucket_with_http_info( + async def accounts_by_l1_address_with_http_info( self, - account_index: StrictInt, + l1_address: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -951,13 +1019,13 @@ async def fee_bucket_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[FeeBucket]: - """feeBucket + ) -> ApiResponse[SubAccounts]: + """accountsByL1Address - Get account fee bucket + Get accounts by l1_address returns all accounts associated with the given L1 address - :param account_index: (required) - :type account_index: int + :param l1_address: (required) + :type l1_address: 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 @@ -980,8 +1048,8 @@ async def fee_bucket_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._fee_bucket_serialize( - account_index=account_index, + _param = self._accounts_by_l1_address_serialize( + l1_address=l1_address, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -989,7 +1057,7 @@ async def fee_bucket_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "FeeBucket", + '200': "SubAccounts", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -1004,9 +1072,9 @@ async def fee_bucket_with_http_info( @validate_call - async def fee_bucket_without_preload_content( + async def accounts_by_l1_address_without_preload_content( self, - account_index: StrictInt, + l1_address: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1020,12 +1088,12 @@ async def fee_bucket_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """feeBucket + """accountsByL1Address - Get account fee bucket + Get accounts by l1_address returns all accounts associated with the given L1 address - :param account_index: (required) - :type account_index: int + :param l1_address: (required) + :type l1_address: 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 @@ -1048,8 +1116,8 @@ async def fee_bucket_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._fee_bucket_serialize( - account_index=account_index, + _param = self._accounts_by_l1_address_serialize( + l1_address=l1_address, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1057,7 +1125,7 @@ async def fee_bucket_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "FeeBucket", + '200': "SubAccounts", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -1067,9 +1135,9 @@ async def fee_bucket_without_preload_content( return response_data.response - def _fee_bucket_serialize( + def _accounts_by_l1_address_serialize( self, - account_index, + l1_address, _request_auth, _content_type, _headers, @@ -1090,9 +1158,9 @@ def _fee_bucket_serialize( # process the path parameters # process the query parameters - if account_index is not None: + if l1_address is not None: - _query_params.append(('account_index', account_index)) + _query_params.append(('l1_address', l1_address)) # process the header parameters # process the form parameters @@ -1114,7 +1182,7 @@ def _fee_bucket_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/feeBucket', + resource_path='/api/v1/accountsByL1Address', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1131,16 +1199,10 @@ def _fee_bucket_serialize( @validate_call - async def pnl( + async def apikeys( self, - by: StrictStr, - value: StrictStr, - resolution: StrictStr, - start_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], - end_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], - count_back: StrictInt, - auth: Optional[StrictStr] = None, - ignore_transfers: Optional[StrictBool] = None, + account_index: StrictInt, + api_key_index: Optional[StrictInt] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1153,27 +1215,15 @@ async def pnl( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> AccountPnL: - """pnl + ) -> AccountApiKeys: + """apikeys - Get account PnL chart + Get account api key. Set `api_key_index` to 255 to retrieve all api keys associated with the account. - :param by: (required) - :type by: str - :param value: (required) - :type value: str - :param resolution: (required) - :type resolution: str - :param start_timestamp: (required) - :type start_timestamp: int - :param end_timestamp: (required) - :type end_timestamp: int - :param count_back: (required) - :type count_back: int - :param auth: - :type auth: str - :param ignore_transfers: - :type ignore_transfers: bool + :param account_index: (required) + :type account_index: int + :param api_key_index: + :type api_key_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 @@ -1196,15 +1246,9 @@ async def pnl( :return: Returns the result object. """ # noqa: E501 - _param = self._pnl_serialize( - by=by, - value=value, - resolution=resolution, - start_timestamp=start_timestamp, - end_timestamp=end_timestamp, - count_back=count_back, - auth=auth, - ignore_transfers=ignore_transfers, + _param = self._apikeys_serialize( + account_index=account_index, + api_key_index=api_key_index, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1212,7 +1256,1345 @@ async def pnl( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "AccountPnL", + '200': "AccountApiKeys", + '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 + + + @validate_call + async def apikeys_with_http_info( + self, + account_index: StrictInt, + api_key_index: Optional[StrictInt] = 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[AccountApiKeys]: + """apikeys + + Get account api key. Set `api_key_index` to 255 to retrieve all api keys associated with the account. + + :param account_index: (required) + :type account_index: int + :param api_key_index: + :type api_key_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._apikeys_serialize( + account_index=account_index, + api_key_index=api_key_index, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AccountApiKeys", + '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, + ) + + + @validate_call + async def apikeys_without_preload_content( + self, + account_index: StrictInt, + api_key_index: Optional[StrictInt] = 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: + """apikeys + + Get account api key. Set `api_key_index` to 255 to retrieve all api keys associated with the account. + + :param account_index: (required) + :type account_index: int + :param api_key_index: + :type api_key_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._apikeys_serialize( + account_index=account_index, + api_key_index=api_key_index, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AccountApiKeys", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _apikeys_serialize( + self, + account_index, + api_key_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 + if account_index is not None: + + _query_params.append(('account_index', account_index)) + + if api_key_index is not None: + + _query_params.append(('api_key_index', api_key_index)) + + # 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/apikeys', + 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 + ) + + + + + @validate_call + async def l1_metadata( + self, + l1_address: StrictStr, + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = 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, + ) -> L1Metadata: + """l1Metadata + + Get L1 metadata + + :param l1_address: (required) + :type l1_address: str + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: 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._l1_metadata_serialize( + l1_address=l1_address, + authorization=authorization, + auth=auth, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "L1Metadata", + '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 + + + @validate_call + async def l1_metadata_with_http_info( + self, + l1_address: StrictStr, + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = 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[L1Metadata]: + """l1Metadata + + Get L1 metadata + + :param l1_address: (required) + :type l1_address: str + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: 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._l1_metadata_serialize( + l1_address=l1_address, + authorization=authorization, + auth=auth, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "L1Metadata", + '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, + ) + + + @validate_call + async def l1_metadata_without_preload_content( + self, + l1_address: StrictStr, + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = 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: + """l1Metadata + + Get L1 metadata + + :param l1_address: (required) + :type l1_address: str + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: 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._l1_metadata_serialize( + l1_address=l1_address, + authorization=authorization, + auth=auth, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "L1Metadata", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _l1_metadata_serialize( + self, + l1_address, + authorization, + auth, + _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 auth is not None: + + _query_params.append(('auth', auth)) + + if l1_address is not None: + + _query_params.append(('l1_address', l1_address)) + + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # 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/l1Metadata', + 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 + ) + + + + + @validate_call + async def liquidations( + self, + account_index: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = None, + market_id: Optional[StrictInt] = None, + cursor: 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, + ) -> LiquidationInfos: + """liquidations + + Get liquidation infos + + :param account_index: (required) + :type account_index: int + :param limit: (required) + :type limit: int + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: str + :param market_id: + :type market_id: int + :param cursor: + :type cursor: 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._liquidations_serialize( + account_index=account_index, + limit=limit, + authorization=authorization, + auth=auth, + market_id=market_id, + cursor=cursor, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LiquidationInfos", + '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 + + + @validate_call + async def liquidations_with_http_info( + self, + account_index: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = None, + market_id: Optional[StrictInt] = None, + cursor: 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[LiquidationInfos]: + """liquidations + + Get liquidation infos + + :param account_index: (required) + :type account_index: int + :param limit: (required) + :type limit: int + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: str + :param market_id: + :type market_id: int + :param cursor: + :type cursor: 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._liquidations_serialize( + account_index=account_index, + limit=limit, + authorization=authorization, + auth=auth, + market_id=market_id, + cursor=cursor, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LiquidationInfos", + '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, + ) + + + @validate_call + async def liquidations_without_preload_content( + self, + account_index: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = None, + market_id: Optional[StrictInt] = None, + cursor: 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: + """liquidations + + Get liquidation infos + + :param account_index: (required) + :type account_index: int + :param limit: (required) + :type limit: int + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: str + :param market_id: + :type market_id: int + :param cursor: + :type cursor: 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._liquidations_serialize( + account_index=account_index, + limit=limit, + authorization=authorization, + auth=auth, + market_id=market_id, + cursor=cursor, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LiquidationInfos", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _liquidations_serialize( + self, + account_index, + limit, + authorization, + auth, + market_id, + cursor, + _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 auth is not None: + + _query_params.append(('auth', auth)) + + if account_index is not None: + + _query_params.append(('account_index', account_index)) + + if market_id is not None: + + _query_params.append(('market_id', market_id)) + + if cursor is not None: + + _query_params.append(('cursor', cursor)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # 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/liquidations', + 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 + ) + + + + + @validate_call + async def pnl( + self, + by: StrictStr, + value: StrictStr, + resolution: StrictStr, + start_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], + end_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], + count_back: StrictInt, + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + ignore_transfers: Optional[StrictBool] = 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, + ) -> AccountPnL: + """pnl + + Get account PnL chart + + :param by: (required) + :type by: str + :param value: (required) + :type value: str + :param resolution: (required) + :type resolution: str + :param start_timestamp: (required) + :type start_timestamp: int + :param end_timestamp: (required) + :type end_timestamp: int + :param count_back: (required) + :type count_back: int + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param ignore_transfers: + :type ignore_transfers: bool + :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._pnl_serialize( + by=by, + value=value, + resolution=resolution, + start_timestamp=start_timestamp, + end_timestamp=end_timestamp, + count_back=count_back, + authorization=authorization, + auth=auth, + ignore_transfers=ignore_transfers, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AccountPnL", + '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 + + + @validate_call + async def pnl_with_http_info( + self, + by: StrictStr, + value: StrictStr, + resolution: StrictStr, + start_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], + end_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], + count_back: StrictInt, + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + ignore_transfers: Optional[StrictBool] = 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[AccountPnL]: + """pnl + + Get account PnL chart + + :param by: (required) + :type by: str + :param value: (required) + :type value: str + :param resolution: (required) + :type resolution: str + :param start_timestamp: (required) + :type start_timestamp: int + :param end_timestamp: (required) + :type end_timestamp: int + :param count_back: (required) + :type count_back: int + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param ignore_transfers: + :type ignore_transfers: bool + :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._pnl_serialize( + by=by, + value=value, + resolution=resolution, + start_timestamp=start_timestamp, + end_timestamp=end_timestamp, + count_back=count_back, + authorization=authorization, + auth=auth, + ignore_transfers=ignore_transfers, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AccountPnL", + '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, + ) + + + @validate_call + async def pnl_without_preload_content( + self, + by: StrictStr, + value: StrictStr, + resolution: StrictStr, + start_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], + end_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], + count_back: StrictInt, + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + ignore_transfers: Optional[StrictBool] = 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: + """pnl + + Get account PnL chart + + :param by: (required) + :type by: str + :param value: (required) + :type value: str + :param resolution: (required) + :type resolution: str + :param start_timestamp: (required) + :type start_timestamp: int + :param end_timestamp: (required) + :type end_timestamp: int + :param count_back: (required) + :type count_back: int + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param ignore_transfers: + :type ignore_transfers: bool + :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._pnl_serialize( + by=by, + value=value, + resolution=resolution, + start_timestamp=start_timestamp, + end_timestamp=end_timestamp, + count_back=count_back, + authorization=authorization, + auth=auth, + ignore_transfers=ignore_transfers, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AccountPnL", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _pnl_serialize( + self, + by, + value, + resolution, + start_timestamp, + end_timestamp, + count_back, + authorization, + auth, + ignore_transfers, + _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 auth is not None: + + _query_params.append(('auth', auth)) + + if by is not None: + + _query_params.append(('by', by)) + + if value is not None: + + _query_params.append(('value', value)) + + if resolution is not None: + + _query_params.append(('resolution', resolution)) + + if start_timestamp is not None: + + _query_params.append(('start_timestamp', start_timestamp)) + + if end_timestamp is not None: + + _query_params.append(('end_timestamp', end_timestamp)) + + if count_back is not None: + + _query_params.append(('count_back', count_back)) + + if ignore_transfers is not None: + + _query_params.append(('ignore_transfers', ignore_transfers)) + + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # 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/pnl', + 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 + ) + + + + + @validate_call + async def position_funding( + self, + account_index: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + market_id: Optional[StrictInt] = None, + cursor: Optional[StrictStr] = None, + side: 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, + ) -> PositionFundings: + """positionFunding + + Get accounts position fundings + + :param account_index: (required) + :type account_index: int + :param limit: (required) + :type limit: int + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param market_id: + :type market_id: int + :param cursor: + :type cursor: str + :param side: + :type side: 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._position_funding_serialize( + account_index=account_index, + limit=limit, + authorization=authorization, + auth=auth, + market_id=market_id, + cursor=cursor, + side=side, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PositionFundings", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -1227,16 +2609,15 @@ async def pnl( @validate_call - async def pnl_with_http_info( + async def position_funding_with_http_info( self, - by: StrictStr, - value: StrictStr, - resolution: StrictStr, - start_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], - end_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], - count_back: StrictInt, + account_index: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, auth: Optional[StrictStr] = None, - ignore_transfers: Optional[StrictBool] = None, + market_id: Optional[StrictInt] = None, + cursor: Optional[StrictStr] = None, + side: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1249,27 +2630,25 @@ async def pnl_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[AccountPnL]: - """pnl + ) -> ApiResponse[PositionFundings]: + """positionFunding - Get account PnL chart + Get accounts position fundings - :param by: (required) - :type by: str - :param value: (required) - :type value: str - :param resolution: (required) - :type resolution: str - :param start_timestamp: (required) - :type start_timestamp: int - :param end_timestamp: (required) - :type end_timestamp: int - :param count_back: (required) - :type count_back: int + :param account_index: (required) + :type account_index: int + :param limit: (required) + :type limit: int + :param authorization: + :type authorization: str :param auth: :type auth: str - :param ignore_transfers: - :type ignore_transfers: bool + :param market_id: + :type market_id: int + :param cursor: + :type cursor: str + :param side: + :type side: 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 @@ -1292,15 +2671,14 @@ async def pnl_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._pnl_serialize( - by=by, - value=value, - resolution=resolution, - start_timestamp=start_timestamp, - end_timestamp=end_timestamp, - count_back=count_back, + _param = self._position_funding_serialize( + account_index=account_index, + limit=limit, + authorization=authorization, auth=auth, - ignore_transfers=ignore_transfers, + market_id=market_id, + cursor=cursor, + side=side, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1308,7 +2686,7 @@ async def pnl_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "AccountPnL", + '200': "PositionFundings", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -1323,16 +2701,15 @@ async def pnl_with_http_info( @validate_call - async def pnl_without_preload_content( + async def position_funding_without_preload_content( self, - by: StrictStr, - value: StrictStr, - resolution: StrictStr, - start_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], - end_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], - count_back: StrictInt, + account_index: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, auth: Optional[StrictStr] = None, - ignore_transfers: Optional[StrictBool] = None, + market_id: Optional[StrictInt] = None, + cursor: Optional[StrictStr] = None, + side: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1346,26 +2723,24 @@ async def pnl_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """pnl + """positionFunding - Get account PnL chart + Get accounts position fundings - :param by: (required) - :type by: str - :param value: (required) - :type value: str - :param resolution: (required) - :type resolution: str - :param start_timestamp: (required) - :type start_timestamp: int - :param end_timestamp: (required) - :type end_timestamp: int - :param count_back: (required) - :type count_back: int + :param account_index: (required) + :type account_index: int + :param limit: (required) + :type limit: int + :param authorization: + :type authorization: str :param auth: :type auth: str - :param ignore_transfers: - :type ignore_transfers: bool + :param market_id: + :type market_id: int + :param cursor: + :type cursor: str + :param side: + :type side: 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 @@ -1388,15 +2763,14 @@ async def pnl_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._pnl_serialize( - by=by, - value=value, - resolution=resolution, - start_timestamp=start_timestamp, - end_timestamp=end_timestamp, - count_back=count_back, + _param = self._position_funding_serialize( + account_index=account_index, + limit=limit, + authorization=authorization, auth=auth, - ignore_transfers=ignore_transfers, + market_id=market_id, + cursor=cursor, + side=side, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1404,7 +2778,7 @@ async def pnl_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "AccountPnL", + '200': "PositionFundings", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -1414,16 +2788,15 @@ async def pnl_without_preload_content( return response_data.response - def _pnl_serialize( + def _position_funding_serialize( self, - by, - value, - resolution, - start_timestamp, - end_timestamp, - count_back, + account_index, + limit, + authorization, auth, - ignore_transfers, + market_id, + cursor, + side, _request_auth, _content_type, _headers, @@ -1448,35 +2821,29 @@ def _pnl_serialize( _query_params.append(('auth', auth)) - if by is not None: - - _query_params.append(('by', by)) - - if value is not None: - - _query_params.append(('value', value)) - - if resolution is not None: + if account_index is not None: - _query_params.append(('resolution', resolution)) + _query_params.append(('account_index', account_index)) - if start_timestamp is not None: + if market_id is not None: - _query_params.append(('start_timestamp', start_timestamp)) + _query_params.append(('market_id', market_id)) - if end_timestamp is not None: + if cursor is not None: - _query_params.append(('end_timestamp', end_timestamp)) + _query_params.append(('cursor', cursor)) - if count_back is not None: + if limit is not None: - _query_params.append(('count_back', count_back)) + _query_params.append(('limit', limit)) - if ignore_transfers is not None: + if side is not None: - _query_params.append(('ignore_transfers', ignore_transfers)) + _query_params.append(('side', side)) # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization # process the form parameters # process the body parameter @@ -1496,7 +2863,7 @@ def _pnl_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/pnl', + resource_path='/api/v1/positionFunding', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1510,11 +2877,14 @@ def _pnl_serialize( ) + + @validate_call async def public_pools( self, index: StrictInt, limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, auth: Optional[StrictStr] = None, filter: Optional[StrictStr] = None, account_index: Optional[StrictInt] = None, @@ -1539,6 +2909,8 @@ async def public_pools( :type index: int :param limit: (required) :type limit: int + :param authorization: + :type authorization: str :param auth: :type auth: str :param filter: @@ -1570,6 +2942,7 @@ async def public_pools( _param = self._public_pools_serialize( index=index, limit=limit, + authorization=authorization, auth=auth, filter=filter, account_index=account_index, @@ -1599,6 +2972,7 @@ async def public_pools_with_http_info( self, index: StrictInt, limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, auth: Optional[StrictStr] = None, filter: Optional[StrictStr] = None, account_index: Optional[StrictInt] = None, @@ -1623,6 +2997,8 @@ async def public_pools_with_http_info( :type index: int :param limit: (required) :type limit: int + :param authorization: + :type authorization: str :param auth: :type auth: str :param filter: @@ -1654,6 +3030,7 @@ async def public_pools_with_http_info( _param = self._public_pools_serialize( index=index, limit=limit, + authorization=authorization, auth=auth, filter=filter, account_index=account_index, @@ -1683,6 +3060,7 @@ async def public_pools_without_preload_content( self, index: StrictInt, limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, auth: Optional[StrictStr] = None, filter: Optional[StrictStr] = None, account_index: Optional[StrictInt] = None, @@ -1707,6 +3085,8 @@ async def public_pools_without_preload_content( :type index: int :param limit: (required) :type limit: int + :param authorization: + :type authorization: str :param auth: :type auth: str :param filter: @@ -1738,6 +3118,7 @@ async def public_pools_without_preload_content( _param = self._public_pools_serialize( index=index, limit=limit, + authorization=authorization, auth=auth, filter=filter, account_index=account_index, @@ -1762,6 +3143,7 @@ def _public_pools_serialize( self, index, limit, + authorization, auth, filter, account_index, @@ -1806,6 +3188,8 @@ def _public_pools_serialize( _query_params.append(('account_index', account_index)) # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization # process the form parameters # process the body parameter diff --git a/lighter/api/info_api.py b/lighter/api/announcement_api.py similarity index 91% rename from lighter/api/info_api.py rename to lighter/api/announcement_api.py index ad75eb5..7eaa982 100644 --- a/lighter/api/info_api.py +++ b/lighter/api/announcement_api.py @@ -16,14 +16,14 @@ from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from lighter.models.layer2_basic_info import Layer2BasicInfo +from lighter.models.announcements import Announcements from lighter.api_client import ApiClient, RequestSerialized from lighter.api_response import ApiResponse from lighter.rest import RESTResponseType -class InfoApi: +class AnnouncementApi: """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech @@ -37,7 +37,7 @@ def __init__(self, api_client=None) -> None: @validate_call - async def layer2_basic_info( + async def announcement( self, _request_timeout: Union[ None, @@ -51,10 +51,10 @@ async def layer2_basic_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> Layer2BasicInfo: - """layer2BasicInfo + ) -> Announcements: + """announcement - Get zklighter general info, including transaction and block stats + Get announcement :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -78,7 +78,7 @@ async def layer2_basic_info( :return: Returns the result object. """ # noqa: E501 - _param = self._layer2_basic_info_serialize( + _param = self._announcement_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -86,7 +86,7 @@ async def layer2_basic_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "Layer2BasicInfo", + '200': "Announcements", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -101,7 +101,7 @@ async def layer2_basic_info( @validate_call - async def layer2_basic_info_with_http_info( + async def announcement_with_http_info( self, _request_timeout: Union[ None, @@ -115,10 +115,10 @@ async def layer2_basic_info_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[Layer2BasicInfo]: - """layer2BasicInfo + ) -> ApiResponse[Announcements]: + """announcement - Get zklighter general info, including transaction and block stats + Get announcement :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -142,7 +142,7 @@ async def layer2_basic_info_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._layer2_basic_info_serialize( + _param = self._announcement_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -150,7 +150,7 @@ async def layer2_basic_info_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "Layer2BasicInfo", + '200': "Announcements", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -165,7 +165,7 @@ async def layer2_basic_info_with_http_info( @validate_call - async def layer2_basic_info_without_preload_content( + async def announcement_without_preload_content( self, _request_timeout: Union[ None, @@ -180,9 +180,9 @@ async def layer2_basic_info_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """layer2BasicInfo + """announcement - Get zklighter general info, including transaction and block stats + Get announcement :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -206,7 +206,7 @@ async def layer2_basic_info_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._layer2_basic_info_serialize( + _param = self._announcement_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -214,7 +214,7 @@ async def layer2_basic_info_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "Layer2BasicInfo", + '200': "Announcements", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -224,7 +224,7 @@ async def layer2_basic_info_without_preload_content( return response_data.response - def _layer2_basic_info_serialize( + def _announcement_serialize( self, _request_auth, _content_type, @@ -266,7 +266,7 @@ def _layer2_basic_info_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/layer2BasicInfo', + resource_path='/api/v1/announcement', path_params=_path_params, query_params=_query_params, header_params=_header_params, diff --git a/lighter/api/bridge_api.py b/lighter/api/bridge_api.py new file mode 100644 index 0000000..f9d7851 --- /dev/null +++ b/lighter/api/bridge_api.py @@ -0,0 +1,282 @@ +# 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 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from lighter.models.resp_get_fast_bridge_info import RespGetFastBridgeInfo + +from lighter.api_client import ApiClient, RequestSerialized +from lighter.api_response import ApiResponse +from lighter.rest import RESTResponseType + + +class BridgeApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def fastbridge_info( + self, + _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, + ) -> RespGetFastBridgeInfo: + """fastbridge_info + + Get fast bridge info + + :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._fastbridge_info_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespGetFastBridgeInfo", + '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 + + + @validate_call + async def fastbridge_info_with_http_info( + self, + _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[RespGetFastBridgeInfo]: + """fastbridge_info + + Get fast bridge info + + :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._fastbridge_info_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespGetFastBridgeInfo", + '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, + ) + + + @validate_call + async def fastbridge_info_without_preload_content( + self, + _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: + """fastbridge_info + + Get fast bridge info + + :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._fastbridge_info_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespGetFastBridgeInfo", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _fastbridge_info_serialize( + self, + _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 + # 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/fastbridge/info', + 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 + ) + + diff --git a/lighter/api/funding_api.py b/lighter/api/funding_api.py new file mode 100644 index 0000000..5bcc028 --- /dev/null +++ b/lighter/api/funding_api.py @@ -0,0 +1,282 @@ +# 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 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from lighter.models.funding_rates import FundingRates + +from lighter.api_client import ApiClient, RequestSerialized +from lighter.api_response import ApiResponse +from lighter.rest import RESTResponseType + + +class FundingApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def funding_rates( + self, + _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, + ) -> FundingRates: + """funding-rates + + Get funding rates + + :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._funding_rates_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FundingRates", + '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 + + + @validate_call + async def funding_rates_with_http_info( + self, + _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[FundingRates]: + """funding-rates + + Get funding rates + + :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._funding_rates_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FundingRates", + '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, + ) + + + @validate_call + async def funding_rates_without_preload_content( + self, + _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: + """funding-rates + + Get funding rates + + :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._funding_rates_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FundingRates", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _funding_rates_serialize( + self, + _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 + # 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/funding-rates', + 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 + ) + + diff --git a/lighter/api/notification_api.py b/lighter/api/notification_api.py new file mode 100644 index 0000000..a3c2477 --- /dev/null +++ b/lighter/api/notification_api.py @@ -0,0 +1,358 @@ +# 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 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictInt, StrictStr +from typing import Optional +from typing_extensions import Annotated +from lighter.models.result_code import ResultCode + +from lighter.api_client import ApiClient, RequestSerialized +from lighter.api_response import ApiResponse +from lighter.rest import RESTResponseType + + +class NotificationApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def notification_ack( + self, + notif_id: StrictStr, + account_index: StrictInt, + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = 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: + """notification_ack + + Ack notification + + :param notif_id: (required) + :type notif_id: str + :param account_index: (required) + :type account_index: int + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: 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._notification_ack_serialize( + notif_id=notif_id, + account_index=account_index, + authorization=authorization, + auth=auth, + _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 + + + @validate_call + async def notification_ack_with_http_info( + self, + notif_id: StrictStr, + account_index: StrictInt, + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = 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]: + """notification_ack + + Ack notification + + :param notif_id: (required) + :type notif_id: str + :param account_index: (required) + :type account_index: int + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: 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._notification_ack_serialize( + notif_id=notif_id, + account_index=account_index, + authorization=authorization, + auth=auth, + _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, + ) + + + @validate_call + async def notification_ack_without_preload_content( + self, + notif_id: StrictStr, + account_index: StrictInt, + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = 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: + """notification_ack + + Ack notification + + :param notif_id: (required) + :type notif_id: str + :param account_index: (required) + :type account_index: int + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: 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._notification_ack_serialize( + notif_id=notif_id, + account_index=account_index, + authorization=authorization, + auth=auth, + _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 _notification_ack_serialize( + self, + notif_id, + account_index, + authorization, + auth, + _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 notif_id is not None: + _form_params.append(('notif_id', notif_id)) + if auth is not None: + _form_params.append(('auth', auth)) + if account_index is not None: + _form_params.append(('account_index', account_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( + [ + 'multipart/form-data' + ] + ) + ) + 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/notification/ack', + 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 + ) + + diff --git a/lighter/api/order_api.py b/lighter/api/order_api.py index fa247cb..b4f7f4a 100644 --- a/lighter/api/order_api.py +++ b/lighter/api/order_api.py @@ -20,8 +20,8 @@ from typing import Optional from typing_extensions import Annotated from lighter.models.exchange_stats import ExchangeStats +from lighter.models.export_data import ExportData from lighter.models.order_book_details import OrderBookDetails -from lighter.models.order_book_orders import OrderBookOrders from lighter.models.order_books import OrderBooks from lighter.models.orders import Orders from lighter.models.trades import Trades @@ -45,674 +45,15 @@ def __init__(self, api_client=None) -> None: @validate_call - async def account_active_orders( - self, - account_index: StrictInt, - market_id: StrictInt, - auth: StrictStr, - _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, - ) -> Orders: - """accountActiveOrders - - Get account active orders. `auth` can be generated using the SDK. - - :param account_index: (required) - :type account_index: int - :param market_id: (required) - :type market_id: int - :param auth: (required) - :type auth: 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._account_active_orders_serialize( - account_index=account_index, - market_id=market_id, - auth=auth, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "Orders", - '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 - - - @validate_call - async def account_active_orders_with_http_info( - self, - account_index: StrictInt, - market_id: StrictInt, - auth: StrictStr, - _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[Orders]: - """accountActiveOrders - - Get account active orders. `auth` can be generated using the SDK. - - :param account_index: (required) - :type account_index: int - :param market_id: (required) - :type market_id: int - :param auth: (required) - :type auth: 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._account_active_orders_serialize( - account_index=account_index, - market_id=market_id, - auth=auth, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "Orders", - '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, - ) - - - @validate_call - async def account_active_orders_without_preload_content( - self, - account_index: StrictInt, - market_id: StrictInt, - auth: StrictStr, - _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: - """accountActiveOrders - - Get account active orders. `auth` can be generated using the SDK. - - :param account_index: (required) - :type account_index: int - :param market_id: (required) - :type market_id: int - :param auth: (required) - :type auth: 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._account_active_orders_serialize( - account_index=account_index, - market_id=market_id, - auth=auth, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "Orders", - '400': "ResultCode", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _account_active_orders_serialize( - self, - account_index, - market_id, - auth, - _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 account_index is not None: - - _query_params.append(('account_index', account_index)) - - if market_id is not None: - - _query_params.append(('market_id', market_id)) - - if auth is not None: - - _query_params.append(('auth', auth)) - - # 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/accountActiveOrders', - 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 - ) - - - - - @validate_call - async def account_inactive_orders( - self, - auth: StrictStr, - account_index: StrictInt, - limit: Annotated[int, Field(le=100, strict=True, ge=1)], - market_id: Optional[StrictInt] = None, - ask_filter: Optional[StrictInt] = None, - between_timestamps: Optional[StrictStr] = None, - cursor: 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, - ) -> Orders: - """accountInactiveOrders - - Get account inactive orders - - :param auth: (required) - :type auth: str - :param account_index: (required) - :type account_index: int - :param limit: (required) - :type limit: int - :param market_id: - :type market_id: int - :param ask_filter: - :type ask_filter: int - :param between_timestamps: - :type between_timestamps: str - :param cursor: - :type cursor: 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._account_inactive_orders_serialize( - auth=auth, - account_index=account_index, - limit=limit, - market_id=market_id, - ask_filter=ask_filter, - between_timestamps=between_timestamps, - cursor=cursor, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "Orders", - '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 - - - @validate_call - async def account_inactive_orders_with_http_info( - self, - auth: StrictStr, - account_index: StrictInt, - limit: Annotated[int, Field(le=100, strict=True, ge=1)], - market_id: Optional[StrictInt] = None, - ask_filter: Optional[StrictInt] = None, - between_timestamps: Optional[StrictStr] = None, - cursor: 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[Orders]: - """accountInactiveOrders - - Get account inactive orders - - :param auth: (required) - :type auth: str - :param account_index: (required) - :type account_index: int - :param limit: (required) - :type limit: int - :param market_id: - :type market_id: int - :param ask_filter: - :type ask_filter: int - :param between_timestamps: - :type between_timestamps: str - :param cursor: - :type cursor: 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._account_inactive_orders_serialize( - auth=auth, - account_index=account_index, - limit=limit, - market_id=market_id, - ask_filter=ask_filter, - between_timestamps=between_timestamps, - cursor=cursor, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "Orders", - '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, - ) - - - @validate_call - async def account_inactive_orders_without_preload_content( - self, - auth: StrictStr, - account_index: StrictInt, - limit: Annotated[int, Field(le=100, strict=True, ge=1)], - market_id: Optional[StrictInt] = None, - ask_filter: Optional[StrictInt] = None, - between_timestamps: Optional[StrictStr] = None, - cursor: 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: - """accountInactiveOrders - - Get account inactive orders - - :param auth: (required) - :type auth: str - :param account_index: (required) - :type account_index: int - :param limit: (required) - :type limit: int - :param market_id: - :type market_id: int - :param ask_filter: - :type ask_filter: int - :param between_timestamps: - :type between_timestamps: str - :param cursor: - :type cursor: 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._account_inactive_orders_serialize( - auth=auth, - account_index=account_index, - limit=limit, - market_id=market_id, - ask_filter=ask_filter, - between_timestamps=between_timestamps, - cursor=cursor, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "Orders", - '400': "ResultCode", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _account_inactive_orders_serialize( - self, - auth, - account_index, - limit, - market_id, - ask_filter, - between_timestamps, - cursor, - _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 auth is not None: - - _query_params.append(('auth', auth)) - - if account_index is not None: - - _query_params.append(('account_index', account_index)) - - if market_id is not None: - - _query_params.append(('market_id', market_id)) - - if ask_filter is not None: - - _query_params.append(('ask_filter', ask_filter)) - - if between_timestamps is not None: - - _query_params.append(('between_timestamps', between_timestamps)) - - if cursor is not None: - - _query_params.append(('cursor', cursor)) - - if limit is not None: - - _query_params.append(('limit', limit)) - - # 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/accountInactiveOrders', - 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 - ) - - - - - @validate_call - async def account_orders( + async def account_inactive_orders( self, - auth: StrictStr, account_index: StrictInt, - market_id: StrictInt, limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = None, + market_id: Optional[StrictInt] = None, + ask_filter: Optional[StrictInt] = None, + between_timestamps: Optional[StrictStr] = None, cursor: Optional[StrictStr] = None, _request_timeout: Union[ None, @@ -727,18 +68,24 @@ async def account_orders( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> Orders: - """accountOrders + """accountInactiveOrders - Get account orders + Get account inactive orders - :param auth: (required) - :type auth: str :param account_index: (required) :type account_index: int - :param market_id: (required) - :type market_id: int :param limit: (required) :type limit: int + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: str + :param market_id: + :type market_id: int + :param ask_filter: + :type ask_filter: int + :param between_timestamps: + :type between_timestamps: str :param cursor: :type cursor: str :param _request_timeout: timeout setting for this request. If one @@ -763,11 +110,14 @@ async def account_orders( :return: Returns the result object. """ # noqa: E501 - _param = self._account_orders_serialize( - auth=auth, + _param = self._account_inactive_orders_serialize( account_index=account_index, - market_id=market_id, limit=limit, + authorization=authorization, + auth=auth, + market_id=market_id, + ask_filter=ask_filter, + between_timestamps=between_timestamps, cursor=cursor, _request_auth=_request_auth, _content_type=_content_type, @@ -791,12 +141,15 @@ async def account_orders( @validate_call - async def account_orders_with_http_info( + async def account_inactive_orders_with_http_info( self, - auth: StrictStr, account_index: StrictInt, - market_id: StrictInt, limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = None, + market_id: Optional[StrictInt] = None, + ask_filter: Optional[StrictInt] = None, + between_timestamps: Optional[StrictStr] = None, cursor: Optional[StrictStr] = None, _request_timeout: Union[ None, @@ -811,18 +164,24 @@ async def account_orders_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[Orders]: - """accountOrders + """accountInactiveOrders - Get account orders + Get account inactive orders - :param auth: (required) - :type auth: str :param account_index: (required) :type account_index: int - :param market_id: (required) - :type market_id: int :param limit: (required) :type limit: int + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: str + :param market_id: + :type market_id: int + :param ask_filter: + :type ask_filter: int + :param between_timestamps: + :type between_timestamps: str :param cursor: :type cursor: str :param _request_timeout: timeout setting for this request. If one @@ -847,11 +206,14 @@ async def account_orders_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._account_orders_serialize( - auth=auth, + _param = self._account_inactive_orders_serialize( account_index=account_index, - market_id=market_id, limit=limit, + authorization=authorization, + auth=auth, + market_id=market_id, + ask_filter=ask_filter, + between_timestamps=between_timestamps, cursor=cursor, _request_auth=_request_auth, _content_type=_content_type, @@ -875,12 +237,15 @@ async def account_orders_with_http_info( @validate_call - async def account_orders_without_preload_content( + async def account_inactive_orders_without_preload_content( self, - auth: StrictStr, account_index: StrictInt, - market_id: StrictInt, limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = None, + market_id: Optional[StrictInt] = None, + ask_filter: Optional[StrictInt] = None, + between_timestamps: Optional[StrictStr] = None, cursor: Optional[StrictStr] = None, _request_timeout: Union[ None, @@ -895,18 +260,24 @@ async def account_orders_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """accountOrders + """accountInactiveOrders - Get account orders + Get account inactive orders - :param auth: (required) - :type auth: str :param account_index: (required) :type account_index: int - :param market_id: (required) - :type market_id: int :param limit: (required) :type limit: int + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: str + :param market_id: + :type market_id: int + :param ask_filter: + :type ask_filter: int + :param between_timestamps: + :type between_timestamps: str :param cursor: :type cursor: str :param _request_timeout: timeout setting for this request. If one @@ -931,11 +302,14 @@ async def account_orders_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._account_orders_serialize( - auth=auth, + _param = self._account_inactive_orders_serialize( account_index=account_index, - market_id=market_id, limit=limit, + authorization=authorization, + auth=auth, + market_id=market_id, + ask_filter=ask_filter, + between_timestamps=between_timestamps, cursor=cursor, _request_auth=_request_auth, _content_type=_content_type, @@ -954,12 +328,15 @@ async def account_orders_without_preload_content( return response_data.response - def _account_orders_serialize( + def _account_inactive_orders_serialize( self, - auth, account_index, - market_id, limit, + authorization, + auth, + market_id, + ask_filter, + between_timestamps, cursor, _request_auth, _content_type, @@ -993,6 +370,14 @@ def _account_orders_serialize( _query_params.append(('market_id', market_id)) + if ask_filter is not None: + + _query_params.append(('ask_filter', ask_filter)) + + if between_timestamps is not None: + + _query_params.append(('between_timestamps', between_timestamps)) + if cursor is not None: _query_params.append(('cursor', cursor)) @@ -1002,6 +387,8 @@ def _account_orders_serialize( _query_params.append(('limit', limit)) # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization # process the form parameters # process the body parameter @@ -1021,7 +408,7 @@ def _account_orders_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/accountOrders', + resource_path='/api/v1/accountInactiveOrders', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1284,8 +671,12 @@ def _exchange_stats_serialize( @validate_call - async def order_book_details( + async def export( self, + type: StrictStr, + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + account_index: Optional[StrictInt] = None, market_id: Optional[StrictInt] = None, _request_timeout: Union[ None, @@ -1299,11 +690,19 @@ async def order_book_details( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> OrderBookDetails: - """orderBookDetails + ) -> ExportData: + """export - Get order books metadata + Export data + :param type: (required) + :type type: str + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param account_index: + :type account_index: int :param market_id: :type market_id: int :param _request_timeout: timeout setting for this request. If one @@ -1328,7 +727,11 @@ async def order_book_details( :return: Returns the result object. """ # noqa: E501 - _param = self._order_book_details_serialize( + _param = self._export_serialize( + type=type, + authorization=authorization, + auth=auth, + account_index=account_index, market_id=market_id, _request_auth=_request_auth, _content_type=_content_type, @@ -1337,7 +740,7 @@ async def order_book_details( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "OrderBookDetails", + '200': "ExportData", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -1352,8 +755,12 @@ async def order_book_details( @validate_call - async def order_book_details_with_http_info( + async def export_with_http_info( self, + type: StrictStr, + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + account_index: Optional[StrictInt] = None, market_id: Optional[StrictInt] = None, _request_timeout: Union[ None, @@ -1367,11 +774,19 @@ async def order_book_details_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[OrderBookDetails]: - """orderBookDetails + ) -> ApiResponse[ExportData]: + """export - Get order books metadata + Export data + :param type: (required) + :type type: str + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param account_index: + :type account_index: int :param market_id: :type market_id: int :param _request_timeout: timeout setting for this request. If one @@ -1396,7 +811,11 @@ async def order_book_details_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._order_book_details_serialize( + _param = self._export_serialize( + type=type, + authorization=authorization, + auth=auth, + account_index=account_index, market_id=market_id, _request_auth=_request_auth, _content_type=_content_type, @@ -1405,7 +824,7 @@ async def order_book_details_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "OrderBookDetails", + '200': "ExportData", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -1420,8 +839,12 @@ async def order_book_details_with_http_info( @validate_call - async def order_book_details_without_preload_content( + async def export_without_preload_content( self, + type: StrictStr, + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + account_index: Optional[StrictInt] = None, market_id: Optional[StrictInt] = None, _request_timeout: Union[ None, @@ -1436,10 +859,18 @@ async def order_book_details_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """orderBookDetails + """export - Get order books metadata + Export data + :param type: (required) + :type type: str + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param account_index: + :type account_index: int :param market_id: :type market_id: int :param _request_timeout: timeout setting for this request. If one @@ -1464,7 +895,11 @@ async def order_book_details_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._order_book_details_serialize( + _param = self._export_serialize( + type=type, + authorization=authorization, + auth=auth, + account_index=account_index, market_id=market_id, _request_auth=_request_auth, _content_type=_content_type, @@ -1473,7 +908,7 @@ async def order_book_details_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "OrderBookDetails", + '200': "ExportData", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -1483,8 +918,12 @@ async def order_book_details_without_preload_content( return response_data.response - def _order_book_details_serialize( + def _export_serialize( self, + type, + authorization, + auth, + account_index, market_id, _request_auth, _content_type, @@ -1506,11 +945,25 @@ def _order_book_details_serialize( # process the path parameters # process the query parameters + if auth is not None: + + _query_params.append(('auth', auth)) + + if account_index is not None: + + _query_params.append(('account_index', account_index)) + if market_id is not None: _query_params.append(('market_id', market_id)) + if type is not None: + + _query_params.append(('type', type)) + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization # process the form parameters # process the body parameter @@ -1530,7 +983,7 @@ def _order_book_details_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/orderBookDetails', + resource_path='/api/v1/export', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1547,10 +1000,9 @@ def _order_book_details_serialize( @validate_call - async def order_book_orders( + async def order_book_details( self, - market_id: StrictInt, - limit: Annotated[int, Field(le=100, strict=True, ge=1)], + market_id: Optional[StrictInt] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1563,15 +1015,13 @@ async def order_book_orders( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> OrderBookOrders: - """orderBookOrders + ) -> OrderBookDetails: + """orderBookDetails - Get order book orders + Get order books metadata - :param market_id: (required) + :param market_id: :type market_id: int - :param limit: (required) - :type limit: 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 @@ -1594,9 +1044,8 @@ async def order_book_orders( :return: Returns the result object. """ # noqa: E501 - _param = self._order_book_orders_serialize( + _param = self._order_book_details_serialize( market_id=market_id, - limit=limit, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1604,7 +1053,7 @@ async def order_book_orders( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "OrderBookOrders", + '200': "OrderBookDetails", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -1619,10 +1068,9 @@ async def order_book_orders( @validate_call - async def order_book_orders_with_http_info( + async def order_book_details_with_http_info( self, - market_id: StrictInt, - limit: Annotated[int, Field(le=100, strict=True, ge=1)], + market_id: Optional[StrictInt] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1635,15 +1083,13 @@ async def order_book_orders_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[OrderBookOrders]: - """orderBookOrders + ) -> ApiResponse[OrderBookDetails]: + """orderBookDetails - Get order book orders + Get order books metadata - :param market_id: (required) + :param market_id: :type market_id: int - :param limit: (required) - :type limit: 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 @@ -1666,9 +1112,8 @@ async def order_book_orders_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._order_book_orders_serialize( + _param = self._order_book_details_serialize( market_id=market_id, - limit=limit, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1676,7 +1121,7 @@ async def order_book_orders_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "OrderBookOrders", + '200': "OrderBookDetails", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -1691,10 +1136,9 @@ async def order_book_orders_with_http_info( @validate_call - async def order_book_orders_without_preload_content( + async def order_book_details_without_preload_content( self, - market_id: StrictInt, - limit: Annotated[int, Field(le=100, strict=True, ge=1)], + market_id: Optional[StrictInt] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1708,14 +1152,12 @@ async def order_book_orders_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """orderBookOrders + """orderBookDetails - Get order book orders + Get order books metadata - :param market_id: (required) + :param market_id: :type market_id: int - :param limit: (required) - :type limit: 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 @@ -1738,9 +1180,8 @@ async def order_book_orders_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._order_book_orders_serialize( + _param = self._order_book_details_serialize( market_id=market_id, - limit=limit, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1748,7 +1189,7 @@ async def order_book_orders_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "OrderBookOrders", + '200': "OrderBookDetails", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -1758,10 +1199,9 @@ async def order_book_orders_without_preload_content( return response_data.response - def _order_book_orders_serialize( + def _order_book_details_serialize( self, market_id, - limit, _request_auth, _content_type, _headers, @@ -1786,10 +1226,6 @@ def _order_book_orders_serialize( _query_params.append(('market_id', market_id)) - if limit is not None: - - _query_params.append(('limit', limit)) - # process the header parameters # process the form parameters # process the body parameter @@ -1810,7 +1246,7 @@ def _order_book_orders_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/orderBookOrders', + resource_path='/api/v1/orderBookDetails', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -2374,6 +1810,7 @@ async def trades( self, sort_by: StrictStr, limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, auth: Optional[StrictStr] = None, market_id: Optional[StrictInt] = None, account_index: Optional[StrictInt] = None, @@ -2403,6 +1840,8 @@ async def trades( :type sort_by: str :param limit: (required) :type limit: int + :param authorization: + :type authorization: str :param auth: :type auth: str :param market_id: @@ -2444,6 +1883,7 @@ async def trades( _param = self._trades_serialize( sort_by=sort_by, limit=limit, + authorization=authorization, auth=auth, market_id=market_id, account_index=account_index, @@ -2478,6 +1918,7 @@ async def trades_with_http_info( self, sort_by: StrictStr, limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, auth: Optional[StrictStr] = None, market_id: Optional[StrictInt] = None, account_index: Optional[StrictInt] = None, @@ -2507,6 +1948,8 @@ async def trades_with_http_info( :type sort_by: str :param limit: (required) :type limit: int + :param authorization: + :type authorization: str :param auth: :type auth: str :param market_id: @@ -2548,6 +1991,7 @@ async def trades_with_http_info( _param = self._trades_serialize( sort_by=sort_by, limit=limit, + authorization=authorization, auth=auth, market_id=market_id, account_index=account_index, @@ -2582,6 +2026,7 @@ async def trades_without_preload_content( self, sort_by: StrictStr, limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, auth: Optional[StrictStr] = None, market_id: Optional[StrictInt] = None, account_index: Optional[StrictInt] = None, @@ -2611,6 +2056,8 @@ async def trades_without_preload_content( :type sort_by: str :param limit: (required) :type limit: int + :param authorization: + :type authorization: str :param auth: :type auth: str :param market_id: @@ -2652,6 +2099,7 @@ async def trades_without_preload_content( _param = self._trades_serialize( sort_by=sort_by, limit=limit, + authorization=authorization, auth=auth, market_id=market_id, account_index=account_index, @@ -2681,6 +2129,7 @@ def _trades_serialize( self, sort_by, limit, + authorization, auth, market_id, account_index, @@ -2750,6 +2199,8 @@ def _trades_serialize( _query_params.append(('limit', limit)) # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization # process the form parameters # process the body parameter diff --git a/lighter/api/referral_api.py b/lighter/api/referral_api.py new file mode 100644 index 0000000..733ac60 --- /dev/null +++ b/lighter/api/referral_api.py @@ -0,0 +1,334 @@ +# 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 + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictInt, StrictStr +from typing import Optional +from typing_extensions import Annotated +from lighter.models.referral_points import ReferralPoints + +from lighter.api_client import ApiClient, RequestSerialized +from lighter.api_response import ApiResponse +from lighter.rest import RESTResponseType + + +class ReferralApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def referral_points( + self, + account_index: StrictInt, + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = 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, + ) -> ReferralPoints: + """referral_points + + Get referral points + + :param account_index: (required) + :type account_index: int + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: 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._referral_points_serialize( + account_index=account_index, + authorization=authorization, + auth=auth, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ReferralPoints", + '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 + + + @validate_call + async def referral_points_with_http_info( + self, + account_index: StrictInt, + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = 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[ReferralPoints]: + """referral_points + + Get referral points + + :param account_index: (required) + :type account_index: int + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: 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._referral_points_serialize( + account_index=account_index, + authorization=authorization, + auth=auth, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ReferralPoints", + '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, + ) + + + @validate_call + async def referral_points_without_preload_content( + self, + account_index: StrictInt, + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = 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: + """referral_points + + Get referral points + + :param account_index: (required) + :type account_index: int + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: 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._referral_points_serialize( + account_index=account_index, + authorization=authorization, + auth=auth, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ReferralPoints", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _referral_points_serialize( + self, + account_index, + authorization, + auth, + _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 auth is not None: + + _query_params.append(('auth', auth)) + + if account_index is not None: + + _query_params.append(('account_index', account_index)) + + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # 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/referral/points', + 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 + ) + + diff --git a/lighter/api/transaction_api.py b/lighter/api/transaction_api.py index d146305..efee466 100644 --- a/lighter/api/transaction_api.py +++ b/lighter/api/transaction_api.py @@ -661,8 +661,9 @@ def _block_txs_serialize( async def deposit_history( self, account_index: StrictInt, - auth: StrictStr, l1_address: StrictStr, + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = None, cursor: Optional[StrictStr] = None, filter: Optional[StrictStr] = None, _request_timeout: Union[ @@ -684,10 +685,12 @@ async def deposit_history( :param account_index: (required) :type account_index: int - :param auth: (required) - :type auth: str :param l1_address: (required) :type l1_address: str + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: str :param cursor: :type cursor: str :param filter: @@ -716,8 +719,9 @@ async def deposit_history( _param = self._deposit_history_serialize( account_index=account_index, - auth=auth, l1_address=l1_address, + authorization=authorization, + auth=auth, cursor=cursor, filter=filter, _request_auth=_request_auth, @@ -745,8 +749,9 @@ async def deposit_history( async def deposit_history_with_http_info( self, account_index: StrictInt, - auth: StrictStr, l1_address: StrictStr, + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = None, cursor: Optional[StrictStr] = None, filter: Optional[StrictStr] = None, _request_timeout: Union[ @@ -768,10 +773,12 @@ async def deposit_history_with_http_info( :param account_index: (required) :type account_index: int - :param auth: (required) - :type auth: str :param l1_address: (required) :type l1_address: str + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: str :param cursor: :type cursor: str :param filter: @@ -800,8 +807,9 @@ async def deposit_history_with_http_info( _param = self._deposit_history_serialize( account_index=account_index, - auth=auth, l1_address=l1_address, + authorization=authorization, + auth=auth, cursor=cursor, filter=filter, _request_auth=_request_auth, @@ -829,8 +837,9 @@ async def deposit_history_with_http_info( async def deposit_history_without_preload_content( self, account_index: StrictInt, - auth: StrictStr, l1_address: StrictStr, + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = None, cursor: Optional[StrictStr] = None, filter: Optional[StrictStr] = None, _request_timeout: Union[ @@ -852,10 +861,12 @@ async def deposit_history_without_preload_content( :param account_index: (required) :type account_index: int - :param auth: (required) - :type auth: str :param l1_address: (required) :type l1_address: str + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: str :param cursor: :type cursor: str :param filter: @@ -884,8 +895,9 @@ async def deposit_history_without_preload_content( _param = self._deposit_history_serialize( account_index=account_index, - auth=auth, l1_address=l1_address, + authorization=authorization, + auth=auth, cursor=cursor, filter=filter, _request_auth=_request_auth, @@ -908,8 +920,9 @@ async def deposit_history_without_preload_content( def _deposit_history_serialize( self, account_index, - auth, l1_address, + authorization, + auth, cursor, filter, _request_auth, @@ -953,6 +966,8 @@ def _deposit_history_serialize( _query_params.append(('filter', filter)) # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization # process the form parameters # process the body parameter @@ -2688,7 +2703,8 @@ def _txs_serialize( async def withdraw_history( self, account_index: StrictInt, - auth: StrictStr, + authorizatio: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = None, cursor: Optional[StrictStr] = None, filter: Optional[StrictStr] = None, _request_timeout: Union[ @@ -2710,7 +2726,9 @@ async def withdraw_history( :param account_index: (required) :type account_index: int - :param auth: (required) + :param authorizatio: make required after integ is done + :type authorizatio: str + :param auth: made optional to support header auth clients :type auth: str :param cursor: :type cursor: str @@ -2740,6 +2758,7 @@ async def withdraw_history( _param = self._withdraw_history_serialize( account_index=account_index, + authorizatio=authorizatio, auth=auth, cursor=cursor, filter=filter, @@ -2768,7 +2787,8 @@ async def withdraw_history( async def withdraw_history_with_http_info( self, account_index: StrictInt, - auth: StrictStr, + authorizatio: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = None, cursor: Optional[StrictStr] = None, filter: Optional[StrictStr] = None, _request_timeout: Union[ @@ -2790,7 +2810,9 @@ async def withdraw_history_with_http_info( :param account_index: (required) :type account_index: int - :param auth: (required) + :param authorizatio: make required after integ is done + :type authorizatio: str + :param auth: made optional to support header auth clients :type auth: str :param cursor: :type cursor: str @@ -2820,6 +2842,7 @@ async def withdraw_history_with_http_info( _param = self._withdraw_history_serialize( account_index=account_index, + authorizatio=authorizatio, auth=auth, cursor=cursor, filter=filter, @@ -2848,7 +2871,8 @@ async def withdraw_history_with_http_info( async def withdraw_history_without_preload_content( self, account_index: StrictInt, - auth: StrictStr, + authorizatio: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = None, cursor: Optional[StrictStr] = None, filter: Optional[StrictStr] = None, _request_timeout: Union[ @@ -2870,7 +2894,9 @@ async def withdraw_history_without_preload_content( :param account_index: (required) :type account_index: int - :param auth: (required) + :param authorizatio: make required after integ is done + :type authorizatio: str + :param auth: made optional to support header auth clients :type auth: str :param cursor: :type cursor: str @@ -2900,6 +2926,7 @@ async def withdraw_history_without_preload_content( _param = self._withdraw_history_serialize( account_index=account_index, + authorizatio=authorizatio, auth=auth, cursor=cursor, filter=filter, @@ -2923,6 +2950,7 @@ async def withdraw_history_without_preload_content( def _withdraw_history_serialize( self, account_index, + authorizatio, auth, cursor, filter, @@ -2963,6 +2991,8 @@ def _withdraw_history_serialize( _query_params.append(('filter', filter)) # process the header parameters + if authorizatio is not None: + _header_params['authorizatio'] = authorizatio # process the form parameters # process the body parameter diff --git a/lighter/models/__init__.py b/lighter/models/__init__.py index 19c157c..5fea2f6 100644 --- a/lighter/models/__init__.py +++ b/lighter/models/__init__.py @@ -16,48 +16,112 @@ # import models into model package from lighter.models.account import Account from lighter.models.account_api_keys import AccountApiKeys +from lighter.models.account_limits import AccountLimits +from lighter.models.account_market_stats import AccountMarketStats +from lighter.models.account_metadata import AccountMetadata +from lighter.models.account_metadatas import AccountMetadatas from lighter.models.account_pn_l import AccountPnL from lighter.models.account_position import AccountPosition +from lighter.models.account_stats import AccountStats +from lighter.models.account_trade_stats import AccountTradeStats +from lighter.models.announcement import Announcement +from lighter.models.announcements import Announcements from lighter.models.api_key import ApiKey from lighter.models.block import Block from lighter.models.blocks import Blocks +from lighter.models.bridge_supported_network import BridgeSupportedNetwork from lighter.models.candlestick import Candlestick from lighter.models.candlesticks import Candlesticks +from lighter.models.contract_address import ContractAddress from lighter.models.current_height import CurrentHeight +from lighter.models.cursor import Cursor from lighter.models.daily_return import DailyReturn from lighter.models.deposit_history import DepositHistory from lighter.models.deposit_history_item import DepositHistoryItem from lighter.models.detailed_account import DetailedAccount from lighter.models.detailed_accounts import DetailedAccounts +from lighter.models.detailed_candlestick import DetailedCandlestick from lighter.models.enriched_tx import EnrichedTx from lighter.models.exchange_stats import ExchangeStats -from lighter.models.fee_bucket import FeeBucket +from lighter.models.export_data import ExportData from lighter.models.funding import Funding +from lighter.models.funding_rate import FundingRate +from lighter.models.funding_rates import FundingRates from lighter.models.fundings import Fundings -from lighter.models.layer2_basic_info import Layer2BasicInfo +from lighter.models.l1_metadata import L1Metadata +from lighter.models.l1_provider_info import L1ProviderInfo +from lighter.models.liq_trade import LiqTrade +from lighter.models.liquidation import Liquidation +from lighter.models.liquidation_info import LiquidationInfo +from lighter.models.liquidation_infos import LiquidationInfos +from lighter.models.market_info import MarketInfo from lighter.models.next_nonce import NextNonce from lighter.models.order import Order from lighter.models.order_book import OrderBook +from lighter.models.order_book_depth import OrderBookDepth from lighter.models.order_book_detail import OrderBookDetail from lighter.models.order_book_details import OrderBookDetails -from lighter.models.order_book_orders import OrderBookOrders from lighter.models.order_book_stats import OrderBookStats from lighter.models.order_books import OrderBooks from lighter.models.orders import Orders from lighter.models.pn_l_entry import PnLEntry +from lighter.models.position_funding import PositionFunding +from lighter.models.position_fundings import PositionFundings +from lighter.models.price_level import PriceLevel from lighter.models.public_pool import PublicPool from lighter.models.public_pool_info import PublicPoolInfo from lighter.models.public_pool_share import PublicPoolShare from lighter.models.public_pools import PublicPools +from lighter.models.referral_point_entry import ReferralPointEntry +from lighter.models.referral_points import ReferralPoints +from lighter.models.req_export_data import ReqExportData +from lighter.models.req_get_account import ReqGetAccount +from lighter.models.req_get_account_api_keys import ReqGetAccountApiKeys +from lighter.models.req_get_account_by_l1_address import ReqGetAccountByL1Address +from lighter.models.req_get_account_inactive_orders import ReqGetAccountInactiveOrders +from lighter.models.req_get_account_limits import ReqGetAccountLimits +from lighter.models.req_get_account_metadata import ReqGetAccountMetadata +from lighter.models.req_get_account_pending_txs import ReqGetAccountPendingTxs +from lighter.models.req_get_account_pn_l import ReqGetAccountPnL +from lighter.models.req_get_account_txs import ReqGetAccountTxs +from lighter.models.req_get_block import ReqGetBlock +from lighter.models.req_get_block_txs import ReqGetBlockTxs +from lighter.models.req_get_by_account import ReqGetByAccount +from lighter.models.req_get_candlesticks import ReqGetCandlesticks +from lighter.models.req_get_deposit_history import ReqGetDepositHistory +from lighter.models.req_get_fast_withdraw_info import ReqGetFastWithdrawInfo +from lighter.models.req_get_fundings import ReqGetFundings +from lighter.models.req_get_l1_metadata import ReqGetL1Metadata +from lighter.models.req_get_l1_tx import ReqGetL1Tx +from lighter.models.req_get_latest_deposit import ReqGetLatestDeposit +from lighter.models.req_get_liquidation_infos import ReqGetLiquidationInfos +from lighter.models.req_get_next_nonce import ReqGetNextNonce +from lighter.models.req_get_order_book_details import ReqGetOrderBookDetails +from lighter.models.req_get_order_books import ReqGetOrderBooks +from lighter.models.req_get_position_funding import ReqGetPositionFunding +from lighter.models.req_get_public_pools import ReqGetPublicPools +from lighter.models.req_get_range_with_cursor import ReqGetRangeWithCursor +from lighter.models.req_get_range_with_index import ReqGetRangeWithIndex +from lighter.models.req_get_range_with_index_sortable import ReqGetRangeWithIndexSortable +from lighter.models.req_get_recent_trades import ReqGetRecentTrades +from lighter.models.req_get_referral_points import ReqGetReferralPoints +from lighter.models.req_get_trades import ReqGetTrades +from lighter.models.req_get_tx import ReqGetTx +from lighter.models.req_get_withdraw_history import ReqGetWithdrawHistory +from lighter.models.resp_get_fast_bridge_info import RespGetFastBridgeInfo +from lighter.models.result_code import ResultCode +from lighter.models.risk_info import RiskInfo from lighter.models.simple_order import SimpleOrder from lighter.models.status import Status from lighter.models.sub_accounts import SubAccounts +from lighter.models.ticker import Ticker from lighter.models.trade import Trade from lighter.models.trades import Trades from lighter.models.tx import Tx from lighter.models.tx_hash import TxHash from lighter.models.tx_hashes import TxHashes from lighter.models.txs import Txs +from lighter.models.validator_info import ValidatorInfo from lighter.models.withdraw_history import WithdrawHistory from lighter.models.withdraw_history_item import WithdrawHistoryItem from lighter.models.zk_lighter_info import ZkLighterInfo diff --git a/lighter/models/layer2_basic_info.py b/lighter/models/account_limits.py similarity index 82% rename from lighter/models/layer2_basic_info.py rename to lighter/models/account_limits.py index c16ca62..d899264 100644 --- a/lighter/models/layer2_basic_info.py +++ b/lighter/models/account_limits.py @@ -22,17 +22,15 @@ from typing import Optional, Set from typing_extensions import Self -class Layer2BasicInfo(BaseModel): +class AccountLimits(BaseModel): """ - Layer2BasicInfo + AccountLimits """ # noqa: E501 code: StrictInt message: Optional[StrictStr] = None - block_committed: StrictInt - block_verified: StrictInt - total_transaction_count: StrictInt + max_llp_percentage: StrictInt additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["code", "message", "block_committed", "block_verified", "total_transaction_count"] + __properties: ClassVar[List[str]] = ["code", "message", "max_llp_percentage"] model_config = ConfigDict( populate_by_name=True, @@ -52,7 +50,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of Layer2BasicInfo from a JSON string""" + """Create an instance of AccountLimits from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -84,7 +82,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of Layer2BasicInfo from a dict""" + """Create an instance of AccountLimits from a dict""" if obj is None: return None @@ -94,9 +92,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), - "block_committed": obj.get("block_committed"), - "block_verified": obj.get("block_verified"), - "total_transaction_count": obj.get("total_transaction_count") + "max_llp_percentage": obj.get("max_llp_percentage") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/account_market_stats.py b/lighter/models/account_market_stats.py new file mode 100644 index 0000000..efa1731 --- /dev/null +++ b/lighter/models/account_market_stats.py @@ -0,0 +1,124 @@ +# 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 +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self + +class AccountMarketStats(BaseModel): + """ + AccountMarketStats + """ # noqa: E501 + market_id: StrictInt + daily_trades_count: StrictInt + daily_base_token_volume: Union[StrictFloat, StrictInt] + daily_quote_token_volume: Union[StrictFloat, StrictInt] + weekly_trades_count: StrictInt + weekly_base_token_volume: Union[StrictFloat, StrictInt] + weekly_quote_token_volume: Union[StrictFloat, StrictInt] + monthly_trades_count: StrictInt + monthly_base_token_volume: Union[StrictFloat, StrictInt] + monthly_quote_token_volume: Union[StrictFloat, StrictInt] + total_trades_count: StrictInt + total_base_token_volume: Union[StrictFloat, StrictInt] + total_quote_token_volume: Union[StrictFloat, StrictInt] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["market_id", "daily_trades_count", "daily_base_token_volume", "daily_quote_token_volume", "weekly_trades_count", "weekly_base_token_volume", "weekly_quote_token_volume", "monthly_trades_count", "monthly_base_token_volume", "monthly_quote_token_volume", "total_trades_count", "total_base_token_volume", "total_quote_token_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 AccountMarketStats 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 AccountMarketStats from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "market_id": obj.get("market_id"), + "daily_trades_count": obj.get("daily_trades_count"), + "daily_base_token_volume": obj.get("daily_base_token_volume"), + "daily_quote_token_volume": obj.get("daily_quote_token_volume"), + "weekly_trades_count": obj.get("weekly_trades_count"), + "weekly_base_token_volume": obj.get("weekly_base_token_volume"), + "weekly_quote_token_volume": obj.get("weekly_quote_token_volume"), + "monthly_trades_count": obj.get("monthly_trades_count"), + "monthly_base_token_volume": obj.get("monthly_base_token_volume"), + "monthly_quote_token_volume": obj.get("monthly_quote_token_volume"), + "total_trades_count": obj.get("total_trades_count"), + "total_base_token_volume": obj.get("total_base_token_volume"), + "total_quote_token_volume": obj.get("total_quote_token_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/lighter/models/account_metadata.py b/lighter/models/account_metadata.py new file mode 100644 index 0000000..ddd09e6 --- /dev/null +++ b/lighter/models/account_metadata.py @@ -0,0 +1,108 @@ +# 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, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class AccountMetadata(BaseModel): + """ + AccountMetadata + """ # noqa: E501 + account_index: StrictInt + name: StrictStr + description: StrictStr + can_invite: StrictBool = Field(description=" Remove After FE uses L1 meta endpoint") + referral_points_percentage: StrictStr = Field(description=" Remove After FE uses L1 meta endpoint") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["account_index", "name", "description", "can_invite", "referral_points_percentage"] + + 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 AccountMetadata 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 AccountMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "account_index": obj.get("account_index"), + "name": obj.get("name"), + "description": obj.get("description"), + "can_invite": obj.get("can_invite"), + "referral_points_percentage": obj.get("referral_points_percentage") + }) + # 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/account_metadatas.py b/lighter/models/account_metadatas.py new file mode 100644 index 0000000..3d41085 --- /dev/null +++ b/lighter/models/account_metadatas.py @@ -0,0 +1,112 @@ +# 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 lighter.models.account_metadata import AccountMetadata +from typing import Optional, Set +from typing_extensions import Self + +class AccountMetadatas(BaseModel): + """ + AccountMetadatas + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + account_metadatas: List[AccountMetadata] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "account_metadatas"] + + 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 AccountMetadatas 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 account_metadatas (list) + _items = [] + if self.account_metadatas: + for _item in self.account_metadatas: + if _item: + _items.append(_item.to_dict()) + _dict['account_metadatas'] = _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 AccountMetadatas from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "account_metadatas": [AccountMetadata.from_dict(_item) for _item in obj["account_metadatas"]] if obj.get("account_metadatas") 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/account_stats.py b/lighter/models/account_stats.py new file mode 100644 index 0000000..85e14c2 --- /dev/null +++ b/lighter/models/account_stats.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, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class AccountStats(BaseModel): + """ + AccountStats + """ # noqa: E501 + collateral: StrictStr + portfolio_value: StrictStr + leverage: StrictStr + available_balance: StrictStr + margin_usage: StrictStr + buying_power: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["collateral", "portfolio_value", "leverage", "available_balance", "margin_usage", "buying_power"] + + 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 AccountStats 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 AccountStats from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "collateral": obj.get("collateral"), + "portfolio_value": obj.get("portfolio_value"), + "leverage": obj.get("leverage"), + "available_balance": obj.get("available_balance"), + "margin_usage": obj.get("margin_usage"), + "buying_power": obj.get("buying_power") + }) + # 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/account_trade_stats.py b/lighter/models/account_trade_stats.py new file mode 100644 index 0000000..a266610 --- /dev/null +++ b/lighter/models/account_trade_stats.py @@ -0,0 +1,114 @@ +# 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 +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self + +class AccountTradeStats(BaseModel): + """ + AccountTradeStats + """ # noqa: E501 + daily_trades_count: StrictInt + daily_volume: Union[StrictFloat, StrictInt] + weekly_trades_count: StrictInt + weekly_volume: Union[StrictFloat, StrictInt] + monthly_trades_count: StrictInt + monthly_volume: Union[StrictFloat, StrictInt] + total_trades_count: StrictInt + total_volume: Union[StrictFloat, StrictInt] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["daily_trades_count", "daily_volume", "weekly_trades_count", "weekly_volume", "monthly_trades_count", "monthly_volume", "total_trades_count", "total_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 AccountTradeStats 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 AccountTradeStats from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "daily_trades_count": obj.get("daily_trades_count"), + "daily_volume": obj.get("daily_volume"), + "weekly_trades_count": obj.get("weekly_trades_count"), + "weekly_volume": obj.get("weekly_volume"), + "monthly_trades_count": obj.get("monthly_trades_count"), + "monthly_volume": obj.get("monthly_volume"), + "total_trades_count": obj.get("total_trades_count"), + "total_volume": obj.get("total_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/lighter/models/announcement.py b/lighter/models/announcement.py new file mode 100644 index 0000000..cbccae5 --- /dev/null +++ b/lighter/models/announcement.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 +from typing import Optional, Set +from typing_extensions import Self + +class Announcement(BaseModel): + """ + Announcement + """ # noqa: E501 + title: StrictStr + content: StrictStr + created_at: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "content", "created_at"] + + 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 Announcement 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 Announcement from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "content": obj.get("content"), + "created_at": obj.get("created_at") + }) + # 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/announcements.py b/lighter/models/announcements.py new file mode 100644 index 0000000..d89894f --- /dev/null +++ b/lighter/models/announcements.py @@ -0,0 +1,112 @@ +# 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 lighter.models.announcement import Announcement +from typing import Optional, Set +from typing_extensions import Self + +class Announcements(BaseModel): + """ + Announcements + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + announcements: List[Announcement] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "announcements"] + + 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 Announcements 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 announcements (list) + _items = [] + if self.announcements: + for _item in self.announcements: + if _item: + _items.append(_item.to_dict()) + _dict['announcements'] = _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 Announcements from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "announcements": [Announcement.from_dict(_item) for _item in obj["announcements"]] if obj.get("announcements") 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/bridge_supported_network.py b/lighter/models/bridge_supported_network.py new file mode 100644 index 0000000..4e3533a --- /dev/null +++ b/lighter/models/bridge_supported_network.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, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class BridgeSupportedNetwork(BaseModel): + """ + BridgeSupportedNetwork + """ # noqa: E501 + name: StrictStr + chain_id: StrictStr + explorer: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name", "chain_id", "explorer"] + + 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 BridgeSupportedNetwork 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 BridgeSupportedNetwork from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "chain_id": obj.get("chain_id"), + "explorer": obj.get("explorer") + }) + # 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/contract_address.py b/lighter/models/contract_address.py new file mode 100644 index 0000000..768652e --- /dev/null +++ b/lighter/models/contract_address.py @@ -0,0 +1,102 @@ +# 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, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ContractAddress(BaseModel): + """ + ContractAddress + """ # noqa: E501 + name: StrictStr + address: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name", "address"] + + 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 ContractAddress 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 ContractAddress from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "address": obj.get("address") + }) + # 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/cursor.py b/lighter/models/cursor.py new file mode 100644 index 0000000..a1ca1ef --- /dev/null +++ b/lighter/models/cursor.py @@ -0,0 +1,100 @@ +# 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, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class Cursor(BaseModel): + """ + Cursor + """ # noqa: E501 + next_cursor: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["next_cursor"] + + 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 Cursor 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 Cursor from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "next_cursor": obj.get("next_cursor") + }) + # 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/detailed_account.py b/lighter/models/detailed_account.py index e9a05b2..56123c8 100644 --- a/lighter/models/detailed_account.py +++ b/lighter/models/detailed_account.py @@ -17,7 +17,7 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional from lighter.models.account_position import AccountPosition from lighter.models.public_pool_info import PublicPoolInfo @@ -39,17 +39,17 @@ class DetailedAccount(BaseModel): pending_order_count: StrictInt status: StrictInt collateral: StrictStr + account_index: StrictInt name: StrictStr description: StrictStr - can_invite: StrictBool - referral_points_percentage: StrictStr - max_referral_usage_limit: Optional[StrictInt] + can_invite: StrictBool = Field(description=" Remove After FE uses L1 meta endpoint") + referral_points_percentage: StrictStr = Field(description=" Remove After FE uses L1 meta endpoint") positions: List[AccountPosition] total_asset_value: StrictStr pool_info: PublicPoolInfo shares: List[PublicPoolShare] additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["code", "message", "account_type", "index", "l1_address", "cancel_all_time", "total_order_count", "pending_order_count", "status", "collateral", "name", "description", "can_invite", "referral_points_percentage", "max_referral_usage_limit", "positions", "total_asset_value", "pool_info", "shares"] + __properties: ClassVar[List[str]] = ["code", "message", "account_type", "index", "l1_address", "cancel_all_time", "total_order_count", "pending_order_count", "status", "collateral", "account_index", "name", "description", "can_invite", "referral_points_percentage", "positions", "total_asset_value", "pool_info", "shares"] model_config = ConfigDict( populate_by_name=True, @@ -136,11 +136,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "pending_order_count": obj.get("pending_order_count"), "status": obj.get("status"), "collateral": obj.get("collateral"), + "account_index": obj.get("account_index"), "name": obj.get("name"), "description": obj.get("description"), "can_invite": obj.get("can_invite"), "referral_points_percentage": obj.get("referral_points_percentage"), - "max_referral_usage_limit": obj.get("max_referral_usage_limit"), "positions": [AccountPosition.from_dict(_item) for _item in obj["positions"]] if obj.get("positions") is not None else None, "total_asset_value": obj.get("total_asset_value"), "pool_info": PublicPoolInfo.from_dict(obj["pool_info"]) if obj.get("pool_info") is not None else None, diff --git a/lighter/models/detailed_candlestick.py b/lighter/models/detailed_candlestick.py new file mode 100644 index 0000000..36a84ca --- /dev/null +++ b/lighter/models/detailed_candlestick.py @@ -0,0 +1,116 @@ +# 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 +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self + +class DetailedCandlestick(BaseModel): + """ + DetailedCandlestick + """ # noqa: E501 + timestamp: StrictInt + open: Union[StrictFloat, StrictInt] + high: Union[StrictFloat, StrictInt] + low: Union[StrictFloat, StrictInt] + close: Union[StrictFloat, StrictInt] + volume0: Union[StrictFloat, StrictInt] + volume1: Union[StrictFloat, StrictInt] + last_trade_id: StrictInt + trade_count: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["timestamp", "open", "high", "low", "close", "volume0", "volume1", "last_trade_id", "trade_count"] + + 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 DetailedCandlestick 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 DetailedCandlestick from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "timestamp": obj.get("timestamp"), + "open": obj.get("open"), + "high": obj.get("high"), + "low": obj.get("low"), + "close": obj.get("close"), + "volume0": obj.get("volume0"), + "volume1": obj.get("volume1"), + "last_trade_id": obj.get("last_trade_id"), + "trade_count": obj.get("trade_count") + }) + # 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/export_data.py b/lighter/models/export_data.py new file mode 100644 index 0000000..4e712d8 --- /dev/null +++ b/lighter/models/export_data.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 ExportData(BaseModel): + """ + ExportData + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + data_url: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "data_url"] + + 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 ExportData 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 ExportData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "data_url": obj.get("data_url") + }) + # 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/funding_rate.py b/lighter/models/funding_rate.py new file mode 100644 index 0000000..ff591b1 --- /dev/null +++ b/lighter/models/funding_rate.py @@ -0,0 +1,113 @@ +# 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, field_validator +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self + +class FundingRate(BaseModel): + """ + FundingRate + """ # noqa: E501 + market_id: StrictInt + exchange: StrictStr + symbol: StrictStr + rate: Union[StrictFloat, StrictInt] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["market_id", "exchange", "symbol", "rate"] + + @field_validator('exchange') + def exchange_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['binance', 'bybit', 'hyperliquid', 'lighter']): + raise ValueError("must be one of enum values ('binance', 'bybit', 'hyperliquid', 'lighter')") + return value + + 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 FundingRate 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 FundingRate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "market_id": obj.get("market_id"), + "exchange": obj.get("exchange"), + "symbol": obj.get("symbol"), + "rate": obj.get("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/funding_rates.py b/lighter/models/funding_rates.py new file mode 100644 index 0000000..90e062b --- /dev/null +++ b/lighter/models/funding_rates.py @@ -0,0 +1,112 @@ +# 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 lighter.models.funding_rate import FundingRate +from typing import Optional, Set +from typing_extensions import Self + +class FundingRates(BaseModel): + """ + FundingRates + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + funding_rates: List[FundingRate] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "funding_rates"] + + 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 FundingRates 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 funding_rates (list) + _items = [] + if self.funding_rates: + for _item in self.funding_rates: + if _item: + _items.append(_item.to_dict()) + _dict['funding_rates'] = _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 FundingRates from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "funding_rates": [FundingRate.from_dict(_item) for _item in obj["funding_rates"]] if obj.get("funding_rates") 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/l1_metadata.py b/lighter/models/l1_metadata.py new file mode 100644 index 0000000..19f653b --- /dev/null +++ b/lighter/models/l1_metadata.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, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class L1Metadata(BaseModel): + """ + L1Metadata + """ # noqa: E501 + l1_address: StrictStr + can_invite: StrictBool + referral_points_percentage: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["l1_address", "can_invite", "referral_points_percentage"] + + 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 L1Metadata 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 L1Metadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "l1_address": obj.get("l1_address"), + "can_invite": obj.get("can_invite"), + "referral_points_percentage": obj.get("referral_points_percentage") + }) + # 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/l1_provider_info.py b/lighter/models/l1_provider_info.py new file mode 100644 index 0000000..41e5a3b --- /dev/null +++ b/lighter/models/l1_provider_info.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, Field, StrictInt +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class L1ProviderInfo(BaseModel): + """ + L1ProviderInfo + """ # noqa: E501 + chain_id: StrictInt = Field(alias="chainId") + network_id: StrictInt = Field(alias="networkId") + latest_block_number: StrictInt = Field(alias="latestBlockNumber") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["chainId", "networkId", "latestBlockNumber"] + + 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 L1ProviderInfo 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 L1ProviderInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "chainId": obj.get("chainId"), + "networkId": obj.get("networkId"), + "latestBlockNumber": obj.get("latestBlockNumber") + }) + # 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/liq_trade.py b/lighter/models/liq_trade.py new file mode 100644 index 0000000..276042e --- /dev/null +++ b/lighter/models/liq_trade.py @@ -0,0 +1,106 @@ +# 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, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class LiqTrade(BaseModel): + """ + LiqTrade + """ # noqa: E501 + price: StrictStr + size: StrictStr + taker_fee: StrictStr + maker_fee: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["price", "size", "taker_fee", "maker_fee"] + + 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 LiqTrade 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 LiqTrade from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "price": obj.get("price"), + "size": obj.get("size"), + "taker_fee": obj.get("taker_fee"), + "maker_fee": obj.get("maker_fee") + }) + # 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/liquidation.py b/lighter/models/liquidation.py new file mode 100644 index 0000000..aa012a4 --- /dev/null +++ b/lighter/models/liquidation.py @@ -0,0 +1,125 @@ +# 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, field_validator +from typing import Any, ClassVar, Dict, List +from lighter.models.liq_trade import LiqTrade +from lighter.models.liquidation_info import LiquidationInfo +from typing import Optional, Set +from typing_extensions import Self + +class Liquidation(BaseModel): + """ + Liquidation + """ # noqa: E501 + id: StrictInt + market_id: StrictInt + type: StrictStr + trade: LiqTrade + info: LiquidationInfo + executed_at: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "market_id", "type", "trade", "info", "executed_at"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['partial', 'deleverage']): + raise ValueError("must be one of enum values ('partial', 'deleverage')") + return value + + 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 Liquidation 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 trade + if self.trade: + _dict['trade'] = self.trade.to_dict() + # override the default output from pydantic by calling `to_dict()` of info + if self.info: + _dict['info'] = self.info.to_dict() + # 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 Liquidation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "market_id": obj.get("market_id"), + "type": obj.get("type"), + "trade": LiqTrade.from_dict(obj["trade"]) if obj.get("trade") is not None else None, + "info": LiquidationInfo.from_dict(obj["info"]) if obj.get("info") is not None else None, + "executed_at": obj.get("executed_at") + }) + # 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/liquidation_info.py b/lighter/models/liquidation_info.py new file mode 100644 index 0000000..91519d1 --- /dev/null +++ b/lighter/models/liquidation_info.py @@ -0,0 +1,121 @@ +# 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 +from typing import Any, ClassVar, Dict, List, Union +from lighter.models.account_position import AccountPosition +from lighter.models.risk_info import RiskInfo +from typing import Optional, Set +from typing_extensions import Self + +class LiquidationInfo(BaseModel): + """ + LiquidationInfo + """ # noqa: E501 + positions: List[AccountPosition] + risk_info_before: RiskInfo + risk_info_after: RiskInfo + mark_prices: Dict[str, Union[StrictFloat, StrictInt]] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["positions", "risk_info_before", "risk_info_after", "mark_prices"] + + 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 LiquidationInfo 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 positions (list) + _items = [] + if self.positions: + for _item in self.positions: + if _item: + _items.append(_item.to_dict()) + _dict['positions'] = _items + # override the default output from pydantic by calling `to_dict()` of risk_info_before + if self.risk_info_before: + _dict['risk_info_before'] = self.risk_info_before.to_dict() + # override the default output from pydantic by calling `to_dict()` of risk_info_after + if self.risk_info_after: + _dict['risk_info_after'] = self.risk_info_after.to_dict() + # 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 LiquidationInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "positions": [AccountPosition.from_dict(_item) for _item in obj["positions"]] if obj.get("positions") is not None else None, + "risk_info_before": RiskInfo.from_dict(obj["risk_info_before"]) if obj.get("risk_info_before") is not None else None, + "risk_info_after": RiskInfo.from_dict(obj["risk_info_after"]) if obj.get("risk_info_after") is not None else None, + "mark_prices": obj.get("mark_prices") + }) + # 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/liquidation_infos.py b/lighter/models/liquidation_infos.py new file mode 100644 index 0000000..9d633d7 --- /dev/null +++ b/lighter/models/liquidation_infos.py @@ -0,0 +1,114 @@ +# 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 lighter.models.liquidation import Liquidation +from typing import Optional, Set +from typing_extensions import Self + +class LiquidationInfos(BaseModel): + """ + LiquidationInfos + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + liquidations: List[Liquidation] + next_cursor: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "liquidations", "next_cursor"] + + 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 LiquidationInfos 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 liquidations (list) + _items = [] + if self.liquidations: + for _item in self.liquidations: + if _item: + _items.append(_item.to_dict()) + _dict['liquidations'] = _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 LiquidationInfos from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "liquidations": [Liquidation.from_dict(_item) for _item in obj["liquidations"]] if obj.get("liquidations") is not None else None, + "next_cursor": obj.get("next_cursor") + }) + # 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/market_info.py b/lighter/models/market_info.py new file mode 100644 index 0000000..c836971 --- /dev/null +++ b/lighter/models/market_info.py @@ -0,0 +1,124 @@ +# 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 MarketInfo(BaseModel): + """ + MarketInfo + """ # noqa: E501 + market_id: StrictInt + index_price: StrictStr + mark_price: StrictStr + open_interest: StrictStr + last_trade_price: StrictStr + current_funding_rate: StrictStr + funding_rate: StrictStr + funding_timestamp: StrictInt + daily_base_token_volume: Union[StrictFloat, StrictInt] + daily_quote_token_volume: Union[StrictFloat, StrictInt] + daily_price_low: Union[StrictFloat, StrictInt] + daily_price_high: Union[StrictFloat, StrictInt] + daily_price_change: Union[StrictFloat, StrictInt] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["market_id", "index_price", "mark_price", "open_interest", "last_trade_price", "current_funding_rate", "funding_rate", "funding_timestamp", "daily_base_token_volume", "daily_quote_token_volume", "daily_price_low", "daily_price_high", "daily_price_change"] + + 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 MarketInfo 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 MarketInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "market_id": obj.get("market_id"), + "index_price": obj.get("index_price"), + "mark_price": obj.get("mark_price"), + "open_interest": obj.get("open_interest"), + "last_trade_price": obj.get("last_trade_price"), + "current_funding_rate": obj.get("current_funding_rate"), + "funding_rate": obj.get("funding_rate"), + "funding_timestamp": obj.get("funding_timestamp"), + "daily_base_token_volume": obj.get("daily_base_token_volume"), + "daily_quote_token_volume": obj.get("daily_quote_token_volume"), + "daily_price_low": obj.get("daily_price_low"), + "daily_price_high": obj.get("daily_price_high"), + "daily_price_change": obj.get("daily_price_change") + }) + # 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/order_book_orders.py b/lighter/models/order_book_depth.py similarity index 81% rename from lighter/models/order_book_orders.py rename to lighter/models/order_book_depth.py index 549d79c..214d798 100644 --- a/lighter/models/order_book_orders.py +++ b/lighter/models/order_book_depth.py @@ -19,22 +19,21 @@ from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from lighter.models.simple_order import SimpleOrder +from lighter.models.price_level import PriceLevel from typing import Optional, Set from typing_extensions import Self -class OrderBookOrders(BaseModel): +class OrderBookDepth(BaseModel): """ - OrderBookOrders + OrderBookDepth """ # noqa: E501 code: StrictInt message: Optional[StrictStr] = None - total_asks: StrictInt - asks: List[SimpleOrder] - total_bids: StrictInt - bids: List[SimpleOrder] + asks: List[PriceLevel] + bids: List[PriceLevel] + offset: StrictInt additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["code", "message", "total_asks", "asks", "total_bids", "bids"] + __properties: ClassVar[List[str]] = ["code", "message", "asks", "bids", "offset"] model_config = ConfigDict( populate_by_name=True, @@ -54,7 +53,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of OrderBookOrders from a JSON string""" + """Create an instance of OrderBookDepth from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -100,7 +99,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of OrderBookOrders from a dict""" + """Create an instance of OrderBookDepth from a dict""" if obj is None: return None @@ -110,10 +109,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), - "total_asks": obj.get("total_asks"), - "asks": [SimpleOrder.from_dict(_item) for _item in obj["asks"]] if obj.get("asks") is not None else None, - "total_bids": obj.get("total_bids"), - "bids": [SimpleOrder.from_dict(_item) for _item in obj["bids"]] if obj.get("bids") is not None else None + "asks": [PriceLevel.from_dict(_item) for _item in obj["asks"]] if obj.get("asks") is not None else None, + "bids": [PriceLevel.from_dict(_item) for _item in obj["bids"]] if obj.get("bids") is not None else None, + "offset": obj.get("offset") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/pn_l_entry.py b/lighter/models/pn_l_entry.py index e0b53fc..67b5b99 100644 --- a/lighter/models/pn_l_entry.py +++ b/lighter/models/pn_l_entry.py @@ -27,13 +27,14 @@ class PnLEntry(BaseModel): PnLEntry """ # noqa: E501 timestamp: StrictInt - value: Union[StrictFloat, StrictInt] trade_pnl: Union[StrictFloat, StrictInt] - pool_pnl: Union[StrictFloat, StrictInt] inflow: Union[StrictFloat, StrictInt] outflow: Union[StrictFloat, StrictInt] + pool_pnl: Union[StrictFloat, StrictInt] + pool_inflow: Union[StrictFloat, StrictInt] + pool_outflow: Union[StrictFloat, StrictInt] additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["timestamp", "value", "trade_pnl", "pool_pnl", "inflow", "outflow"] + __properties: ClassVar[List[str]] = ["timestamp", "trade_pnl", "inflow", "outflow", "pool_pnl", "pool_inflow", "pool_outflow"] model_config = ConfigDict( populate_by_name=True, @@ -94,11 +95,12 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "timestamp": obj.get("timestamp"), - "value": obj.get("value"), "trade_pnl": obj.get("trade_pnl"), - "pool_pnl": obj.get("pool_pnl"), "inflow": obj.get("inflow"), - "outflow": obj.get("outflow") + "outflow": obj.get("outflow"), + "pool_pnl": obj.get("pool_pnl"), + "pool_inflow": obj.get("pool_inflow"), + "pool_outflow": obj.get("pool_outflow") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/position_funding.py b/lighter/models/position_funding.py new file mode 100644 index 0000000..1fee27f --- /dev/null +++ b/lighter/models/position_funding.py @@ -0,0 +1,119 @@ +# 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, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class PositionFunding(BaseModel): + """ + PositionFunding + """ # noqa: E501 + timestamp: StrictInt + market_id: StrictInt + funding_id: StrictInt + change: StrictStr + rate: StrictStr + position_size: StrictStr + position_side: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["timestamp", "market_id", "funding_id", "change", "rate", "position_size", "position_side"] + + @field_validator('position_side') + def position_side_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['long', 'short']): + raise ValueError("must be one of enum values ('long', 'short')") + return value + + 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 PositionFunding 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 PositionFunding from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "timestamp": obj.get("timestamp"), + "market_id": obj.get("market_id"), + "funding_id": obj.get("funding_id"), + "change": obj.get("change"), + "rate": obj.get("rate"), + "position_size": obj.get("position_size"), + "position_side": obj.get("position_side") + }) + # 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/position_fundings.py b/lighter/models/position_fundings.py new file mode 100644 index 0000000..fcd8677 --- /dev/null +++ b/lighter/models/position_fundings.py @@ -0,0 +1,114 @@ +# 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 lighter.models.position_funding import PositionFunding +from typing import Optional, Set +from typing_extensions import Self + +class PositionFundings(BaseModel): + """ + PositionFundings + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + position_fundings: List[PositionFunding] + next_cursor: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "position_fundings", "next_cursor"] + + 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 PositionFundings 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 position_fundings (list) + _items = [] + if self.position_fundings: + for _item in self.position_fundings: + if _item: + _items.append(_item.to_dict()) + _dict['position_fundings'] = _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 PositionFundings from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "position_fundings": [PositionFunding.from_dict(_item) for _item in obj["position_fundings"]] if obj.get("position_fundings") is not None else None, + "next_cursor": obj.get("next_cursor") + }) + # 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/price_level.py b/lighter/models/price_level.py new file mode 100644 index 0000000..dc5b081 --- /dev/null +++ b/lighter/models/price_level.py @@ -0,0 +1,102 @@ +# 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, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class PriceLevel(BaseModel): + """ + PriceLevel + """ # noqa: E501 + price: StrictStr + size: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["price", "size"] + + 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 PriceLevel 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 PriceLevel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "price": obj.get("price"), + "size": obj.get("size") + }) + # 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/public_pool.py b/lighter/models/public_pool.py index 7f8630b..0c32351 100644 --- a/lighter/models/public_pool.py +++ b/lighter/models/public_pool.py @@ -17,7 +17,7 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional from lighter.models.public_pool_info import PublicPoolInfo from lighter.models.public_pool_share import PublicPoolShare @@ -38,16 +38,16 @@ class PublicPool(BaseModel): pending_order_count: StrictInt status: StrictInt collateral: StrictStr + account_index: StrictInt name: StrictStr description: StrictStr - can_invite: StrictBool - referral_points_percentage: StrictStr - max_referral_usage_limit: Optional[StrictInt] + can_invite: StrictBool = Field(description=" Remove After FE uses L1 meta endpoint") + referral_points_percentage: StrictStr = Field(description=" Remove After FE uses L1 meta endpoint") total_asset_value: StrictStr pool_info: PublicPoolInfo account_share: Optional[PublicPoolShare] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["code", "message", "account_type", "index", "l1_address", "cancel_all_time", "total_order_count", "pending_order_count", "status", "collateral", "name", "description", "can_invite", "referral_points_percentage", "max_referral_usage_limit", "total_asset_value", "pool_info", "account_share"] + __properties: ClassVar[List[str]] = ["code", "message", "account_type", "index", "l1_address", "cancel_all_time", "total_order_count", "pending_order_count", "status", "collateral", "account_index", "name", "description", "can_invite", "referral_points_percentage", "total_asset_value", "pool_info", "account_share"] model_config = ConfigDict( populate_by_name=True, @@ -123,11 +123,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "pending_order_count": obj.get("pending_order_count"), "status": obj.get("status"), "collateral": obj.get("collateral"), + "account_index": obj.get("account_index"), "name": obj.get("name"), "description": obj.get("description"), "can_invite": obj.get("can_invite"), "referral_points_percentage": obj.get("referral_points_percentage"), - "max_referral_usage_limit": obj.get("max_referral_usage_limit"), "total_asset_value": obj.get("total_asset_value"), "pool_info": PublicPoolInfo.from_dict(obj["pool_info"]) if obj.get("pool_info") is not None else None, "account_share": PublicPoolShare.from_dict(obj["account_share"]) if obj.get("account_share") is not None else None diff --git a/lighter/models/referral_point_entry.py b/lighter/models/referral_point_entry.py new file mode 100644 index 0000000..fdce287 --- /dev/null +++ b/lighter/models/referral_point_entry.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 ReferralPointEntry(BaseModel): + """ + ReferralPointEntry + """ # noqa: E501 + l1_address: StrictStr + total_points: StrictInt + week_points: StrictInt + total_reward_points: StrictInt + week_reward_points: StrictInt + reward_point_multiplier: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["l1_address", "total_points", "week_points", "total_reward_points", "week_reward_points", "reward_point_multiplier"] + + 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 ReferralPointEntry 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 ReferralPointEntry from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "l1_address": obj.get("l1_address"), + "total_points": obj.get("total_points"), + "week_points": obj.get("week_points"), + "total_reward_points": obj.get("total_reward_points"), + "week_reward_points": obj.get("week_reward_points"), + "reward_point_multiplier": obj.get("reward_point_multiplier") + }) + # 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/referral_points.py b/lighter/models/referral_points.py new file mode 100644 index 0000000..5a162dc --- /dev/null +++ b/lighter/models/referral_points.py @@ -0,0 +1,118 @@ +# 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 lighter.models.referral_point_entry import ReferralPointEntry +from typing import Optional, Set +from typing_extensions import Self + +class ReferralPoints(BaseModel): + """ + ReferralPoints + """ # noqa: E501 + referrals: List[ReferralPointEntry] + user_total_points: StrictInt + user_last_week_points: StrictInt + user_total_referral_reward_points: StrictInt + user_last_week_referral_reward_points: StrictInt + reward_point_multiplier: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["referrals", "user_total_points", "user_last_week_points", "user_total_referral_reward_points", "user_last_week_referral_reward_points", "reward_point_multiplier"] + + 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 ReferralPoints 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 referrals (list) + _items = [] + if self.referrals: + for _item in self.referrals: + if _item: + _items.append(_item.to_dict()) + _dict['referrals'] = _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 ReferralPoints from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "referrals": [ReferralPointEntry.from_dict(_item) for _item in obj["referrals"]] if obj.get("referrals") is not None else None, + "user_total_points": obj.get("user_total_points"), + "user_last_week_points": obj.get("user_last_week_points"), + "user_total_referral_reward_points": obj.get("user_total_referral_reward_points"), + "user_last_week_referral_reward_points": obj.get("user_last_week_referral_reward_points"), + "reward_point_multiplier": obj.get("reward_point_multiplier") + }) + # 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/req_export_data.py b/lighter/models/req_export_data.py new file mode 100644 index 0000000..d82b64e --- /dev/null +++ b/lighter/models/req_export_data.py @@ -0,0 +1,113 @@ +# 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, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqExportData(BaseModel): + """ + ReqExportData + """ # noqa: E501 + auth: Optional[StrictStr] = None + account_index: Optional[StrictInt] = -1 + market_id: Optional[StrictInt] = None + type: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["auth", "account_index", "market_id", "type"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['funding', 'trade']): + raise ValueError("must be one of enum values ('funding', 'trade')") + return value + + 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 ReqExportData 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 ReqExportData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "auth": obj.get("auth"), + "account_index": obj.get("account_index") if obj.get("account_index") is not None else -1, + "market_id": obj.get("market_id"), + "type": obj.get("type") + }) + # 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/req_get_account.py b/lighter/models/req_get_account.py new file mode 100644 index 0000000..c6108e6 --- /dev/null +++ b/lighter/models/req_get_account.py @@ -0,0 +1,109 @@ +# 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetAccount(BaseModel): + """ + ReqGetAccount + """ # noqa: E501 + by: StrictStr + value: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["by", "value"] + + @field_validator('by') + def by_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['index', 'l1_address']): + raise ValueError("must be one of enum values ('index', 'l1_address')") + return value + + 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 ReqGetAccount 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 ReqGetAccount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "by": obj.get("by"), + "value": obj.get("value") + }) + # 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/req_get_account_api_keys.py b/lighter/models/req_get_account_api_keys.py new file mode 100644 index 0000000..2a395ad --- /dev/null +++ b/lighter/models/req_get_account_api_keys.py @@ -0,0 +1,102 @@ +# 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetAccountApiKeys(BaseModel): + """ + ReqGetAccountApiKeys + """ # noqa: E501 + account_index: StrictInt + api_key_index: Optional[StrictInt] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["account_index", "api_key_index"] + + 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 ReqGetAccountApiKeys 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 ReqGetAccountApiKeys from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "account_index": obj.get("account_index"), + "api_key_index": obj.get("api_key_index") + }) + # 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/req_get_account_by_l1_address.py b/lighter/models/req_get_account_by_l1_address.py new file mode 100644 index 0000000..a0b86eb --- /dev/null +++ b/lighter/models/req_get_account_by_l1_address.py @@ -0,0 +1,100 @@ +# 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, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetAccountByL1Address(BaseModel): + """ + ReqGetAccountByL1Address + """ # noqa: E501 + l1_address: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["l1_address"] + + 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 ReqGetAccountByL1Address 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 ReqGetAccountByL1Address from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "l1_address": obj.get("l1_address") + }) + # 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/req_get_account_inactive_orders.py b/lighter/models/req_get_account_inactive_orders.py new file mode 100644 index 0000000..9ea9b18 --- /dev/null +++ b/lighter/models/req_get_account_inactive_orders.py @@ -0,0 +1,113 @@ +# 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, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetAccountInactiveOrders(BaseModel): + """ + ReqGetAccountInactiveOrders + """ # noqa: E501 + auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") + account_index: StrictInt + market_id: Optional[StrictInt] = None + ask_filter: Optional[StrictInt] = None + between_timestamps: Optional[StrictStr] = None + cursor: Optional[StrictStr] = None + limit: Annotated[int, Field(le=100, strict=True, ge=1)] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["auth", "account_index", "market_id", "ask_filter", "between_timestamps", "cursor", "limit"] + + 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 ReqGetAccountInactiveOrders 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 ReqGetAccountInactiveOrders from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "auth": obj.get("auth"), + "account_index": obj.get("account_index"), + "market_id": obj.get("market_id"), + "ask_filter": obj.get("ask_filter"), + "between_timestamps": obj.get("between_timestamps"), + "cursor": obj.get("cursor"), + "limit": obj.get("limit") + }) + # 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/req_get_account_limits.py b/lighter/models/req_get_account_limits.py new file mode 100644 index 0000000..206f876 --- /dev/null +++ b/lighter/models/req_get_account_limits.py @@ -0,0 +1,102 @@ +# 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, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetAccountLimits(BaseModel): + """ + ReqGetAccountLimits + """ # noqa: E501 + account_index: StrictInt + auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["account_index", "auth"] + + 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 ReqGetAccountLimits 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 ReqGetAccountLimits from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "account_index": obj.get("account_index"), + "auth": obj.get("auth") + }) + # 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/req_get_account_metadata.py b/lighter/models/req_get_account_metadata.py new file mode 100644 index 0000000..4403e9d --- /dev/null +++ b/lighter/models/req_get_account_metadata.py @@ -0,0 +1,111 @@ +# 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetAccountMetadata(BaseModel): + """ + ReqGetAccountMetadata + """ # noqa: E501 + by: StrictStr + value: StrictStr + auth: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["by", "value", "auth"] + + @field_validator('by') + def by_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['index', 'l1_address']): + raise ValueError("must be one of enum values ('index', 'l1_address')") + return value + + 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 ReqGetAccountMetadata 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 ReqGetAccountMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "by": obj.get("by"), + "value": obj.get("value"), + "auth": obj.get("auth") + }) + # 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/req_get_account_pending_txs.py b/lighter/models/req_get_account_pending_txs.py new file mode 100644 index 0000000..9f0f878 --- /dev/null +++ b/lighter/models/req_get_account_pending_txs.py @@ -0,0 +1,114 @@ +# 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, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetAccountPendingTxs(BaseModel): + """ + ReqGetAccountPendingTxs + """ # noqa: E501 + by: Optional[StrictStr] = None + value: Optional[StrictStr] = None + types: Optional[List[StrictInt]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["by", "value", "types"] + + @field_validator('by') + def by_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['account_index']): + raise ValueError("must be one of enum values ('account_index')") + return value + + 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 ReqGetAccountPendingTxs 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 ReqGetAccountPendingTxs from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "by": obj.get("by"), + "value": obj.get("value"), + "types": obj.get("types") + }) + # 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/req_get_account_pn_l.py b/lighter/models/req_get_account_pn_l.py new file mode 100644 index 0000000..034022c --- /dev/null +++ b/lighter/models/req_get_account_pn_l.py @@ -0,0 +1,129 @@ +# 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, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetAccountPnL(BaseModel): + """ + ReqGetAccountPnL + """ # noqa: E501 + auth: Optional[StrictStr] = None + by: StrictStr + value: StrictStr + resolution: StrictStr + start_timestamp: Annotated[int, Field(le=5000000000000, strict=True)] + end_timestamp: Annotated[int, Field(le=5000000000000, strict=True)] + count_back: StrictInt + ignore_transfers: Optional[StrictBool] = False + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["auth", "by", "value", "resolution", "start_timestamp", "end_timestamp", "count_back", "ignore_transfers"] + + @field_validator('by') + def by_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['index']): + raise ValueError("must be one of enum values ('index')") + return value + + @field_validator('resolution') + def resolution_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['1m', '5m', '15m', '1h', '4h', '1d']): + raise ValueError("must be one of enum values ('1m', '5m', '15m', '1h', '4h', '1d')") + return value + + 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 ReqGetAccountPnL 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 ReqGetAccountPnL from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "auth": obj.get("auth"), + "by": obj.get("by"), + "value": obj.get("value"), + "resolution": obj.get("resolution"), + "start_timestamp": obj.get("start_timestamp"), + "end_timestamp": obj.get("end_timestamp"), + "count_back": obj.get("count_back"), + "ignore_transfers": obj.get("ignore_transfers") if obj.get("ignore_transfers") is not None else False + }) + # 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/req_get_account_txs.py b/lighter/models/req_get_account_txs.py new file mode 100644 index 0000000..c83d7ae --- /dev/null +++ b/lighter/models/req_get_account_txs.py @@ -0,0 +1,119 @@ +# 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, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetAccountTxs(BaseModel): + """ + ReqGetAccountTxs + """ # noqa: E501 + index: Optional[StrictInt] = None + limit: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = None + by: Optional[StrictStr] = None + value: Optional[StrictStr] = None + types: Optional[List[StrictInt]] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["index", "limit", "by", "value", "types"] + + @field_validator('by') + def by_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['account_index']): + raise ValueError("must be one of enum values ('account_index')") + return value + + 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 ReqGetAccountTxs 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 ReqGetAccountTxs from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "index": obj.get("index"), + "limit": obj.get("limit"), + "by": obj.get("by"), + "value": obj.get("value"), + "types": obj.get("types") + }) + # 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/req_get_block.py b/lighter/models/req_get_block.py new file mode 100644 index 0000000..574e2c7 --- /dev/null +++ b/lighter/models/req_get_block.py @@ -0,0 +1,109 @@ +# 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetBlock(BaseModel): + """ + ReqGetBlock + """ # noqa: E501 + by: StrictStr + value: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["by", "value"] + + @field_validator('by') + def by_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['commitment', 'height']): + raise ValueError("must be one of enum values ('commitment', 'height')") + return value + + 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 ReqGetBlock 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 ReqGetBlock from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "by": obj.get("by"), + "value": obj.get("value") + }) + # 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/req_get_block_txs.py b/lighter/models/req_get_block_txs.py new file mode 100644 index 0000000..b040c5e --- /dev/null +++ b/lighter/models/req_get_block_txs.py @@ -0,0 +1,109 @@ +# 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetBlockTxs(BaseModel): + """ + ReqGetBlockTxs + """ # noqa: E501 + by: StrictStr + value: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["by", "value"] + + @field_validator('by') + def by_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['block_height', 'block_commitment']): + raise ValueError("must be one of enum values ('block_height', 'block_commitment')") + return value + + 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 ReqGetBlockTxs 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 ReqGetBlockTxs from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "by": obj.get("by"), + "value": obj.get("value") + }) + # 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/req_get_by_account.py b/lighter/models/req_get_by_account.py new file mode 100644 index 0000000..9e52c14 --- /dev/null +++ b/lighter/models/req_get_by_account.py @@ -0,0 +1,109 @@ +# 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetByAccount(BaseModel): + """ + ReqGetByAccount + """ # noqa: E501 + by: StrictStr + value: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["by", "value"] + + @field_validator('by') + def by_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['account_index']): + raise ValueError("must be one of enum values ('account_index')") + return value + + 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 ReqGetByAccount 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 ReqGetByAccount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "by": obj.get("by"), + "value": obj.get("value") + }) + # 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/req_get_candlesticks.py b/lighter/models/req_get_candlesticks.py new file mode 100644 index 0000000..0fc9642 --- /dev/null +++ b/lighter/models/req_get_candlesticks.py @@ -0,0 +1,118 @@ +# 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, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetCandlesticks(BaseModel): + """ + ReqGetCandlesticks + """ # noqa: E501 + market_id: StrictInt + resolution: StrictStr + start_timestamp: Annotated[int, Field(le=5000000000000, strict=True)] + end_timestamp: Annotated[int, Field(le=5000000000000, strict=True)] + count_back: StrictInt + set_timestamp_to_end: Optional[StrictBool] = False + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["market_id", "resolution", "start_timestamp", "end_timestamp", "count_back", "set_timestamp_to_end"] + + @field_validator('resolution') + def resolution_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['1m', '5m', '15m', '1h', '4h', '1d']): + raise ValueError("must be one of enum values ('1m', '5m', '15m', '1h', '4h', '1d')") + return value + + 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 ReqGetCandlesticks 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 ReqGetCandlesticks from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "market_id": obj.get("market_id"), + "resolution": obj.get("resolution"), + "start_timestamp": obj.get("start_timestamp"), + "end_timestamp": obj.get("end_timestamp"), + "count_back": obj.get("count_back"), + "set_timestamp_to_end": obj.get("set_timestamp_to_end") if obj.get("set_timestamp_to_end") is not None else False + }) + # 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/req_get_deposit_history.py b/lighter/models/req_get_deposit_history.py new file mode 100644 index 0000000..b51846c --- /dev/null +++ b/lighter/models/req_get_deposit_history.py @@ -0,0 +1,118 @@ +# 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, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetDepositHistory(BaseModel): + """ + ReqGetDepositHistory + """ # noqa: E501 + account_index: StrictInt + auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") + l1_address: StrictStr + cursor: Optional[StrictStr] = None + filter: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["account_index", "auth", "l1_address", "cursor", "filter"] + + @field_validator('filter') + def filter_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['all', 'pending', 'claimable']): + raise ValueError("must be one of enum values ('all', 'pending', 'claimable')") + return value + + 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 ReqGetDepositHistory 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 ReqGetDepositHistory from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "account_index": obj.get("account_index"), + "auth": obj.get("auth"), + "l1_address": obj.get("l1_address"), + "cursor": obj.get("cursor"), + "filter": obj.get("filter") + }) + # 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/req_get_fast_withdraw_info.py b/lighter/models/req_get_fast_withdraw_info.py new file mode 100644 index 0000000..bced0a8 --- /dev/null +++ b/lighter/models/req_get_fast_withdraw_info.py @@ -0,0 +1,102 @@ +# 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, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetFastWithdrawInfo(BaseModel): + """ + ReqGetFastWithdrawInfo + """ # noqa: E501 + account_index: StrictInt + auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["account_index", "auth"] + + 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 ReqGetFastWithdrawInfo 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 ReqGetFastWithdrawInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "account_index": obj.get("account_index"), + "auth": obj.get("auth") + }) + # 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/req_get_fundings.py b/lighter/models/req_get_fundings.py new file mode 100644 index 0000000..f694ed6 --- /dev/null +++ b/lighter/models/req_get_fundings.py @@ -0,0 +1,116 @@ +# 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, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetFundings(BaseModel): + """ + ReqGetFundings + """ # noqa: E501 + market_id: StrictInt + resolution: StrictStr + start_timestamp: Annotated[int, Field(le=5000000000000, strict=True)] + end_timestamp: Annotated[int, Field(le=5000000000000, strict=True)] + count_back: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["market_id", "resolution", "start_timestamp", "end_timestamp", "count_back"] + + @field_validator('resolution') + def resolution_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['1h']): + raise ValueError("must be one of enum values ('1h')") + return value + + 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 ReqGetFundings 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 ReqGetFundings from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "market_id": obj.get("market_id"), + "resolution": obj.get("resolution"), + "start_timestamp": obj.get("start_timestamp"), + "end_timestamp": obj.get("end_timestamp"), + "count_back": obj.get("count_back") + }) + # 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/req_get_l1_metadata.py b/lighter/models/req_get_l1_metadata.py new file mode 100644 index 0000000..0ce494a --- /dev/null +++ b/lighter/models/req_get_l1_metadata.py @@ -0,0 +1,102 @@ +# 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, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetL1Metadata(BaseModel): + """ + ReqGetL1Metadata + """ # noqa: E501 + auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") + l1_address: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["auth", "l1_address"] + + 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 ReqGetL1Metadata 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 ReqGetL1Metadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "auth": obj.get("auth"), + "l1_address": obj.get("l1_address") + }) + # 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/req_get_l1_tx.py b/lighter/models/req_get_l1_tx.py new file mode 100644 index 0000000..dda8501 --- /dev/null +++ b/lighter/models/req_get_l1_tx.py @@ -0,0 +1,100 @@ +# 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, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetL1Tx(BaseModel): + """ + ReqGetL1Tx + """ # noqa: E501 + hash: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["hash"] + + 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 ReqGetL1Tx 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 ReqGetL1Tx from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "hash": obj.get("hash") + }) + # 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/req_get_latest_deposit.py b/lighter/models/req_get_latest_deposit.py new file mode 100644 index 0000000..6ce2506 --- /dev/null +++ b/lighter/models/req_get_latest_deposit.py @@ -0,0 +1,100 @@ +# 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, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetLatestDeposit(BaseModel): + """ + ReqGetLatestDeposit + """ # noqa: E501 + l1_address: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["l1_address"] + + 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 ReqGetLatestDeposit 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 ReqGetLatestDeposit from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "l1_address": obj.get("l1_address") + }) + # 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/req_get_liquidation_infos.py b/lighter/models/req_get_liquidation_infos.py new file mode 100644 index 0000000..16701b7 --- /dev/null +++ b/lighter/models/req_get_liquidation_infos.py @@ -0,0 +1,109 @@ +# 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, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetLiquidationInfos(BaseModel): + """ + ReqGetLiquidationInfos + """ # noqa: E501 + auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") + account_index: StrictInt + market_id: Optional[StrictInt] = None + cursor: Optional[StrictStr] = None + limit: Annotated[int, Field(le=100, strict=True, ge=1)] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["auth", "account_index", "market_id", "cursor", "limit"] + + 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 ReqGetLiquidationInfos 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 ReqGetLiquidationInfos from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "auth": obj.get("auth"), + "account_index": obj.get("account_index"), + "market_id": obj.get("market_id"), + "cursor": obj.get("cursor"), + "limit": obj.get("limit") + }) + # 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/fee_bucket.py b/lighter/models/req_get_next_nonce.py similarity index 85% rename from lighter/models/fee_bucket.py rename to lighter/models/req_get_next_nonce.py index 3bde87d..90920a0 100644 --- a/lighter/models/fee_bucket.py +++ b/lighter/models/req_get_next_nonce.py @@ -22,15 +22,14 @@ from typing import Optional, Set from typing_extensions import Self -class FeeBucket(BaseModel): +class ReqGetNextNonce(BaseModel): """ - FeeBucket + ReqGetNextNonce """ # noqa: E501 - vip_tier: StrictInt - taker_fee: StrictInt - maker_fee: StrictInt + account_index: StrictInt + api_key_index: StrictInt additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["vip_tier", "taker_fee", "maker_fee"] + __properties: ClassVar[List[str]] = ["account_index", "api_key_index"] model_config = ConfigDict( populate_by_name=True, @@ -50,7 +49,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of FeeBucket from a JSON string""" + """Create an instance of ReqGetNextNonce from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -82,7 +81,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of FeeBucket from a dict""" + """Create an instance of ReqGetNextNonce from a dict""" if obj is None: return None @@ -90,9 +89,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "vip_tier": obj.get("vip_tier"), - "taker_fee": obj.get("taker_fee"), - "maker_fee": obj.get("maker_fee") + "account_index": obj.get("account_index"), + "api_key_index": obj.get("api_key_index") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/req_get_order_book_details.py b/lighter/models/req_get_order_book_details.py new file mode 100644 index 0000000..e38a012 --- /dev/null +++ b/lighter/models/req_get_order_book_details.py @@ -0,0 +1,100 @@ +# 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetOrderBookDetails(BaseModel): + """ + ReqGetOrderBookDetails + """ # noqa: E501 + market_id: Optional[StrictInt] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["market_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 ReqGetOrderBookDetails 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 ReqGetOrderBookDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "market_id": obj.get("market_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/req_get_order_books.py b/lighter/models/req_get_order_books.py new file mode 100644 index 0000000..9608c4b --- /dev/null +++ b/lighter/models/req_get_order_books.py @@ -0,0 +1,100 @@ +# 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 +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetOrderBooks(BaseModel): + """ + ReqGetOrderBooks + """ # noqa: E501 + market_id: Optional[StrictInt] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["market_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 ReqGetOrderBooks 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 ReqGetOrderBooks from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "market_id": obj.get("market_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/req_get_position_funding.py b/lighter/models/req_get_position_funding.py new file mode 100644 index 0000000..04d07f8 --- /dev/null +++ b/lighter/models/req_get_position_funding.py @@ -0,0 +1,121 @@ +# 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, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetPositionFunding(BaseModel): + """ + ReqGetPositionFunding + """ # noqa: E501 + auth: Optional[StrictStr] = None + account_index: StrictInt + market_id: Optional[StrictInt] = None + cursor: Optional[StrictStr] = None + limit: Annotated[int, Field(le=100, strict=True, ge=1)] + side: Optional[StrictStr] = 'all' + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["auth", "account_index", "market_id", "cursor", "limit", "side"] + + @field_validator('side') + def side_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['long', 'short', 'all']): + raise ValueError("must be one of enum values ('long', 'short', 'all')") + return value + + 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 ReqGetPositionFunding 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 ReqGetPositionFunding from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "auth": obj.get("auth"), + "account_index": obj.get("account_index"), + "market_id": obj.get("market_id"), + "cursor": obj.get("cursor"), + "limit": obj.get("limit"), + "side": obj.get("side") if obj.get("side") is not None else 'all' + }) + # 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/req_get_public_pools.py b/lighter/models/req_get_public_pools.py new file mode 100644 index 0000000..94786e4 --- /dev/null +++ b/lighter/models/req_get_public_pools.py @@ -0,0 +1,119 @@ +# 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, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetPublicPools(BaseModel): + """ + ReqGetPublicPools + """ # noqa: E501 + auth: Optional[StrictStr] = None + filter: Optional[StrictStr] = None + index: StrictInt + limit: Annotated[int, Field(le=100, strict=True, ge=1)] + account_index: Optional[StrictInt] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["auth", "filter", "index", "limit", "account_index"] + + @field_validator('filter') + def filter_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['all', 'user', 'protocol', 'account_index']): + raise ValueError("must be one of enum values ('all', 'user', 'protocol', 'account_index')") + return value + + 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 ReqGetPublicPools 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 ReqGetPublicPools from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "auth": obj.get("auth"), + "filter": obj.get("filter"), + "index": obj.get("index"), + "limit": obj.get("limit"), + "account_index": obj.get("account_index") + }) + # 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/req_get_range_with_cursor.py b/lighter/models/req_get_range_with_cursor.py new file mode 100644 index 0000000..dc7821e --- /dev/null +++ b/lighter/models/req_get_range_with_cursor.py @@ -0,0 +1,103 @@ +# 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, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetRangeWithCursor(BaseModel): + """ + ReqGetRangeWithCursor + """ # noqa: E501 + cursor: Optional[StrictStr] = None + limit: Annotated[int, Field(le=100, strict=True, ge=1)] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["cursor", "limit"] + + 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 ReqGetRangeWithCursor 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 ReqGetRangeWithCursor from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "cursor": obj.get("cursor"), + "limit": obj.get("limit") + }) + # 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/req_get_range_with_index.py b/lighter/models/req_get_range_with_index.py new file mode 100644 index 0000000..e589449 --- /dev/null +++ b/lighter/models/req_get_range_with_index.py @@ -0,0 +1,103 @@ +# 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, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetRangeWithIndex(BaseModel): + """ + ReqGetRangeWithIndex + """ # noqa: E501 + index: Optional[StrictInt] = None + limit: Annotated[int, Field(le=100, strict=True, ge=1)] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["index", "limit"] + + 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 ReqGetRangeWithIndex 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 ReqGetRangeWithIndex from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "index": obj.get("index"), + "limit": obj.get("limit") + }) + # 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/req_get_range_with_index_sortable.py b/lighter/models/req_get_range_with_index_sortable.py new file mode 100644 index 0000000..d22bbb2 --- /dev/null +++ b/lighter/models/req_get_range_with_index_sortable.py @@ -0,0 +1,115 @@ +# 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, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetRangeWithIndexSortable(BaseModel): + """ + ReqGetRangeWithIndexSortable + """ # noqa: E501 + index: Optional[StrictInt] = None + limit: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = None + sort: Optional[StrictStr] = 'asc' + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["index", "limit", "sort"] + + @field_validator('sort') + def sort_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['asc', 'desc']): + raise ValueError("must be one of enum values ('asc', 'desc')") + return value + + 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 ReqGetRangeWithIndexSortable 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 ReqGetRangeWithIndexSortable from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "index": obj.get("index"), + "limit": obj.get("limit"), + "sort": obj.get("sort") if obj.get("sort") is not None else 'asc' + }) + # 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/req_get_recent_trades.py b/lighter/models/req_get_recent_trades.py new file mode 100644 index 0000000..96dba79 --- /dev/null +++ b/lighter/models/req_get_recent_trades.py @@ -0,0 +1,103 @@ +# 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, Field, StrictInt +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetRecentTrades(BaseModel): + """ + ReqGetRecentTrades + """ # noqa: E501 + market_id: StrictInt + limit: Annotated[int, Field(le=100, strict=True, ge=1)] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["market_id", "limit"] + + 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 ReqGetRecentTrades 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 ReqGetRecentTrades from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "market_id": obj.get("market_id"), + "limit": obj.get("limit") + }) + # 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/req_get_referral_points.py b/lighter/models/req_get_referral_points.py new file mode 100644 index 0000000..19192ec --- /dev/null +++ b/lighter/models/req_get_referral_points.py @@ -0,0 +1,102 @@ +# 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, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetReferralPoints(BaseModel): + """ + ReqGetReferralPoints + """ # noqa: E501 + auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") + account_index: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["auth", "account_index"] + + 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 ReqGetReferralPoints 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 ReqGetReferralPoints from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "auth": obj.get("auth"), + "account_index": obj.get("account_index") + }) + # 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/req_get_trades.py b/lighter/models/req_get_trades.py new file mode 100644 index 0000000..c760bce --- /dev/null +++ b/lighter/models/req_get_trades.py @@ -0,0 +1,136 @@ +# 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, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetTrades(BaseModel): + """ + ReqGetTrades + """ # noqa: E501 + auth: Optional[StrictStr] = None + market_id: Optional[StrictInt] = None + account_index: Optional[StrictInt] = -1 + order_index: Optional[StrictInt] = None + sort_by: StrictStr + sort_dir: Optional[StrictStr] = 'desc' + cursor: Optional[StrictStr] = None + var_from: Optional[StrictInt] = Field(default=-1, alias="from") + ask_filter: Optional[StrictInt] = None + limit: Annotated[int, Field(le=100, strict=True, ge=1)] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["auth", "market_id", "account_index", "order_index", "sort_by", "sort_dir", "cursor", "from", "ask_filter", "limit"] + + @field_validator('sort_by') + def sort_by_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['block_height', 'timestamp', 'trade_id']): + raise ValueError("must be one of enum values ('block_height', 'timestamp', 'trade_id')") + return value + + @field_validator('sort_dir') + def sort_dir_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['desc']): + raise ValueError("must be one of enum values ('desc')") + return value + + 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 ReqGetTrades 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 ReqGetTrades from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "auth": obj.get("auth"), + "market_id": obj.get("market_id"), + "account_index": obj.get("account_index") if obj.get("account_index") is not None else -1, + "order_index": obj.get("order_index"), + "sort_by": obj.get("sort_by"), + "sort_dir": obj.get("sort_dir") if obj.get("sort_dir") is not None else 'desc', + "cursor": obj.get("cursor"), + "from": obj.get("from") if obj.get("from") is not None else -1, + "ask_filter": obj.get("ask_filter"), + "limit": obj.get("limit") + }) + # 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/req_get_tx.py b/lighter/models/req_get_tx.py new file mode 100644 index 0000000..275c4ff --- /dev/null +++ b/lighter/models/req_get_tx.py @@ -0,0 +1,109 @@ +# 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, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetTx(BaseModel): + """ + ReqGetTx + """ # noqa: E501 + by: StrictStr + value: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["by", "value"] + + @field_validator('by') + def by_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['hash', 'sequence_index']): + raise ValueError("must be one of enum values ('hash', 'sequence_index')") + return value + + 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 ReqGetTx 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 ReqGetTx from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "by": obj.get("by"), + "value": obj.get("value") + }) + # 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/req_get_withdraw_history.py b/lighter/models/req_get_withdraw_history.py new file mode 100644 index 0000000..ecd05c7 --- /dev/null +++ b/lighter/models/req_get_withdraw_history.py @@ -0,0 +1,116 @@ +# 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, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetWithdrawHistory(BaseModel): + """ + ReqGetWithdrawHistory + """ # noqa: E501 + account_index: StrictInt + auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") + cursor: Optional[StrictStr] = None + filter: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["account_index", "auth", "cursor", "filter"] + + @field_validator('filter') + def filter_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['all', 'pending', 'claimable']): + raise ValueError("must be one of enum values ('all', 'pending', 'claimable')") + return value + + 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 ReqGetWithdrawHistory 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 ReqGetWithdrawHistory from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "account_index": obj.get("account_index"), + "auth": obj.get("auth"), + "cursor": obj.get("cursor"), + "filter": obj.get("filter") + }) + # 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_get_fast_bridge_info.py b/lighter/models/resp_get_fast_bridge_info.py new file mode 100644 index 0000000..baf3922 --- /dev/null +++ b/lighter/models/resp_get_fast_bridge_info.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 RespGetFastBridgeInfo(BaseModel): + """ + RespGetFastBridgeInfo + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + fast_bridge_limit: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "fast_bridge_limit"] + + 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 RespGetFastBridgeInfo 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 RespGetFastBridgeInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "fast_bridge_limit": obj.get("fast_bridge_limit") + }) + # 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/result_code.py b/lighter/models/result_code.py new file mode 100644 index 0000000..a29a276 --- /dev/null +++ b/lighter/models/result_code.py @@ -0,0 +1,102 @@ +# 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 ResultCode(BaseModel): + """ + ResultCode + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message"] + + 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 ResultCode 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 ResultCode from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message") + }) + # 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/risk_info.py b/lighter/models/risk_info.py new file mode 100644 index 0000000..0186cc7 --- /dev/null +++ b/lighter/models/risk_info.py @@ -0,0 +1,108 @@ +# 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, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class RiskInfo(BaseModel): + """ + RiskInfo + """ # noqa: E501 + collateral: StrictStr + total_account_value: StrictStr + initial_margin_req: StrictStr + maintenance_margin_req: StrictStr + close_out_margin_req: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["collateral", "total_account_value", "initial_margin_req", "maintenance_margin_req", "close_out_margin_req"] + + 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 RiskInfo 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 RiskInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "collateral": obj.get("collateral"), + "total_account_value": obj.get("total_account_value"), + "initial_margin_req": obj.get("initial_margin_req"), + "maintenance_margin_req": obj.get("maintenance_margin_req"), + "close_out_margin_req": obj.get("close_out_margin_req") + }) + # 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/ticker.py b/lighter/models/ticker.py new file mode 100644 index 0000000..96a5cd4 --- /dev/null +++ b/lighter/models/ticker.py @@ -0,0 +1,111 @@ +# 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, StrictStr +from typing import Any, ClassVar, Dict, List +from lighter.models.price_level import PriceLevel +from typing import Optional, Set +from typing_extensions import Self + +class Ticker(BaseModel): + """ + Ticker + """ # noqa: E501 + s: StrictStr + a: PriceLevel + b: PriceLevel + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["s", "a", "b"] + + 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 Ticker 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 a + if self.a: + _dict['a'] = self.a.to_dict() + # override the default output from pydantic by calling `to_dict()` of b + if self.b: + _dict['b'] = self.b.to_dict() + # 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 Ticker from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "s": obj.get("s"), + "a": PriceLevel.from_dict(obj["a"]) if obj.get("a") is not None else None, + "b": PriceLevel.from_dict(obj["b"]) if obj.get("b") 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/trade.py b/lighter/models/trade.py index 3d0c336..7ee6ac6 100644 --- a/lighter/models/trade.py +++ b/lighter/models/trade.py @@ -40,8 +40,14 @@ class Trade(BaseModel): is_maker_ask: StrictBool block_height: StrictInt timestamp: StrictInt + taker_position_size_before: StrictStr + taker_entry_quote_before: StrictStr + taker_initial_margin_fraction_before: StrictInt + maker_position_size_before: StrictStr + maker_entry_quote_before: StrictStr + maker_initial_margin_fraction_before: StrictInt additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["trade_id", "tx_hash", "type", "market_id", "size", "price", "usd_amount", "ask_id", "bid_id", "ask_account_id", "bid_account_id", "is_maker_ask", "block_height", "timestamp"] + __properties: ClassVar[List[str]] = ["trade_id", "tx_hash", "type", "market_id", "size", "price", "usd_amount", "ask_id", "bid_id", "ask_account_id", "bid_account_id", "is_maker_ask", "block_height", "timestamp", "taker_fee", "taker_position_size_before", "taker_entry_quote_before", "taker_initial_margin_fraction_before", "taker_position_sign_changed", "maker_fee", "maker_position_size_before", "maker_entry_quote_before", "maker_initial_margin_fraction_before", "maker_position_sign_changed"] @field_validator('type') def type_validate_enum(cls, value): @@ -121,7 +127,17 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "bid_account_id": obj.get("bid_account_id"), "is_maker_ask": obj.get("is_maker_ask"), "block_height": obj.get("block_height"), - "timestamp": obj.get("timestamp") + "timestamp": obj.get("timestamp"), + "taker_fee": obj.get("taker_fee"), + "taker_position_size_before": obj.get("taker_position_size_before"), + "taker_entry_quote_before": obj.get("taker_entry_quote_before"), + "taker_initial_margin_fraction_before": obj.get("taker_initial_margin_fraction_before"), + "taker_position_sign_changed": obj.get("taker_position_sign_changed"), + "maker_fee": obj.get("maker_fee"), + "maker_position_size_before": obj.get("maker_position_size_before"), + "maker_entry_quote_before": obj.get("maker_entry_quote_before"), + "maker_initial_margin_fraction_before": obj.get("maker_initial_margin_fraction_before"), + "maker_position_sign_changed": obj.get("maker_position_sign_changed") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/validator_info.py b/lighter/models/validator_info.py new file mode 100644 index 0000000..ca08bdf --- /dev/null +++ b/lighter/models/validator_info.py @@ -0,0 +1,102 @@ +# 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, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ValidatorInfo(BaseModel): + """ + ValidatorInfo + """ # noqa: E501 + address: StrictStr + is_active: StrictBool + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["address", "is_active"] + + 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 ValidatorInfo 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 ValidatorInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "address": obj.get("address"), + "is_active": obj.get("is_active") + }) + # 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 + +