diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 3ab3734..adbbe6e 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -16,9 +16,12 @@ docs/ApiToken.md docs/ApprovedIntegrator.md docs/Asset.md docs/AssetDetails.md +docs/BinaryOptionMarketStats.md docs/Block.md docs/BlockApi.md docs/Blocks.md +docs/BoEventPnL.md +docs/BoOutcomePnL.md docs/BridgeApi.md docs/BridgeSupportedNetwork.md docs/BridgeSupportedNetworks.md @@ -35,6 +38,9 @@ docs/DepositHistoryItem.md docs/DetailedAccount.md docs/DetailedAccounts.md docs/EnrichedTx.md +docs/EventApi.md +docs/EventDetail.md +docs/EventOrderBookEntry.md docs/ExchangeMetric.md docs/ExchangeStats.md docs/ExecuteStat.md @@ -80,8 +86,11 @@ docs/PerpsOrderBookDetail.md docs/PnLEntry.md docs/PnlLeaderboard.md docs/PnlLeaderboardEntry.md +docs/PortfolioApi.md docs/PositionFunding.md docs/PositionFundings.md +docs/PriceOracleMarket.md +docs/PriceOraclePrice.md docs/PublicPoolInfo.md docs/PublicPoolMetadata.md docs/PublicPoolShare.md @@ -101,6 +110,8 @@ docs/ReqSetAccountMetadata.md docs/RespChangeAccountTier.md docs/RespCreateRFQ.md docs/RespGetApiTokens.md +docs/RespGetBoPnL.md +docs/RespGetEvents.md docs/RespGetExchangeMetrics.md docs/RespGetExecuteStats.md docs/RespGetFastBridgeInfo.md @@ -109,8 +120,10 @@ docs/RespGetLeaseOptions.md docs/RespGetLeases.md docs/RespGetMakerOnlyApiKeys.md docs/RespGetRFQ.md +docs/RespGetUpDownCandles.md docs/RespListRFQs.md docs/RespPostApiToken.md +docs/RespPriceOracleInfo.md docs/RespPublicPoolsMetadata.md docs/RespRespondToRFQ.md docs/RespRevokeApiToken.md @@ -148,6 +161,8 @@ docs/TransferHistoryItem.md docs/Tx.md docs/TxHash.md docs/Txs.md +docs/UpDownCandle.md +docs/UpdownApi.md docs/UserReferrals.md docs/ValidatorInfo.md docs/WithdrawHistory.md @@ -160,15 +175,18 @@ lighter/api/announcement_api.py lighter/api/block_api.py lighter/api/bridge_api.py lighter/api/candlestick_api.py +lighter/api/event_api.py lighter/api/funding_api.py lighter/api/info_api.py lighter/api/livepoints_api.py lighter/api/notification_api.py lighter/api/order_api.py +lighter/api/portfolio_api.py lighter/api/referral_api.py lighter/api/root_api.py lighter/api/tokenlist_api.py lighter/api/transaction_api.py +lighter/api/updown_api.py lighter/api_client.py lighter/api_response.py lighter/configuration.py @@ -189,8 +207,11 @@ lighter/models/api_token.py lighter/models/approved_integrator.py lighter/models/asset.py lighter/models/asset_details.py +lighter/models/binary_option_market_stats.py lighter/models/block.py lighter/models/blocks.py +lighter/models/bo_event_pn_l.py +lighter/models/bo_outcome_pn_l.py lighter/models/bridge_supported_network.py lighter/models/bridge_supported_networks.py lighter/models/candle.py @@ -205,6 +226,8 @@ lighter/models/deposit_history_item.py lighter/models/detailed_account.py lighter/models/detailed_accounts.py lighter/models/enriched_tx.py +lighter/models/event_detail.py +lighter/models/event_order_book_entry.py lighter/models/exchange_metric.py lighter/models/exchange_stats.py lighter/models/execute_stat.py @@ -247,6 +270,8 @@ lighter/models/pnl_leaderboard.py lighter/models/pnl_leaderboard_entry.py lighter/models/position_funding.py lighter/models/position_fundings.py +lighter/models/price_oracle_market.py +lighter/models/price_oracle_price.py lighter/models/public_pool_info.py lighter/models/public_pool_metadata.py lighter/models/public_pool_share.py @@ -262,6 +287,8 @@ lighter/models/req_set_account_metadata.py lighter/models/resp_change_account_tier.py lighter/models/resp_create_rfq.py lighter/models/resp_get_api_tokens.py +lighter/models/resp_get_bo_pn_l.py +lighter/models/resp_get_events.py lighter/models/resp_get_exchange_metrics.py lighter/models/resp_get_execute_stats.py lighter/models/resp_get_fast_bridge_info.py @@ -270,8 +297,10 @@ lighter/models/resp_get_lease_options.py lighter/models/resp_get_leases.py lighter/models/resp_get_maker_only_api_keys.py lighter/models/resp_get_rfq.py +lighter/models/resp_get_up_down_candles.py lighter/models/resp_list_rfqs.py lighter/models/resp_post_api_token.py +lighter/models/resp_price_oracle_info.py lighter/models/resp_public_pools_metadata.py lighter/models/resp_respond_to_rfq.py lighter/models/resp_revoke_api_token.py @@ -309,6 +338,7 @@ lighter/models/transfer_history_item.py lighter/models/tx.py lighter/models/tx_hash.py lighter/models/txs.py +lighter/models/up_down_candle.py lighter/models/user_referrals.py lighter/models/validator_info.py lighter/models/withdraw_history.py diff --git a/README.md b/README.md index 226bf9a..4018156 100644 --- a/README.md +++ b/README.md @@ -97,8 +97,10 @@ Class | Method | HTTP request | Description *CandlestickApi* | [**fundings**](docs/CandlestickApi.md#fundings) | **GET** /api/v1/fundings | fundings *CandlestickApi* | [**mark_price_candles**](docs/CandlestickApi.md#mark_price_candles) | **GET** /api/v1/markPriceCandles | markPriceCandles *CandlestickApi* | [**market_price_charts**](docs/CandlestickApi.md#market_price_charts) | **GET** /api/v1/marketPriceCharts | marketPriceCharts +*EventApi* | [**events**](docs/EventApi.md#events) | **GET** /api/v1/events | events *FundingApi* | [**funding_rates**](docs/FundingApi.md#funding_rates) | **GET** /api/v1/funding-rates | funding-rates *InfoApi* | [**layer1_basic_info**](docs/InfoApi.md#layer1_basic_info) | **GET** /api/v1/layer1BasicInfo | layer1BasicInfo +*InfoApi* | [**price_oracle_info**](docs/InfoApi.md#price_oracle_info) | **GET** /api/v1/priceOracleInfo | priceOracleInfo *InfoApi* | [**synthetic_spot_info**](docs/InfoApi.md#synthetic_spot_info) | **GET** /api/v1/syntheticSpotInfo | syntheticSpotInfo *InfoApi* | [**system_config**](docs/InfoApi.md#system_config) | **GET** /api/v1/systemConfig | systemConfig *InfoApi* | [**transfer_fee_info**](docs/InfoApi.md#transfer_fee_info) | **GET** /api/v1/transferFeeInfo | transferFeeInfo @@ -111,14 +113,15 @@ Class | Method | HTTP request | Description *OrderApi* | [**asset_details**](docs/OrderApi.md#asset_details) | **GET** /api/v1/assetDetails | assetDetails *OrderApi* | [**exchange_metrics**](docs/OrderApi.md#exchange_metrics) | **GET** /api/v1/exchangeMetrics | exchangeMetrics *OrderApi* | [**exchange_stats**](docs/OrderApi.md#exchange_stats) | **GET** /api/v1/exchangeStats | exchangeStats -*OrderApi* | [**export_historical_trades**](docs/OrderApi.md#export_historical_trades) | **GET** /api/v1/export/historicalTrades | export_historicalTrades *OrderApi* | [**execute_stats**](docs/OrderApi.md#execute_stats) | **GET** /api/v1/executeStats | executeStats *OrderApi* | [**export**](docs/OrderApi.md#export) | **GET** /api/v1/export | export +*OrderApi* | [**export_historical_trades**](docs/OrderApi.md#export_historical_trades) | **GET** /api/v1/export/historicalTrades | export_historicalTrades *OrderApi* | [**order_book_details**](docs/OrderApi.md#order_book_details) | **GET** /api/v1/orderBookDetails | orderBookDetails *OrderApi* | [**order_book_orders**](docs/OrderApi.md#order_book_orders) | **GET** /api/v1/orderBookOrders | orderBookOrders *OrderApi* | [**order_books**](docs/OrderApi.md#order_books) | **GET** /api/v1/orderBooks | orderBooks *OrderApi* | [**recent_trades**](docs/OrderApi.md#recent_trades) | **GET** /api/v1/recentTrades | recentTrades *OrderApi* | [**trades**](docs/OrderApi.md#trades) | **GET** /api/v1/trades | trades +*PortfolioApi* | [**portfolio_bo_pnl**](docs/PortfolioApi.md#portfolio_bo_pnl) | **GET** /api/v1/portfolio/boPnl | portfolio_boPnl *ReferralApi* | [**referral_create**](docs/ReferralApi.md#referral_create) | **POST** /api/v1/referral/create | referral_create *ReferralApi* | [**referral_get**](docs/ReferralApi.md#referral_get) | **GET** /api/v1/referral/get | referral_get *ReferralApi* | [**referral_kickback_update**](docs/ReferralApi.md#referral_kickback_update) | **POST** /api/v1/referral/kickback/update | referral_kickback_update @@ -141,6 +144,7 @@ Class | Method | HTTP request | Description *TransactionApi* | [**tx_from_l1_tx_hash**](docs/TransactionApi.md#tx_from_l1_tx_hash) | **GET** /api/v1/txFromL1TxHash | txFromL1TxHash *TransactionApi* | [**txs**](docs/TransactionApi.md#txs) | **GET** /api/v1/txs | txs *TransactionApi* | [**withdraw_history**](docs/TransactionApi.md#withdraw_history) | **GET** /api/v1/withdraw/history | withdraw_history +*UpdownApi* | [**up_down_candles**](docs/UpdownApi.md#up_down_candles) | **GET** /api/v1/upDownCandles | upDownCandles @@ -159,8 +163,11 @@ Class | Method | HTTP request | Description - [ApprovedIntegrator](docs/ApprovedIntegrator.md) - [Asset](docs/Asset.md) - [AssetDetails](docs/AssetDetails.md) + - [BinaryOptionMarketStats](docs/BinaryOptionMarketStats.md) - [Block](docs/Block.md) - [Blocks](docs/Blocks.md) + - [BoEventPnL](docs/BoEventPnL.md) + - [BoOutcomePnL](docs/BoOutcomePnL.md) - [BridgeSupportedNetwork](docs/BridgeSupportedNetwork.md) - [BridgeSupportedNetworks](docs/BridgeSupportedNetworks.md) - [Candle](docs/Candle.md) @@ -175,6 +182,8 @@ Class | Method | HTTP request | Description - [DetailedAccount](docs/DetailedAccount.md) - [DetailedAccounts](docs/DetailedAccounts.md) - [EnrichedTx](docs/EnrichedTx.md) + - [EventDetail](docs/EventDetail.md) + - [EventOrderBookEntry](docs/EventOrderBookEntry.md) - [ExchangeMetric](docs/ExchangeMetric.md) - [ExchangeStats](docs/ExchangeStats.md) - [ExecuteStat](docs/ExecuteStat.md) @@ -182,8 +191,8 @@ Class | Method | HTTP request | Description - [Funding](docs/Funding.md) - [FundingRate](docs/FundingRate.md) - [FundingRates](docs/FundingRates.md) - - [HistoricalTradesExportData](docs/HistoricalTradesExportData.md) - [Fundings](docs/Fundings.md) + - [HistoricalTradesExportData](docs/HistoricalTradesExportData.md) - [L1Metadata](docs/L1Metadata.md) - [L1ProviderInfo](docs/L1ProviderInfo.md) - [Layer1BasicInfo](docs/Layer1BasicInfo.md) @@ -212,11 +221,13 @@ Class | Method | HTTP request | Description - [PartnerStats](docs/PartnerStats.md) - [PendingUnlock](docs/PendingUnlock.md) - [PerpsOrderBookDetail](docs/PerpsOrderBookDetail.md) + - [PnLEntry](docs/PnLEntry.md) - [PnlLeaderboard](docs/PnlLeaderboard.md) - [PnlLeaderboardEntry](docs/PnlLeaderboardEntry.md) - - [PnLEntry](docs/PnLEntry.md) - [PositionFunding](docs/PositionFunding.md) - [PositionFundings](docs/PositionFundings.md) + - [PriceOracleMarket](docs/PriceOracleMarket.md) + - [PriceOraclePrice](docs/PriceOraclePrice.md) - [PublicPoolInfo](docs/PublicPoolInfo.md) - [PublicPoolMetadata](docs/PublicPoolMetadata.md) - [PublicPoolShare](docs/PublicPoolShare.md) @@ -224,17 +235,19 @@ Class | Method | HTTP request | Description - [RFQMetadata](docs/RFQMetadata.md) - [RFQResponseEntry](docs/RFQResponseEntry.md) - [Referral](docs/Referral.md) - - [ReferralStat](docs/ReferralStat.md) - - [ReferralStats](docs/ReferralStats.md) - [ReferralCode](docs/ReferralCode.md) - [ReferralPointEntry](docs/ReferralPointEntry.md) - [ReferralPoints](docs/ReferralPoints.md) - [ReferralProgramKickback](docs/ReferralProgramKickback.md) + - [ReferralStat](docs/ReferralStat.md) + - [ReferralStats](docs/ReferralStats.md) - [ReferralTotals](docs/ReferralTotals.md) - [ReqSetAccountMetadata](docs/ReqSetAccountMetadata.md) - [RespChangeAccountTier](docs/RespChangeAccountTier.md) - [RespCreateRFQ](docs/RespCreateRFQ.md) - [RespGetApiTokens](docs/RespGetApiTokens.md) + - [RespGetBoPnL](docs/RespGetBoPnL.md) + - [RespGetEvents](docs/RespGetEvents.md) - [RespGetExchangeMetrics](docs/RespGetExchangeMetrics.md) - [RespGetExecuteStats](docs/RespGetExecuteStats.md) - [RespGetFastBridgeInfo](docs/RespGetFastBridgeInfo.md) @@ -243,8 +256,10 @@ Class | Method | HTTP request | Description - [RespGetLeases](docs/RespGetLeases.md) - [RespGetMakerOnlyApiKeys](docs/RespGetMakerOnlyApiKeys.md) - [RespGetRFQ](docs/RespGetRFQ.md) + - [RespGetUpDownCandles](docs/RespGetUpDownCandles.md) - [RespListRFQs](docs/RespListRFQs.md) - [RespPostApiToken](docs/RespPostApiToken.md) + - [RespPriceOracleInfo](docs/RespPriceOracleInfo.md) - [RespPublicPoolsMetadata](docs/RespPublicPoolsMetadata.md) - [RespRespondToRFQ](docs/RespRespondToRFQ.md) - [RespRevokeApiToken](docs/RespRevokeApiToken.md) @@ -279,6 +294,7 @@ Class | Method | HTTP request | Description - [Tx](docs/Tx.md) - [TxHash](docs/TxHash.md) - [Txs](docs/Txs.md) + - [UpDownCandle](docs/UpDownCandle.md) - [UserReferrals](docs/UserReferrals.md) - [ValidatorInfo](docs/ValidatorInfo.md) - [WithdrawHistory](docs/WithdrawHistory.md) diff --git a/docs/AccountApi.md b/docs/AccountApi.md index 2d6a440..34edadf 100644 --- a/docs/AccountApi.md +++ b/docs/AccountApi.md @@ -402,7 +402,7 @@ No authorization required changeAccountTier -Change account type (applies to both master, and subaccounts). Downgrades can be performed once every 24 hours. +Change account tier. You can only perform this action once every 24 hours. ### Example diff --git a/docs/BinaryOptionMarketStats.md b/docs/BinaryOptionMarketStats.md new file mode 100644 index 0000000..a67db34 --- /dev/null +++ b/docs/BinaryOptionMarketStats.md @@ -0,0 +1,44 @@ +# BinaryOptionMarketStats + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**symbol** | **str** | | +**market_id** | **int** | | +**mid_price** | **str** | | +**best_ask_price** | **str** | | +**best_bid_price** | **str** | | +**last_trade_price** | **str** | | +**daily_base_token_volume** | **float** | | +**daily_quote_token_volume** | **float** | | +**daily_price_low** | **float** | | +**daily_price_high** | **float** | | +**daily_price_change** | **float** | | +**lifetime_quote_token_volume** | **float** | | +**lifetime_base_token_volume** | **float** | outcome shares traded over the market's life | +**open_interest** | **str** | | +**status** | **str** | inactive once the trading window closes | +**outcome** | **int** | | + +## Example + +```python +from lighter.models.binary_option_market_stats import BinaryOptionMarketStats + +# TODO update the JSON string below +json = "{}" +# create an instance of BinaryOptionMarketStats from a JSON string +binary_option_market_stats_instance = BinaryOptionMarketStats.from_json(json) +# print the JSON string representation of the object +print(BinaryOptionMarketStats.to_json()) + +# convert the object into a dict +binary_option_market_stats_dict = binary_option_market_stats_instance.to_dict() +# create an instance of BinaryOptionMarketStats from a dict +binary_option_market_stats_from_dict = BinaryOptionMarketStats.from_dict(binary_option_market_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/BoEventPnL.md b/docs/BoEventPnL.md new file mode 100644 index 0000000..7279162 --- /dev/null +++ b/docs/BoEventPnL.md @@ -0,0 +1,33 @@ +# BoEventPnL + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event_id** | **int** | | +**event_title** | **str** | | +**event_description** | **str** | | +**total_pnl** | **str** | | +**outcomes** | [**List[BoOutcomePnL]**](BoOutcomePnL.md) | | + +## Example + +```python +from lighter.models.bo_event_pn_l import BoEventPnL + +# TODO update the JSON string below +json = "{}" +# create an instance of BoEventPnL from a JSON string +bo_event_pn_l_instance = BoEventPnL.from_json(json) +# print the JSON string representation of the object +print(BoEventPnL.to_json()) + +# convert the object into a dict +bo_event_pn_l_dict = bo_event_pn_l_instance.to_dict() +# create an instance of BoEventPnL from a dict +bo_event_pn_l_from_dict = BoEventPnL.from_dict(bo_event_pn_l_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/BoOutcomePnL.md b/docs/BoOutcomePnL.md new file mode 100644 index 0000000..973be46 --- /dev/null +++ b/docs/BoOutcomePnL.md @@ -0,0 +1,35 @@ +# BoOutcomePnL + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**market_id** | **int** | | +**symbol** | **str** | | +**outcome** | **int** | | +**end_timestamp** | **int** | | +**settlement_pnl** | **str** | | +**last_trade_id** | **int** | | +**total_pnl** | **str** | | + +## Example + +```python +from lighter.models.bo_outcome_pn_l import BoOutcomePnL + +# TODO update the JSON string below +json = "{}" +# create an instance of BoOutcomePnL from a JSON string +bo_outcome_pn_l_instance = BoOutcomePnL.from_json(json) +# print the JSON string representation of the object +print(BoOutcomePnL.to_json()) + +# convert the object into a dict +bo_outcome_pn_l_dict = bo_outcome_pn_l_instance.to_dict() +# create an instance of BoOutcomePnL from a dict +bo_outcome_pn_l_from_dict = BoOutcomePnL.from_dict(bo_outcome_pn_l_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/CandlestickApi.md b/docs/CandlestickApi.md index 6ee39d6..3dd5b18 100644 --- a/docs/CandlestickApi.md +++ b/docs/CandlestickApi.md @@ -11,7 +11,7 @@ Method | HTTP request | Description # **candles** -> Candles candles(market_id, resolution, start_timestamp, end_timestamp, count_back, set_timestamp_to_end=set_timestamp_to_end) +> Candles candles(market_id, resolution, start_timestamp, end_timestamp, count_back, set_timestamp_to_end=set_timestamp_to_end, merge_mark_price=merge_mark_price) candles @@ -43,10 +43,11 @@ async with lighter.ApiClient(configuration) as api_client: end_timestamp = 56 # int | count_back = 56 # int | set_timestamp_to_end = False # bool | (optional) (default to False) + merge_mark_price = False # bool | (optional) (default to False) try: # candles - api_response = await api_instance.candles(market_id, resolution, start_timestamp, end_timestamp, count_back, set_timestamp_to_end=set_timestamp_to_end) + api_response = await api_instance.candles(market_id, resolution, start_timestamp, end_timestamp, count_back, set_timestamp_to_end=set_timestamp_to_end, merge_mark_price=merge_mark_price) print("The response of CandlestickApi->candles:\n") pprint(api_response) except Exception as e: @@ -66,6 +67,7 @@ Name | Type | Description | Notes **end_timestamp** | **int**| | **count_back** | **int**| | **set_timestamp_to_end** | **bool**| | [optional] [default to False] + **merge_mark_price** | **bool**| | [optional] [default to False] ### Return type diff --git a/docs/EventApi.md b/docs/EventApi.md new file mode 100644 index 0000000..bb84480 --- /dev/null +++ b/docs/EventApi.md @@ -0,0 +1,100 @@ +# lighter.EventApi + +All URIs are relative to *https://mainnet.zklighter.elliot.ai* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**events**](EventApi.md#events) | **GET** /api/v1/events | events + + +# **events** +> RespGetEvents events(event_ids=event_ids, market_ids=market_ids, creator_account_index=creator_account_index, cursor=cursor, active=active, limit=limit, tag=tag, event_kind=event_kind, start_from=start_from, start_before=start_before, sort=sort, order=order) + +events + +Get events and registered order books, including scheduled events with no books. event_ids and market_ids accept up to 50 comma-separated positive IDs, are mutually exclusive, and use the same filters, sorting and pagination. market_ids returns each related event once with all its order books. Defaults to descending id. Occurrence sorting uses (occurrence_start_at, event_id); cursor identifies an existing event and excludes it in the requested direction. tag filters across creators; creator_account_index is an optional additional filter. active=true requires a tradeable outcome; active=false includes scheduled and closed events. + +### Example + + +```python +import lighter +from lighter.models.resp_get_events import RespGetEvents +from lighter.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://mainnet.zklighter.elliot.ai +# See configuration.py for a list of all supported configuration parameters. +configuration = lighter.Configuration( + host = "https://mainnet.zklighter.elliot.ai" +) + + +# Enter a context with an instance of the API client +async with lighter.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = lighter.EventApi(api_client) + event_ids = 'event_ids_example' # str | comma-separated positive IDs, max 50 (optional) + market_ids = 'market_ids_example' # str | comma-separated positive IDs, max 50 (optional) + creator_account_index = 56 # int | (optional) + cursor = 56 # int | (optional) + active = True # bool | true: at least one outcome still tradeable; false: none (optional) + limit = 56 # int | (optional) + tag = 'tag_example' # str | series tag; creator filter is optional (optional) + event_kind = 'event_kind_example' # str | (optional) + start_from = 56 # int | inclusive occurrence start, Unix milliseconds (optional) + start_before = 56 # int | exclusive occurrence start, Unix milliseconds (optional) + sort = id # str | (optional) (default to id) + order = desc # str | (optional) (default to desc) + + try: + # events + api_response = await api_instance.events(event_ids=event_ids, market_ids=market_ids, creator_account_index=creator_account_index, cursor=cursor, active=active, limit=limit, tag=tag, event_kind=event_kind, start_from=start_from, start_before=start_before, sort=sort, order=order) + print("The response of EventApi->events:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling EventApi->events: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **event_ids** | **str**| comma-separated positive IDs, max 50 | [optional] + **market_ids** | **str**| comma-separated positive IDs, max 50 | [optional] + **creator_account_index** | **int**| | [optional] + **cursor** | **int**| | [optional] + **active** | **bool**| true: at least one outcome still tradeable; false: none | [optional] + **limit** | **int**| | [optional] + **tag** | **str**| series tag; creator filter is optional | [optional] + **event_kind** | **str**| | [optional] + **start_from** | **int**| inclusive occurrence start, Unix milliseconds | [optional] + **start_before** | **int**| exclusive occurrence start, Unix milliseconds | [optional] + **sort** | **str**| | [optional] [default to id] + **order** | **str**| | [optional] [default to desc] + +### Return type + +[**RespGetEvents**](RespGetEvents.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/EventDetail.md b/docs/EventDetail.md new file mode 100644 index 0000000..8aa6206 --- /dev/null +++ b/docs/EventDetail.md @@ -0,0 +1,41 @@ +# EventDetail + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**event_id** | **int** | | +**title** | **str** | | +**description** | **str** | | +**creator_account_index** | **int** | | +**created_at** | **int** | | +**tag** | **str** | | +**event_kind** | **str** | | +**recurrence_period_seconds** | **int** | | +**occurrence_start_at** | **int** | | +**occurrence_end_at** | **int** | | +**metadata** | **Dict[str, object]** | | +**order_books** | [**List[EventOrderBookEntry]**](EventOrderBookEntry.md) | | +**lifetime_quote_token_volume** | **float** | | + +## Example + +```python +from lighter.models.event_detail import EventDetail + +# TODO update the JSON string below +json = "{}" +# create an instance of EventDetail from a JSON string +event_detail_instance = EventDetail.from_json(json) +# print the JSON string representation of the object +print(EventDetail.to_json()) + +# convert the object into a dict +event_detail_dict = event_detail_instance.to_dict() +# create an instance of EventDetail from a dict +event_detail_from_dict = EventDetail.from_dict(event_detail_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/EventOrderBookEntry.md b/docs/EventOrderBookEntry.md new file mode 100644 index 0000000..153771a --- /dev/null +++ b/docs/EventOrderBookEntry.md @@ -0,0 +1,61 @@ +# EventOrderBookEntry + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**symbol** | **str** | | +**market_id** | **int** | | +**market_slot_id** | **int** | internal only: the reusable tree slot backing this market; never serialized, users only know market_id (the public market index) | +**market_type** | **str** | | +**base_asset_id** | **int** | | +**quote_asset_id** | **int** | | +**status** | **str** | | +**taker_fee** | **str** | | +**is_taker_fee_enabled** | **bool** | | +**maker_fee** | **str** | | +**is_maker_fee_enabled** | **bool** | | +**liquidation_fee** | **str** | | +**min_base_amount** | **str** | | +**min_quote_amount** | **str** | | +**order_quote_limit** | **str** | | +**supported_size_decimals** | **int** | | +**supported_price_decimals** | **int** | | +**supported_quote_decimals** | **int** | | +**created_at** | **str** | | +**multiplier** | **str** | | +**start_timestamp** | **int** | | +**end_timestamp** | **int** | | +**open_interest** | **str** | | +**outcome** | **int** | | +**operator_account_index** | **int** | | +**settlement_cap** | **int** | | +**settlement_type** | **int** | | +**settlement_price** | **int** | | +**default_price** | **int** | | +**is_frozen** | **bool** | | +**size_decimals** | **int** | | +**price_decimals** | **int** | | +**stats** | [**BinaryOptionMarketStats**](BinaryOptionMarketStats.md) | | + +## Example + +```python +from lighter.models.event_order_book_entry import EventOrderBookEntry + +# TODO update the JSON string below +json = "{}" +# create an instance of EventOrderBookEntry from a JSON string +event_order_book_entry_instance = EventOrderBookEntry.from_json(json) +# print the JSON string representation of the object +print(EventOrderBookEntry.to_json()) + +# convert the object into a dict +event_order_book_entry_dict = event_order_book_entry_instance.to_dict() +# create an instance of EventOrderBookEntry from a dict +event_order_book_entry_from_dict = EventOrderBookEntry.from_dict(event_order_book_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/InfoApi.md b/docs/InfoApi.md index 376b8c2..e39a333 100644 --- a/docs/InfoApi.md +++ b/docs/InfoApi.md @@ -5,6 +5,7 @@ All URIs are relative to *https://mainnet.zklighter.elliot.ai* Method | HTTP request | Description ------------- | ------------- | ------------- [**layer1_basic_info**](InfoApi.md#layer1_basic_info) | **GET** /api/v1/layer1BasicInfo | layer1BasicInfo +[**price_oracle_info**](InfoApi.md#price_oracle_info) | **GET** /api/v1/priceOracleInfo | priceOracleInfo [**synthetic_spot_info**](InfoApi.md#synthetic_spot_info) | **GET** /api/v1/syntheticSpotInfo | syntheticSpotInfo [**system_config**](InfoApi.md#system_config) | **GET** /api/v1/systemConfig | systemConfig [**transfer_fee_info**](InfoApi.md#transfer_fee_info) | **GET** /api/v1/transferFeeInfo | transferFeeInfo @@ -76,6 +77,75 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **price_oracle_info** +> RespPriceOracleInfo price_oracle_info(symbol=symbol) + +priceOracleInfo + +Get price oracle info (source in use, median exchanges, price cap) for all markets or a single symbol + +### Example + + +```python +import lighter +from lighter.models.resp_price_oracle_info import RespPriceOracleInfo +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.InfoApi(api_client) + symbol = 'symbol_example' # str | (optional) + + try: + # priceOracleInfo + api_response = await api_instance.price_oracle_info(symbol=symbol) + print("The response of InfoApi->price_oracle_info:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling InfoApi->price_oracle_info: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **str**| | [optional] + +### Return type + +[**RespPriceOracleInfo**](RespPriceOracleInfo.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) + # **synthetic_spot_info** > RespSyntheticSpotInfo synthetic_spot_info(symbol) diff --git a/docs/OrderApi.md b/docs/OrderApi.md index ab8f842..9faced7 100644 --- a/docs/OrderApi.md +++ b/docs/OrderApi.md @@ -976,7 +976,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, authorization=authorization, market_id=market_id, market_type=market_type, account_index=account_index, order_index=order_index, sort_dir=sort_dir, cursor=cursor, var_from=var_from, ask_filter=ask_filter, role=role, type=type, aggregate=aggregate, skip_ask_order_id=skip_ask_order_id, skip_bid_order_id=skip_bid_order_id) +> Trades trades(sort_by, limit, authorization=authorization, market_id=market_id, market_type=market_type, account_index=account_index, order_index=order_index, sort_dir=sort_dir, cursor=cursor, var_from=var_from, ask_filter=ask_filter, role=role, type=type, aggregate=aggregate, skip_ask_order_id=skip_ask_order_id, skip_bid_order_id=skip_bid_order_id, integrator_account_index=integrator_account_index, order_index_str=order_index_str) trades @@ -1018,10 +1018,12 @@ async with lighter.ApiClient(configuration) as api_client: aggregate = False # bool | (optional) (default to False) skip_ask_order_id = 'skip_ask_order_id_example' # str | (optional) skip_bid_order_id = 'skip_bid_order_id_example' # str | (optional) + integrator_account_index = 56 # int | (optional) + order_index_str = 'order_index_str_example' # str | takes precedence over order_index; for clients that cannot represent uint64 exactly (optional) try: # trades - api_response = await api_instance.trades(sort_by, limit, authorization=authorization, market_id=market_id, market_type=market_type, account_index=account_index, order_index=order_index, sort_dir=sort_dir, cursor=cursor, var_from=var_from, ask_filter=ask_filter, role=role, type=type, aggregate=aggregate, skip_ask_order_id=skip_ask_order_id, skip_bid_order_id=skip_bid_order_id) + api_response = await api_instance.trades(sort_by, limit, authorization=authorization, market_id=market_id, market_type=market_type, account_index=account_index, order_index=order_index, sort_dir=sort_dir, cursor=cursor, var_from=var_from, ask_filter=ask_filter, role=role, type=type, aggregate=aggregate, skip_ask_order_id=skip_ask_order_id, skip_bid_order_id=skip_bid_order_id, integrator_account_index=integrator_account_index, order_index_str=order_index_str) print("The response of OrderApi->trades:\n") pprint(api_response) except Exception as e: @@ -1051,6 +1053,8 @@ Name | Type | Description | Notes **aggregate** | **bool**| | [optional] [default to False] **skip_ask_order_id** | **str**| | [optional] **skip_bid_order_id** | **str**| | [optional] + **integrator_account_index** | **int**| | [optional] + **order_index_str** | **str**| takes precedence over order_index; for clients that cannot represent uint64 exactly | [optional] ### Return type diff --git a/docs/PortfolioApi.md b/docs/PortfolioApi.md new file mode 100644 index 0000000..db45b13 --- /dev/null +++ b/docs/PortfolioApi.md @@ -0,0 +1,88 @@ +# lighter.PortfolioApi + +All URIs are relative to *https://mainnet.zklighter.elliot.ai* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**portfolio_bo_pnl**](PortfolioApi.md#portfolio_bo_pnl) | **GET** /api/v1/portfolio/boPnl | portfolio_boPnl + + +# **portfolio_bo_pnl** +> RespGetBoPnL portfolio_bo_pnl(account_index, authorization=authorization, auth=auth, event_id=event_id, cursor=cursor, limit=limit) + +portfolio_boPnl + +Get binary-options realized PnL for an authenticated account, grouped by event and ordered newest event first. cursor is an exclusive event id; event_id returns a single event. Every outcome the account has traded is reported, including markets still open or unsettled, so an entry never disappears as the account trades. Per outcome, total_pnl is all realized PnL so far including settlement, and settlement_pnl is null until the market settles with a position to settle, then the string 0.000000 for an actual zero-PnL settlement. An event's total_pnl is the sum of its listed outcomes. Missing display metadata uses zero/empty values. + +### Example + + +```python +import lighter +from lighter.models.resp_get_bo_pn_l import RespGetBoPnL +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.PortfolioApi(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) + event_id = 56 # int | (optional) + cursor = 56 # int | (optional) + limit = 56 # int | (optional) + + try: + # portfolio_boPnl + api_response = await api_instance.portfolio_bo_pnl(account_index, authorization=authorization, auth=auth, event_id=event_id, cursor=cursor, limit=limit) + print("The response of PortfolioApi->portfolio_bo_pnl:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling PortfolioApi->portfolio_bo_pnl: %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] + **event_id** | **int**| | [optional] + **cursor** | **int**| | [optional] + **limit** | **int**| | [optional] + +### Return type + +[**RespGetBoPnL**](RespGetBoPnL.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/PriceOracleMarket.md b/docs/PriceOracleMarket.md new file mode 100644 index 0000000..93ce3e6 --- /dev/null +++ b/docs/PriceOracleMarket.md @@ -0,0 +1,31 @@ +# PriceOracleMarket + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**symbol** | **str** | | +**index** | [**PriceOraclePrice**](PriceOraclePrice.md) | | +**mark** | [**PriceOraclePrice**](PriceOraclePrice.md) | | + +## Example + +```python +from lighter.models.price_oracle_market import PriceOracleMarket + +# TODO update the JSON string below +json = "{}" +# create an instance of PriceOracleMarket from a JSON string +price_oracle_market_instance = PriceOracleMarket.from_json(json) +# print the JSON string representation of the object +print(PriceOracleMarket.to_json()) + +# convert the object into a dict +price_oracle_market_dict = price_oracle_market_instance.to_dict() +# create an instance of PriceOracleMarket from a dict +price_oracle_market_from_dict = PriceOracleMarket.from_dict(price_oracle_market_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/PriceOraclePrice.md b/docs/PriceOraclePrice.md new file mode 100644 index 0000000..c06fdf1 --- /dev/null +++ b/docs/PriceOraclePrice.md @@ -0,0 +1,34 @@ +# PriceOraclePrice + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**source** | **str** | | +**using_median** | **bool** | | +**using_internal_price** | **bool** | | +**median_sources** | **List[str]** | | +**price_cap_bps** | **float** | | +**price_cap_reference_price** | **float** | cap bounds: ref * (1 -/+ bps / 10000) | + +## Example + +```python +from lighter.models.price_oracle_price import PriceOraclePrice + +# TODO update the JSON string below +json = "{}" +# create an instance of PriceOraclePrice from a JSON string +price_oracle_price_instance = PriceOraclePrice.from_json(json) +# print the JSON string representation of the object +print(PriceOraclePrice.to_json()) + +# convert the object into a dict +price_oracle_price_dict = price_oracle_price_instance.to_dict() +# create an instance of PriceOraclePrice from a dict +price_oracle_price_from_dict = PriceOraclePrice.from_dict(price_oracle_price_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/RespGetBoPnL.md b/docs/RespGetBoPnL.md new file mode 100644 index 0000000..ef45558 --- /dev/null +++ b/docs/RespGetBoPnL.md @@ -0,0 +1,32 @@ +# RespGetBoPnL + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**events** | [**List[BoEventPnL]**](BoEventPnL.md) | | +**next_cursor** | **int** | | [optional] + +## Example + +```python +from lighter.models.resp_get_bo_pn_l import RespGetBoPnL + +# TODO update the JSON string below +json = "{}" +# create an instance of RespGetBoPnL from a JSON string +resp_get_bo_pn_l_instance = RespGetBoPnL.from_json(json) +# print the JSON string representation of the object +print(RespGetBoPnL.to_json()) + +# convert the object into a dict +resp_get_bo_pn_l_dict = resp_get_bo_pn_l_instance.to_dict() +# create an instance of RespGetBoPnL from a dict +resp_get_bo_pn_l_from_dict = RespGetBoPnL.from_dict(resp_get_bo_pn_l_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/RespGetEvents.md b/docs/RespGetEvents.md new file mode 100644 index 0000000..8152530 --- /dev/null +++ b/docs/RespGetEvents.md @@ -0,0 +1,32 @@ +# RespGetEvents + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**next_cursor** | **int** | | [optional] +**events** | [**List[EventDetail]**](EventDetail.md) | | + +## Example + +```python +from lighter.models.resp_get_events import RespGetEvents + +# TODO update the JSON string below +json = "{}" +# create an instance of RespGetEvents from a JSON string +resp_get_events_instance = RespGetEvents.from_json(json) +# print the JSON string representation of the object +print(RespGetEvents.to_json()) + +# convert the object into a dict +resp_get_events_dict = resp_get_events_instance.to_dict() +# create an instance of RespGetEvents from a dict +resp_get_events_from_dict = RespGetEvents.from_dict(resp_get_events_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/RespGetUpDownCandles.md b/docs/RespGetUpDownCandles.md new file mode 100644 index 0000000..65936e8 --- /dev/null +++ b/docs/RespGetUpDownCandles.md @@ -0,0 +1,32 @@ +# RespGetUpDownCandles + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**candles** | [**List[UpDownCandle]**](UpDownCandle.md) | ascending by timestamp | +**next_cursor** | **int** | start_timestamp of the next page; 0 when the range is exhausted | [optional] + +## Example + +```python +from lighter.models.resp_get_up_down_candles import RespGetUpDownCandles + +# TODO update the JSON string below +json = "{}" +# create an instance of RespGetUpDownCandles from a JSON string +resp_get_up_down_candles_instance = RespGetUpDownCandles.from_json(json) +# print the JSON string representation of the object +print(RespGetUpDownCandles.to_json()) + +# convert the object into a dict +resp_get_up_down_candles_dict = resp_get_up_down_candles_instance.to_dict() +# create an instance of RespGetUpDownCandles from a dict +resp_get_up_down_candles_from_dict = RespGetUpDownCandles.from_dict(resp_get_up_down_candles_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/RespPriceOracleInfo.md b/docs/RespPriceOracleInfo.md new file mode 100644 index 0000000..dec9516 --- /dev/null +++ b/docs/RespPriceOracleInfo.md @@ -0,0 +1,32 @@ +# RespPriceOracleInfo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**computed_at_ms** | **int** | | +**markets** | [**List[PriceOracleMarket]**](PriceOracleMarket.md) | | + +## Example + +```python +from lighter.models.resp_price_oracle_info import RespPriceOracleInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of RespPriceOracleInfo from a JSON string +resp_price_oracle_info_instance = RespPriceOracleInfo.from_json(json) +# print the JSON string representation of the object +print(RespPriceOracleInfo.to_json()) + +# convert the object into a dict +resp_price_oracle_info_dict = resp_price_oracle_info_instance.to_dict() +# create an instance of RespPriceOracleInfo from a dict +resp_price_oracle_info_from_dict = RespPriceOracleInfo.from_dict(resp_price_oracle_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/UpDownCandle.md b/docs/UpDownCandle.md new file mode 100644 index 0000000..769f894 --- /dev/null +++ b/docs/UpDownCandle.md @@ -0,0 +1,39 @@ +# UpDownCandle + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**symbol** | **str** | | +**duration** | **str** | | +**resolution** | **str** | | +**timestamp** | **int** | bucket start, unix seconds | +**open** | **str** | exact provider prices, decimal strings | +**high** | **str** | | +**low** | **str** | | +**close** | **str** | | +**sample_count** | **int** | observations in the candle: orders live updates of the same bucket, not served | +**provider** | **str** | provider feed of the last observation of the candle | +**feed_id** | **str** | | + +## Example + +```python +from lighter.models.up_down_candle import UpDownCandle + +# TODO update the JSON string below +json = "{}" +# create an instance of UpDownCandle from a JSON string +up_down_candle_instance = UpDownCandle.from_json(json) +# print the JSON string representation of the object +print(UpDownCandle.to_json()) + +# convert the object into a dict +up_down_candle_dict = up_down_candle_instance.to_dict() +# create an instance of UpDownCandle from a dict +up_down_candle_from_dict = UpDownCandle.from_dict(up_down_candle_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/UpdownApi.md b/docs/UpdownApi.md new file mode 100644 index 0000000..a1d49d1 --- /dev/null +++ b/docs/UpdownApi.md @@ -0,0 +1,88 @@ +# lighter.UpdownApi + +All URIs are relative to *https://mainnet.zklighter.elliot.ai* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**up_down_candles**](UpdownApi.md#up_down_candles) | **GET** /api/v1/upDownCandles | upDownCandles + + +# **up_down_candles** +> RespGetUpDownCandles up_down_candles(symbol, duration, start_timestamp, end_timestamp, resolution=resolution, limit=limit) + +upDownCandles + +Get the OHLC candles (1s = the exact price observations, or 30s) of an up/down market series (symbol + duration, e.g. btc/5m) in a bounded time range (at most 24h), oldest first. Pass next_cursor as start_timestamp to page forward; live candles are on the up_down_candle/// websocket channel. + +### Example + + +```python +import lighter +from lighter.models.resp_get_up_down_candles import RespGetUpDownCandles +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.UpdownApi(api_client) + symbol = 'symbol_example' # str | market series: underlying (case-insensitive) ... + duration = 'duration_example' # str | ... and market duration, e.g. 30s or 5m + start_timestamp = 56 # int | inclusive bucket start, seconds + end_timestamp = 56 # int | inclusive, seconds; at most 24h after start_timestamp + resolution = 1s # str | 1s candles are the observations themselves (optional) (default to 1s) + limit = 56 # int | (optional) + + try: + # upDownCandles + api_response = await api_instance.up_down_candles(symbol, duration, start_timestamp, end_timestamp, resolution=resolution, limit=limit) + print("The response of UpdownApi->up_down_candles:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling UpdownApi->up_down_candles: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **str**| market series: underlying (case-insensitive) ... | + **duration** | **str**| ... and market duration, e.g. 30s or 5m | + **start_timestamp** | **int**| inclusive bucket start, seconds | + **end_timestamp** | **int**| inclusive, seconds; at most 24h after start_timestamp | + **resolution** | **str**| 1s candles are the observations themselves | [optional] [default to 1s] + **limit** | **int**| | [optional] + +### Return type + +[**RespGetUpDownCandles**](RespGetUpDownCandles.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/examples/binary-options/create_order_from_event.py b/examples/binary-options/create_order_from_event.py new file mode 100644 index 0000000..7817b63 --- /dev/null +++ b/examples/binary-options/create_order_from_event.py @@ -0,0 +1,50 @@ +import asyncio +import time +import lighter +from examples.utils import default_example_setup + +TAG = "eth-updown-15m" +SHARES = 10 +PRICE_PCT = 60 # buy YES at 60% of settlement_cap == 0.60 implied probability + + +async def main(): + client, api_client, _ = default_example_setup() + + # Binary options markets are not listed by /orderBooks, discover them through /events. + # Filter by series tag (e.g. btc-updown-30s, eth-updown-5m) and pick the market that resolves soonest. + events = await lighter.EventApi(api_client).events(active=True, tag=TAG, limit=10) + now_ms = int(time.time() * 1000) + market = min( + (ob for event in events.events for ob in event.order_books if ob.end_timestamp > now_ms), + key=lambda ob: ob.end_timestamp, + ) + print( + f"{market.symbol} market_id={market.market_id} settlement_cap={market.settlement_cap} " + f"best_bid={market.stats.best_bid_price or 'none'} best_ask={market.stats.best_ask_price or 'none'}" + ) + + # Prices are ticks between 0 and settlement_cap (the payout of a winning share). + # Buy = YES, sell = NO. + price = market.settlement_cap * PRICE_PCT // 100 + base_amount = SHARES * 10**market.size_decimals + + tx, tx_hash, err = await client.create_order( + market_index=market.market_id, + client_order_index=0, + base_amount=base_amount, + price=price, + is_ask=False, + order_type=client.ORDER_TYPE_LIMIT, + time_in_force=client.ORDER_TIME_IN_FORCE_GOOD_TILL_TIME, + ) + print(f"Create Order {tx=} {tx_hash=} {err=}") + if err is not None: + raise Exception(err) + + await client.close() + await api_client.close() + + +if __name__ == "__main__": + asyncio.run(main()) \ No newline at end of file diff --git a/lighter/__init__.py b/lighter/__init__.py index 3c85127..3e2a9b7 100644 --- a/lighter/__init__.py +++ b/lighter/__init__.py @@ -22,15 +22,18 @@ from lighter.api.block_api import BlockApi from lighter.api.bridge_api import BridgeApi from lighter.api.candlestick_api import CandlestickApi +from lighter.api.event_api import EventApi from lighter.api.funding_api import FundingApi from lighter.api.info_api import InfoApi from lighter.api.livepoints_api import LivepointsApi from lighter.api.notification_api import NotificationApi from lighter.api.order_api import OrderApi +from lighter.api.portfolio_api import PortfolioApi from lighter.api.referral_api import ReferralApi from lighter.api.root_api import RootApi from lighter.api.tokenlist_api import TokenlistApi from lighter.api.transaction_api import TransactionApi +from lighter.api.updown_api import UpdownApi # import ApiClient from lighter.api_response import ApiResponse @@ -59,8 +62,11 @@ from lighter.models.approved_integrator import ApprovedIntegrator from lighter.models.asset import Asset from lighter.models.asset_details import AssetDetails +from lighter.models.binary_option_market_stats import BinaryOptionMarketStats from lighter.models.block import Block from lighter.models.blocks import Blocks +from lighter.models.bo_event_pn_l import BoEventPnL +from lighter.models.bo_outcome_pn_l import BoOutcomePnL from lighter.models.bridge_supported_network import BridgeSupportedNetwork from lighter.models.bridge_supported_networks import BridgeSupportedNetworks from lighter.models.candle import Candle @@ -75,6 +81,8 @@ from lighter.models.detailed_account import DetailedAccount from lighter.models.detailed_accounts import DetailedAccounts from lighter.models.enriched_tx import EnrichedTx +from lighter.models.event_detail import EventDetail +from lighter.models.event_order_book_entry import EventOrderBookEntry from lighter.models.exchange_metric import ExchangeMetric from lighter.models.exchange_stats import ExchangeStats from lighter.models.execute_stat import ExecuteStat @@ -117,9 +125,15 @@ 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_oracle_market import PriceOracleMarket +from lighter.models.price_oracle_price import PriceOraclePrice from lighter.models.public_pool_info import PublicPoolInfo from lighter.models.public_pool_metadata import PublicPoolMetadata from lighter.models.public_pool_share import PublicPoolShare +from lighter.models.resp_get_bo_pn_l import RespGetBoPnL +from lighter.models.resp_get_events import RespGetEvents +from lighter.models.resp_get_up_down_candles import RespGetUpDownCandles +from lighter.models.resp_price_oracle_info import RespPriceOracleInfo from lighter.models.rfq_entry import RFQEntry from lighter.models.rfq_metadata import RFQMetadata from lighter.models.rfq_response_entry import RFQResponseEntry @@ -179,6 +193,7 @@ from lighter.models.tx import Tx from lighter.models.tx_hash import TxHash from lighter.models.txs import Txs +from lighter.models.up_down_candle import UpDownCandle from lighter.models.user_referrals import UserReferrals from lighter.models.validator_info import ValidatorInfo from lighter.models.withdraw_history import WithdrawHistory diff --git a/lighter/api/__init__.py b/lighter/api/__init__.py index ca0290d..38006d3 100644 --- a/lighter/api/__init__.py +++ b/lighter/api/__init__.py @@ -6,13 +6,16 @@ from lighter.api.block_api import BlockApi from lighter.api.bridge_api import BridgeApi from lighter.api.candlestick_api import CandlestickApi +from lighter.api.event_api import EventApi from lighter.api.funding_api import FundingApi from lighter.api.info_api import InfoApi from lighter.api.livepoints_api import LivepointsApi from lighter.api.notification_api import NotificationApi from lighter.api.order_api import OrderApi +from lighter.api.portfolio_api import PortfolioApi from lighter.api.referral_api import ReferralApi from lighter.api.root_api import RootApi from lighter.api.tokenlist_api import TokenlistApi from lighter.api.transaction_api import TransactionApi +from lighter.api.updown_api import UpdownApi diff --git a/lighter/api/account_api.py b/lighter/api/account_api.py index 7c97b0b..b670050 100644 --- a/lighter/api/account_api.py +++ b/lighter/api/account_api.py @@ -1535,7 +1535,7 @@ async def change_account_tier( ) -> RespChangeAccountTier: """changeAccountTier - Change account type (applies to both master, and subaccounts). Downgrades can be performed once every 24 hours. + Change account tier. You can only perform this action once every 24 hours. :param account_index: (required) :type account_index: int @@ -1610,7 +1610,7 @@ async def change_account_tier_with_http_info( ) -> ApiResponse[RespChangeAccountTier]: """changeAccountTier - Change account type (applies to both master, and subaccounts). Downgrades can be performed once every 24 hours. + Change account tier. You can only perform this action once every 24 hours. :param account_index: (required) :type account_index: int @@ -1685,7 +1685,7 @@ async def change_account_tier_without_preload_content( ) -> RESTResponseType: """changeAccountTier - Change account type (applies to both master, and subaccounts). Downgrades can be performed once every 24 hours. + Change account tier. You can only perform this action once every 24 hours. :param account_index: (required) :type account_index: int diff --git a/lighter/api/candlestick_api.py b/lighter/api/candlestick_api.py index 84984bf..f6d9d29 100644 --- a/lighter/api/candlestick_api.py +++ b/lighter/api/candlestick_api.py @@ -50,6 +50,7 @@ async def candles( end_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], count_back: StrictInt, set_timestamp_to_end: Optional[StrictBool] = None, + merge_mark_price: Optional[StrictBool] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -79,6 +80,8 @@ async def candles( :type count_back: int :param set_timestamp_to_end: :type set_timestamp_to_end: bool + :param merge_mark_price: + :type merge_mark_price: 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 @@ -108,6 +111,7 @@ async def candles( end_timestamp=end_timestamp, count_back=count_back, set_timestamp_to_end=set_timestamp_to_end, + merge_mark_price=merge_mark_price, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -137,6 +141,7 @@ async def candles_with_http_info( end_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], count_back: StrictInt, set_timestamp_to_end: Optional[StrictBool] = None, + merge_mark_price: Optional[StrictBool] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -166,6 +171,8 @@ async def candles_with_http_info( :type count_back: int :param set_timestamp_to_end: :type set_timestamp_to_end: bool + :param merge_mark_price: + :type merge_mark_price: 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 @@ -195,6 +202,7 @@ async def candles_with_http_info( end_timestamp=end_timestamp, count_back=count_back, set_timestamp_to_end=set_timestamp_to_end, + merge_mark_price=merge_mark_price, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -224,6 +232,7 @@ async def candles_without_preload_content( end_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], count_back: StrictInt, set_timestamp_to_end: Optional[StrictBool] = None, + merge_mark_price: Optional[StrictBool] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -253,6 +262,8 @@ async def candles_without_preload_content( :type count_back: int :param set_timestamp_to_end: :type set_timestamp_to_end: bool + :param merge_mark_price: + :type merge_mark_price: 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 @@ -282,6 +293,7 @@ async def candles_without_preload_content( end_timestamp=end_timestamp, count_back=count_back, set_timestamp_to_end=set_timestamp_to_end, + merge_mark_price=merge_mark_price, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -307,6 +319,7 @@ def _candles_serialize( end_timestamp, count_back, set_timestamp_to_end, + merge_mark_price, _request_auth, _content_type, _headers, @@ -351,6 +364,10 @@ def _candles_serialize( _query_params.append(('set_timestamp_to_end', set_timestamp_to_end)) + if merge_mark_price is not None: + + _query_params.append(('merge_mark_price', merge_mark_price)) + # process the header parameters # process the form parameters # process the body parameter diff --git a/lighter/api/event_api.py b/lighter/api/event_api.py new file mode 100644 index 0000000..8f4c362 --- /dev/null +++ b/lighter/api/event_api.py @@ -0,0 +1,486 @@ +# 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, StrictBool, StrictInt, StrictStr, field_validator +from typing import Optional +from typing_extensions import Annotated +from lighter.models.resp_get_events import RespGetEvents + +from lighter.api_client import ApiClient, RequestSerialized +from lighter.api_response import ApiResponse +from lighter.rest import RESTResponseType + + +class EventApi: + """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 + + + async def events( + self, + event_ids: Annotated[Optional[StrictStr], Field(description=" comma-separated positive IDs, max 50")] = None, + market_ids: Annotated[Optional[StrictStr], Field(description=" comma-separated positive IDs, max 50")] = None, + creator_account_index: Optional[StrictInt] = None, + cursor: Optional[StrictInt] = None, + active: Annotated[Optional[StrictBool], Field(description=" true: at least one outcome still tradeable; false: none")] = None, + limit: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = None, + tag: Annotated[Optional[StrictStr], Field(description=" series tag; creator filter is optional")] = None, + event_kind: Optional[StrictStr] = None, + start_from: Annotated[Optional[StrictInt], Field(description=" inclusive occurrence start, Unix milliseconds")] = None, + start_before: Annotated[Optional[StrictInt], Field(description=" exclusive occurrence start, Unix milliseconds")] = None, + sort: Optional[StrictStr] = None, + order: 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, + ) -> RespGetEvents: + """events + + Get events and registered order books, including scheduled events with no books. event_ids and market_ids accept up to 50 comma-separated positive IDs, are mutually exclusive, and use the same filters, sorting and pagination. market_ids returns each related event once with all its order books. Defaults to descending id. Occurrence sorting uses (occurrence_start_at, event_id); cursor identifies an existing event and excludes it in the requested direction. tag filters across creators; creator_account_index is an optional additional filter. active=true requires a tradeable outcome; active=false includes scheduled and closed events. + + :param event_ids: comma-separated positive IDs, max 50 + :type event_ids: str + :param market_ids: comma-separated positive IDs, max 50 + :type market_ids: str + :param creator_account_index: + :type creator_account_index: int + :param cursor: + :type cursor: int + :param active: true: at least one outcome still tradeable; false: none + :type active: bool + :param limit: + :type limit: int + :param tag: series tag; creator filter is optional + :type tag: str + :param event_kind: + :type event_kind: str + :param start_from: inclusive occurrence start, Unix milliseconds + :type start_from: int + :param start_before: exclusive occurrence start, Unix milliseconds + :type start_before: int + :param sort: + :type sort: str + :param order: + :type order: 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._events_serialize( + event_ids=event_ids, + market_ids=market_ids, + creator_account_index=creator_account_index, + cursor=cursor, + active=active, + limit=limit, + tag=tag, + event_kind=event_kind, + start_from=start_from, + start_before=start_before, + sort=sort, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespGetEvents", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + async def events_with_http_info( + self, + event_ids: Annotated[Optional[StrictStr], Field(description=" comma-separated positive IDs, max 50")] = None, + market_ids: Annotated[Optional[StrictStr], Field(description=" comma-separated positive IDs, max 50")] = None, + creator_account_index: Optional[StrictInt] = None, + cursor: Optional[StrictInt] = None, + active: Annotated[Optional[StrictBool], Field(description=" true: at least one outcome still tradeable; false: none")] = None, + limit: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = None, + tag: Annotated[Optional[StrictStr], Field(description=" series tag; creator filter is optional")] = None, + event_kind: Optional[StrictStr] = None, + start_from: Annotated[Optional[StrictInt], Field(description=" inclusive occurrence start, Unix milliseconds")] = None, + start_before: Annotated[Optional[StrictInt], Field(description=" exclusive occurrence start, Unix milliseconds")] = None, + sort: Optional[StrictStr] = None, + order: 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[RespGetEvents]: + """events + + Get events and registered order books, including scheduled events with no books. event_ids and market_ids accept up to 50 comma-separated positive IDs, are mutually exclusive, and use the same filters, sorting and pagination. market_ids returns each related event once with all its order books. Defaults to descending id. Occurrence sorting uses (occurrence_start_at, event_id); cursor identifies an existing event and excludes it in the requested direction. tag filters across creators; creator_account_index is an optional additional filter. active=true requires a tradeable outcome; active=false includes scheduled and closed events. + + :param event_ids: comma-separated positive IDs, max 50 + :type event_ids: str + :param market_ids: comma-separated positive IDs, max 50 + :type market_ids: str + :param creator_account_index: + :type creator_account_index: int + :param cursor: + :type cursor: int + :param active: true: at least one outcome still tradeable; false: none + :type active: bool + :param limit: + :type limit: int + :param tag: series tag; creator filter is optional + :type tag: str + :param event_kind: + :type event_kind: str + :param start_from: inclusive occurrence start, Unix milliseconds + :type start_from: int + :param start_before: exclusive occurrence start, Unix milliseconds + :type start_before: int + :param sort: + :type sort: str + :param order: + :type order: 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._events_serialize( + event_ids=event_ids, + market_ids=market_ids, + creator_account_index=creator_account_index, + cursor=cursor, + active=active, + limit=limit, + tag=tag, + event_kind=event_kind, + start_from=start_from, + start_before=start_before, + sort=sort, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespGetEvents", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + async def events_without_preload_content( + self, + event_ids: Annotated[Optional[StrictStr], Field(description=" comma-separated positive IDs, max 50")] = None, + market_ids: Annotated[Optional[StrictStr], Field(description=" comma-separated positive IDs, max 50")] = None, + creator_account_index: Optional[StrictInt] = None, + cursor: Optional[StrictInt] = None, + active: Annotated[Optional[StrictBool], Field(description=" true: at least one outcome still tradeable; false: none")] = None, + limit: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = None, + tag: Annotated[Optional[StrictStr], Field(description=" series tag; creator filter is optional")] = None, + event_kind: Optional[StrictStr] = None, + start_from: Annotated[Optional[StrictInt], Field(description=" inclusive occurrence start, Unix milliseconds")] = None, + start_before: Annotated[Optional[StrictInt], Field(description=" exclusive occurrence start, Unix milliseconds")] = None, + sort: Optional[StrictStr] = None, + order: 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: + """events + + Get events and registered order books, including scheduled events with no books. event_ids and market_ids accept up to 50 comma-separated positive IDs, are mutually exclusive, and use the same filters, sorting and pagination. market_ids returns each related event once with all its order books. Defaults to descending id. Occurrence sorting uses (occurrence_start_at, event_id); cursor identifies an existing event and excludes it in the requested direction. tag filters across creators; creator_account_index is an optional additional filter. active=true requires a tradeable outcome; active=false includes scheduled and closed events. + + :param event_ids: comma-separated positive IDs, max 50 + :type event_ids: str + :param market_ids: comma-separated positive IDs, max 50 + :type market_ids: str + :param creator_account_index: + :type creator_account_index: int + :param cursor: + :type cursor: int + :param active: true: at least one outcome still tradeable; false: none + :type active: bool + :param limit: + :type limit: int + :param tag: series tag; creator filter is optional + :type tag: str + :param event_kind: + :type event_kind: str + :param start_from: inclusive occurrence start, Unix milliseconds + :type start_from: int + :param start_before: exclusive occurrence start, Unix milliseconds + :type start_before: int + :param sort: + :type sort: str + :param order: + :type order: 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._events_serialize( + event_ids=event_ids, + market_ids=market_ids, + creator_account_index=creator_account_index, + cursor=cursor, + active=active, + limit=limit, + tag=tag, + event_kind=event_kind, + start_from=start_from, + start_before=start_before, + sort=sort, + order=order, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespGetEvents", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _events_serialize( + self, + event_ids, + market_ids, + creator_account_index, + cursor, + active, + limit, + tag, + event_kind, + start_from, + start_before, + sort, + order, + _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 event_ids is not None: + + _query_params.append(('event_ids', event_ids)) + + if market_ids is not None: + + _query_params.append(('market_ids', market_ids)) + + if creator_account_index is not None: + + _query_params.append(('creator_account_index', creator_account_index)) + + if cursor is not None: + + _query_params.append(('cursor', cursor)) + + if active is not None: + + _query_params.append(('active', active)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if tag is not None: + + _query_params.append(('tag', tag)) + + if event_kind is not None: + + _query_params.append(('event_kind', event_kind)) + + if start_from is not None: + + _query_params.append(('start_from', start_from)) + + if start_before is not None: + + _query_params.append(('start_before', start_before)) + + if sort is not None: + + _query_params.append(('sort', sort)) + + if order is not None: + + _query_params.append(('order', order)) + + # 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/events', + 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/info_api.py b/lighter/api/info_api.py index a64b51c..6547802 100644 --- a/lighter/api/info_api.py +++ b/lighter/api/info_api.py @@ -19,6 +19,7 @@ from pydantic import StrictInt, StrictStr from typing import Optional from lighter.models.layer1_basic_info import Layer1BasicInfo +from lighter.models.resp_price_oracle_info import RespPriceOracleInfo from lighter.models.resp_synthetic_spot_info import RespSyntheticSpotInfo from lighter.models.resp_withdrawal_delay import RespWithdrawalDelay from lighter.models.system_config import SystemConfig @@ -285,6 +286,266 @@ def _layer1_basic_info_serialize( + async def price_oracle_info( + self, + symbol: 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, + ) -> RespPriceOracleInfo: + """priceOracleInfo + + Get price oracle info (source in use, median exchanges, price cap) for all markets or a single symbol + + :param symbol: + :type symbol: 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._price_oracle_info_serialize( + symbol=symbol, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespPriceOracleInfo", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + async def price_oracle_info_with_http_info( + self, + symbol: 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[RespPriceOracleInfo]: + """priceOracleInfo + + Get price oracle info (source in use, median exchanges, price cap) for all markets or a single symbol + + :param symbol: + :type symbol: 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._price_oracle_info_serialize( + symbol=symbol, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespPriceOracleInfo", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + async def price_oracle_info_without_preload_content( + self, + symbol: 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: + """priceOracleInfo + + Get price oracle info (source in use, median exchanges, price cap) for all markets or a single symbol + + :param symbol: + :type symbol: 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._price_oracle_info_serialize( + symbol=symbol, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespPriceOracleInfo", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _price_oracle_info_serialize( + self, + symbol, + _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 symbol is not None: + + _query_params.append(('symbol', symbol)) + + # 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/priceOracleInfo', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + async def synthetic_spot_info( self, symbol: StrictStr, diff --git a/lighter/api/order_api.py b/lighter/api/order_api.py index 522dec2..aa8e530 100644 --- a/lighter/api/order_api.py +++ b/lighter/api/order_api.py @@ -3949,6 +3949,8 @@ async def trades( aggregate: Optional[StrictBool] = None, skip_ask_order_id: Optional[StrictStr] = None, skip_bid_order_id: Optional[StrictStr] = None, + integrator_account_index: Optional[StrictInt] = None, + order_index_str: Annotated[Optional[StrictStr], Field(description=" takes precedence over order_index; for clients that cannot represent uint64 exactly")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3998,6 +4000,10 @@ async def trades( :type skip_ask_order_id: str :param skip_bid_order_id: :type skip_bid_order_id: str + :param integrator_account_index: + :type integrator_account_index: int + :param order_index_str: takes precedence over order_index; for clients that cannot represent uint64 exactly + :type order_index_str: 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 @@ -4037,6 +4043,8 @@ async def trades( aggregate=aggregate, skip_ask_order_id=skip_ask_order_id, skip_bid_order_id=skip_bid_order_id, + integrator_account_index=integrator_account_index, + order_index_str=order_index_str, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4076,6 +4084,8 @@ async def trades_with_http_info( aggregate: Optional[StrictBool] = None, skip_ask_order_id: Optional[StrictStr] = None, skip_bid_order_id: Optional[StrictStr] = None, + integrator_account_index: Optional[StrictInt] = None, + order_index_str: Annotated[Optional[StrictStr], Field(description=" takes precedence over order_index; for clients that cannot represent uint64 exactly")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -4125,6 +4135,10 @@ async def trades_with_http_info( :type skip_ask_order_id: str :param skip_bid_order_id: :type skip_bid_order_id: str + :param integrator_account_index: + :type integrator_account_index: int + :param order_index_str: takes precedence over order_index; for clients that cannot represent uint64 exactly + :type order_index_str: 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 @@ -4164,6 +4178,8 @@ async def trades_with_http_info( aggregate=aggregate, skip_ask_order_id=skip_ask_order_id, skip_bid_order_id=skip_bid_order_id, + integrator_account_index=integrator_account_index, + order_index_str=order_index_str, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4203,6 +4219,8 @@ async def trades_without_preload_content( aggregate: Optional[StrictBool] = None, skip_ask_order_id: Optional[StrictStr] = None, skip_bid_order_id: Optional[StrictStr] = None, + integrator_account_index: Optional[StrictInt] = None, + order_index_str: Annotated[Optional[StrictStr], Field(description=" takes precedence over order_index; for clients that cannot represent uint64 exactly")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -4252,6 +4270,10 @@ async def trades_without_preload_content( :type skip_ask_order_id: str :param skip_bid_order_id: :type skip_bid_order_id: str + :param integrator_account_index: + :type integrator_account_index: int + :param order_index_str: takes precedence over order_index; for clients that cannot represent uint64 exactly + :type order_index_str: 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 @@ -4291,6 +4313,8 @@ async def trades_without_preload_content( aggregate=aggregate, skip_ask_order_id=skip_ask_order_id, skip_bid_order_id=skip_bid_order_id, + integrator_account_index=integrator_account_index, + order_index_str=order_index_str, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4326,6 +4350,8 @@ def _trades_serialize( aggregate, skip_ask_order_id, skip_bid_order_id, + integrator_account_index, + order_index_str, _request_auth, _content_type, _headers, @@ -4406,6 +4432,14 @@ def _trades_serialize( _query_params.append(('skip_bid_order_id', skip_bid_order_id)) + if integrator_account_index is not None: + + _query_params.append(('integrator_account_index', integrator_account_index)) + + if order_index_str is not None: + + _query_params.append(('order_index_str', order_index_str)) + # process the header parameters if authorization is not None: _header_params['authorization'] = authorization diff --git a/lighter/api/portfolio_api.py b/lighter/api/portfolio_api.py new file mode 100644 index 0000000..967d5d1 --- /dev/null +++ b/lighter/api/portfolio_api.py @@ -0,0 +1,384 @@ +# 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.resp_get_bo_pn_l import RespGetBoPnL + +from lighter.api_client import ApiClient, RequestSerialized +from lighter.api_response import ApiResponse +from lighter.rest import RESTResponseType + + +class PortfolioApi: + """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 + + + async def portfolio_bo_pnl( + 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, + event_id: Optional[StrictInt] = None, + cursor: Optional[StrictInt] = None, + limit: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = 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, + ) -> RespGetBoPnL: + """portfolio_boPnl + + Get binary-options realized PnL for an authenticated account, grouped by event and ordered newest event first. cursor is an exclusive event id; event_id returns a single event. Every outcome the account has traded is reported, including markets still open or unsettled, so an entry never disappears as the account trades. Per outcome, total_pnl is all realized PnL so far including settlement, and settlement_pnl is null until the market settles with a position to settle, then the string 0.000000 for an actual zero-PnL settlement. An event's total_pnl is the sum of its listed outcomes. Missing display metadata uses zero/empty values. + + :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 event_id: + :type event_id: int + :param cursor: + :type cursor: int + :param limit: + :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 + (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._portfolio_bo_pnl_serialize( + account_index=account_index, + authorization=authorization, + auth=auth, + event_id=event_id, + cursor=cursor, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespGetBoPnL", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + async def portfolio_bo_pnl_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, + event_id: Optional[StrictInt] = None, + cursor: Optional[StrictInt] = None, + limit: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = 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[RespGetBoPnL]: + """portfolio_boPnl + + Get binary-options realized PnL for an authenticated account, grouped by event and ordered newest event first. cursor is an exclusive event id; event_id returns a single event. Every outcome the account has traded is reported, including markets still open or unsettled, so an entry never disappears as the account trades. Per outcome, total_pnl is all realized PnL so far including settlement, and settlement_pnl is null until the market settles with a position to settle, then the string 0.000000 for an actual zero-PnL settlement. An event's total_pnl is the sum of its listed outcomes. Missing display metadata uses zero/empty values. + + :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 event_id: + :type event_id: int + :param cursor: + :type cursor: int + :param limit: + :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 + (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._portfolio_bo_pnl_serialize( + account_index=account_index, + authorization=authorization, + auth=auth, + event_id=event_id, + cursor=cursor, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespGetBoPnL", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + async def portfolio_bo_pnl_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, + event_id: Optional[StrictInt] = None, + cursor: Optional[StrictInt] = None, + limit: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = 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: + """portfolio_boPnl + + Get binary-options realized PnL for an authenticated account, grouped by event and ordered newest event first. cursor is an exclusive event id; event_id returns a single event. Every outcome the account has traded is reported, including markets still open or unsettled, so an entry never disappears as the account trades. Per outcome, total_pnl is all realized PnL so far including settlement, and settlement_pnl is null until the market settles with a position to settle, then the string 0.000000 for an actual zero-PnL settlement. An event's total_pnl is the sum of its listed outcomes. Missing display metadata uses zero/empty values. + + :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 event_id: + :type event_id: int + :param cursor: + :type cursor: int + :param limit: + :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 + (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._portfolio_bo_pnl_serialize( + account_index=account_index, + authorization=authorization, + auth=auth, + event_id=event_id, + cursor=cursor, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespGetBoPnL", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _portfolio_bo_pnl_serialize( + self, + account_index, + authorization, + auth, + event_id, + cursor, + limit, + _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 authorization is not None: + + _query_params.append(('authorization', authorization)) + + if auth is not None: + + _query_params.append(('auth', auth)) + + if account_index is not None: + + _query_params.append(('account_index', account_index)) + + if event_id is not None: + + _query_params.append(('event_id', event_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 + # 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/portfolio/boPnl', + 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/updown_api.py b/lighter/api/updown_api.py new file mode 100644 index 0000000..b1032bb --- /dev/null +++ b/lighter/api/updown_api.py @@ -0,0 +1,384 @@ +# 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, StrictStr, field_validator +from typing import Optional +from typing_extensions import Annotated +from lighter.models.resp_get_up_down_candles import RespGetUpDownCandles + +from lighter.api_client import ApiClient, RequestSerialized +from lighter.api_response import ApiResponse +from lighter.rest import RESTResponseType + + +class UpdownApi: + """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 + + + async def up_down_candles( + self, + symbol: Annotated[StrictStr, Field(description=" market series: underlying (case-insensitive) ...")], + duration: Annotated[StrictStr, Field(description=" ... and market duration, e.g. 30s or 5m")], + start_timestamp: Annotated[int, Field(le=5000000000, strict=True, ge=0, description=" inclusive bucket start, seconds")], + end_timestamp: Annotated[int, Field(le=5000000000, strict=True, ge=0, description=" inclusive, seconds; at most 24h after start_timestamp")], + resolution: Annotated[Optional[StrictStr], Field(description=" 1s candles are the observations themselves")] = None, + limit: Optional[Annotated[int, Field(le=3600, strict=True, ge=1)]] = 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, + ) -> RespGetUpDownCandles: + """upDownCandles + + Get the OHLC candles (1s = the exact price observations, or 30s) of an up/down market series (symbol + duration, e.g. btc/5m) in a bounded time range (at most 24h), oldest first. Pass next_cursor as start_timestamp to page forward; live candles are on the up_down_candle/// websocket channel. + + :param symbol: market series: underlying (case-insensitive) ... (required) + :type symbol: str + :param duration: ... and market duration, e.g. 30s or 5m (required) + :type duration: str + :param start_timestamp: inclusive bucket start, seconds (required) + :type start_timestamp: int + :param end_timestamp: inclusive, seconds; at most 24h after start_timestamp (required) + :type end_timestamp: int + :param resolution: 1s candles are the observations themselves + :type resolution: str + :param limit: + :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 + (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._up_down_candles_serialize( + symbol=symbol, + duration=duration, + start_timestamp=start_timestamp, + end_timestamp=end_timestamp, + resolution=resolution, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespGetUpDownCandles", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + async def up_down_candles_with_http_info( + self, + symbol: Annotated[StrictStr, Field(description=" market series: underlying (case-insensitive) ...")], + duration: Annotated[StrictStr, Field(description=" ... and market duration, e.g. 30s or 5m")], + start_timestamp: Annotated[int, Field(le=5000000000, strict=True, ge=0, description=" inclusive bucket start, seconds")], + end_timestamp: Annotated[int, Field(le=5000000000, strict=True, ge=0, description=" inclusive, seconds; at most 24h after start_timestamp")], + resolution: Annotated[Optional[StrictStr], Field(description=" 1s candles are the observations themselves")] = None, + limit: Optional[Annotated[int, Field(le=3600, strict=True, ge=1)]] = 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[RespGetUpDownCandles]: + """upDownCandles + + Get the OHLC candles (1s = the exact price observations, or 30s) of an up/down market series (symbol + duration, e.g. btc/5m) in a bounded time range (at most 24h), oldest first. Pass next_cursor as start_timestamp to page forward; live candles are on the up_down_candle/// websocket channel. + + :param symbol: market series: underlying (case-insensitive) ... (required) + :type symbol: str + :param duration: ... and market duration, e.g. 30s or 5m (required) + :type duration: str + :param start_timestamp: inclusive bucket start, seconds (required) + :type start_timestamp: int + :param end_timestamp: inclusive, seconds; at most 24h after start_timestamp (required) + :type end_timestamp: int + :param resolution: 1s candles are the observations themselves + :type resolution: str + :param limit: + :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 + (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._up_down_candles_serialize( + symbol=symbol, + duration=duration, + start_timestamp=start_timestamp, + end_timestamp=end_timestamp, + resolution=resolution, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespGetUpDownCandles", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + async def up_down_candles_without_preload_content( + self, + symbol: Annotated[StrictStr, Field(description=" market series: underlying (case-insensitive) ...")], + duration: Annotated[StrictStr, Field(description=" ... and market duration, e.g. 30s or 5m")], + start_timestamp: Annotated[int, Field(le=5000000000, strict=True, ge=0, description=" inclusive bucket start, seconds")], + end_timestamp: Annotated[int, Field(le=5000000000, strict=True, ge=0, description=" inclusive, seconds; at most 24h after start_timestamp")], + resolution: Annotated[Optional[StrictStr], Field(description=" 1s candles are the observations themselves")] = None, + limit: Optional[Annotated[int, Field(le=3600, strict=True, ge=1)]] = 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: + """upDownCandles + + Get the OHLC candles (1s = the exact price observations, or 30s) of an up/down market series (symbol + duration, e.g. btc/5m) in a bounded time range (at most 24h), oldest first. Pass next_cursor as start_timestamp to page forward; live candles are on the up_down_candle/// websocket channel. + + :param symbol: market series: underlying (case-insensitive) ... (required) + :type symbol: str + :param duration: ... and market duration, e.g. 30s or 5m (required) + :type duration: str + :param start_timestamp: inclusive bucket start, seconds (required) + :type start_timestamp: int + :param end_timestamp: inclusive, seconds; at most 24h after start_timestamp (required) + :type end_timestamp: int + :param resolution: 1s candles are the observations themselves + :type resolution: str + :param limit: + :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 + (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._up_down_candles_serialize( + symbol=symbol, + duration=duration, + start_timestamp=start_timestamp, + end_timestamp=end_timestamp, + resolution=resolution, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespGetUpDownCandles", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _up_down_candles_serialize( + self, + symbol, + duration, + start_timestamp, + end_timestamp, + resolution, + limit, + _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 symbol is not None: + + _query_params.append(('symbol', symbol)) + + if duration is not None: + + _query_params.append(('duration', duration)) + + 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 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/upDownCandles', + 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/models/__init__.py b/lighter/models/__init__.py index 3ec0bb3..2a21bdf 100644 --- a/lighter/models/__init__.py +++ b/lighter/models/__init__.py @@ -29,8 +29,11 @@ from lighter.models.approved_integrator import ApprovedIntegrator from lighter.models.asset import Asset from lighter.models.asset_details import AssetDetails +from lighter.models.binary_option_market_stats import BinaryOptionMarketStats from lighter.models.block import Block from lighter.models.blocks import Blocks +from lighter.models.bo_event_pn_l import BoEventPnL +from lighter.models.bo_outcome_pn_l import BoOutcomePnL from lighter.models.bridge_supported_network import BridgeSupportedNetwork from lighter.models.bridge_supported_networks import BridgeSupportedNetworks from lighter.models.candle import Candle @@ -45,6 +48,8 @@ from lighter.models.detailed_account import DetailedAccount from lighter.models.detailed_accounts import DetailedAccounts from lighter.models.enriched_tx import EnrichedTx +from lighter.models.event_detail import EventDetail +from lighter.models.event_order_book_entry import EventOrderBookEntry from lighter.models.exchange_metric import ExchangeMetric from lighter.models.exchange_stats import ExchangeStats from lighter.models.execute_stat import ExecuteStat @@ -87,6 +92,8 @@ from lighter.models.pnl_leaderboard_entry import PnlLeaderboardEntry from lighter.models.position_funding import PositionFunding from lighter.models.position_fundings import PositionFundings +from lighter.models.price_oracle_market import PriceOracleMarket +from lighter.models.price_oracle_price import PriceOraclePrice from lighter.models.public_pool_info import PublicPoolInfo from lighter.models.public_pool_metadata import PublicPoolMetadata from lighter.models.public_pool_share import PublicPoolShare @@ -105,6 +112,8 @@ from lighter.models.resp_change_account_tier import RespChangeAccountTier from lighter.models.resp_create_rfq import RespCreateRFQ from lighter.models.resp_get_api_tokens import RespGetApiTokens +from lighter.models.resp_get_bo_pn_l import RespGetBoPnL +from lighter.models.resp_get_events import RespGetEvents from lighter.models.resp_get_exchange_metrics import RespGetExchangeMetrics from lighter.models.resp_get_execute_stats import RespGetExecuteStats from lighter.models.resp_get_fast_bridge_info import RespGetFastBridgeInfo @@ -113,8 +122,10 @@ from lighter.models.resp_get_leases import RespGetLeases from lighter.models.resp_get_maker_only_api_keys import RespGetMakerOnlyApiKeys from lighter.models.resp_get_rfq import RespGetRFQ +from lighter.models.resp_get_up_down_candles import RespGetUpDownCandles from lighter.models.resp_list_rfqs import RespListRFQs from lighter.models.resp_post_api_token import RespPostApiToken +from lighter.models.resp_price_oracle_info import RespPriceOracleInfo from lighter.models.resp_public_pools_metadata import RespPublicPoolsMetadata from lighter.models.resp_respond_to_rfq import RespRespondToRFQ from lighter.models.resp_revoke_api_token import RespRevokeApiToken @@ -149,6 +160,7 @@ from lighter.models.tx import Tx from lighter.models.tx_hash import TxHash from lighter.models.txs import Txs +from lighter.models.up_down_candle import UpDownCandle from lighter.models.user_referrals import UserReferrals from lighter.models.validator_info import ValidatorInfo from lighter.models.withdraw_history import WithdrawHistory diff --git a/lighter/models/binary_option_market_stats.py b/lighter/models/binary_option_market_stats.py new file mode 100644 index 0000000..4125438 --- /dev/null +++ b/lighter/models/binary_option_market_stats.py @@ -0,0 +1,144 @@ +# 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, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self + +class BinaryOptionMarketStats(BaseModel): + """ + BinaryOptionMarketStats + """ # noqa: E501 + symbol: StrictStr + market_id: StrictInt + mid_price: StrictStr + best_ask_price: StrictStr + best_bid_price: StrictStr + last_trade_price: StrictStr + 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] + lifetime_quote_token_volume: Union[StrictFloat, StrictInt] + lifetime_base_token_volume: Union[StrictFloat, StrictInt] = Field(description=" outcome shares traded over the market's life") + open_interest: StrictStr + status: StrictStr = Field(description=" inactive once the trading window closes") + outcome: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["symbol", "market_id", "mid_price", "best_ask_price", "best_bid_price", "last_trade_price", "daily_base_token_volume", "daily_quote_token_volume", "daily_price_low", "daily_price_high", "daily_price_change", "lifetime_quote_token_volume", "lifetime_base_token_volume", "open_interest", "status", "outcome"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['inactive', 'active', 'in-settlement']): + raise ValueError("must be one of enum values ('inactive', 'active', 'in-settlement')") + return value + + @field_validator('outcome') + def outcome_validate_enum(cls, value): + """Validates the enum""" + if value not in set([0, 1, 2]): + raise ValueError("must be one of enum values (0, 1, 2)") + 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 BinaryOptionMarketStats 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 BinaryOptionMarketStats from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_construct(**{ + "symbol": obj.get("symbol"), + "market_id": obj.get("market_id"), + "mid_price": obj.get("mid_price"), + "best_ask_price": obj.get("best_ask_price"), + "best_bid_price": obj.get("best_bid_price"), + "last_trade_price": obj.get("last_trade_price"), + "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"), + "lifetime_quote_token_volume": obj.get("lifetime_quote_token_volume"), + "lifetime_base_token_volume": obj.get("lifetime_base_token_volume"), + "open_interest": obj.get("open_interest"), + "status": obj.get("status"), + "outcome": obj.get("outcome") + }) + # 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/bo_event_pn_l.py b/lighter/models/bo_event_pn_l.py new file mode 100644 index 0000000..1075e38 --- /dev/null +++ b/lighter/models/bo_event_pn_l.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, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from lighter.models.bo_outcome_pn_l import BoOutcomePnL +from typing import Optional, Set +from typing_extensions import Self + +class BoEventPnL(BaseModel): + """ + BoEventPnL + """ # noqa: E501 + event_id: StrictInt + event_title: StrictStr + event_description: StrictStr + total_pnl: StrictStr + outcomes: List[BoOutcomePnL] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["event_id", "event_title", "event_description", "total_pnl", "outcomes"] + + 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 BoEventPnL 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 outcomes (list) + _items = [] + if self.outcomes: + for _item in self.outcomes: + if _item: + _items.append(_item.to_dict()) + _dict['outcomes'] = _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 BoEventPnL from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_construct(**{ + "event_id": obj.get("event_id"), + "event_title": obj.get("event_title"), + "event_description": obj.get("event_description"), + "total_pnl": obj.get("total_pnl"), + "outcomes": [BoOutcomePnL.from_dict(_item) for _item in obj["outcomes"]] if obj.get("outcomes") 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/bo_outcome_pn_l.py b/lighter/models/bo_outcome_pn_l.py new file mode 100644 index 0000000..f68af83 --- /dev/null +++ b/lighter/models/bo_outcome_pn_l.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 BoOutcomePnL(BaseModel): + """ + BoOutcomePnL + """ # noqa: E501 + market_id: StrictInt + symbol: StrictStr + outcome: StrictInt + end_timestamp: StrictInt + settlement_pnl: StrictStr + last_trade_id: StrictInt + total_pnl: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["market_id", "symbol", "outcome", "end_timestamp", "settlement_pnl", "last_trade_id", "total_pnl"] + + @field_validator('outcome') + def outcome_validate_enum(cls, value): + """Validates the enum""" + if value not in set([0, 1, 2]): + raise ValueError("must be one of enum values (0, 1, 2)") + 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 BoOutcomePnL 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 BoOutcomePnL from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_construct(**{ + "market_id": obj.get("market_id"), + "symbol": obj.get("symbol"), + "outcome": obj.get("outcome"), + "end_timestamp": obj.get("end_timestamp"), + "settlement_pnl": obj.get("settlement_pnl"), + "last_trade_id": obj.get("last_trade_id"), + "total_pnl": obj.get("total_pnl") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/lighter/models/event_detail.py b/lighter/models/event_detail.py new file mode 100644 index 0000000..6221395 --- /dev/null +++ b/lighter/models/event_detail.py @@ -0,0 +1,139 @@ +# 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 lighter.models.event_order_book_entry import EventOrderBookEntry +from typing import Optional, Set +from typing_extensions import Self + +class EventDetail(BaseModel): + """ + EventDetail + """ # noqa: E501 + event_id: StrictInt + title: StrictStr + description: StrictStr + creator_account_index: StrictInt + created_at: StrictInt + tag: StrictStr + event_kind: StrictStr + recurrence_period_seconds: StrictInt + occurrence_start_at: StrictInt + occurrence_end_at: StrictInt + metadata: Dict[str, Any] + order_books: List[EventOrderBookEntry] + lifetime_quote_token_volume: Union[StrictFloat, StrictInt] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["event_id", "title", "description", "creator_account_index", "created_at", "tag", "event_kind", "recurrence_period_seconds", "occurrence_start_at", "occurrence_end_at", "metadata", "order_books", "lifetime_quote_token_volume"] + + @field_validator('event_kind') + def event_kind_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['one_off', 'recurrent']): + raise ValueError("must be one of enum values ('one_off', 'recurrent')") + 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 EventDetail 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 order_books (list) + _items = [] + if self.order_books: + for _item in self.order_books: + if _item: + _items.append(_item.to_dict()) + _dict['order_books'] = _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 EventDetail from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_construct(**{ + "event_id": obj.get("event_id"), + "title": obj.get("title"), + "description": obj.get("description"), + "creator_account_index": obj.get("creator_account_index"), + "created_at": obj.get("created_at"), + "tag": obj.get("tag"), + "event_kind": obj.get("event_kind"), + "recurrence_period_seconds": obj.get("recurrence_period_seconds"), + "occurrence_start_at": obj.get("occurrence_start_at"), + "occurrence_end_at": obj.get("occurrence_end_at"), + "metadata": obj.get("metadata"), + "order_books": [EventOrderBookEntry.from_dict(_item) for _item in obj["order_books"]] if obj.get("order_books") is not None else None, + "lifetime_quote_token_volume": obj.get("lifetime_quote_token_volume") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/lighter/models/event_order_book_entry.py b/lighter/models/event_order_book_entry.py new file mode 100644 index 0000000..138e080 --- /dev/null +++ b/lighter/models/event_order_book_entry.py @@ -0,0 +1,196 @@ +# 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 +from lighter.models.binary_option_market_stats import BinaryOptionMarketStats +from typing import Optional, Set +from typing_extensions import Self + +class EventOrderBookEntry(BaseModel): + """ + EventOrderBookEntry + """ # noqa: E501 + symbol: StrictStr + market_id: StrictInt + market_slot_id: StrictInt = Field(description=" internal only: the reusable tree slot backing this market; never serialized, users only know market_id (the public market index)", alias="marketSlotId") + market_type: StrictStr + base_asset_id: StrictInt + quote_asset_id: StrictInt + status: StrictStr + taker_fee: StrictStr + is_taker_fee_enabled: StrictBool + maker_fee: StrictStr + is_maker_fee_enabled: StrictBool + liquidation_fee: StrictStr + min_base_amount: StrictStr + min_quote_amount: StrictStr + order_quote_limit: StrictStr + supported_size_decimals: StrictInt + supported_price_decimals: StrictInt + supported_quote_decimals: StrictInt + created_at: StrictStr + multiplier: StrictStr + start_timestamp: StrictInt + end_timestamp: StrictInt + open_interest: StrictStr + outcome: StrictInt + operator_account_index: StrictInt + settlement_cap: StrictInt + settlement_type: StrictInt + settlement_price: StrictInt + default_price: StrictInt + is_frozen: StrictBool + size_decimals: StrictInt + price_decimals: StrictInt + stats: BinaryOptionMarketStats + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["symbol", "market_id", "marketSlotId", "market_type", "base_asset_id", "quote_asset_id", "status", "taker_fee", "is_taker_fee_enabled", "maker_fee", "is_maker_fee_enabled", "liquidation_fee", "min_base_amount", "min_quote_amount", "order_quote_limit", "supported_size_decimals", "supported_price_decimals", "supported_quote_decimals", "created_at", "multiplier", "start_timestamp", "end_timestamp", "open_interest", "outcome", "operator_account_index", "settlement_cap", "settlement_type", "settlement_price", "default_price", "is_frozen", "size_decimals", "price_decimals", "stats"] + + @field_validator('market_type') + def market_type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['perp', 'spot', 'binary_options']): + raise ValueError("must be one of enum values ('perp', 'spot', 'binary_options')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['inactive', 'active']): + raise ValueError("must be one of enum values ('inactive', 'active')") + return value + + @field_validator('outcome') + def outcome_validate_enum(cls, value): + """Validates the enum""" + if value not in set([0, 1, 2]): + raise ValueError("must be one of enum values (0, 1, 2)") + return value + + @field_validator('settlement_type') + def settlement_type_validate_enum(cls, value): + """Validates the enum""" + if value not in set([0, 1]): + raise ValueError("must be one of enum values (0, 1)") + 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 EventOrderBookEntry 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 stats + if self.stats: + _dict['stats'] = self.stats.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 EventOrderBookEntry from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_construct(**{ + "symbol": obj.get("symbol"), + "market_id": obj.get("market_id"), + "marketSlotId": obj.get("marketSlotId"), + "market_type": obj.get("market_type"), + "base_asset_id": obj.get("base_asset_id"), + "quote_asset_id": obj.get("quote_asset_id"), + "status": obj.get("status"), + "taker_fee": obj.get("taker_fee"), + "is_taker_fee_enabled": obj.get("is_taker_fee_enabled"), + "maker_fee": obj.get("maker_fee"), + "is_maker_fee_enabled": obj.get("is_maker_fee_enabled"), + "liquidation_fee": obj.get("liquidation_fee"), + "min_base_amount": obj.get("min_base_amount"), + "min_quote_amount": obj.get("min_quote_amount"), + "order_quote_limit": obj.get("order_quote_limit"), + "supported_size_decimals": obj.get("supported_size_decimals"), + "supported_price_decimals": obj.get("supported_price_decimals"), + "supported_quote_decimals": obj.get("supported_quote_decimals"), + "created_at": obj.get("created_at"), + "multiplier": obj.get("multiplier"), + "start_timestamp": obj.get("start_timestamp"), + "end_timestamp": obj.get("end_timestamp"), + "open_interest": obj.get("open_interest"), + "outcome": obj.get("outcome"), + "operator_account_index": obj.get("operator_account_index"), + "settlement_cap": obj.get("settlement_cap"), + "settlement_type": obj.get("settlement_type"), + "settlement_price": obj.get("settlement_price"), + "default_price": obj.get("default_price"), + "is_frozen": obj.get("is_frozen"), + "size_decimals": obj.get("size_decimals"), + "price_decimals": obj.get("price_decimals"), + "stats": BinaryOptionMarketStats.from_dict(obj["stats"]) if obj.get("stats") 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/price_oracle_market.py b/lighter/models/price_oracle_market.py new file mode 100644 index 0000000..40ed79c --- /dev/null +++ b/lighter/models/price_oracle_market.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_oracle_price import PriceOraclePrice +from typing import Optional, Set +from typing_extensions import Self + +class PriceOracleMarket(BaseModel): + """ + PriceOracleMarket + """ # noqa: E501 + symbol: StrictStr + index: PriceOraclePrice + mark: PriceOraclePrice + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["symbol", "index", "mark"] + + 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 PriceOracleMarket 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 index + if self.index: + _dict['index'] = self.index.to_dict() + # override the default output from pydantic by calling `to_dict()` of mark + if self.mark: + _dict['mark'] = self.mark.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 PriceOracleMarket from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_construct(**{ + "symbol": obj.get("symbol"), + "index": PriceOraclePrice.from_dict(obj["index"]) if obj.get("index") is not None else None, + "mark": PriceOraclePrice.from_dict(obj["mark"]) if obj.get("mark") 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/price_oracle_price.py b/lighter/models/price_oracle_price.py new file mode 100644 index 0000000..4e4508c --- /dev/null +++ b/lighter/models/price_oracle_price.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, Field, StrictBool, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self + +class PriceOraclePrice(BaseModel): + """ + PriceOraclePrice + """ # noqa: E501 + source: StrictStr + using_median: StrictBool + using_internal_price: StrictBool + median_sources: List[StrictStr] + price_cap_bps: Union[StrictFloat, StrictInt] + price_cap_reference_price: Union[StrictFloat, StrictInt] = Field(description=" cap bounds: ref * (1 -/+ bps / 10000)") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["source", "using_median", "using_internal_price", "median_sources", "price_cap_bps", "price_cap_reference_price"] + + 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 PriceOraclePrice 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 PriceOraclePrice from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_construct(**{ + "source": obj.get("source"), + "using_median": obj.get("using_median"), + "using_internal_price": obj.get("using_internal_price"), + "median_sources": obj.get("median_sources"), + "price_cap_bps": obj.get("price_cap_bps"), + "price_cap_reference_price": obj.get("price_cap_reference_price") + }) + # 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_bo_pn_l.py b/lighter/models/resp_get_bo_pn_l.py new file mode 100644 index 0000000..e7ad775 --- /dev/null +++ b/lighter/models/resp_get_bo_pn_l.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.bo_event_pn_l import BoEventPnL +from typing import Optional, Set +from typing_extensions import Self + +class RespGetBoPnL(BaseModel): + """ + RespGetBoPnL + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + events: List[BoEventPnL] + next_cursor: Optional[StrictInt] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "events", "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 RespGetBoPnL 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 events (list) + _items = [] + if self.events: + for _item in self.events: + if _item: + _items.append(_item.to_dict()) + _dict['events'] = _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 RespGetBoPnL from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_construct(**{ + "code": obj.get("code"), + "message": obj.get("message"), + "events": [BoEventPnL.from_dict(_item) for _item in obj["events"]] if obj.get("events") 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/resp_get_events.py b/lighter/models/resp_get_events.py new file mode 100644 index 0000000..cae1b43 --- /dev/null +++ b/lighter/models/resp_get_events.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.event_detail import EventDetail +from typing import Optional, Set +from typing_extensions import Self + +class RespGetEvents(BaseModel): + """ + RespGetEvents + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + next_cursor: Optional[StrictInt] = None + events: List[EventDetail] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "next_cursor", "events"] + + 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 RespGetEvents 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 events (list) + _items = [] + if self.events: + for _item in self.events: + if _item: + _items.append(_item.to_dict()) + _dict['events'] = _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 RespGetEvents from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_construct(**{ + "code": obj.get("code"), + "message": obj.get("message"), + "next_cursor": obj.get("next_cursor"), + "events": [EventDetail.from_dict(_item) for _item in obj["events"]] if obj.get("events") 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/resp_get_up_down_candles.py b/lighter/models/resp_get_up_down_candles.py new file mode 100644 index 0000000..50a90bd --- /dev/null +++ b/lighter/models/resp_get_up_down_candles.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, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.up_down_candle import UpDownCandle +from typing import Optional, Set +from typing_extensions import Self + +class RespGetUpDownCandles(BaseModel): + """ + RespGetUpDownCandles + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + candles: List[UpDownCandle] = Field(description=" ascending by timestamp") + next_cursor: Optional[StrictInt] = Field(default=None, description=" start_timestamp of the next page; 0 when the range is exhausted") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "candles", "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 RespGetUpDownCandles 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 candles (list) + _items = [] + if self.candles: + for _item in self.candles: + if _item: + _items.append(_item.to_dict()) + _dict['candles'] = _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 RespGetUpDownCandles from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_construct(**{ + "code": obj.get("code"), + "message": obj.get("message"), + "candles": [UpDownCandle.from_dict(_item) for _item in obj["candles"]] if obj.get("candles") 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/resp_price_oracle_info.py b/lighter/models/resp_price_oracle_info.py new file mode 100644 index 0000000..b1e091e --- /dev/null +++ b/lighter/models/resp_price_oracle_info.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.price_oracle_market import PriceOracleMarket +from typing import Optional, Set +from typing_extensions import Self + +class RespPriceOracleInfo(BaseModel): + """ + RespPriceOracleInfo + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + computed_at_ms: StrictInt + markets: List[PriceOracleMarket] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "computed_at_ms", "markets"] + + 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 RespPriceOracleInfo 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 markets (list) + _items = [] + if self.markets: + for _item in self.markets: + if _item: + _items.append(_item.to_dict()) + _dict['markets'] = _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 RespPriceOracleInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_construct(**{ + "code": obj.get("code"), + "message": obj.get("message"), + "computed_at_ms": obj.get("computed_at_ms"), + "markets": [PriceOracleMarket.from_dict(_item) for _item in obj["markets"]] if obj.get("markets") 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/up_down_candle.py b/lighter/models/up_down_candle.py new file mode 100644 index 0000000..10a743e --- /dev/null +++ b/lighter/models/up_down_candle.py @@ -0,0 +1,120 @@ +# 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 +from typing import Optional, Set +from typing_extensions import Self + +class UpDownCandle(BaseModel): + """ + UpDownCandle + """ # noqa: E501 + symbol: StrictStr + duration: StrictStr + resolution: StrictStr + timestamp: StrictInt = Field(description=" bucket start, unix seconds") + open: StrictStr = Field(description=" exact provider prices, decimal strings") + high: StrictStr + low: StrictStr + close: StrictStr + sample_count: StrictInt = Field(description=" observations in the candle: orders live updates of the same bucket, not served", alias="sampleCount") + provider: StrictStr = Field(description=" provider feed of the last observation of the candle") + feed_id: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["symbol", "duration", "resolution", "timestamp", "open", "high", "low", "close", "sampleCount", "provider", "feed_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 UpDownCandle 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 UpDownCandle from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_construct(**{ + "symbol": obj.get("symbol"), + "duration": obj.get("duration"), + "resolution": obj.get("resolution"), + "timestamp": obj.get("timestamp"), + "open": obj.get("open"), + "high": obj.get("high"), + "low": obj.get("low"), + "close": obj.get("close"), + "sampleCount": obj.get("sampleCount"), + "provider": obj.get("provider"), + "feed_id": obj.get("feed_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/openapi.json b/openapi.json index d75e75a..9edf81b 100644 --- a/openapi.json +++ b/openapi.json @@ -940,6 +940,16 @@ "format": "boolean", "default": "false" } + }, + { + "name": "merge_mark_price", + "in": "query", + "required": false, + "schema": { + "type": "boolean", + "format": "boolean", + "default": "false" + } } ], "responses": { @@ -973,7 +983,7 @@ "tags": [ "account" ], - "description": "Change account type (applies to both master, and subaccounts). Downgrades can be performed once every 24 hours.", + "description": "Change account tier. You can only perform this action once every 24 hours.", "parameters": [ { "name": "authorization", @@ -2413,7 +2423,8 @@ "enum": [ "all", "spot", - "perp" + "perp", + "bo" ], "default": "all" } @@ -2556,6 +2567,25 @@ "schema": { "type": "string" } + }, + { + "name": "integrator_account_index", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "default": "-1" + } + }, + { + "name": "order_index_str", + "in": "query", + "description": " takes precedence over order_index; for clients that cannot represent uint64 exactly", + "required": false, + "schema": { + "type": "string" + } } ], "responses": { @@ -5280,89 +5310,482 @@ } } } - } - }, - "servers": [ - { - "url": "https://mainnet.zklighter.elliot.ai/" - } - ], - "components": { - "securitySchemes": { - "apiKey": { - "type": "apiKey", - "description": "Enter JWT Bearer token **_only_**", - "name": "Authorization", - "in": "header" - } }, - "schemas": { - "Account": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" + "/api/v1/priceOracleInfo": { + "get": { + "summary": "priceOracleInfo", + "operationId": "priceOracleInfo", + "tags": [ + "info" + ], + "description": "Get price oracle info (source in use, median exchanges, price cap) for all markets or a single symbol", + "parameters": [ + { + "name": "symbol", + "in": "query", + "required": false, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RespPriceOracleInfo" + } + } + } }, - "message": { - "type": "string" + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + } + } + } + }, + "/api/v1/upDownCandles": { + "get": { + "summary": "upDownCandles", + "operationId": "upDownCandles", + "tags": [ + "updown" + ], + "description": "Get the OHLC candles (1s = the exact price observations, or 30s) of an up/down market series (symbol + duration, e.g. btc/5m) in a bounded time range (at most 24h), oldest first. Pass next_cursor as start_timestamp to page forward; live candles are on the up_down_candle/// websocket channel.", + "parameters": [ + { + "name": "symbol", + "in": "query", + "description": " market series: underlying (case-insensitive) ...", + "required": true, + "schema": { + "type": "string" + } }, - "account_type": { - "type": "integer", - "format": "uint8", - "example": "1" + { + "name": "duration", + "in": "query", + "description": " ... and market duration, e.g. 30s or 5m", + "required": true, + "schema": { + "type": "string" + } }, - "account_trading_mode": { - "type": "integer", - "format": "uint8", - "example": "1", - "description": "Classic=0 and Unified=1" + { + "name": "resolution", + "in": "query", + "description": " 1s candles are the observations themselves", + "required": false, + "schema": { + "type": "string", + "enum": [ + "1s", + "30s" + ], + "default": "1s" + } }, - "index": { - "type": "integer", - "format": "int64", - "example": "1" + { + "name": "start_timestamp", + "in": "query", + "description": " inclusive bucket start, seconds", + "required": true, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 5000000000 + } }, - "l1_address": { - "type": "string", - "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + { + "name": "end_timestamp", + "in": "query", + "description": " inclusive, seconds; at most 24h after start_timestamp", + "required": true, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 5000000000 + } }, - "cancel_all_time": { - "type": "integer", - "format": "int64", - "example": "1640995200" + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "default": "1000", + "minimum": 1, + "maximum": 3600 + } + } + ], + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RespGetUpDownCandles" + } + } + } }, - "total_order_count": { - "type": "integer", - "format": "int64", - "example": "100" + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + } + } + } + }, + "/api/v1/events": { + "get": { + "summary": "events", + "operationId": "events", + "tags": [ + "event" + ], + "description": "Get events and registered order books, including scheduled events with no books. event_ids and market_ids accept up to 50 comma-separated positive IDs, are mutually exclusive, and use the same filters, sorting and pagination. market_ids returns each related event once with all its order books. Defaults to descending id. Occurrence sorting uses (occurrence_start_at, event_id); cursor identifies an existing event and excludes it in the requested direction. tag filters across creators; creator_account_index is an optional additional filter. active=true requires a tradeable outcome; active=false includes scheduled and closed events.", + "parameters": [ + { + "name": "event_ids", + "in": "query", + "description": " comma-separated positive IDs, max 50", + "required": false, + "schema": { + "type": "string" + } }, - "total_isolated_order_count": { - "type": "integer", - "format": "int64", - "example": "100" + { + "name": "market_ids", + "in": "query", + "description": " comma-separated positive IDs, max 50", + "required": false, + "schema": { + "type": "string" + } }, - "pending_order_count": { - "type": "integer", - "format": "int64", - "example": "100" + { + "name": "creator_account_index", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64" + } }, - "available_balance": { - "type": "string", - "example": "19995" + { + "name": "cursor", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64" + } }, - "status": { - "type": "integer", - "format": "uint8", - "example": "1" + { + "name": "active", + "in": "query", + "description": " true: at least one outcome still tradeable; false: none", + "required": false, + "schema": { + "type": "boolean", + "format": "boolean" + } }, - "collateral": { - "type": "string", - "example": "46342" + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100 + } }, - "transaction_time": { - "type": "integer", + { + "name": "tag", + "in": "query", + "description": " series tag; creator filter is optional", + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "event_kind", + "in": "query", + "required": false, + "schema": { + "type": "string", + "enum": [ + "one_off", + "recurrent" + ] + } + }, + { + "name": "start_from", + "in": "query", + "description": " inclusive occurrence start, Unix milliseconds", + "required": false, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "name": "start_before", + "in": "query", + "description": " exclusive occurrence start, Unix milliseconds", + "required": false, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "name": "sort", + "in": "query", + "required": false, + "schema": { + "type": "string", + "enum": [ + "id", + "occurrence_start_at" + ], + "default": "id" + } + }, + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "type": "string", + "enum": [ + "asc", + "desc" + ], + "default": "desc" + } + } + ], + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RespGetEvents" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + } + } + } + }, + "/api/v1/portfolio/boPnl": { + "get": { + "summary": "portfolio_boPnl", + "operationId": "portfolio_boPnl", + "tags": [ + "portfolio" + ], + "description": "Get binary-options realized PnL for an authenticated account, grouped by event and ordered newest event first. cursor is an exclusive event id; event_id returns a single event. Every outcome the account has traded is reported, including markets still open or unsettled, so an entry never disappears as the account trades. Per outcome, total_pnl is all realized PnL so far including settlement, and settlement_pnl is null until the market settles with a position to settle, then the string 0.000000 for an actual zero-PnL settlement. An event's total_pnl is the sum of its listed outcomes. Missing display metadata uses zero/empty values.", + "parameters": [ + { + "name": "authorization", + "in": "query", + "description": " make required after integ is done", + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "auth", + "in": "query", + "description": " made optional to support header auth clients", + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "account_index", + "in": "query", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "name": "event_id", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "name": "cursor", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "default": "100", + "minimum": 1, + "maximum": 100 + } + } + ], + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RespGetBoPnL" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + } + } + } + } + }, + "servers": [ + { + "url": "https://mainnet.zklighter.elliot.ai/" + } + ], + "components": { + "securitySchemes": { + "apiKey": { + "type": "apiKey", + "description": "Enter JWT Bearer token **_only_**", + "name": "Authorization", + "in": "header" + } + }, + "schemas": { + "Account": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "account_type": { + "type": "integer", + "format": "uint8", + "example": "1" + }, + "account_trading_mode": { + "type": "integer", + "format": "uint8", + "example": "1", + "description": "Classic=0 and Unified=1" + }, + "index": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "l1_address": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + }, + "cancel_all_time": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "total_order_count": { + "type": "integer", + "format": "int64", + "example": "100" + }, + "total_isolated_order_count": { + "type": "integer", + "format": "int64", + "example": "100" + }, + "pending_order_count": { + "type": "integer", + "format": "int64", + "example": "100" + }, + "available_balance": { + "type": "string", + "example": "19995" + }, + "status": { + "type": "integer", + "format": "uint8", + "example": "1" + }, + "collateral": { + "type": "string", + "example": "46342" + }, + "transaction_time": { + "type": "integer", "format": "int64" } }, @@ -12154,6 +12577,740 @@ "roi", "volume" ] + }, + "RespPriceOracleInfo": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "computed_at_ms": { + "type": "integer", + "format": "int64" + }, + "markets": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PriceOracleMarket" + } + } + }, + "title": "RespPriceOracleInfo", + "required": [ + "code", + "computed_at_ms", + "markets" + ] + }, + "PriceOracleMarket": { + "type": "object", + "properties": { + "symbol": { + "type": "string" + }, + "index": { + "$ref": "#/components/schemas/PriceOraclePrice" + }, + "mark": { + "$ref": "#/components/schemas/PriceOraclePrice" + } + }, + "title": "PriceOracleMarket", + "required": [ + "symbol", + "index", + "mark" + ] + }, + "PriceOraclePrice": { + "type": "object", + "properties": { + "source": { + "type": "string" + }, + "using_median": { + "type": "boolean", + "format": "boolean" + }, + "using_internal_price": { + "type": "boolean", + "format": "boolean" + }, + "median_sources": { + "type": "array", + "items": { + "type": "string" + } + }, + "price_cap_bps": { + "type": "number", + "format": "double" + }, + "price_cap_reference_price": { + "type": "number", + "format": "double", + "description": " cap bounds: ref * (1 -/+ bps / 10000)" + } + }, + "title": "PriceOraclePrice", + "required": [ + "source", + "using_median", + "using_internal_price", + "median_sources", + "price_cap_bps", + "price_cap_reference_price" + ] + }, + "RespGetUpDownCandles": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "candles": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UpDownCandle" + }, + "description": " ascending by timestamp" + }, + "next_cursor": { + "type": "integer", + "format": "int64", + "example": "0", + "description": " start_timestamp of the next page; 0 when the range is exhausted" + } + }, + "title": "RespGetUpDownCandles", + "required": [ + "code", + "candles" + ] + }, + "UpDownCandle": { + "type": "object", + "properties": { + "symbol": { + "type": "string", + "example": "btc" + }, + "duration": { + "type": "string", + "example": "5m" + }, + "resolution": { + "type": "string", + "example": "30s" + }, + "timestamp": { + "type": "integer", + "format": "int64", + "example": "1789551600", + "description": " bucket start, unix seconds" + }, + "open": { + "type": "string", + "example": "115342.123456789012345678", + "description": " exact provider prices, decimal strings" + }, + "high": { + "type": "string", + "example": "115350.5" + }, + "low": { + "type": "string", + "example": "115300.25" + }, + "close": { + "type": "string", + "example": "115340.123456789012345678" + }, + "sampleCount": { + "type": "integer", + "format": "int64", + "description": " observations in the candle: orders live updates of the same bucket, not served" + }, + "provider": { + "type": "string", + "example": "chainlink", + "description": " provider feed of the last observation of the candle" + }, + "feed_id": { + "type": "string", + "example": "0x0002ee6757e8822c00d273bc340fc24c9cafe123a4ff2ea1dbdb31944bc7d95f" + } + }, + "title": "UpDownCandle", + "required": [ + "symbol", + "duration", + "resolution", + "timestamp", + "open", + "high", + "low", + "close", + "sampleCount", + "provider", + "feed_id" + ] + }, + "RespGetEvents": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "next_cursor": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "events": { + "type": "array", + "items": { + "$ref": "#/components/schemas/EventDetail" + } + } + }, + "title": "RespGetEvents", + "required": [ + "code", + "events" + ] + }, + "EventDetail": { + "type": "object", + "properties": { + "event_id": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "creator_account_index": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "created_at": { + "type": "integer", + "format": "int64", + "example": "1640995200000" + }, + "tag": { + "type": "string" + }, + "event_kind": { + "type": "string", + "enum": [ + "one_off", + "recurrent" + ] + }, + "recurrence_period_seconds": { + "type": "integer", + "format": "int32" + }, + "occurrence_start_at": { + "type": "integer", + "format": "int64" + }, + "occurrence_end_at": { + "type": "integer", + "format": "int64" + }, + "metadata": { + "type": "object", + "additionalProperties": true + }, + "order_books": { + "type": "array", + "items": { + "$ref": "#/components/schemas/EventOrderBookEntry" + } + }, + "lifetime_quote_token_volume": { + "type": "number", + "format": "double", + "example": "8400000.00" + } + }, + "title": "EventDetail", + "required": [ + "event_id", + "title", + "description", + "creator_account_index", + "created_at", + "tag", + "event_kind", + "recurrence_period_seconds", + "occurrence_start_at", + "occurrence_end_at", + "metadata", + "order_books", + "lifetime_quote_token_volume" + ] + }, + "EventOrderBookEntry": { + "type": "object", + "properties": { + "symbol": { + "type": "string", + "example": "ETH" + }, + "market_id": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "marketSlotId": { + "type": "integer", + "format": "int16", + "description": " internal only: the reusable tree slot backing this market; never serialized, users only know market_id (the public market index)" + }, + "market_type": { + "type": "string", + "enum": [ + "perp", + "spot", + "binary_options" + ] + }, + "base_asset_id": { + "type": "integer", + "format": "int16", + "example": "1" + }, + "quote_asset_id": { + "type": "integer", + "format": "int16", + "example": "2" + }, + "status": { + "type": "string", + "enum": [ + "inactive", + "active" + ] + }, + "taker_fee": { + "type": "string", + "example": "0.0001" + }, + "is_taker_fee_enabled": { + "type": "boolean", + "format": "boolean", + "example": "true" + }, + "maker_fee": { + "type": "string", + "example": "0.0000" + }, + "is_maker_fee_enabled": { + "type": "boolean", + "format": "boolean", + "example": "true" + }, + "liquidation_fee": { + "type": "string", + "example": "0.01" + }, + "min_base_amount": { + "type": "string", + "example": "0.01" + }, + "min_quote_amount": { + "type": "string", + "example": "0.1" + }, + "order_quote_limit": { + "type": "string", + "example": "235.25" + }, + "supported_size_decimals": { + "type": "integer", + "format": "uint8", + "example": "4" + }, + "supported_price_decimals": { + "type": "integer", + "format": "uint8", + "example": "4" + }, + "supported_quote_decimals": { + "type": "integer", + "format": "uint8", + "example": "4" + }, + "created_at": { + "type": "string", + "example": "1640995200000" + }, + "multiplier": { + "type": "string", + "example": "1.000000000000000000" + }, + "start_timestamp": { + "type": "integer", + "format": "int64", + "example": "1640995200000" + }, + "end_timestamp": { + "type": "integer", + "format": "int64", + "example": "1640995200000" + }, + "open_interest": { + "type": "string", + "example": "93.0" + }, + "outcome": { + "type": "integer", + "format": "int32", + "enum": [ + 0, + 1, + 2 + ], + "x-enum-varnames": [ + "None", + "No", + "Yes" + ] + }, + "operator_account_index": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "settlement_cap": { + "type": "integer", + "format": "int32", + "example": "10000" + }, + "settlement_type": { + "type": "integer", + "format": "int32", + "enum": [ + 0, + 1 + ], + "x-enum-varnames": [ + "Discrete", + "Continuous" + ] + }, + "settlement_price": { + "type": "integer", + "format": "int32", + "example": "10000" + }, + "default_price": { + "type": "integer", + "format": "int32", + "example": "5000" + }, + "is_frozen": { + "type": "boolean", + "format": "boolean", + "example": "false" + }, + "size_decimals": { + "type": "integer", + "format": "uint8", + "example": "4" + }, + "price_decimals": { + "type": "integer", + "format": "uint8", + "example": "4" + }, + "stats": { + "$ref": "#/components/schemas/BinaryOptionMarketStats" + } + }, + "title": "EventOrderBookEntry", + "required": [ + "symbol", + "market_id", + "marketSlotId", + "market_type", + "base_asset_id", + "quote_asset_id", + "status", + "taker_fee", + "is_taker_fee_enabled", + "maker_fee", + "is_maker_fee_enabled", + "liquidation_fee", + "min_base_amount", + "min_quote_amount", + "order_quote_limit", + "supported_size_decimals", + "supported_price_decimals", + "supported_quote_decimals", + "created_at", + "multiplier", + "start_timestamp", + "end_timestamp", + "open_interest", + "outcome", + "operator_account_index", + "settlement_cap", + "settlement_type", + "settlement_price", + "default_price", + "is_frozen", + "size_decimals", + "price_decimals", + "stats" + ] + }, + "BinaryOptionMarketStats": { + "type": "object", + "properties": { + "symbol": { + "type": "string", + "example": "BINOPT1000" + }, + "market_id": { + "type": "integer", + "format": "int64", + "example": "1000" + }, + "mid_price": { + "type": "string", + "example": "0.52" + }, + "best_ask_price": { + "type": "string", + "example": "0.53" + }, + "best_bid_price": { + "type": "string", + "example": "0.51" + }, + "last_trade_price": { + "type": "string", + "example": "0.52" + }, + "daily_base_token_volume": { + "type": "number", + "format": "double", + "example": "235.25" + }, + "daily_quote_token_volume": { + "type": "number", + "format": "double", + "example": "115.27" + }, + "daily_price_low": { + "type": "number", + "format": "double", + "example": "0.42" + }, + "daily_price_high": { + "type": "number", + "format": "double", + "example": "0.55" + }, + "daily_price_change": { + "type": "number", + "format": "double", + "example": "0.03" + }, + "lifetime_quote_token_volume": { + "type": "number", + "format": "double", + "example": "8400000.00" + }, + "lifetime_base_token_volume": { + "type": "number", + "format": "double", + "example": "16000000.00", + "description": " outcome shares traded over the market's life" + }, + "open_interest": { + "type": "string", + "example": "93.0" + }, + "status": { + "type": "string", + "enum": [ + "inactive", + "active", + "in-settlement" + ], + "description": " inactive once the trading window closes" + }, + "outcome": { + "type": "integer", + "format": "int32", + "enum": [ + 0, + 1, + 2 + ], + "x-enum-varnames": [ + "None", + "No", + "Yes" + ] + } + }, + "title": "BinaryOptionMarketStats", + "required": [ + "symbol", + "market_id", + "mid_price", + "best_ask_price", + "best_bid_price", + "last_trade_price", + "daily_base_token_volume", + "daily_quote_token_volume", + "daily_price_low", + "daily_price_high", + "daily_price_change", + "lifetime_quote_token_volume", + "lifetime_base_token_volume", + "open_interest", + "status", + "outcome" + ] + }, + "RespGetBoPnL": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "events": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BoEventPnL" + } + }, + "next_cursor": { + "type": "integer", + "format": "int64", + "example": "1" + } + }, + "title": "RespGetBoPnL", + "required": [ + "code", + "events" + ] + }, + "BoEventPnL": { + "type": "object", + "properties": { + "event_id": { + "type": "integer", + "format": "int64" + }, + "event_title": { + "type": "string" + }, + "event_description": { + "type": "string" + }, + "total_pnl": { + "type": "string" + }, + "outcomes": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BoOutcomePnL" + } + } + }, + "title": "BoEventPnL", + "required": [ + "event_id", + "event_title", + "event_description", + "total_pnl", + "outcomes" + ] + }, + "BoOutcomePnL": { + "type": "object", + "properties": { + "market_id": { + "type": "integer", + "format": "int64" + }, + "symbol": { + "type": "string" + }, + "outcome": { + "type": "integer", + "format": "int32", + "enum": [ + 0, + 1, + 2 + ], + "x-enum-varnames": [ + "None", + "No", + "Yes" + ] + }, + "end_timestamp": { + "type": "integer", + "format": "int64" + }, + "settlement_pnl": { + "type": "string" + }, + "last_trade_id": { + "type": "integer", + "format": "int64" + }, + "total_pnl": { + "type": "string" + } + }, + "title": "BoOutcomePnL", + "required": [ + "market_id", + "symbol", + "outcome", + "end_timestamp", + "settlement_pnl", + "last_trade_id", + "total_pnl" + ] } } }