lighter-sdk 0.1.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- lighter/__init__.py +140 -0
- lighter/api/__init__.py +11 -0
- lighter/api/account_api.py +2371 -0
- lighter/api/block_api.py +863 -0
- lighter/api/candlestick_api.py +718 -0
- lighter/api/info_api.py +282 -0
- lighter/api/order_api.py +2734 -0
- lighter/api/root_api.py +529 -0
- lighter/api/transaction_api.py +3525 -0
- lighter/api_client.py +784 -0
- lighter/api_response.py +21 -0
- lighter/configuration.py +475 -0
- lighter/exceptions.py +199 -0
- lighter/models/__init__.py +112 -0
- lighter/models/account.py +110 -0
- lighter/models/account_api_keys.py +104 -0
- lighter/models/account_market_stats.py +98 -0
- lighter/models/account_metadata.py +94 -0
- lighter/models/account_pn_l.py +106 -0
- lighter/models/account_position.py +112 -0
- lighter/models/account_stats.py +102 -0
- lighter/models/accounts.py +106 -0
- lighter/models/api_key.py +98 -0
- lighter/models/block.py +124 -0
- lighter/models/blocks.py +106 -0
- lighter/models/bridge_supported_network.py +96 -0
- lighter/models/candlestick.py +106 -0
- lighter/models/candlesticks.py +106 -0
- lighter/models/contract_address.py +94 -0
- lighter/models/current_height.py +96 -0
- lighter/models/cursor.py +92 -0
- lighter/models/deposit_history.py +106 -0
- lighter/models/deposit_history_item.py +105 -0
- lighter/models/detailed_account.py +152 -0
- lighter/models/detailed_accounts.py +106 -0
- lighter/models/detailed_candlestick.py +108 -0
- lighter/models/enriched_tx.py +129 -0
- lighter/models/exchange_stats.py +110 -0
- lighter/models/fee_bucket.py +96 -0
- lighter/models/funding.py +98 -0
- lighter/models/fundings.py +106 -0
- lighter/models/is_whitelisted.py +98 -0
- lighter/models/l1_provider_info.py +98 -0
- lighter/models/layer2_basic_info.py +100 -0
- lighter/models/liquidation.py +100 -0
- lighter/models/market_info.py +116 -0
- lighter/models/next_nonce.py +96 -0
- lighter/models/order.py +159 -0
- lighter/models/order_book.py +119 -0
- lighter/models/order_book_depth.py +115 -0
- lighter/models/order_book_detail.py +151 -0
- lighter/models/order_book_details.py +104 -0
- lighter/models/order_book_orders.py +117 -0
- lighter/models/order_book_stats.py +102 -0
- lighter/models/order_books.py +104 -0
- lighter/models/orders.py +106 -0
- lighter/models/pn_l_entry.py +94 -0
- lighter/models/position_funding.py +111 -0
- lighter/models/price_level.py +94 -0
- lighter/models/public_pool.py +128 -0
- lighter/models/public_pool_info.py +100 -0
- lighter/models/public_pool_share.py +96 -0
- lighter/models/public_pools.py +106 -0
- lighter/models/req_get_account.py +101 -0
- lighter/models/req_get_account_active_orders.py +96 -0
- lighter/models/req_get_account_api_keys.py +94 -0
- lighter/models/req_get_account_by_l1_address.py +92 -0
- lighter/models/req_get_account_inactive_orders.py +103 -0
- lighter/models/req_get_account_orders.py +99 -0
- lighter/models/req_get_account_pending_txs.py +106 -0
- lighter/models/req_get_account_pn_l.py +118 -0
- lighter/models/req_get_account_txs.py +111 -0
- lighter/models/req_get_block.py +101 -0
- lighter/models/req_get_block_txs.py +101 -0
- lighter/models/req_get_by_account.py +101 -0
- lighter/models/req_get_candlesticks.py +109 -0
- lighter/models/req_get_deposit_history.py +106 -0
- lighter/models/req_get_fee_bucket.py +92 -0
- lighter/models/req_get_fundings.py +107 -0
- lighter/models/req_get_l1_tx.py +92 -0
- lighter/models/req_get_latest_deposit.py +92 -0
- lighter/models/req_get_next_nonce.py +94 -0
- lighter/models/req_get_order_book_details.py +92 -0
- lighter/models/req_get_order_book_orders.py +95 -0
- lighter/models/req_get_order_books.py +92 -0
- lighter/models/req_get_public_pools.py +109 -0
- lighter/models/req_get_range_with_cursor.py +95 -0
- lighter/models/req_get_range_with_index.py +95 -0
- lighter/models/req_get_range_with_index_sortable.py +107 -0
- lighter/models/req_get_recent_trades.py +95 -0
- lighter/models/req_get_trades.py +126 -0
- lighter/models/req_get_tx.py +101 -0
- lighter/models/req_get_withdraw_history.py +106 -0
- lighter/models/req_is_whitelisted.py +92 -0
- lighter/models/result_code.py +94 -0
- lighter/models/simple_order.py +102 -0
- lighter/models/status.py +94 -0
- lighter/models/sub_accounts.py +106 -0
- lighter/models/ticker.py +103 -0
- lighter/models/trade.py +125 -0
- lighter/models/trades.py +106 -0
- lighter/models/tx.py +121 -0
- lighter/models/tx_hash.py +96 -0
- lighter/models/tx_hashes.py +96 -0
- lighter/models/txs.py +104 -0
- lighter/models/validator_info.py +94 -0
- lighter/models/withdraw_history.py +110 -0
- lighter/models/withdraw_history_cursor.py +94 -0
- lighter/models/withdraw_history_item.py +114 -0
- lighter/models/zk_lighter_info.py +92 -0
- lighter/py.typed +0 -0
- lighter/rest.py +215 -0
- lighter/signer_client.py +440 -0
- lighter/signers/signer-amd64.so +0 -0
- lighter/signers/signer-arm64.dylib +0 -0
- lighter/transactions/__init__.py +3 -0
- lighter/transactions/cancel_order.py +27 -0
- lighter/transactions/create_order.py +33 -0
- lighter/transactions/withdraw.py +25 -0
- lighter/ws_client.py +160 -0
- lighter_sdk-0.1.0.dist-info/LICENSE +201 -0
- lighter_sdk-0.1.0.dist-info/METADATA +26 -0
- lighter_sdk-0.1.0.dist-info/RECORD +125 -0
- lighter_sdk-0.1.0.dist-info/WHEEL +5 -0
- lighter_sdk-0.1.0.dist-info/top_level.txt +1 -0
lighter/models/orders.py
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
|
5
|
+
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
|
+
|
8
|
+
The version of the OpenAPI document:
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from lighter.models.order import Order
|
23
|
+
from typing import Optional, Set
|
24
|
+
from typing_extensions import Self
|
25
|
+
|
26
|
+
class Orders(BaseModel):
|
27
|
+
"""
|
28
|
+
Orders
|
29
|
+
""" # noqa: E501
|
30
|
+
code: StrictInt
|
31
|
+
message: Optional[StrictStr] = None
|
32
|
+
next_cursor: Optional[StrictStr] = None
|
33
|
+
orders: List[Order]
|
34
|
+
__properties: ClassVar[List[str]] = ["code", "message", "next_cursor", "orders"]
|
35
|
+
|
36
|
+
model_config = ConfigDict(
|
37
|
+
populate_by_name=True,
|
38
|
+
validate_assignment=True,
|
39
|
+
protected_namespaces=(),
|
40
|
+
)
|
41
|
+
|
42
|
+
|
43
|
+
def to_str(self) -> str:
|
44
|
+
"""Returns the string representation of the model using alias"""
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
46
|
+
|
47
|
+
def to_json(self) -> str:
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
49
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
50
|
+
return json.dumps(self.to_dict())
|
51
|
+
|
52
|
+
@classmethod
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
54
|
+
"""Create an instance of Orders from a JSON string"""
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
56
|
+
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
59
|
+
|
60
|
+
This has the following differences from calling pydantic's
|
61
|
+
`self.model_dump(by_alias=True)`:
|
62
|
+
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
64
|
+
were set at model initialization. Other fields with value `None`
|
65
|
+
are ignored.
|
66
|
+
"""
|
67
|
+
excluded_fields: Set[str] = set([
|
68
|
+
])
|
69
|
+
|
70
|
+
_dict = self.model_dump(
|
71
|
+
by_alias=True,
|
72
|
+
exclude=excluded_fields,
|
73
|
+
exclude_none=True,
|
74
|
+
)
|
75
|
+
# override the default output from pydantic by calling `to_dict()` of each item in orders (list)
|
76
|
+
_items = []
|
77
|
+
if self.orders:
|
78
|
+
for _item in self.orders:
|
79
|
+
if _item:
|
80
|
+
_items.append(_item.to_dict())
|
81
|
+
_dict['orders'] = _items
|
82
|
+
return _dict
|
83
|
+
|
84
|
+
@classmethod
|
85
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
86
|
+
"""Create an instance of Orders from a dict"""
|
87
|
+
if obj is None:
|
88
|
+
return None
|
89
|
+
|
90
|
+
if not isinstance(obj, dict):
|
91
|
+
return cls.model_validate(obj)
|
92
|
+
|
93
|
+
# raise errors for additional fields in the input
|
94
|
+
for _key in obj.keys():
|
95
|
+
if _key not in cls.__properties:
|
96
|
+
raise ValueError("Error due to additional fields (not defined in Orders) in the input: " + _key)
|
97
|
+
|
98
|
+
_obj = cls.model_validate({
|
99
|
+
"code": obj.get("code"),
|
100
|
+
"message": obj.get("message"),
|
101
|
+
"next_cursor": obj.get("next_cursor"),
|
102
|
+
"orders": [Order.from_dict(_item) for _item in obj["orders"]] if obj.get("orders") is not None else None
|
103
|
+
})
|
104
|
+
return _obj
|
105
|
+
|
106
|
+
|
@@ -0,0 +1,94 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
|
5
|
+
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
|
+
|
8
|
+
The version of the OpenAPI document:
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt
|
21
|
+
from typing import Any, ClassVar, Dict, List, Union
|
22
|
+
from typing import Optional, Set
|
23
|
+
from typing_extensions import Self
|
24
|
+
|
25
|
+
class PnLEntry(BaseModel):
|
26
|
+
"""
|
27
|
+
PnLEntry
|
28
|
+
""" # noqa: E501
|
29
|
+
timestamp: StrictInt
|
30
|
+
value: Union[StrictFloat, StrictInt]
|
31
|
+
__properties: ClassVar[List[str]] = ["timestamp", "value"]
|
32
|
+
|
33
|
+
model_config = ConfigDict(
|
34
|
+
populate_by_name=True,
|
35
|
+
validate_assignment=True,
|
36
|
+
protected_namespaces=(),
|
37
|
+
)
|
38
|
+
|
39
|
+
|
40
|
+
def to_str(self) -> str:
|
41
|
+
"""Returns the string representation of the model using alias"""
|
42
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
43
|
+
|
44
|
+
def to_json(self) -> str:
|
45
|
+
"""Returns the JSON representation of the model using alias"""
|
46
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
47
|
+
return json.dumps(self.to_dict())
|
48
|
+
|
49
|
+
@classmethod
|
50
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
51
|
+
"""Create an instance of PnLEntry from a JSON string"""
|
52
|
+
return cls.from_dict(json.loads(json_str))
|
53
|
+
|
54
|
+
def to_dict(self) -> Dict[str, Any]:
|
55
|
+
"""Return the dictionary representation of the model using alias.
|
56
|
+
|
57
|
+
This has the following differences from calling pydantic's
|
58
|
+
`self.model_dump(by_alias=True)`:
|
59
|
+
|
60
|
+
* `None` is only added to the output dict for nullable fields that
|
61
|
+
were set at model initialization. Other fields with value `None`
|
62
|
+
are ignored.
|
63
|
+
"""
|
64
|
+
excluded_fields: Set[str] = set([
|
65
|
+
])
|
66
|
+
|
67
|
+
_dict = self.model_dump(
|
68
|
+
by_alias=True,
|
69
|
+
exclude=excluded_fields,
|
70
|
+
exclude_none=True,
|
71
|
+
)
|
72
|
+
return _dict
|
73
|
+
|
74
|
+
@classmethod
|
75
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
76
|
+
"""Create an instance of PnLEntry from a dict"""
|
77
|
+
if obj is None:
|
78
|
+
return None
|
79
|
+
|
80
|
+
if not isinstance(obj, dict):
|
81
|
+
return cls.model_validate(obj)
|
82
|
+
|
83
|
+
# raise errors for additional fields in the input
|
84
|
+
for _key in obj.keys():
|
85
|
+
if _key not in cls.__properties:
|
86
|
+
raise ValueError("Error due to additional fields (not defined in PnLEntry) in the input: " + _key)
|
87
|
+
|
88
|
+
_obj = cls.model_validate({
|
89
|
+
"timestamp": obj.get("timestamp"),
|
90
|
+
"value": obj.get("value")
|
91
|
+
})
|
92
|
+
return _obj
|
93
|
+
|
94
|
+
|
@@ -0,0 +1,111 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
|
5
|
+
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
|
+
|
8
|
+
The version of the OpenAPI document:
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr, field_validator
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
22
|
+
from typing import Optional, Set
|
23
|
+
from typing_extensions import Self
|
24
|
+
|
25
|
+
class PositionFunding(BaseModel):
|
26
|
+
"""
|
27
|
+
PositionFunding
|
28
|
+
""" # noqa: E501
|
29
|
+
timestamp: StrictInt
|
30
|
+
market_id: StrictInt
|
31
|
+
funding_id: StrictInt
|
32
|
+
change: StrictStr
|
33
|
+
rate: StrictStr
|
34
|
+
position_size: StrictStr
|
35
|
+
position_side: StrictStr
|
36
|
+
__properties: ClassVar[List[str]] = ["timestamp", "market_id", "funding_id", "change", "rate", "position_size", "position_side"]
|
37
|
+
|
38
|
+
@field_validator('position_side')
|
39
|
+
def position_side_validate_enum(cls, value):
|
40
|
+
"""Validates the enum"""
|
41
|
+
if value not in set(['long', 'short']):
|
42
|
+
raise ValueError("must be one of enum values ('long', 'short')")
|
43
|
+
return value
|
44
|
+
|
45
|
+
model_config = ConfigDict(
|
46
|
+
populate_by_name=True,
|
47
|
+
validate_assignment=True,
|
48
|
+
protected_namespaces=(),
|
49
|
+
)
|
50
|
+
|
51
|
+
|
52
|
+
def to_str(self) -> str:
|
53
|
+
"""Returns the string representation of the model using alias"""
|
54
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
55
|
+
|
56
|
+
def to_json(self) -> str:
|
57
|
+
"""Returns the JSON representation of the model using alias"""
|
58
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
59
|
+
return json.dumps(self.to_dict())
|
60
|
+
|
61
|
+
@classmethod
|
62
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
63
|
+
"""Create an instance of PositionFunding from a JSON string"""
|
64
|
+
return cls.from_dict(json.loads(json_str))
|
65
|
+
|
66
|
+
def to_dict(self) -> Dict[str, Any]:
|
67
|
+
"""Return the dictionary representation of the model using alias.
|
68
|
+
|
69
|
+
This has the following differences from calling pydantic's
|
70
|
+
`self.model_dump(by_alias=True)`:
|
71
|
+
|
72
|
+
* `None` is only added to the output dict for nullable fields that
|
73
|
+
were set at model initialization. Other fields with value `None`
|
74
|
+
are ignored.
|
75
|
+
"""
|
76
|
+
excluded_fields: Set[str] = set([
|
77
|
+
])
|
78
|
+
|
79
|
+
_dict = self.model_dump(
|
80
|
+
by_alias=True,
|
81
|
+
exclude=excluded_fields,
|
82
|
+
exclude_none=True,
|
83
|
+
)
|
84
|
+
return _dict
|
85
|
+
|
86
|
+
@classmethod
|
87
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
88
|
+
"""Create an instance of PositionFunding from a dict"""
|
89
|
+
if obj is None:
|
90
|
+
return None
|
91
|
+
|
92
|
+
if not isinstance(obj, dict):
|
93
|
+
return cls.model_validate(obj)
|
94
|
+
|
95
|
+
# raise errors for additional fields in the input
|
96
|
+
for _key in obj.keys():
|
97
|
+
if _key not in cls.__properties:
|
98
|
+
raise ValueError("Error due to additional fields (not defined in PositionFunding) in the input: " + _key)
|
99
|
+
|
100
|
+
_obj = cls.model_validate({
|
101
|
+
"timestamp": obj.get("timestamp"),
|
102
|
+
"market_id": obj.get("market_id"),
|
103
|
+
"funding_id": obj.get("funding_id"),
|
104
|
+
"change": obj.get("change"),
|
105
|
+
"rate": obj.get("rate"),
|
106
|
+
"position_size": obj.get("position_size"),
|
107
|
+
"position_side": obj.get("position_side")
|
108
|
+
})
|
109
|
+
return _obj
|
110
|
+
|
111
|
+
|
@@ -0,0 +1,94 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
|
5
|
+
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
|
+
|
8
|
+
The version of the OpenAPI document:
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictStr
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
22
|
+
from typing import Optional, Set
|
23
|
+
from typing_extensions import Self
|
24
|
+
|
25
|
+
class PriceLevel(BaseModel):
|
26
|
+
"""
|
27
|
+
PriceLevel
|
28
|
+
""" # noqa: E501
|
29
|
+
price: StrictStr
|
30
|
+
size: StrictStr
|
31
|
+
__properties: ClassVar[List[str]] = ["price", "size"]
|
32
|
+
|
33
|
+
model_config = ConfigDict(
|
34
|
+
populate_by_name=True,
|
35
|
+
validate_assignment=True,
|
36
|
+
protected_namespaces=(),
|
37
|
+
)
|
38
|
+
|
39
|
+
|
40
|
+
def to_str(self) -> str:
|
41
|
+
"""Returns the string representation of the model using alias"""
|
42
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
43
|
+
|
44
|
+
def to_json(self) -> str:
|
45
|
+
"""Returns the JSON representation of the model using alias"""
|
46
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
47
|
+
return json.dumps(self.to_dict())
|
48
|
+
|
49
|
+
@classmethod
|
50
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
51
|
+
"""Create an instance of PriceLevel from a JSON string"""
|
52
|
+
return cls.from_dict(json.loads(json_str))
|
53
|
+
|
54
|
+
def to_dict(self) -> Dict[str, Any]:
|
55
|
+
"""Return the dictionary representation of the model using alias.
|
56
|
+
|
57
|
+
This has the following differences from calling pydantic's
|
58
|
+
`self.model_dump(by_alias=True)`:
|
59
|
+
|
60
|
+
* `None` is only added to the output dict for nullable fields that
|
61
|
+
were set at model initialization. Other fields with value `None`
|
62
|
+
are ignored.
|
63
|
+
"""
|
64
|
+
excluded_fields: Set[str] = set([
|
65
|
+
])
|
66
|
+
|
67
|
+
_dict = self.model_dump(
|
68
|
+
by_alias=True,
|
69
|
+
exclude=excluded_fields,
|
70
|
+
exclude_none=True,
|
71
|
+
)
|
72
|
+
return _dict
|
73
|
+
|
74
|
+
@classmethod
|
75
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
76
|
+
"""Create an instance of PriceLevel from a dict"""
|
77
|
+
if obj is None:
|
78
|
+
return None
|
79
|
+
|
80
|
+
if not isinstance(obj, dict):
|
81
|
+
return cls.model_validate(obj)
|
82
|
+
|
83
|
+
# raise errors for additional fields in the input
|
84
|
+
for _key in obj.keys():
|
85
|
+
if _key not in cls.__properties:
|
86
|
+
raise ValueError("Error due to additional fields (not defined in PriceLevel) in the input: " + _key)
|
87
|
+
|
88
|
+
_obj = cls.model_validate({
|
89
|
+
"price": obj.get("price"),
|
90
|
+
"size": obj.get("size")
|
91
|
+
})
|
92
|
+
return _obj
|
93
|
+
|
94
|
+
|
@@ -0,0 +1,128 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
|
5
|
+
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
|
+
|
8
|
+
The version of the OpenAPI document:
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from lighter.models.public_pool_info import PublicPoolInfo
|
23
|
+
from lighter.models.public_pool_share import PublicPoolShare
|
24
|
+
from typing import Optional, Set
|
25
|
+
from typing_extensions import Self
|
26
|
+
|
27
|
+
class PublicPool(BaseModel):
|
28
|
+
"""
|
29
|
+
PublicPool
|
30
|
+
""" # noqa: E501
|
31
|
+
code: StrictInt
|
32
|
+
message: Optional[StrictStr] = None
|
33
|
+
account_type: StrictInt
|
34
|
+
index: StrictInt
|
35
|
+
l1_address: StrictStr
|
36
|
+
cancel_all_time: StrictInt
|
37
|
+
total_order_count: StrictInt
|
38
|
+
pending_order_count: StrictInt
|
39
|
+
status: StrictInt
|
40
|
+
collateral: StrictStr
|
41
|
+
name: StrictStr
|
42
|
+
description: StrictStr
|
43
|
+
total_asset_value: StrictStr
|
44
|
+
pool_info: PublicPoolInfo
|
45
|
+
account_share: PublicPoolShare
|
46
|
+
__properties: ClassVar[List[str]] = ["code", "message", "account_type", "index", "l1_address", "cancel_all_time", "total_order_count", "pending_order_count", "status", "collateral", "name", "description", "total_asset_value", "pool_info", "account_share"]
|
47
|
+
|
48
|
+
model_config = ConfigDict(
|
49
|
+
populate_by_name=True,
|
50
|
+
validate_assignment=True,
|
51
|
+
protected_namespaces=(),
|
52
|
+
)
|
53
|
+
|
54
|
+
|
55
|
+
def to_str(self) -> str:
|
56
|
+
"""Returns the string representation of the model using alias"""
|
57
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
58
|
+
|
59
|
+
def to_json(self) -> str:
|
60
|
+
"""Returns the JSON representation of the model using alias"""
|
61
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
62
|
+
return json.dumps(self.to_dict())
|
63
|
+
|
64
|
+
@classmethod
|
65
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
66
|
+
"""Create an instance of PublicPool from a JSON string"""
|
67
|
+
return cls.from_dict(json.loads(json_str))
|
68
|
+
|
69
|
+
def to_dict(self) -> Dict[str, Any]:
|
70
|
+
"""Return the dictionary representation of the model using alias.
|
71
|
+
|
72
|
+
This has the following differences from calling pydantic's
|
73
|
+
`self.model_dump(by_alias=True)`:
|
74
|
+
|
75
|
+
* `None` is only added to the output dict for nullable fields that
|
76
|
+
were set at model initialization. Other fields with value `None`
|
77
|
+
are ignored.
|
78
|
+
"""
|
79
|
+
excluded_fields: Set[str] = set([
|
80
|
+
])
|
81
|
+
|
82
|
+
_dict = self.model_dump(
|
83
|
+
by_alias=True,
|
84
|
+
exclude=excluded_fields,
|
85
|
+
exclude_none=True,
|
86
|
+
)
|
87
|
+
# override the default output from pydantic by calling `to_dict()` of pool_info
|
88
|
+
if self.pool_info:
|
89
|
+
_dict['pool_info'] = self.pool_info.to_dict()
|
90
|
+
# override the default output from pydantic by calling `to_dict()` of account_share
|
91
|
+
if self.account_share:
|
92
|
+
_dict['account_share'] = self.account_share.to_dict()
|
93
|
+
return _dict
|
94
|
+
|
95
|
+
@classmethod
|
96
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
97
|
+
"""Create an instance of PublicPool from a dict"""
|
98
|
+
if obj is None:
|
99
|
+
return None
|
100
|
+
|
101
|
+
if not isinstance(obj, dict):
|
102
|
+
return cls.model_validate(obj)
|
103
|
+
|
104
|
+
# raise errors for additional fields in the input
|
105
|
+
for _key in obj.keys():
|
106
|
+
if _key not in cls.__properties:
|
107
|
+
raise ValueError("Error due to additional fields (not defined in PublicPool) in the input: " + _key)
|
108
|
+
|
109
|
+
_obj = cls.model_validate({
|
110
|
+
"code": obj.get("code"),
|
111
|
+
"message": obj.get("message"),
|
112
|
+
"account_type": obj.get("account_type"),
|
113
|
+
"index": obj.get("index"),
|
114
|
+
"l1_address": obj.get("l1_address"),
|
115
|
+
"cancel_all_time": obj.get("cancel_all_time"),
|
116
|
+
"total_order_count": obj.get("total_order_count"),
|
117
|
+
"pending_order_count": obj.get("pending_order_count"),
|
118
|
+
"status": obj.get("status"),
|
119
|
+
"collateral": obj.get("collateral"),
|
120
|
+
"name": obj.get("name"),
|
121
|
+
"description": obj.get("description"),
|
122
|
+
"total_asset_value": obj.get("total_asset_value"),
|
123
|
+
"pool_info": PublicPoolInfo.from_dict(obj["pool_info"]) if obj.get("pool_info") is not None else None,
|
124
|
+
"account_share": PublicPoolShare.from_dict(obj["account_share"]) if obj.get("account_share") is not None else None
|
125
|
+
})
|
126
|
+
return _obj
|
127
|
+
|
128
|
+
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
|
5
|
+
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
|
+
|
8
|
+
The version of the OpenAPI document:
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
22
|
+
from typing import Optional, Set
|
23
|
+
from typing_extensions import Self
|
24
|
+
|
25
|
+
class PublicPoolInfo(BaseModel):
|
26
|
+
"""
|
27
|
+
PublicPoolInfo
|
28
|
+
""" # noqa: E501
|
29
|
+
status: StrictInt
|
30
|
+
operator_fee: StrictStr
|
31
|
+
min_operator_share_rate: StrictStr
|
32
|
+
total_shares: StrictInt
|
33
|
+
operator_shares: StrictInt
|
34
|
+
__properties: ClassVar[List[str]] = ["status", "operator_fee", "min_operator_share_rate", "total_shares", "operator_shares"]
|
35
|
+
|
36
|
+
model_config = ConfigDict(
|
37
|
+
populate_by_name=True,
|
38
|
+
validate_assignment=True,
|
39
|
+
protected_namespaces=(),
|
40
|
+
)
|
41
|
+
|
42
|
+
|
43
|
+
def to_str(self) -> str:
|
44
|
+
"""Returns the string representation of the model using alias"""
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
46
|
+
|
47
|
+
def to_json(self) -> str:
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
49
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
50
|
+
return json.dumps(self.to_dict())
|
51
|
+
|
52
|
+
@classmethod
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
54
|
+
"""Create an instance of PublicPoolInfo from a JSON string"""
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
56
|
+
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
59
|
+
|
60
|
+
This has the following differences from calling pydantic's
|
61
|
+
`self.model_dump(by_alias=True)`:
|
62
|
+
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
64
|
+
were set at model initialization. Other fields with value `None`
|
65
|
+
are ignored.
|
66
|
+
"""
|
67
|
+
excluded_fields: Set[str] = set([
|
68
|
+
])
|
69
|
+
|
70
|
+
_dict = self.model_dump(
|
71
|
+
by_alias=True,
|
72
|
+
exclude=excluded_fields,
|
73
|
+
exclude_none=True,
|
74
|
+
)
|
75
|
+
return _dict
|
76
|
+
|
77
|
+
@classmethod
|
78
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
79
|
+
"""Create an instance of PublicPoolInfo from a dict"""
|
80
|
+
if obj is None:
|
81
|
+
return None
|
82
|
+
|
83
|
+
if not isinstance(obj, dict):
|
84
|
+
return cls.model_validate(obj)
|
85
|
+
|
86
|
+
# raise errors for additional fields in the input
|
87
|
+
for _key in obj.keys():
|
88
|
+
if _key not in cls.__properties:
|
89
|
+
raise ValueError("Error due to additional fields (not defined in PublicPoolInfo) in the input: " + _key)
|
90
|
+
|
91
|
+
_obj = cls.model_validate({
|
92
|
+
"status": obj.get("status"),
|
93
|
+
"operator_fee": obj.get("operator_fee"),
|
94
|
+
"min_operator_share_rate": obj.get("min_operator_share_rate"),
|
95
|
+
"total_shares": obj.get("total_shares"),
|
96
|
+
"operator_shares": obj.get("operator_shares")
|
97
|
+
})
|
98
|
+
return _obj
|
99
|
+
|
100
|
+
|