Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ docs/Account.md
docs/AccountApi.md
docs/AccountApiKeys.md
docs/AccountAsset.md
docs/AccountBinaryOptionsPosition.md
docs/AccountLimits.md
docs/AccountMetadata.md
docs/AccountMetadatas.md
Expand Down Expand Up @@ -195,6 +196,7 @@ lighter/models/__init__.py
lighter/models/account.py
lighter/models/account_api_keys.py
lighter/models/account_asset.py
lighter/models/account_binary_options_position.py
lighter/models/account_limits.py
lighter/models/account_metadata.py
lighter/models/account_metadatas.py
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ Class | Method | HTTP request | Description

<!-- AUTOGEN:MODELS -->
- [Account](docs/Account.md)
- [AccountBinaryOptionsPosition](docs/AccountBinaryOptionsPosition.md)
- [AccountApiKeys](docs/AccountApiKeys.md)
- [AccountAsset](docs/AccountAsset.md)
- [AccountLimits](docs/AccountLimits.md)
Expand Down
33 changes: 33 additions & 0 deletions docs/AccountBinaryOptionsPosition.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# AccountBinaryOptionsPosition


## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**market_id** | **int** | |
**entry_quote** | **str** | |
**avg_entry_price** | **str** | average price paid for the held outcome (YES price for sign 1, NO price for sign -1) |
**sign** | **int** | 1 holds the YES outcome, -1 holds the NO outcome |
**size** | **str** | magnitude only; combine with sign |

## Example

