kalshi-python-sync 3.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. kalshi_python_sync/__init__.py +272 -0
  2. kalshi_python_sync/api/__init__.py +19 -0
  3. kalshi_python_sync/api/api_keys_api.py +1098 -0
  4. kalshi_python_sync/api/communications_api.py +3216 -0
  5. kalshi_python_sync/api/events_api.py +1941 -0
  6. kalshi_python_sync/api/exchange_api.py +1263 -0
  7. kalshi_python_sync/api/fcm_api.py +792 -0
  8. kalshi_python_sync/api/incentive_programs_api.py +346 -0
  9. kalshi_python_sync/api/live_data_api.py +564 -0
  10. kalshi_python_sync/api/market_api.py +2568 -0
  11. kalshi_python_sync/api/milestone_api.py +689 -0
  12. kalshi_python_sync/api/multivariate_api.py +1486 -0
  13. kalshi_python_sync/api/order_groups_api.py +1375 -0
  14. kalshi_python_sync/api/orders_api.py +2913 -0
  15. kalshi_python_sync/api/portfolio_api.py +1572 -0
  16. kalshi_python_sync/api/search_api.py +516 -0
  17. kalshi_python_sync/api/structured_targets_api.py +605 -0
  18. kalshi_python_sync/api_client.py +830 -0
  19. kalshi_python_sync/api_response.py +21 -0
  20. kalshi_python_sync/auth.py +89 -0
  21. kalshi_python_sync/configuration.py +626 -0
  22. kalshi_python_sync/exceptions.py +216 -0
  23. kalshi_python_sync/models/__init__.py +136 -0
  24. kalshi_python_sync/models/accept_quote_request.py +94 -0
  25. kalshi_python_sync/models/amend_order_request.py +120 -0
  26. kalshi_python_sync/models/amend_order_response.py +96 -0
  27. kalshi_python_sync/models/announcement.py +108 -0
  28. kalshi_python_sync/models/api_key.py +89 -0
  29. kalshi_python_sync/models/associated_event.py +105 -0
  30. kalshi_python_sync/models/batch_cancel_orders_individual_response.py +111 -0
  31. kalshi_python_sync/models/batch_cancel_orders_request.py +87 -0
  32. kalshi_python_sync/models/batch_cancel_orders_response.py +95 -0
  33. kalshi_python_sync/models/batch_create_orders_individual_response.py +114 -0
  34. kalshi_python_sync/models/batch_create_orders_request.py +95 -0
  35. kalshi_python_sync/models/batch_create_orders_response.py +95 -0
  36. kalshi_python_sync/models/batch_get_market_candlesticks_response.py +95 -0
  37. kalshi_python_sync/models/bid_ask_distribution.py +101 -0
  38. kalshi_python_sync/models/cancel_order_response.py +93 -0
  39. kalshi_python_sync/models/create_api_key_request.py +89 -0
  40. kalshi_python_sync/models/create_api_key_response.py +87 -0
  41. kalshi_python_sync/models/create_market_in_multivariate_event_collection_request.py +95 -0
  42. kalshi_python_sync/models/create_market_in_multivariate_event_collection_response.py +89 -0
  43. kalshi_python_sync/models/create_order_group_request.py +88 -0
  44. kalshi_python_sync/models/create_order_group_response.py +87 -0
  45. kalshi_python_sync/models/create_order_request.py +159 -0
  46. kalshi_python_sync/models/create_order_response.py +91 -0
  47. kalshi_python_sync/models/create_quote_request.py +93 -0
  48. kalshi_python_sync/models/create_quote_response.py +87 -0
  49. kalshi_python_sync/models/create_rfq_request.py +97 -0
  50. kalshi_python_sync/models/create_rfq_response.py +87 -0
  51. kalshi_python_sync/models/daily_schedule.py +89 -0
  52. kalshi_python_sync/models/decrease_order_request.py +90 -0
  53. kalshi_python_sync/models/decrease_order_response.py +91 -0
  54. kalshi_python_sync/models/error_response.py +93 -0
  55. kalshi_python_sync/models/event_data.py +133 -0
  56. kalshi_python_sync/models/event_position.py +105 -0
  57. kalshi_python_sync/models/exchange_status.py +97 -0
  58. kalshi_python_sync/models/fill.py +134 -0
  59. kalshi_python_sync/models/forecast_percentiles_point.py +101 -0
  60. kalshi_python_sync/models/generate_api_key_request.py +87 -0
  61. kalshi_python_sync/models/generate_api_key_response.py +89 -0
  62. kalshi_python_sync/models/get_api_keys_response.py +95 -0
  63. kalshi_python_sync/models/get_balance_response.py +91 -0
  64. kalshi_python_sync/models/get_communications_id_response.py +87 -0
  65. kalshi_python_sync/models/get_event_candlesticks_response.py +104 -0
  66. kalshi_python_sync/models/get_event_forecast_percentiles_history_response.py +95 -0
  67. kalshi_python_sync/models/get_event_metadata_response.py +123 -0
  68. kalshi_python_sync/models/get_event_response.py +101 -0
  69. kalshi_python_sync/models/get_events_response.py +107 -0
  70. kalshi_python_sync/models/get_exchange_announcements_response.py +95 -0
  71. kalshi_python_sync/models/get_exchange_schedule_response.py +91 -0
  72. kalshi_python_sync/models/get_fills_response.py +97 -0
  73. kalshi_python_sync/models/get_filters_by_sports_response.py +102 -0
  74. kalshi_python_sync/models/get_incentive_programs_response.py +97 -0
  75. kalshi_python_sync/models/get_live_data_response.py +91 -0
  76. kalshi_python_sync/models/get_live_datas_response.py +95 -0
  77. kalshi_python_sync/models/get_market_candlesticks_response.py +97 -0
  78. kalshi_python_sync/models/get_market_orderbook_response.py +91 -0
  79. kalshi_python_sync/models/get_market_response.py +91 -0
  80. kalshi_python_sync/models/get_markets_response.py +97 -0
  81. kalshi_python_sync/models/get_milestone_response.py +91 -0
  82. kalshi_python_sync/models/get_milestones_response.py +97 -0
  83. kalshi_python_sync/models/get_multivariate_event_collection_lookup_history_response.py +95 -0
  84. kalshi_python_sync/models/get_multivariate_event_collection_response.py +91 -0
  85. kalshi_python_sync/models/get_multivariate_event_collections_response.py +97 -0
  86. kalshi_python_sync/models/get_multivariate_events_response.py +97 -0
  87. kalshi_python_sync/models/get_order_group_response.py +89 -0
  88. kalshi_python_sync/models/get_order_groups_response.py +95 -0
  89. kalshi_python_sync/models/get_order_queue_position_response.py +87 -0
  90. kalshi_python_sync/models/get_order_queue_positions_response.py +95 -0
  91. kalshi_python_sync/models/get_order_response.py +91 -0
  92. kalshi_python_sync/models/get_orders_response.py +97 -0
  93. kalshi_python_sync/models/get_portfolio_resting_order_total_value_response.py +87 -0
  94. kalshi_python_sync/models/get_positions_response.py +107 -0
  95. kalshi_python_sync/models/get_quote_response.py +91 -0
  96. kalshi_python_sync/models/get_quotes_response.py +97 -0
  97. kalshi_python_sync/models/get_rfq_response.py +91 -0
  98. kalshi_python_sync/models/get_rfqs_response.py +97 -0
  99. kalshi_python_sync/models/get_series_fee_changes_response.py +95 -0
  100. kalshi_python_sync/models/get_series_list_response.py +95 -0
  101. kalshi_python_sync/models/get_series_response.py +91 -0
  102. kalshi_python_sync/models/get_settlements_response.py +97 -0
  103. kalshi_python_sync/models/get_structured_target_response.py +91 -0
  104. kalshi_python_sync/models/get_structured_targets_response.py +97 -0
  105. kalshi_python_sync/models/get_tags_for_series_categories_response.py +87 -0
  106. kalshi_python_sync/models/get_trades_response.py +97 -0
  107. kalshi_python_sync/models/get_user_data_timestamp_response.py +88 -0
  108. kalshi_python_sync/models/incentive_program.py +121 -0
  109. kalshi_python_sync/models/live_data.py +91 -0
  110. kalshi_python_sync/models/lookup_point.py +102 -0
  111. kalshi_python_sync/models/lookup_tickers_for_market_in_multivariate_event_collection_request.py +95 -0
  112. kalshi_python_sync/models/lookup_tickers_for_market_in_multivariate_event_collection_response.py +89 -0
  113. kalshi_python_sync/models/maintenance_window.py +90 -0
  114. kalshi_python_sync/models/market.py +307 -0
  115. kalshi_python_sync/models/market_candlestick.py +108 -0
  116. kalshi_python_sync/models/market_candlesticks_response.py +97 -0
  117. kalshi_python_sync/models/market_metadata.py +91 -0
  118. kalshi_python_sync/models/market_position.py +110 -0
  119. kalshi_python_sync/models/milestone.py +120 -0
  120. kalshi_python_sync/models/multivariate_event_collection.py +122 -0
  121. kalshi_python_sync/models/mve_selected_leg.py +91 -0
  122. kalshi_python_sync/models/order.py +189 -0
  123. kalshi_python_sync/models/order_group.py +89 -0
  124. kalshi_python_sync/models/order_queue_position.py +91 -0
  125. kalshi_python_sync/models/order_status.py +38 -0
  126. kalshi_python_sync/models/orderbook.py +94 -0
  127. kalshi_python_sync/models/percentile_point.py +93 -0
  128. kalshi_python_sync/models/price_distribution.py +157 -0
  129. kalshi_python_sync/models/price_range.py +91 -0
  130. kalshi_python_sync/models/quote.py +153 -0
  131. kalshi_python_sync/models/rfq.py +129 -0
  132. kalshi_python_sync/models/schedule.py +105 -0
  133. kalshi_python_sync/models/scope_list.py +87 -0
  134. kalshi_python_sync/models/self_trade_prevention_type.py +37 -0
  135. kalshi_python_sync/models/series.py +129 -0
  136. kalshi_python_sync/models/series_fee_change.py +103 -0
  137. kalshi_python_sync/models/settlement.py +118 -0
  138. kalshi_python_sync/models/settlement_source.py +89 -0
  139. kalshi_python_sync/models/sport_filter_details.py +102 -0
  140. kalshi_python_sync/models/structured_target.py +98 -0
  141. kalshi_python_sync/models/ticker_pair.py +98 -0
  142. kalshi_python_sync/models/trade.py +113 -0
  143. kalshi_python_sync/models/weekly_schedule.py +154 -0
  144. kalshi_python_sync/py.typed +0 -0
  145. kalshi_python_sync/rest.py +258 -0
  146. kalshi_python_sync-3.0.0.dist-info/METADATA +77 -0
  147. kalshi_python_sync-3.0.0.dist-info/RECORD +149 -0
  148. kalshi_python_sync-3.0.0.dist-info/WHEEL +5 -0
  149. kalshi_python_sync-3.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,114 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Kalshi Trade API Manual Endpoints
