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,112 @@
1
+ # coding: utf-8
2
+
3
+ # flake8: noqa
4
+ """
5
+
6
+
7
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
8
+
9
+ The version of the OpenAPI document:
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ # import models into model package
17
+ from lighter.models.account import Account
18
+ from lighter.models.account_api_keys import AccountApiKeys
19
+ from lighter.models.account_market_stats import AccountMarketStats
20
+ from lighter.models.account_metadata import AccountMetadata
21
+ from lighter.models.account_pn_l import AccountPnL
22
+ from lighter.models.account_position import AccountPosition
23
+ from lighter.models.account_stats import AccountStats
24
+ from lighter.models.accounts import Accounts
25
+ from lighter.models.api_key import ApiKey
26
+ from lighter.models.block import Block
27
+ from lighter.models.blocks import Blocks
28
+ from lighter.models.bridge_supported_network import BridgeSupportedNetwork
29
+ from lighter.models.candlestick import Candlestick
30
+ from lighter.models.candlesticks import Candlesticks
31
+ from lighter.models.contract_address import ContractAddress
32
+ from lighter.models.current_height import CurrentHeight
33
+ from lighter.models.cursor import Cursor
34
+ from lighter.models.deposit_history import DepositHistory
35
+ from lighter.models.deposit_history_item import DepositHistoryItem
36
+ from lighter.models.detailed_account import DetailedAccount
37
+ from lighter.models.detailed_accounts import DetailedAccounts
38
+ from lighter.models.detailed_candlestick import DetailedCandlestick
39
+ from lighter.models.enriched_tx import EnrichedTx
40
+ from lighter.models.exchange_stats import ExchangeStats
41
+ from lighter.models.fee_bucket import FeeBucket
42
+ from lighter.models.funding import Funding
43
+ from lighter.models.fundings import Fundings
44
+ from lighter.models.is_whitelisted import IsWhitelisted
45
+ from lighter.models.l1_provider_info import L1ProviderInfo
46
+ from lighter.models.layer2_basic_info import Layer2BasicInfo
47
+ from lighter.models.liquidation import Liquidation
48
+ from lighter.models.market_info import MarketInfo
49
+ from lighter.models.next_nonce import NextNonce
50
+ from lighter.models.order import Order
51
+ from lighter.models.order_book import OrderBook
52
+ from lighter.models.order_book_depth import OrderBookDepth
53
+ from lighter.models.order_book_detail import OrderBookDetail
54
+ from lighter.models.order_book_details import OrderBookDetails
55
+ from lighter.models.order_book_orders import OrderBookOrders
56
+ from lighter.models.order_book_stats import OrderBookStats
57
+ from lighter.models.order_books import OrderBooks
58
+ from lighter.models.orders import Orders
59
+ from lighter.models.pn_l_entry import PnLEntry
60
+ from lighter.models.position_funding import PositionFunding
61
+ from lighter.models.price_level import PriceLevel
62
+ from lighter.models.public_pool import PublicPool
63
+ from lighter.models.public_pool_info import PublicPoolInfo
64
+ from lighter.models.public_pool_share import PublicPoolShare
65
+ from lighter.models.public_pools import PublicPools
66
+ from lighter.models.req_get_account import ReqGetAccount
67
+ from lighter.models.req_get_account_active_orders import ReqGetAccountActiveOrders
68
+ from lighter.models.req_get_account_api_keys import ReqGetAccountApiKeys
69
+ from lighter.models.req_get_account_by_l1_address import ReqGetAccountByL1Address
70
+ from lighter.models.req_get_account_inactive_orders import ReqGetAccountInactiveOrders
71
+ from lighter.models.req_get_account_orders import ReqGetAccountOrders
72
+ from lighter.models.req_get_account_pending_txs import ReqGetAccountPendingTxs
73
+ from lighter.models.req_get_account_pn_l import ReqGetAccountPnL
74
+ from lighter.models.req_get_account_txs import ReqGetAccountTxs
75
+ from lighter.models.req_get_block import ReqGetBlock
76
+ from lighter.models.req_get_block_txs import ReqGetBlockTxs
77
+ from lighter.models.req_get_by_account import ReqGetByAccount
78
+ from lighter.models.req_get_candlesticks import ReqGetCandlesticks
79
+ from lighter.models.req_get_deposit_history import ReqGetDepositHistory
80
+ from lighter.models.req_get_fee_bucket import ReqGetFeeBucket
81
+ from lighter.models.req_get_fundings import ReqGetFundings
82
+ from lighter.models.req_get_l1_tx import ReqGetL1Tx
83
+ from lighter.models.req_get_latest_deposit import ReqGetLatestDeposit
84
+ from lighter.models.req_get_next_nonce import ReqGetNextNonce
85
+ from lighter.models.req_get_order_book_details import ReqGetOrderBookDetails
86
+ from lighter.models.req_get_order_book_orders import ReqGetOrderBookOrders
87
+ from lighter.models.req_get_order_books import ReqGetOrderBooks
88
+ from lighter.models.req_get_public_pools import ReqGetPublicPools
89
+ from lighter.models.req_get_range_with_cursor import ReqGetRangeWithCursor
90
+ from lighter.models.req_get_range_with_index import ReqGetRangeWithIndex
91
+ from lighter.models.req_get_range_with_index_sortable import ReqGetRangeWithIndexSortable
92
+ from lighter.models.req_get_recent_trades import ReqGetRecentTrades
93
+ from lighter.models.req_get_trades import ReqGetTrades
94
+ from lighter.models.req_get_tx import ReqGetTx
95
+ from lighter.models.req_get_withdraw_history import ReqGetWithdrawHistory
96
+ from lighter.models.req_is_whitelisted import ReqIsWhitelisted
97
+ from lighter.models.result_code import ResultCode
98
+ from lighter.models.simple_order import SimpleOrder
99
+ from lighter.models.status import Status
100
+ from lighter.models.sub_accounts import SubAccounts
101
+ from lighter.models.ticker import Ticker
102
+ from lighter.models.trade import Trade
103
+ from lighter.models.trades import Trades
104
+ from lighter.models.tx import Tx
105
+ from lighter.models.tx_hash import TxHash
106
+ from lighter.models.tx_hashes import TxHashes
107
+ from lighter.models.txs import Txs
108
+ from lighter.models.validator_info import ValidatorInfo
109
+ from lighter.models.withdraw_history import WithdrawHistory
110
+ from lighter.models.withdraw_history_cursor import WithdrawHistoryCursor
111
+ from lighter.models.withdraw_history_item import WithdrawHistoryItem
112
+ from lighter.models.zk_lighter_info import ZkLighterInfo
@@ -0,0 +1,110 @@
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 typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class Account(BaseModel):
26
+ """
27
+ Account
28
+ """ # noqa: E501
29
+ code: StrictInt
30
+ message: Optional[StrictStr] = None
31
+ account_type: StrictInt
32
+ index: StrictInt
33
+ l1_address: StrictStr
34
+ cancel_all_time: StrictInt
35
+ total_order_count: StrictInt
36
+ pending_order_count: StrictInt
37
+ status: StrictInt
38
+ collateral: StrictStr
39
+ __properties: ClassVar[List[str]] = ["code", "message", "account_type", "index", "l1_address", "cancel_all_time", "total_order_count", "pending_order_count", "status", "collateral"]
40
+
41
+ model_config = ConfigDict(
42
+ populate_by_name=True,
43
+ validate_assignment=True,
44
+ protected_namespaces=(),
45
+ )
46
+
47
+
48
+ def to_str(self) -> str:
49
+ """Returns the string representation of the model using alias"""
50
+ return pprint.pformat(self.model_dump(by_alias=True))
51
+
52
+ def to_json(self) -> str:
53
+ """Returns the JSON representation of the model using alias"""
54
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
55
+ return json.dumps(self.to_dict())
56
+
57
+ @classmethod
58
+ def from_json(cls, json_str: str) -> Optional[Self]:
59
+ """Create an instance of Account from a JSON string"""
60
+ return cls.from_dict(json.loads(json_str))
61
+
62
+ def to_dict(self) -> Dict[str, Any]:
63
+ """Return the dictionary representation of the model using alias.
64
+
65
+ This has the following differences from calling pydantic's
66
+ `self.model_dump(by_alias=True)`:
67
+
68
+ * `None` is only added to the output dict for nullable fields that
69
+ were set at model initialization. Other fields with value `None`
70
+ are ignored.
71
+ """
72
+ excluded_fields: Set[str] = set([
73
+ ])
74
+
75
+ _dict = self.model_dump(
76
+ by_alias=True,
77
+ exclude=excluded_fields,
78
+ exclude_none=True,
79
+ )
80
+ return _dict
81
+
82
+ @classmethod
83
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84
+ """Create an instance of Account from a dict"""
85
+ if obj is None:
86
+ return None
87
+
88
+ if not isinstance(obj, dict):
89
+ return cls.model_validate(obj)
90
+
91
+ # raise errors for additional fields in the input
92
+ for _key in obj.keys():
93
+ if _key not in cls.__properties:
94
+ raise ValueError("Error due to additional fields (not defined in Account) in the input: " + _key)
95
+
96
+ _obj = cls.model_validate({
97
+ "code": obj.get("code"),
98
+ "message": obj.get("message"),
99
+ "account_type": obj.get("account_type"),
100
+ "index": obj.get("index"),
101
+ "l1_address": obj.get("l1_address"),
102
+ "cancel_all_time": obj.get("cancel_all_time"),
103
+ "total_order_count": obj.get("total_order_count"),
104
+ "pending_order_count": obj.get("pending_order_count"),
105
+ "status": obj.get("status"),
106
+ "collateral": obj.get("collateral")
107
+ })
108
+ return _obj
109
+
110
+
@@ -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.api_key import ApiKey
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class AccountApiKeys(BaseModel):
27
+ """
28
+ AccountApiKeys
29
+ """ # noqa: E501
30
+ code: StrictInt
31
+ message: Optional[StrictStr] = None
32
+ api_keys: List[ApiKey]
33
+ __properties: ClassVar[List[str]] = ["code", "message", "api_keys"]
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 AccountApiKeys 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 api_keys (list)
75
+ _items = []
76
+ if self.api_keys:
77
+ for _item in self.api_keys:
78
+ if _item:
79
+ _items.append(_item.to_dict())
80
+ _dict['api_keys'] = _items
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
+ """Create an instance of AccountApiKeys 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 AccountApiKeys) in the input: " + _key)
96
+
97
+ _obj = cls.model_validate({
98
+ "code": obj.get("code"),
99
+ "message": obj.get("message"),
100
+ "api_keys": [ApiKey.from_dict(_item) for _item in obj["api_keys"]] if obj.get("api_keys") is not None else None
101
+ })
102
+ return _obj
103
+
104
+
@@ -0,0 +1,98 @@
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 AccountMarketStats(BaseModel):
26
+ """
27
+ AccountMarketStats
28
+ """ # noqa: E501
29
+ market_id: StrictInt
30
+ daily_trades_count: StrictInt
31
+ daily_base_token_volume: Union[StrictFloat, StrictInt]
32
+ daily_quote_token_volume: Union[StrictFloat, StrictInt]
33
+ __properties: ClassVar[List[str]] = ["market_id", "daily_trades_count", "daily_base_token_volume", "daily_quote_token_volume"]
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 AccountMarketStats 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
+ return _dict
75
+
76
+ @classmethod
77
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
78
+ """Create an instance of AccountMarketStats from a dict"""
79
+ if obj is None:
80
+ return None
81
+
82
+ if not isinstance(obj, dict):
83
+ return cls.model_validate(obj)
84
+
85
+ # raise errors for additional fields in the input
86
+ for _key in obj.keys():
87
+ if _key not in cls.__properties:
88
+ raise ValueError("Error due to additional fields (not defined in AccountMarketStats) in the input: " + _key)
89
+
90
+ _obj = cls.model_validate({
91
+ "market_id": obj.get("market_id"),
92
+ "daily_trades_count": obj.get("daily_trades_count"),
93
+ "daily_base_token_volume": obj.get("daily_base_token_volume"),
94
+ "daily_quote_token_volume": obj.get("daily_quote_token_volume")
95
+ })
96
+ return _obj
97
+
98
+
@@ -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 AccountMetadata(BaseModel):
26
+ """
27
+ AccountMetadata
28
+ """ # noqa: E501
29
+ name: StrictStr
30
+ description: StrictStr
31
+ __properties: ClassVar[List[str]] = ["name", "description"]
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 AccountMetadata 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 AccountMetadata 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 AccountMetadata) in the input: " + _key)
87
+
88
+ _obj = cls.model_validate({
89
+ "name": obj.get("name"),
90
+ "description": obj.get("description")
91
+ })
92
+ return _obj
93
+
94
+
@@ -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.pn_l_entry import PnLEntry
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class AccountPnL(BaseModel):
27
+ """
28
+ AccountPnL
29
+ """ # noqa: E501
30
+ code: StrictInt
31
+ message: Optional[StrictStr] = None
32
+ resolution: StrictStr
33
+ pnl: List[PnLEntry]
34
+ __properties: ClassVar[List[str]] = ["code", "message", "resolution", "pnl"]
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 AccountPnL 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 pnl (list)
76
+ _items = []
77
+ if self.pnl:
78
+ for _item in self.pnl:
79
+ if _item:
80
+ _items.append(_item.to_dict())
81
+ _dict['pnl'] = _items
82
+ return _dict
83
+
84
+ @classmethod
85
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
86
+ """Create an instance of AccountPnL 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 AccountPnL) in the input: " + _key)
97
+
98
+ _obj = cls.model_validate({
99
+ "code": obj.get("code"),
100
+ "message": obj.get("message"),
101
+ "resolution": obj.get("resolution"),
102
+ "pnl": [PnLEntry.from_dict(_item) for _item in obj["pnl"]] if obj.get("pnl") is not None else None
103
+ })
104
+ return _obj
105
+
106
+