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.
Files changed (125) hide show
  1. lighter/__init__.py +140 -0
  2. lighter/api/__init__.py +11 -0
  3. lighter/api/account_api.py +2371 -0
  4. lighter/api/block_api.py +863 -0
  5. lighter/api/candlestick_api.py +718 -0
  6. lighter/api/info_api.py +282 -0
  7. lighter/api/order_api.py +2734 -0
  8. lighter/api/root_api.py +529 -0
  9. lighter/api/transaction_api.py +3525 -0
  10. lighter/api_client.py +784 -0
  11. lighter/api_response.py +21 -0
  12. lighter/configuration.py +475 -0
  13. lighter/exceptions.py +199 -0
  14. lighter/models/__init__.py +112 -0
  15. lighter/models/account.py +110 -0
  16. lighter/models/account_api_keys.py +104 -0
  17. lighter/models/account_market_stats.py +98 -0
  18. lighter/models/account_metadata.py +94 -0
  19. lighter/models/account_pn_l.py +106 -0
  20. lighter/models/account_position.py +112 -0
  21. lighter/models/account_stats.py +102 -0
  22. lighter/models/accounts.py +106 -0
  23. lighter/models/api_key.py +98 -0
  24. lighter/models/block.py +124 -0
  25. lighter/models/blocks.py +106 -0
  26. lighter/models/bridge_supported_network.py +96 -0
  27. lighter/models/candlestick.py +106 -0
  28. lighter/models/candlesticks.py +106 -0
  29. lighter/models/contract_address.py +94 -0
  30. lighter/models/current_height.py +96 -0
  31. lighter/models/cursor.py +92 -0
  32. lighter/models/deposit_history.py +106 -0
  33. lighter/models/deposit_history_item.py +105 -0
  34. lighter/models/detailed_account.py +152 -0
  35. lighter/models/detailed_accounts.py +106 -0
  36. lighter/models/detailed_candlestick.py +108 -0
  37. lighter/models/enriched_tx.py +129 -0
  38. lighter/models/exchange_stats.py +110 -0
  39. lighter/models/fee_bucket.py +96 -0
  40. lighter/models/funding.py +98 -0
  41. lighter/models/fundings.py +106 -0
  42. lighter/models/is_whitelisted.py +98 -0
  43. lighter/models/l1_provider_info.py +98 -0
  44. lighter/models/layer2_basic_info.py +100 -0
  45. lighter/models/liquidation.py +100 -0
  46. lighter/models/market_info.py +116 -0
  47. lighter/models/next_nonce.py +96 -0
  48. lighter/models/order.py +159 -0
  49. lighter/models/order_book.py +119 -0
  50. lighter/models/order_book_depth.py +115 -0
  51. lighter/models/order_book_detail.py +151 -0
  52. lighter/models/order_book_details.py +104 -0
  53. lighter/models/order_book_orders.py +117 -0
  54. lighter/models/order_book_stats.py +102 -0
  55. lighter/models/order_books.py +104 -0
  56. lighter/models/orders.py +106 -0
  57. lighter/models/pn_l_entry.py +94 -0
  58. lighter/models/position_funding.py +111 -0
  59. lighter/models/price_level.py +94 -0
  60. lighter/models/public_pool.py +128 -0
  61. lighter/models/public_pool_info.py +100 -0
  62. lighter/models/public_pool_share.py +96 -0
  63. lighter/models/public_pools.py +106 -0
  64. lighter/models/req_get_account.py +101 -0
  65. lighter/models/req_get_account_active_orders.py +96 -0
  66. lighter/models/req_get_account_api_keys.py +94 -0
  67. lighter/models/req_get_account_by_l1_address.py +92 -0
  68. lighter/models/req_get_account_inactive_orders.py +103 -0
  69. lighter/models/req_get_account_orders.py +99 -0
  70. lighter/models/req_get_account_pending_txs.py +106 -0
  71. lighter/models/req_get_account_pn_l.py +118 -0
  72. lighter/models/req_get_account_txs.py +111 -0
  73. lighter/models/req_get_block.py +101 -0
  74. lighter/models/req_get_block_txs.py +101 -0
  75. lighter/models/req_get_by_account.py +101 -0
  76. lighter/models/req_get_candlesticks.py +109 -0
  77. lighter/models/req_get_deposit_history.py +106 -0
  78. lighter/models/req_get_fee_bucket.py +92 -0
  79. lighter/models/req_get_fundings.py +107 -0
  80. lighter/models/req_get_l1_tx.py +92 -0
  81. lighter/models/req_get_latest_deposit.py +92 -0
  82. lighter/models/req_get_next_nonce.py +94 -0
  83. lighter/models/req_get_order_book_details.py +92 -0
  84. lighter/models/req_get_order_book_orders.py +95 -0
  85. lighter/models/req_get_order_books.py +92 -0
  86. lighter/models/req_get_public_pools.py +109 -0
  87. lighter/models/req_get_range_with_cursor.py +95 -0
  88. lighter/models/req_get_range_with_index.py +95 -0
  89. lighter/models/req_get_range_with_index_sortable.py +107 -0
  90. lighter/models/req_get_recent_trades.py +95 -0
  91. lighter/models/req_get_trades.py +126 -0
  92. lighter/models/req_get_tx.py +101 -0
  93. lighter/models/req_get_withdraw_history.py +106 -0
  94. lighter/models/req_is_whitelisted.py +92 -0
  95. lighter/models/result_code.py +94 -0
  96. lighter/models/simple_order.py +102 -0
  97. lighter/models/status.py +94 -0
  98. lighter/models/sub_accounts.py +106 -0
  99. lighter/models/ticker.py +103 -0
  100. lighter/models/trade.py +125 -0
  101. lighter/models/trades.py +106 -0
  102. lighter/models/tx.py +121 -0
  103. lighter/models/tx_hash.py +96 -0
  104. lighter/models/tx_hashes.py +96 -0
  105. lighter/models/txs.py +104 -0
  106. lighter/models/validator_info.py +94 -0
  107. lighter/models/withdraw_history.py +110 -0
  108. lighter/models/withdraw_history_cursor.py +94 -0
  109. lighter/models/withdraw_history_item.py +114 -0
  110. lighter/models/zk_lighter_info.py +92 -0
  111. lighter/py.typed +0 -0
  112. lighter/rest.py +215 -0
  113. lighter/signer_client.py +440 -0
  114. lighter/signers/signer-amd64.so +0 -0
  115. lighter/signers/signer-arm64.dylib +0 -0
  116. lighter/transactions/__init__.py +3 -0
  117. lighter/transactions/cancel_order.py +27 -0
  118. lighter/transactions/create_order.py +33 -0
  119. lighter/transactions/withdraw.py +25 -0
  120. lighter/ws_client.py +160 -0
  121. lighter_sdk-0.1.0.dist-info/LICENSE +201 -0
  122. lighter_sdk-0.1.0.dist-info/METADATA +26 -0
  123. lighter_sdk-0.1.0.dist-info/RECORD +125 -0
  124. lighter_sdk-0.1.0.dist-info/WHEEL +5 -0
  125. lighter_sdk-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,115 @@
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.price_level import PriceLevel
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class OrderBookDepth(BaseModel):
27
+ """
28
+ OrderBookDepth
29
+ """ # noqa: E501
30
+ code: StrictInt
31
+ message: Optional[StrictStr] = None
32
+ asks: List[PriceLevel]
33
+ bids: List[PriceLevel]
34
+ offset: StrictInt
35
+ __properties: ClassVar[List[str]] = ["code", "message", "asks", "bids", "offset"]
36
+
37
+ model_config = ConfigDict(
38
+ populate_by_name=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
41
+ )
42
+
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
+ return json.dumps(self.to_dict())
52
+
53
+ @classmethod
54
+ def from_json(cls, json_str: str) -> Optional[Self]:
55
+ """Create an instance of OrderBookDepth from a JSON string"""
56
+ return cls.from_dict(json.loads(json_str))
57
+
58
+ def to_dict(self) -> Dict[str, Any]:
59
+ """Return the dictionary representation of the model using alias.
60
+
61
+ This has the following differences from calling pydantic's
62
+ `self.model_dump(by_alias=True)`:
63
+
64
+ * `None` is only added to the output dict for nullable fields that
65
+ were set at model initialization. Other fields with value `None`
66
+ are ignored.
67
+ """
68
+ excluded_fields: Set[str] = set([
69
+ ])
70
+
71
+ _dict = self.model_dump(
72
+ by_alias=True,
73
+ exclude=excluded_fields,
74
+ exclude_none=True,
75
+ )
76
+ # override the default output from pydantic by calling `to_dict()` of each item in asks (list)
77
+ _items = []
78
+ if self.asks:
79
+ for _item in self.asks:
80
+ if _item:
81
+ _items.append(_item.to_dict())
82
+ _dict['asks'] = _items
83
+ # override the default output from pydantic by calling `to_dict()` of each item in bids (list)
84
+ _items = []
85
+ if self.bids:
86
+ for _item in self.bids:
87
+ if _item:
88
+ _items.append(_item.to_dict())
89
+ _dict['bids'] = _items
90
+ return _dict
91
+
92
+ @classmethod
93
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
94
+ """Create an instance of OrderBookDepth from a dict"""
95
+ if obj is None:
96
+ return None
97
+
98
+ if not isinstance(obj, dict):
99
+ return cls.model_validate(obj)
100
+
101
+ # raise errors for additional fields in the input
102
+ for _key in obj.keys():
103
+ if _key not in cls.__properties:
104
+ raise ValueError("Error due to additional fields (not defined in OrderBookDepth) in the input: " + _key)
105
+
106
+ _obj = cls.model_validate({
107
+ "code": obj.get("code"),
108
+ "message": obj.get("message"),
109
+ "asks": [PriceLevel.from_dict(_item) for _item in obj["asks"]] if obj.get("asks") is not None else None,
110
+ "bids": [PriceLevel.from_dict(_item) for _item in obj["bids"]] if obj.get("bids") is not None else None,
111
+ "offset": obj.get("offset")
112
+ })
113
+ return _obj
114
+
115
+
@@ -0,0 +1,151 @@
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, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List, Union
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class OrderBookDetail(BaseModel):
26
+ """
27
+ OrderBookDetail
28
+ """ # noqa: E501
29
+ symbol: StrictStr
30
+ market_id: StrictInt
31
+ status: StrictStr
32
+ taker_fee: StrictStr
33
+ maker_fee: StrictStr
34
+ liquidation_fee: StrictStr
35
+ min_base_amount: StrictStr
36
+ min_quote_amount: StrictStr
37
+ supported_size_decimals: StrictInt
38
+ supported_price_decimals: StrictInt
39
+ supported_quote_decimals: StrictInt
40
+ size_decimals: StrictInt
41
+ price_decimals: StrictInt
42
+ quote_multiplier: StrictInt
43
+ default_initial_margin_fraction: StrictInt
44
+ min_initial_margin_fraction: StrictInt
45
+ maintenance_margin_fraction: StrictInt
46
+ closeout_margin_fraction: StrictInt
47
+ last_trade_price: Union[StrictFloat, StrictInt]
48
+ daily_trades_count: StrictInt
49
+ daily_base_token_volume: Union[StrictFloat, StrictInt]
50
+ daily_quote_token_volume: Union[StrictFloat, StrictInt]
51
+ daily_price_low: Union[StrictFloat, StrictInt]
52
+ daily_price_high: Union[StrictFloat, StrictInt]
53
+ daily_price_change: Union[StrictFloat, StrictInt]
54
+ open_interest: Union[StrictFloat, StrictInt]
55
+ daily_chart: Dict[str, Union[StrictFloat, StrictInt]]
56
+ __properties: ClassVar[List[str]] = ["symbol", "market_id", "status", "taker_fee", "maker_fee", "liquidation_fee", "min_base_amount", "min_quote_amount", "supported_size_decimals", "supported_price_decimals", "supported_quote_decimals", "size_decimals", "price_decimals", "quote_multiplier", "default_initial_margin_fraction", "min_initial_margin_fraction", "maintenance_margin_fraction", "closeout_margin_fraction", "last_trade_price", "daily_trades_count", "daily_base_token_volume", "daily_quote_token_volume", "daily_price_low", "daily_price_high", "daily_price_change", "open_interest", "daily_chart"]
57
+
58
+ @field_validator('status')
59
+ def status_validate_enum(cls, value):
60
+ """Validates the enum"""
61
+ if value not in set(['frozen', 'active']):
62
+ raise ValueError("must be one of enum values ('frozen', 'active')")
63
+ return value
64
+
65
+ model_config = ConfigDict(
66
+ populate_by_name=True,
67
+ validate_assignment=True,
68
+ protected_namespaces=(),
69
+ )
70
+
71
+
72
+ def to_str(self) -> str:
73
+ """Returns the string representation of the model using alias"""
74
+ return pprint.pformat(self.model_dump(by_alias=True))
75
+
76
+ def to_json(self) -> str:
77
+ """Returns the JSON representation of the model using alias"""
78
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
79
+ return json.dumps(self.to_dict())
80
+
81
+ @classmethod
82
+ def from_json(cls, json_str: str) -> Optional[Self]:
83
+ """Create an instance of OrderBookDetail from a JSON string"""
84
+ return cls.from_dict(json.loads(json_str))
85
+
86
+ def to_dict(self) -> Dict[str, Any]:
87
+ """Return the dictionary representation of the model using alias.
88
+
89
+ This has the following differences from calling pydantic's
90
+ `self.model_dump(by_alias=True)`:
91
+
92
+ * `None` is only added to the output dict for nullable fields that
93
+ were set at model initialization. Other fields with value `None`
94
+ are ignored.
95
+ """
96
+ excluded_fields: Set[str] = set([
97
+ ])
98
+
99
+ _dict = self.model_dump(
100
+ by_alias=True,
101
+ exclude=excluded_fields,
102
+ exclude_none=True,
103
+ )
104
+ return _dict
105
+
106
+ @classmethod
107
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
108
+ """Create an instance of OrderBookDetail from a dict"""
109
+ if obj is None:
110
+ return None
111
+
112
+ if not isinstance(obj, dict):
113
+ return cls.model_validate(obj)
114
+
115
+ # raise errors for additional fields in the input
116
+ for _key in obj.keys():
117
+ if _key not in cls.__properties:
118
+ raise ValueError("Error due to additional fields (not defined in OrderBookDetail) in the input: " + _key)
119
+
120
+ _obj = cls.model_validate({
121
+ "symbol": obj.get("symbol"),
122
+ "market_id": obj.get("market_id"),
123
+ "status": obj.get("status"),
124
+ "taker_fee": obj.get("taker_fee"),
125
+ "maker_fee": obj.get("maker_fee"),
126
+ "liquidation_fee": obj.get("liquidation_fee"),
127
+ "min_base_amount": obj.get("min_base_amount"),
128
+ "min_quote_amount": obj.get("min_quote_amount"),
129
+ "supported_size_decimals": obj.get("supported_size_decimals"),
130
+ "supported_price_decimals": obj.get("supported_price_decimals"),
131
+ "supported_quote_decimals": obj.get("supported_quote_decimals"),
132
+ "size_decimals": obj.get("size_decimals"),
133
+ "price_decimals": obj.get("price_decimals"),
134
+ "quote_multiplier": obj.get("quote_multiplier"),
135
+ "default_initial_margin_fraction": obj.get("default_initial_margin_fraction"),
136
+ "min_initial_margin_fraction": obj.get("min_initial_margin_fraction"),
137
+ "maintenance_margin_fraction": obj.get("maintenance_margin_fraction"),
138
+ "closeout_margin_fraction": obj.get("closeout_margin_fraction"),
139
+ "last_trade_price": obj.get("last_trade_price"),
140
+ "daily_trades_count": obj.get("daily_trades_count"),
141
+ "daily_base_token_volume": obj.get("daily_base_token_volume"),
142
+ "daily_quote_token_volume": obj.get("daily_quote_token_volume"),
143
+ "daily_price_low": obj.get("daily_price_low"),
144
+ "daily_price_high": obj.get("daily_price_high"),
145
+ "daily_price_change": obj.get("daily_price_change"),
146
+ "open_interest": obj.get("open_interest"),
147
+ "daily_chart": obj.get("daily_chart")
148
+ })
149
+ return _obj
150
+
151
+
@@ -0,0 +1,104 @@
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_book_detail import OrderBookDetail
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class OrderBookDetails(BaseModel):
27
+ """
28
+ OrderBookDetails
29
+ """ # noqa: E501
30
+ code: StrictInt
31
+ message: Optional[StrictStr] = None
32
+ order_book_details: List[OrderBookDetail]
33
+ __properties: ClassVar[List[str]] = ["code", "message", "order_book_details"]
34
+
35
+ model_config = ConfigDict(
36
+ populate_by_name=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True))
45
+
46
+ def to_json(self) -> str:
47
+ """Returns the JSON representation of the model using alias"""
48
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
+ return json.dumps(self.to_dict())
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of OrderBookDetails from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ """
66
+ excluded_fields: Set[str] = set([
67
+ ])
68
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ # override the default output from pydantic by calling `to_dict()` of each item in order_book_details (list)
75
+ _items = []
76
+ if self.order_book_details:
77
+ for _item in self.order_book_details:
78
+ if _item:
79
+ _items.append(_item.to_dict())
80
+ _dict['order_book_details'] = _items
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
+ """Create an instance of OrderBookDetails from a dict"""
86
+ if obj is None:
87
+ return None
88
+
89
+ if not isinstance(obj, dict):
90
+ return cls.model_validate(obj)
91
+
92
+ # raise errors for additional fields in the input
93
+ for _key in obj.keys():
94
+ if _key not in cls.__properties:
95
+ raise ValueError("Error due to additional fields (not defined in OrderBookDetails) in the input: " + _key)
96
+
97
+ _obj = cls.model_validate({
98
+ "code": obj.get("code"),
99
+ "message": obj.get("message"),
100
+ "order_book_details": [OrderBookDetail.from_dict(_item) for _item in obj["order_book_details"]] if obj.get("order_book_details") is not None else None
101
+ })
102
+ return _obj
103
+
104
+
@@ -0,0 +1,117 @@
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.simple_order import SimpleOrder
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class OrderBookOrders(BaseModel):
27
+ """
28
+ OrderBookOrders
29
+ """ # noqa: E501
30
+ code: StrictInt
31
+ message: Optional[StrictStr] = None
32
+ total_asks: StrictInt
33
+ asks: List[SimpleOrder]
34
+ total_bids: StrictInt
35
+ bids: List[SimpleOrder]
36
+ __properties: ClassVar[List[str]] = ["code", "message", "total_asks", "asks", "total_bids", "bids"]
37
+
38
+ model_config = ConfigDict(
39
+ populate_by_name=True,
40
+ validate_assignment=True,
41
+ protected_namespaces=(),
42
+ )
43
+
44
+
45
+ def to_str(self) -> str:
46
+ """Returns the string representation of the model using alias"""
47
+ return pprint.pformat(self.model_dump(by_alias=True))
48
+
49
+ def to_json(self) -> str:
50
+ """Returns the JSON representation of the model using alias"""
51
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
52
+ return json.dumps(self.to_dict())
53
+
54
+ @classmethod
55
+ def from_json(cls, json_str: str) -> Optional[Self]:
56
+ """Create an instance of OrderBookOrders from a JSON string"""
57
+ return cls.from_dict(json.loads(json_str))
58
+
59
+ def to_dict(self) -> Dict[str, Any]:
60
+ """Return the dictionary representation of the model using alias.
61
+
62
+ This has the following differences from calling pydantic's
63
+ `self.model_dump(by_alias=True)`:
64
+
65
+ * `None` is only added to the output dict for nullable fields that
66
+ were set at model initialization. Other fields with value `None`
67
+ are ignored.
68
+ """
69
+ excluded_fields: Set[str] = set([
70
+ ])
71
+
72
+ _dict = self.model_dump(
73
+ by_alias=True,
74
+ exclude=excluded_fields,
75
+ exclude_none=True,
76
+ )
77
+ # override the default output from pydantic by calling `to_dict()` of each item in asks (list)
78
+ _items = []
79
+ if self.asks:
80
+ for _item in self.asks:
81
+ if _item:
82
+ _items.append(_item.to_dict())
83
+ _dict['asks'] = _items
84
+ # override the default output from pydantic by calling `to_dict()` of each item in bids (list)
85
+ _items = []
86
+ if self.bids:
87
+ for _item in self.bids:
88
+ if _item:
89
+ _items.append(_item.to_dict())
90
+ _dict['bids'] = _items
91
+ return _dict
92
+
93
+ @classmethod
94
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
95
+ """Create an instance of OrderBookOrders from a dict"""
96
+ if obj is None:
97
+ return None
98
+
99
+ if not isinstance(obj, dict):
100
+ return cls.model_validate(obj)
101
+
102
+ # raise errors for additional fields in the input
103
+ for _key in obj.keys():
104
+ if _key not in cls.__properties:
105
+ raise ValueError("Error due to additional fields (not defined in OrderBookOrders) in the input: " + _key)
106
+
107
+ _obj = cls.model_validate({
108
+ "code": obj.get("code"),
109
+ "message": obj.get("message"),
110
+ "total_asks": obj.get("total_asks"),
111
+ "asks": [SimpleOrder.from_dict(_item) for _item in obj["asks"]] if obj.get("asks") is not None else None,
112
+ "total_bids": obj.get("total_bids"),
113
+ "bids": [SimpleOrder.from_dict(_item) for _item in obj["bids"]] if obj.get("bids") is not None else None
114
+ })
115
+ return _obj
116
+
117
+
@@ -0,0 +1,102 @@
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, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Union
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class OrderBookStats(BaseModel):
26
+ """
27
+ OrderBookStats
28
+ """ # noqa: E501
29
+ symbol: StrictStr
30
+ last_trade_price: Union[StrictFloat, StrictInt]
31
+ daily_trades_count: StrictInt
32
+ daily_base_token_volume: Union[StrictFloat, StrictInt]
33
+ daily_quote_token_volume: Union[StrictFloat, StrictInt]
34
+ daily_price_change: Union[StrictFloat, StrictInt]
35
+ __properties: ClassVar[List[str]] = ["symbol", "last_trade_price", "daily_trades_count", "daily_base_token_volume", "daily_quote_token_volume", "daily_price_change"]
36
+
37
+ model_config = ConfigDict(
38
+ populate_by_name=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
41
+ )
42
+
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
+ return json.dumps(self.to_dict())
52
+
53
+ @classmethod
54
+ def from_json(cls, json_str: str) -> Optional[Self]:
55
+ """Create an instance of OrderBookStats from a JSON string"""
56
+ return cls.from_dict(json.loads(json_str))
57
+
58
+ def to_dict(self) -> Dict[str, Any]:
59
+ """Return the dictionary representation of the model using alias.
60
+
61
+ This has the following differences from calling pydantic's
62
+ `self.model_dump(by_alias=True)`:
63
+
64
+ * `None` is only added to the output dict for nullable fields that
65
+ were set at model initialization. Other fields with value `None`
66
+ are ignored.
67
+ """
68
+ excluded_fields: Set[str] = set([
69
+ ])
70
+
71
+ _dict = self.model_dump(
72
+ by_alias=True,
73
+ exclude=excluded_fields,
74
+ exclude_none=True,
75
+ )
76
+ return _dict
77
+
78
+ @classmethod
79
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
80
+ """Create an instance of OrderBookStats from a dict"""
81
+ if obj is None:
82
+ return None
83
+
84
+ if not isinstance(obj, dict):
85
+ return cls.model_validate(obj)
86
+
87
+ # raise errors for additional fields in the input
88
+ for _key in obj.keys():
89
+ if _key not in cls.__properties:
90
+ raise ValueError("Error due to additional fields (not defined in OrderBookStats) in the input: " + _key)
91
+
92
+ _obj = cls.model_validate({
93
+ "symbol": obj.get("symbol"),
94
+ "last_trade_price": obj.get("last_trade_price"),
95
+ "daily_trades_count": obj.get("daily_trades_count"),
96
+ "daily_base_token_volume": obj.get("daily_base_token_volume"),
97
+ "daily_quote_token_volume": obj.get("daily_quote_token_volume"),
98
+ "daily_price_change": obj.get("daily_price_change")
99
+ })
100
+ return _obj
101
+
102
+
@@ -0,0 +1,104 @@
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_book import OrderBook
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class OrderBooks(BaseModel):
27
+ """
28
+ OrderBooks
29
+ """ # noqa: E501
30
+ code: StrictInt
31
+ message: Optional[StrictStr] = None
32
+ order_books: List[OrderBook]
33
+ __properties: ClassVar[List[str]] = ["code", "message", "order_books"]
34
+
35
+ model_config = ConfigDict(
36
+ populate_by_name=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True))
45
+
46
+ def to_json(self) -> str:
47
+ """Returns the JSON representation of the model using alias"""
48
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
+ return json.dumps(self.to_dict())
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of OrderBooks from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ """
66
+ excluded_fields: Set[str] = set([
67
+ ])
68
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ # override the default output from pydantic by calling `to_dict()` of each item in order_books (list)
75
+ _items = []
76
+ if self.order_books:
77
+ for _item in self.order_books:
78
+ if _item:
79
+ _items.append(_item.to_dict())
80
+ _dict['order_books'] = _items
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
+ """Create an instance of OrderBooks from a dict"""
86
+ if obj is None:
87
+ return None
88
+
89
+ if not isinstance(obj, dict):
90
+ return cls.model_validate(obj)
91
+
92
+ # raise errors for additional fields in the input
93
+ for _key in obj.keys():
94
+ if _key not in cls.__properties:
95
+ raise ValueError("Error due to additional fields (not defined in OrderBooks) in the input: " + _key)
96
+
97
+ _obj = cls.model_validate({
98
+ "code": obj.get("code"),
99
+ "message": obj.get("message"),
100
+ "order_books": [OrderBook.from_dict(_item) for _item in obj["order_books"]] if obj.get("order_books") is not None else None
101
+ })
102
+ return _obj
103
+
104
+