5
+
6
+ Manually defined OpenAPI spec for endpoints being migrated to spec-first approach
7
+
8
+ The version of the OpenAPI document: 3.0.0
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, Optional
22
+ from kalshi_python_sync.models.error_response import ErrorResponse
23
+ from kalshi_python_sync.models.order import Order
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class BatchCreateOrdersIndividualResponse(BaseModel):
28
+ """
29
+ BatchCreateOrdersIndividualResponse
30
+ """ # noqa: E501
31
+ client_order_id: Optional[StrictStr] = None
32
+ order: Optional[Order] = None
33
+ error: Optional[ErrorResponse] = None
34
+ __properties: ClassVar[List[str]] = ["client_order_id", "order", "error"]
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 BatchCreateOrdersIndividualResponse 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 order
76
+ if self.order:
77
+ _dict['order'] = self.order.to_dict()
78
+ # override the default output from pydantic by calling `to_dict()` of error
79
+ if self.error:
80
+ _dict['error'] = self.error.to_dict()
81
+ # set to None if client_order_id (nullable) is None
82
+ # and model_fields_set contains the field
83
+ if self.client_order_id is None and "client_order_id" in self.model_fields_set:
84
+ _dict['client_order_id'] = None
85
+
86
+ # set to None if order (nullable) is None
87
+ # and model_fields_set contains the field
88
+ if self.order is None and "order" in self.model_fields_set:
89
+ _dict['order'] = None
90
+
91
+ # set to None if error (nullable) is None
92
+ # and model_fields_set contains the field
93
+ if self.error is None and "error" in self.model_fields_set:
94
+ _dict['error'] = None
95
+
96
+ return _dict
97
+
98
+ @classmethod
99
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
100
+ """Create an instance of BatchCreateOrdersIndividualResponse from a dict"""
101
+ if obj is None:
102
+ return None
103
+
104
+ if not isinstance(obj, dict):
105
+ return cls.model_validate(obj)
106
+
107
+ _obj = cls.model_validate({
108
+ "client_order_id": obj.get("client_order_id"),
109
+ "order": Order.from_dict(obj["order"]) if obj.get("order") is not None else None,
110
+ "error": ErrorResponse.from_dict(obj["error"]) if obj.get("error") is not None else None
111
+ })
112
+ return _obj
113
+
114
+
@@ -0,0 +1,95 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Kalshi Trade API Manual Endpoints
5
+
6
+ Manually defined OpenAPI spec for endpoints being migrated to spec-first approach
7
+
8
+ The version of the OpenAPI document: 3.0.0
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
21
+ from typing import Any, ClassVar, Dict, List
22
+ from kalshi_python_sync.models.create_order_request import CreateOrderRequest
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class BatchCreateOrdersRequest(BaseModel):
27
+ """
28
+ BatchCreateOrdersRequest
29
+ """ # noqa: E501
30
+ orders: List[CreateOrderRequest]
31
+ __properties: ClassVar[List[str]] = ["orders"]
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 BatchCreateOrdersRequest 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
+ # override the default output from pydantic by calling `to_dict()` of each item in orders (list)
73
+ _items = []
74
+ if self.orders:
75
+ for _item_orders in self.orders:
76
+ if _item_orders:
77
+ _items.append(_item_orders.to_dict())
78
+ _dict['orders'] = _items
79
+ return _dict
80
+
81
+ @classmethod
82
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83
+ """Create an instance of BatchCreateOrdersRequest from a dict"""
84
+ if obj is None:
85
+ return None
86
+
87
+ if not isinstance(obj, dict):
88
+ return cls.model_validate(obj)
89
+
90
+ _obj = cls.model_validate({
91
+ "orders": [CreateOrderRequest.from_dict(_item) for _item in obj["orders"]] if obj.get("orders") is not None else None
92
+ })
93
+ return _obj
94
+
95
+
@@ -0,0 +1,95 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Kalshi Trade API Manual Endpoints
5
+
6
+ Manually defined OpenAPI spec for endpoints being migrated to spec-first approach
7
+
8
+ The version of the OpenAPI document: 3.0.0
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
21
+ from typing import Any, ClassVar, Dict, List
22
+ from kalshi_python_sync.models.batch_create_orders_individual_response import BatchCreateOrdersIndividualResponse
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class BatchCreateOrdersResponse(BaseModel):
27
+ """
28
+ BatchCreateOrdersResponse
29
+ """ # noqa: E501
30
+ orders: List[BatchCreateOrdersIndividualResponse]
31
+ __properties: ClassVar[List[str]] = ["orders"]
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 BatchCreateOrdersResponse 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
+ # override the default output from pydantic by calling `to_dict()` of each item in orders (list)
73
+ _items = []
74
+ if self.orders:
75
+ for _item_orders in self.orders:
76
+ if _item_orders:
77
+ _items.append(_item_orders.to_dict())
78
+ _dict['orders'] = _items
79
+ return _dict
80
+
81
+ @classmethod
82
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83
+ """Create an instance of BatchCreateOrdersResponse from a dict"""
84
+ if obj is None:
85
+ return None
86
+
87
+ if not isinstance(obj, dict):
88
+ return cls.model_validate(obj)
89
+
90
+ _obj = cls.model_validate({
91
+ "orders": [BatchCreateOrdersIndividualResponse.from_dict(_item) for _item in obj["orders"]] if obj.get("orders") is not None else None
92
+ })
93
+ return _obj
94
+
95
+
@@ -0,0 +1,95 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Kalshi Trade API Manual Endpoints
5
+
6
+ Manually defined OpenAPI spec for endpoints being migrated to spec-first approach
7
+
8
+ The version of the OpenAPI document: 3.0.0
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, Field
21
+ from typing import Any, ClassVar, Dict, List
22
+ from kalshi_python_sync.models.market_candlesticks_response import MarketCandlesticksResponse
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class BatchGetMarketCandlesticksResponse(BaseModel):
27
+ """
28
+ BatchGetMarketCandlesticksResponse
29
+ """ # noqa: E501
30
+ markets: List[MarketCandlesticksResponse] = Field(description="Array of market candlestick data, one entry per requested market.")
31
+ __properties: ClassVar[List[str]] = ["markets"]
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 BatchGetMarketCandlesticksResponse 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
+ # override the default output from pydantic by calling `to_dict()` of each item in markets (list)
73
+ _items = []
74
+ if self.markets:
75
+ for _item_markets in self.markets:
76
+ if _item_markets:
77
+ _items.append(_item_markets.to_dict())
78
+ _dict['markets'] = _items
79
+ return _dict
80
+
81
+ @classmethod
82
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83
+ """Create an instance of BatchGetMarketCandlesticksResponse from a dict"""
84
+ if obj is None:
85
+ return None
86
+
87
+ if not isinstance(obj, dict):
88
+ return cls.model_validate(obj)
89
+
90
+ _obj = cls.model_validate({
91
+ "markets": [MarketCandlesticksResponse.from_dict(_item) for _item in obj["markets"]] if obj.get("markets") is not None else None
92
+ })
93
+ return _obj
94
+
95
+
@@ -0,0 +1,101 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Kalshi Trade API Manual Endpoints
5
+
6
+ Manually defined OpenAPI spec for endpoints being migrated to spec-first approach
7
+
8
+ The version of the OpenAPI document: 3.0.0
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, Field, 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 BidAskDistribution(BaseModel):
26
+ """
27
+ BidAskDistribution
28
+ """ # noqa: E501
29
+ open: StrictInt = Field(description="Offer price on the market at the start of the candlestick period (in cents).")
30
+ open_dollars: StrictStr = Field(description="US dollar amount as a fixed-point decimal string with exactly 4 decimal places")
31
+ low: StrictInt = Field(description="Lowest offer price on the market during the candlestick period (in cents).")
32
+ low_dollars: StrictStr = Field(description="US dollar amount as a fixed-point decimal string with exactly 4 decimal places")
33
+ high: StrictInt = Field(description="Highest offer price on the market during the candlestick period (in cents).")
34
+ high_dollars: StrictStr = Field(description="US dollar amount as a fixed-point decimal string with exactly 4 decimal places")
35
+ close: StrictInt = Field(description="Offer price on the market at the end of the candlestick period (in cents).")
36
+ close_dollars: StrictStr = Field(description="US dollar amount as a fixed-point decimal string with exactly 4 decimal places")
37
+ __properties: ClassVar[List[str]] = ["open", "open_dollars", "low", "low_dollars", "high", "high_dollars", "close", "close_dollars"]
38
+
39
+ model_config = ConfigDict(
40
+ populate_by_name=True,
41
+ validate_assignment=True,
42
+ protected_namespaces=(),
43
+ )
44
+
45
+
46
+ def to_str(self) -> str:
47
+ """Returns the string representation of the model using alias"""
48
+ return pprint.pformat(self.model_dump(by_alias=True))
49
+
50
+ def to_json(self) -> str:
51
+ """Returns the JSON representation of the model using alias"""
52
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
53
+ return json.dumps(self.to_dict())
54
+
55
+ @classmethod
56
+ def from_json(cls, json_str: str) -> Optional[Self]:
57
+ """Create an instance of BidAskDistribution from a JSON string"""
58
+ return cls.from_dict(json.loads(json_str))
59
+
60
+ def to_dict(self) -> Dict[str, Any]:
61
+ """Return the dictionary representation of the model using alias.
62
+
63
+ This has the following differences from calling pydantic's
64
+ `self.model_dump(by_alias=True)`:
65
+
66
+ * `None` is only added to the output dict for nullable fields that
67
+ were set at model initialization. Other fields with value `None`
68
+ are ignored.
69
+ """
70
+ excluded_fields: Set[str] = set([
71
+ ])
72
+
73
+ _dict = self.model_dump(
74
+ by_alias=True,
75
+ exclude=excluded_fields,
76
+ exclude_none=True,
77
+ )
78
+ return _dict
79
+
80
+ @classmethod
81
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
82
+ """Create an instance of BidAskDistribution from a dict"""
83
+ if obj is None:
84
+ return None
85
+
86
+ if not isinstance(obj, dict):
87
+ return cls.model_validate(obj)
88
+
89
+ _obj = cls.model_validate({
90
+ "open": obj.get("open"),
91
+ "open_dollars": obj.get("open_dollars"),
92
+ "low": obj.get("low"),
93
+ "low_dollars": obj.get("low_dollars"),
94
+ "high": obj.get("high"),
95
+ "high_dollars": obj.get("high_dollars"),
96
+ "close": obj.get("close"),
97
+ "close_dollars": obj.get("close_dollars")
98
+ })
99
+ return _obj
100
+
101
+
@@ -0,0 +1,93 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Kalshi Trade API Manual Endpoints
5
+
6
+ Manually defined OpenAPI spec for endpoints being migrated to spec-first approach
7
+
8
+ The version of the OpenAPI document: 3.0.0
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
21
+ from typing import Any, ClassVar, Dict, List
22
+ from kalshi_python_sync.models.order import Order
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class CancelOrderResponse(BaseModel):
27
+ """
28
+ CancelOrderResponse
29
+ """ # noqa: E501
30
+ order: Order
31
+ reduced_by: StrictInt
32
+ __properties: ClassVar[List[str]] = ["order", "reduced_by"]
33
+
34
+ model_config = ConfigDict(
35
+ populate_by_name=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
39
+
40
+
41
+ def to_str(self) -> str:
42
+ """Returns the string representation of the model using alias"""
43
+ return pprint.pformat(self.model_dump(by_alias=True))
44
+
45
+ def to_json(self) -> str:
46
+ """Returns the JSON representation of the model using alias"""
47
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48
+ return json.dumps(self.to_dict())
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of CancelOrderResponse from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ """
65
+ excluded_fields: Set[str] = set([
66
+ ])
67
+
68
+ _dict = self.model_dump(
69
+ by_alias=True,
70
+ exclude=excluded_fields,
71
+ exclude_none=True,
72
+ )
73
+ # override the default output from pydantic by calling `to_dict()` of order
74
+ if self.order:
75
+ _dict['order'] = self.order.to_dict()
76
+ return _dict
77
+
78
+ @classmethod
79
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
80
+ """Create an instance of CancelOrderResponse 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
+ _obj = cls.model_validate({
88
+ "order": Order.from_dict(obj["order"]) if obj.get("order") is not None else None,
89
+ "reduced_by": obj.get("reduced_by")
90
+ })
91
+ return _obj
92
+
93
+
@@ -0,0 +1,89 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Kalshi Trade API Manual Endpoints
5
+
6
+ Manually defined OpenAPI spec for endpoints being migrated to spec-first approach
7
+
8
+ The version of the OpenAPI document: 3.0.0
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, Field, StrictStr
21
+ from typing import Any, ClassVar, Dict, List
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class CreateApiKeyRequest(BaseModel):
26
+ """
27
+ CreateApiKeyRequest
28
+ """ # noqa: E501
29
+ name: StrictStr = Field(description="Name for the API key. This helps identify the key's purpose")
30
+ public_key: StrictStr = Field(description="RSA public key in PEM format. This will be used to verify signatures on API requests")
31
+ __properties: ClassVar[List[str]] = ["name", "public_key"]
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 CreateApiKeyRequest 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 CreateApiKeyRequest 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
+ _obj = cls.model_validate({
84
+ "name": obj.get("name"),
85
+ "public_key": obj.get("public_key")
86
+ })
87
+ return _obj
88
+
89
+