```python
from lighter.models.account_binary_options_position import AccountBinaryOptionsPosition

# TODO update the JSON string below
json = "{}"
# create an instance of AccountBinaryOptionsPosition from a JSON string
account_binary_options_position_instance = AccountBinaryOptionsPosition.from_json(json)
# print the JSON string representation of the object
print(AccountBinaryOptionsPosition.to_json())

# convert the object into a dict
account_binary_options_position_dict = account_binary_options_position_instance.to_dict()
# create an instance of AccountBinaryOptionsPosition from a dict
account_binary_options_position_from_dict = AccountBinaryOptionsPosition.from_dict(account_binary_options_position_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)


1 change: 1 addition & 0 deletions docs/DetailedAccount.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Name | Type | Description | Notes
**can_rfq_market_ids** | **List[str]** | |
**metadata** | [**SubAccountMetadata**](SubAccountMetadata.md) | |
**agent_enabled** | **bool** | |
**bo_positions** | [**List[AccountBinaryOptionsPosition]**](AccountBinaryOptionsPosition.md) | | [optional]

## Example

Expand Down
1 change: 0 additions & 1 deletion docs/EventOrderBookEntry.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ 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** | |
Expand Down
2 changes: 2 additions & 0 deletions docs/Order.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ Name | Type | Description | Notes
**integrator_taker_fee** | **str** | |
**order_flags** | **int** | |
**order_version** | **int** | |
**market_symbol** | **str** | |
**market_kind** | **str** | |

## Example

Expand Down
10 changes: 10 additions & 0 deletions docs/OrderBook.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ Name | Type | Description | Notes
**is_taker_fee_enabled** | **bool** | |
**created_at** | **str** | |
**multiplier** | **str** | |
**start_timestamp** | **int** | |
**end_timestamp** | **int** | |
**settlement_type** | **int** | |
**settlement_price** | **int** | |
**settlement_cap** | **int** | |
**outcome** | **int** | |
**default_price** | **int** | |
**operator_account_index** | **int** | |
**is_frozen** | **bool** | |
**open_interest** | **str** | |

## Example

Expand Down
9 changes: 9 additions & 0 deletions docs/PerpsOrderBookDetail.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ Name | Type | Description | Notes
**multiplier** | **str** | |
**market_flags** | **int** | |
**funding_premium_multiplier** | **int** | |
**start_timestamp** | **int** | |
**end_timestamp** | **int** | |
**settlement_type** | **int** | |
**settlement_price** | **int** | |
**settlement_cap** | **int** | |
**outcome** | **int** | |
**default_price** | **int** | |
**operator_account_index** | **int** | |
**is_frozen** | **bool** | |

## Example

Expand Down
10 changes: 10 additions & 0 deletions docs/SpotOrderBookDetail.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ Name | Type | Description | Notes
**is_taker_fee_enabled** | **bool** | |
**created_at** | **str** | |
**multiplier** | **str** | |
**start_timestamp** | **int** | |
**end_timestamp** | **int** | |
**settlement_type** | **int** | |
**settlement_price** | **int** | |
**settlement_cap** | **int** | |
**outcome** | **int** | |
**default_price** | **int** | |
**operator_account_index** | **int** | |
**is_frozen** | **bool** | |
**open_interest** | **str** | |

## Example

Expand Down
2 changes: 2 additions & 0 deletions docs/Trade.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ Name | Type | Description | Notes
**maker_allocated_margin_usdc_after** | **int** | |
**bid_order_version** | **int** | |
**ask_order_version** | **int** | |
**market_symbol** | **str** | |
**market_kind** | **str** | |

## Example

Expand Down
1 change: 0 additions & 1 deletion docs/UpDownCandle.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Name | Type | Description | Notes
**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** | |

Expand Down
1 change: 1 addition & 0 deletions lighter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@

# import models into sdk package
from lighter.models.account import Account
from lighter.models.account_binary_options_position import AccountBinaryOptionsPosition
from lighter.models.account_api_keys import AccountApiKeys
from lighter.models.account_asset import AccountAsset
from lighter.models.account_limits import AccountLimits
Expand Down
6 changes: 2 additions & 4 deletions lighter/api/order_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2771,10 +2771,6 @@ def _export_historical_trades_serialize(

# 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))
Expand All @@ -2788,6 +2784,8 @@ def _export_historical_trades_serialize(
_query_params.append(('date', var_date))

# process the header parameters
if authorization is not None:
_header_params['authorization'] = authorization
# process the form parameters
# process the body parameter

Expand Down
6 changes: 2 additions & 4 deletions lighter/api/portfolio_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,6 @@ def _portfolio_bo_pnl_serialize(

# 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))
Expand All @@ -349,6 +345,8 @@ def _portfolio_bo_pnl_serialize(
_query_params.append(('limit', limit))

# process the header parameters
if authorization is not None:
_header_params['authorization'] = authorization
# process the form parameters
# process the body parameter

Expand Down
1 change: 1 addition & 0 deletions lighter/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

# import models into model package
from lighter.models.account import Account
from lighter.models.account_binary_options_position import AccountBinaryOptionsPosition
from lighter.models.account_api_keys import AccountApiKeys
from lighter.models.account_asset import AccountAsset
from lighter.models.account_limits import AccountLimits
Expand Down
115 changes: 115 additions & 0 deletions lighter/models/account_binary_options_position.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# coding: utf-8

"""


No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

The version of the OpenAPI document:
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
""" # noqa: E501


from __future__ import annotations
import pprint
import re # noqa: F401
import json

from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List
from typing import Optional, Set
from typing_extensions import Self

class AccountBinaryOptionsPosition(BaseModel):
"""
AccountBinaryOptionsPosition
""" # noqa: E501
market_id: StrictInt
entry_quote: StrictStr
avg_entry_price: StrictStr = Field(description=" average price paid for the held outcome (YES price for sign 1, NO price for sign -1)")
sign: StrictInt = Field(description=" 1 holds the YES outcome, -1 holds the NO outcome")
size: StrictStr = Field(description=" magnitude only; combine with sign")
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["market_id", "entry_quote", "avg_entry_price", "sign", "size"]

@field_validator('sign')
def sign_validate_enum(cls, value):
"""Validates the enum"""
if value not in set([-1, 1]):
raise ValueError("must be one of enum values (-1, 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 AccountBinaryOptionsPosition 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 AccountBinaryOptionsPosition 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"),
"entry_quote": obj.get("entry_quote"),
"avg_entry_price": obj.get("avg_entry_price"),
"sign": obj.get("sign"),
"size": obj.get("size")
})
# store additional fields in additional_properties
for _key in obj.keys():
if _key not in cls.__properties:
_obj.additional_properties[_key] = obj.get(_key)

return _obj


9 changes: 7 additions & 2 deletions lighter/models/bo_outcome_pn_l.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import json

from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

Expand All @@ -30,7 +30,7 @@ class BoOutcomePnL(BaseModel):
symbol: StrictStr
outcome: StrictInt
end_timestamp: StrictInt
settlement_pnl: StrictStr
settlement_pnl: Optional[StrictStr]
last_trade_id: StrictInt
total_pnl: StrictStr
additional_properties: Dict[str, Any] = {}
Expand Down Expand Up @@ -89,6 +89,11 @@ def to_dict(self) -> Dict[str, Any]:
for _key, _value in self.additional_properties.items():
_dict[_key] = _value

# set to None if settlement_pnl (nullable) is None
# and model_fields_set contains the field
if self.settlement_pnl is None and "settlement_pnl" in self.model_fields_set:
_dict['settlement_pnl'] = None

return _dict

@classmethod
Expand Down
14 changes: 12 additions & 2 deletions lighter/models/detailed_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from lighter.models.account_asset import AccountAsset
from lighter.models.account_binary_options_position import AccountBinaryOptionsPosition
from lighter.models.account_position import AccountPosition
from lighter.models.approved_integrator import ApprovedIntegrator
from lighter.models.pending_unlock import PendingUnlock
Expand Down Expand Up @@ -67,8 +68,9 @@ class DetailedAccount(BaseModel):
can_rfq_market_ids: List[StrictStr]
metadata: SubAccountMetadata
agent_enabled: StrictBool
bo_positions: Optional[List[AccountBinaryOptionsPosition]] = None
additional_properties: Dict[str, Any] = {}
__properties: ClassVar[List[str]] = ["code", "message", "account_type", "account_trading_mode", "index", "l1_address", "cancel_all_time", "total_order_count", "total_isolated_order_count", "pending_order_count", "available_balance", "status", "collateral", "account_index", "name", "description", "can_invite", "referral_points_percentage", "positions", "assets", "total_asset_value", "cross_asset_value", "pool_info", "shares", "created_at", "transaction_time", "pending_unlocks", "approved_integrators", "can_rfq", "cross_initial_margin_requirement", "cross_maintenance_margin_requirement", "can_rfq_market_ids", "metadata", "agent_enabled"]
__properties: ClassVar[List[str]] = ["code", "message", "account_type", "account_trading_mode", "index", "l1_address", "cancel_all_time", "total_order_count", "total_isolated_order_count", "pending_order_count", "available_balance", "status", "collateral", "account_index", "name", "description", "can_invite", "referral_points_percentage", "positions", "assets", "total_asset_value", "cross_asset_value", "pool_info", "shares", "created_at", "transaction_time", "pending_unlocks", "approved_integrators", "can_rfq", "cross_initial_margin_requirement", "cross_maintenance_margin_requirement", "can_rfq_market_ids", "metadata", "agent_enabled", "bo_positions"]

model_config = ConfigDict(
populate_by_name=True,
Expand Down Expand Up @@ -152,6 +154,13 @@ def to_dict(self) -> Dict[str, Any]:
# override the default output from pydantic by calling `to_dict()` of metadata
if self.metadata:
_dict['metadata'] = self.metadata.to_dict()
# override the default output from pydantic by calling `to_dict()` of each item in bo_positions (list)
_items = []
if self.bo_positions:
for _item in self.bo_positions:
if _item:
_items.append(_item.to_dict())
_dict['bo_positions'] = _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():
Expand Down Expand Up @@ -202,7 +211,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"cross_maintenance_margin_requirement": obj.get("cross_maintenance_margin_requirement"),
"can_rfq_market_ids": obj.get("can_rfq_market_ids"),
"metadata": SubAccountMetadata.from_dict(obj["metadata"]) if obj.get("metadata") is not None else None,
"agent_enabled": obj.get("agent_enabled")
"agent_enabled": obj.get("agent_enabled"),
"bo_positions": [AccountBinaryOptionsPosition.from_dict(_item) for _item in obj["bo_positions"]] if obj.get("bo_positions") is not None else None
})
# store additional fields in additional_properties
for _key in obj.keys():
Expand Down
Loading
Loading