kalshi-python-async 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.
- kalshi_python_async/__init__.py +272 -0
- kalshi_python_async/api/__init__.py +19 -0
- kalshi_python_async/api/api_keys_api.py +1098 -0
- kalshi_python_async/api/communications_api.py +3216 -0
- kalshi_python_async/api/events_api.py +1941 -0
- kalshi_python_async/api/exchange_api.py +1263 -0
- kalshi_python_async/api/fcm_api.py +792 -0
- kalshi_python_async/api/incentive_programs_api.py +346 -0
- kalshi_python_async/api/live_data_api.py +564 -0
- kalshi_python_async/api/market_api.py +2568 -0
- kalshi_python_async/api/milestone_api.py +689 -0
- kalshi_python_async/api/multivariate_api.py +1486 -0
- kalshi_python_async/api/order_groups_api.py +1375 -0
- kalshi_python_async/api/orders_api.py +2913 -0
- kalshi_python_async/api/portfolio_api.py +1572 -0
- kalshi_python_async/api/search_api.py +516 -0
- kalshi_python_async/api/structured_targets_api.py +605 -0
- kalshi_python_async/api_client.py +833 -0
- kalshi_python_async/api_response.py +21 -0
- kalshi_python_async/auth.py +89 -0
- kalshi_python_async/configuration.py +622 -0
- kalshi_python_async/exceptions.py +216 -0
- kalshi_python_async/models/__init__.py +136 -0
- kalshi_python_async/models/accept_quote_request.py +94 -0
- kalshi_python_async/models/amend_order_request.py +120 -0
- kalshi_python_async/models/amend_order_response.py +96 -0
- kalshi_python_async/models/announcement.py +108 -0
- kalshi_python_async/models/api_key.py +89 -0
- kalshi_python_async/models/associated_event.py +105 -0
- kalshi_python_async/models/batch_cancel_orders_individual_response.py +111 -0
- kalshi_python_async/models/batch_cancel_orders_request.py +87 -0
- kalshi_python_async/models/batch_cancel_orders_response.py +95 -0
- kalshi_python_async/models/batch_create_orders_individual_response.py +114 -0
- kalshi_python_async/models/batch_create_orders_request.py +95 -0
- kalshi_python_async/models/batch_create_orders_response.py +95 -0
- kalshi_python_async/models/batch_get_market_candlesticks_response.py +95 -0
- kalshi_python_async/models/bid_ask_distribution.py +101 -0
- kalshi_python_async/models/cancel_order_response.py +93 -0
- kalshi_python_async/models/create_api_key_request.py +89 -0
- kalshi_python_async/models/create_api_key_response.py +87 -0
- kalshi_python_async/models/create_market_in_multivariate_event_collection_request.py +95 -0
- kalshi_python_async/models/create_market_in_multivariate_event_collection_response.py +89 -0
- kalshi_python_async/models/create_order_group_request.py +88 -0
- kalshi_python_async/models/create_order_group_response.py +87 -0
- kalshi_python_async/models/create_order_request.py +159 -0
- kalshi_python_async/models/create_order_response.py +91 -0
- kalshi_python_async/models/create_quote_request.py +93 -0
- kalshi_python_async/models/create_quote_response.py +87 -0
- kalshi_python_async/models/create_rfq_request.py +97 -0
- kalshi_python_async/models/create_rfq_response.py +87 -0
- kalshi_python_async/models/daily_schedule.py +89 -0
- kalshi_python_async/models/decrease_order_request.py +90 -0
- kalshi_python_async/models/decrease_order_response.py +91 -0
- kalshi_python_async/models/error_response.py +93 -0
- kalshi_python_async/models/event_data.py +133 -0
- kalshi_python_async/models/event_position.py +105 -0
- kalshi_python_async/models/exchange_status.py +97 -0
- kalshi_python_async/models/fill.py +134 -0
- kalshi_python_async/models/forecast_percentiles_point.py +101 -0
- kalshi_python_async/models/generate_api_key_request.py +87 -0
- kalshi_python_async/models/generate_api_key_response.py +89 -0
- kalshi_python_async/models/get_api_keys_response.py +95 -0
- kalshi_python_async/models/get_balance_response.py +91 -0
- kalshi_python_async/models/get_communications_id_response.py +87 -0
- kalshi_python_async/models/get_event_candlesticks_response.py +104 -0
- kalshi_python_async/models/get_event_forecast_percentiles_history_response.py +95 -0
- kalshi_python_async/models/get_event_metadata_response.py +123 -0
- kalshi_python_async/models/get_event_response.py +101 -0
- kalshi_python_async/models/get_events_candlesticks_response.py +95 -0
- kalshi_python_async/models/get_events_candlesticks_response_events_inner.py +106 -0
- kalshi_python_async/models/get_events_response.py +107 -0
- kalshi_python_async/models/get_exchange_announcements_response.py +95 -0
- kalshi_python_async/models/get_exchange_schedule_response.py +91 -0
- kalshi_python_async/models/get_fills_response.py +97 -0
- kalshi_python_async/models/get_filters_by_sports_response.py +102 -0
- kalshi_python_async/models/get_incentive_programs_response.py +97 -0
- kalshi_python_async/models/get_live_data_response.py +91 -0
- kalshi_python_async/models/get_live_datas_response.py +95 -0
- kalshi_python_async/models/get_market_candlesticks_response.py +97 -0
- kalshi_python_async/models/get_market_orderbook_response.py +91 -0
- kalshi_python_async/models/get_market_response.py +91 -0
- kalshi_python_async/models/get_markets_response.py +97 -0
- kalshi_python_async/models/get_milestone_response.py +91 -0
- kalshi_python_async/models/get_milestones_response.py +97 -0
- kalshi_python_async/models/get_multivariate_event_collection_lookup_history_response.py +95 -0
- kalshi_python_async/models/get_multivariate_event_collection_response.py +91 -0
- kalshi_python_async/models/get_multivariate_event_collections_response.py +97 -0
- kalshi_python_async/models/get_multivariate_events_response.py +97 -0
- kalshi_python_async/models/get_order_group_response.py +89 -0
- kalshi_python_async/models/get_order_groups_response.py +95 -0
- kalshi_python_async/models/get_order_queue_position_response.py +87 -0
- kalshi_python_async/models/get_order_queue_positions_response.py +95 -0
- kalshi_python_async/models/get_order_response.py +91 -0
- kalshi_python_async/models/get_orders_response.py +97 -0
- kalshi_python_async/models/get_portfolio_resting_order_total_value_response.py +87 -0
- kalshi_python_async/models/get_positions_response.py +107 -0
- kalshi_python_async/models/get_quote_response.py +91 -0
- kalshi_python_async/models/get_quotes_response.py +97 -0
- kalshi_python_async/models/get_rfq_response.py +91 -0
- kalshi_python_async/models/get_rfqs_response.py +97 -0
- kalshi_python_async/models/get_series_fee_changes_response.py +95 -0
- kalshi_python_async/models/get_series_list_response.py +95 -0
- kalshi_python_async/models/get_series_response.py +91 -0
- kalshi_python_async/models/get_settlements_response.py +97 -0
- kalshi_python_async/models/get_structured_target_response.py +91 -0
- kalshi_python_async/models/get_structured_targets_response.py +97 -0
- kalshi_python_async/models/get_tags_for_series_categories_response.py +87 -0
- kalshi_python_async/models/get_trades_response.py +97 -0
- kalshi_python_async/models/get_user_data_timestamp_response.py +88 -0
- kalshi_python_async/models/incentive_program.py +121 -0
- kalshi_python_async/models/live_data.py +91 -0
- kalshi_python_async/models/lookup_point.py +102 -0
- kalshi_python_async/models/lookup_tickers_for_market_in_multivariate_event_collection_request.py +95 -0
- kalshi_python_async/models/lookup_tickers_for_market_in_multivariate_event_collection_response.py +89 -0
- kalshi_python_async/models/maintenance_window.py +90 -0
- kalshi_python_async/models/market.py +307 -0
- kalshi_python_async/models/market_candlestick.py +108 -0
- kalshi_python_async/models/market_candlesticks_response.py +97 -0
- kalshi_python_async/models/market_metadata.py +91 -0
- kalshi_python_async/models/market_position.py +110 -0
- kalshi_python_async/models/milestone.py +120 -0
- kalshi_python_async/models/multivariate_event_collection.py +122 -0
- kalshi_python_async/models/mve_selected_leg.py +91 -0
- kalshi_python_async/models/order.py +189 -0
- kalshi_python_async/models/order_group.py +89 -0
- kalshi_python_async/models/order_queue_position.py +91 -0
- kalshi_python_async/models/order_status.py +38 -0
- kalshi_python_async/models/orderbook.py +94 -0
- kalshi_python_async/models/percentile_point.py +93 -0
- kalshi_python_async/models/price_distribution.py +157 -0
- kalshi_python_async/models/price_range.py +91 -0
- kalshi_python_async/models/quote.py +153 -0
- kalshi_python_async/models/rfq.py +129 -0
- kalshi_python_async/models/schedule.py +105 -0
- kalshi_python_async/models/scope_list.py +87 -0
- kalshi_python_async/models/self_trade_prevention_type.py +37 -0
- kalshi_python_async/models/series.py +129 -0
- kalshi_python_async/models/series_fee_change.py +103 -0
- kalshi_python_async/models/settlement.py +118 -0
- kalshi_python_async/models/settlement_source.py +89 -0
- kalshi_python_async/models/sport_filter_details.py +102 -0
- kalshi_python_async/models/structured_target.py +98 -0
- kalshi_python_async/models/ticker_pair.py +98 -0
- kalshi_python_async/models/trade.py +113 -0
- kalshi_python_async/models/weekly_schedule.py +154 -0
- kalshi_python_async/py.typed +0 -0
- kalshi_python_async/rest.py +213 -0
- kalshi_python_async-3.0.0.dist-info/METADATA +78 -0
- kalshi_python_async-3.0.0.dist-info/RECORD +151 -0
- kalshi_python_async-3.0.0.dist-info/WHEEL +5 -0
- kalshi_python_async-3.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,157 @@
|
|
|
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, Optional
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class PriceDistribution(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
PriceDistribution
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
open: Optional[StrictInt] = Field(default=None, description="First traded YES contract price on the market during the candlestick period (in cents). May be null if there was no trade during the period.")
|
|
30
|
+
open_dollars: Optional[StrictStr] = Field(default=None, description="US dollar amount as a fixed-point decimal string with exactly 4 decimal places")
|
|
31
|
+
low: Optional[StrictInt] = Field(default=None, description="Lowest traded YES contract price on the market during the candlestick period (in cents). May be null if there was no trade during the period.")
|
|
32
|
+
low_dollars: Optional[StrictStr] = Field(default=None, description="US dollar amount as a fixed-point decimal string with exactly 4 decimal places")
|
|
33
|
+
high: Optional[StrictInt] = Field(default=None, description="Highest traded YES contract price on the market during the candlestick period (in cents). May be null if there was no trade during the period.")
|
|
34
|
+
high_dollars: Optional[StrictStr] = Field(default=None, description="US dollar amount as a fixed-point decimal string with exactly 4 decimal places")
|
|
35
|
+
close: Optional[StrictInt] = Field(default=None, description="Last traded YES contract price on the market during the candlestick period (in cents). May be null if there was no trade during the period.")
|
|
36
|
+
close_dollars: Optional[StrictStr] = Field(default=None, description="US dollar amount as a fixed-point decimal string with exactly 4 decimal places")
|
|
37
|
+
mean: Optional[StrictInt] = Field(default=None, description="Mean traded YES contract price on the market during the candlestick period (in cents). May be null if there was no trade during the period.")
|
|
38
|
+
mean_dollars: Optional[StrictStr] = Field(default=None, description="US dollar amount as a fixed-point decimal string with exactly 4 decimal places")
|
|
39
|
+
previous: Optional[StrictInt] = Field(default=None, description="Last traded YES contract price on the market before the candlestick period (in cents). May be null if there were no trades before the period.")
|
|
40
|
+
previous_dollars: Optional[StrictStr] = Field(default=None, description="US dollar amount as a fixed-point decimal string with exactly 4 decimal places")
|
|
41
|
+
min: Optional[StrictInt] = Field(default=None, description="Minimum close price of any market during the candlestick period (in cents).")
|
|
42
|
+
min_dollars: Optional[StrictStr] = Field(default=None, description="US dollar amount as a fixed-point decimal string with exactly 4 decimal places")
|
|
43
|
+
max: Optional[StrictInt] = Field(default=None, description="Maximum close price of any market during the candlestick period (in cents).")
|
|
44
|
+
max_dollars: Optional[StrictStr] = Field(default=None, description="US dollar amount as a fixed-point decimal string with exactly 4 decimal places")
|
|
45
|
+
__properties: ClassVar[List[str]] = ["open", "open_dollars", "low", "low_dollars", "high", "high_dollars", "close", "close_dollars", "mean", "mean_dollars", "previous", "previous_dollars", "min", "min_dollars", "max", "max_dollars"]
|
|
46
|
+
|
|
47
|
+
model_config = ConfigDict(
|
|
48
|
+
populate_by_name=True,
|
|
49
|
+
validate_assignment=True,
|
|
50
|
+
protected_namespaces=(),
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def to_str(self) -> str:
|
|
55
|
+
"""Returns the string representation of the model using alias"""
|
|
56
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
57
|
+
|
|
58
|
+
def to_json(self) -> str:
|
|
59
|
+
"""Returns the JSON representation of the model using alias"""
|
|
60
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
61
|
+
return json.dumps(self.to_dict())
|
|
62
|
+
|
|
63
|
+
@classmethod
|
|
64
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
65
|
+
"""Create an instance of PriceDistribution from a JSON string"""
|
|
66
|
+
return cls.from_dict(json.loads(json_str))
|
|
67
|
+
|
|
68
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
69
|
+
"""Return the dictionary representation of the model using alias.
|
|
70
|
+
|
|
71
|
+
This has the following differences from calling pydantic's
|
|
72
|
+
`self.model_dump(by_alias=True)`:
|
|
73
|
+
|
|
74
|
+
* `None` is only added to the output dict for nullable fields that
|
|
75
|
+
were set at model initialization. Other fields with value `None`
|
|
76
|
+
are ignored.
|
|
77
|
+
"""
|
|
78
|
+
excluded_fields: Set[str] = set([
|
|
79
|
+
])
|
|
80
|
+
|
|
81
|
+
_dict = self.model_dump(
|
|
82
|
+
by_alias=True,
|
|
83
|
+
exclude=excluded_fields,
|
|
84
|
+
exclude_none=True,
|
|
85
|
+
)
|
|
86
|
+
# set to None if open (nullable) is None
|
|
87
|
+
# and model_fields_set contains the field
|
|
88
|
+
if self.open is None and "open" in self.model_fields_set:
|
|
89
|
+
_dict['open'] = None
|
|
90
|
+
|
|
91
|
+
# set to None if low (nullable) is None
|
|
92
|
+
# and model_fields_set contains the field
|
|
93
|
+
if self.low is None and "low" in self.model_fields_set:
|
|
94
|
+
_dict['low'] = None
|
|
95
|
+
|
|
96
|
+
# set to None if high (nullable) is None
|
|
97
|
+
# and model_fields_set contains the field
|
|
98
|
+
if self.high is None and "high" in self.model_fields_set:
|
|
99
|
+
_dict['high'] = None
|
|
100
|
+
|
|
101
|
+
# set to None if close (nullable) is None
|
|
102
|
+
# and model_fields_set contains the field
|
|
103
|
+
if self.close is None and "close" in self.model_fields_set:
|
|
104
|
+
_dict['close'] = None
|
|
105
|
+
|
|
106
|
+
# set to None if mean (nullable) is None
|
|
107
|
+
# and model_fields_set contains the field
|
|
108
|
+
if self.mean is None and "mean" in self.model_fields_set:
|
|
109
|
+
_dict['mean'] = None
|
|
110
|
+
|
|
111
|
+
# set to None if previous (nullable) is None
|
|
112
|
+
# and model_fields_set contains the field
|
|
113
|
+
if self.previous is None and "previous" in self.model_fields_set:
|
|
114
|
+
_dict['previous'] = None
|
|
115
|
+
|
|
116
|
+
# set to None if min (nullable) is None
|
|
117
|
+
# and model_fields_set contains the field
|
|
118
|
+
if self.min is None and "min" in self.model_fields_set:
|
|
119
|
+
_dict['min'] = None
|
|
120
|
+
|
|
121
|
+
# set to None if max (nullable) is None
|
|
122
|
+
# and model_fields_set contains the field
|
|
123
|
+
if self.max is None and "max" in self.model_fields_set:
|
|
124
|
+
_dict['max'] = None
|
|
125
|
+
|
|
126
|
+
return _dict
|
|
127
|
+
|
|
128
|
+
@classmethod
|
|
129
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
130
|
+
"""Create an instance of PriceDistribution from a dict"""
|
|
131
|
+
if obj is None:
|
|
132
|
+
return None
|
|
133
|
+
|
|
134
|
+
if not isinstance(obj, dict):
|
|
135
|
+
return cls.model_validate(obj)
|
|
136
|
+
|
|
137
|
+
_obj = cls.model_validate({
|
|
138
|
+
"open": obj.get("open"),
|
|
139
|
+
"open_dollars": obj.get("open_dollars"),
|
|
140
|
+
"low": obj.get("low"),
|
|
141
|
+
"low_dollars": obj.get("low_dollars"),
|
|
142
|
+
"high": obj.get("high"),
|
|
143
|
+
"high_dollars": obj.get("high_dollars"),
|
|
144
|
+
"close": obj.get("close"),
|
|
145
|
+
"close_dollars": obj.get("close_dollars"),
|
|
146
|
+
"mean": obj.get("mean"),
|
|
147
|
+
"mean_dollars": obj.get("mean_dollars"),
|
|
148
|
+
"previous": obj.get("previous"),
|
|
149
|
+
"previous_dollars": obj.get("previous_dollars"),
|
|
150
|
+
"min": obj.get("min"),
|
|
151
|
+
"min_dollars": obj.get("min_dollars"),
|
|
152
|
+
"max": obj.get("max"),
|
|
153
|
+
"max_dollars": obj.get("max_dollars")
|
|
154
|
+
})
|
|
155
|
+
return _obj
|
|
156
|
+
|
|
157
|
+
|
|
@@ -0,0 +1,91 @@
|
|
|
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 PriceRange(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
PriceRange
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
start: StrictStr = Field(description="Starting price for this range in dollars")
|
|
30
|
+
end: StrictStr = Field(description="Ending price for this range in dollars")
|
|
31
|
+
step: StrictStr = Field(description="Price step/tick size for this range in dollars")
|
|
32
|
+
__properties: ClassVar[List[str]] = ["start", "end", "step"]
|
|
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 PriceRange 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
|
+
return _dict
|
|
74
|
+
|
|
75
|
+
@classmethod
|
|
76
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
77
|
+
"""Create an instance of PriceRange from a dict"""
|
|
78
|
+
if obj is None:
|
|
79
|
+
return None
|
|
80
|
+
|
|
81
|
+
if not isinstance(obj, dict):
|
|
82
|
+
return cls.model_validate(obj)
|
|
83
|
+
|
|
84
|
+
_obj = cls.model_validate({
|
|
85
|
+
"start": obj.get("start"),
|
|
86
|
+
"end": obj.get("end"),
|
|
87
|
+
"step": obj.get("step")
|
|
88
|
+
})
|
|
89
|
+
return _obj
|
|
90
|
+
|
|
91
|
+
|
|
@@ -0,0 +1,153 @@
|
|
|
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 datetime import datetime
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class Quote(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
Quote
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
id: StrictStr = Field(description="Unique identifier for the quote")
|
|
31
|
+
rfq_id: StrictStr = Field(description="ID of the RFQ this quote is responding to")
|
|
32
|
+
creator_id: StrictStr = Field(description="Public communications ID of the quote creator")
|
|
33
|
+
rfq_creator_id: StrictStr = Field(description="Public communications ID of the RFQ creator")
|
|
34
|
+
market_ticker: StrictStr = Field(description="The ticker of the market this quote is for")
|
|
35
|
+
contracts: StrictInt = Field(description="Number of contracts in the quote")
|
|
36
|
+
yes_bid: StrictInt = Field(description="Bid price for YES contracts, in cents")
|
|
37
|
+
no_bid: StrictInt = Field(description="Bid price for NO contracts, in cents")
|
|
38
|
+
yes_bid_dollars: StrictStr = Field(description="US dollar amount as a fixed-point decimal string with exactly 4 decimal places")
|
|
39
|
+
no_bid_dollars: StrictStr = Field(description="US dollar amount as a fixed-point decimal string with exactly 4 decimal places")
|
|
40
|
+
created_ts: datetime = Field(description="Timestamp when the quote was created")
|
|
41
|
+
updated_ts: datetime = Field(description="Timestamp when the quote was last updated")
|
|
42
|
+
status: StrictStr = Field(description="Current status of the quote")
|
|
43
|
+
accepted_side: Optional[StrictStr] = Field(default=None, description="The side that was accepted (yes or no)")
|
|
44
|
+
accepted_ts: Optional[datetime] = Field(default=None, description="Timestamp when the quote was accepted")
|
|
45
|
+
confirmed_ts: Optional[datetime] = Field(default=None, description="Timestamp when the quote was confirmed")
|
|
46
|
+
executed_ts: Optional[datetime] = Field(default=None, description="Timestamp when the quote was executed")
|
|
47
|
+
cancelled_ts: Optional[datetime] = Field(default=None, description="Timestamp when the quote was cancelled")
|
|
48
|
+
rest_remainder: Optional[StrictBool] = Field(default=None, description="Whether to rest the remainder of the quote after execution")
|
|
49
|
+
cancellation_reason: Optional[StrictStr] = Field(default=None, description="Reason for quote cancellation if cancelled")
|
|
50
|
+
creator_user_id: Optional[StrictStr] = Field(default=None, description="User ID of the quote creator (private field)")
|
|
51
|
+
rfq_creator_user_id: Optional[StrictStr] = Field(default=None, description="User ID of the RFQ creator (private field)")
|
|
52
|
+
rfq_target_cost_centi_cents: Optional[StrictInt] = Field(default=None, description="Total value requested in the RFQ in centi-cents")
|
|
53
|
+
rfq_creator_order_id: Optional[StrictStr] = Field(default=None, description="Order ID for the RFQ creator (private field)")
|
|
54
|
+
creator_order_id: Optional[StrictStr] = Field(default=None, description="Order ID for the quote creator (private field)")
|
|
55
|
+
__properties: ClassVar[List[str]] = ["id", "rfq_id", "creator_id", "rfq_creator_id", "market_ticker", "contracts", "yes_bid", "no_bid", "yes_bid_dollars", "no_bid_dollars", "created_ts", "updated_ts", "status", "accepted_side", "accepted_ts", "confirmed_ts", "executed_ts", "cancelled_ts", "rest_remainder", "cancellation_reason", "creator_user_id", "rfq_creator_user_id", "rfq_target_cost_centi_cents", "rfq_creator_order_id", "creator_order_id"]
|
|
56
|
+
|
|
57
|
+
@field_validator('status')
|
|
58
|
+
def status_validate_enum(cls, value):
|
|
59
|
+
"""Validates the enum"""
|
|
60
|
+
if value not in set(['open', 'accepted', 'confirmed', 'executed', 'cancelled']):
|
|
61
|
+
raise ValueError("must be one of enum values ('open', 'accepted', 'confirmed', 'executed', 'cancelled')")
|
|
62
|
+
return value
|
|
63
|
+
|
|
64
|
+
@field_validator('accepted_side')
|
|
65
|
+
def accepted_side_validate_enum(cls, value):
|
|
66
|
+
"""Validates the enum"""
|
|
67
|
+
if value is None:
|
|
68
|
+
return value
|
|
69
|
+
|
|
70
|
+
if value not in set(['true', 'false']):
|
|
71
|
+
raise ValueError("must be one of enum values ('true', 'false')")
|
|
72
|
+
return value
|
|
73
|
+
|
|
74
|
+
model_config = ConfigDict(
|
|
75
|
+
populate_by_name=True,
|
|
76
|
+
validate_assignment=True,
|
|
77
|
+
protected_namespaces=(),
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def to_str(self) -> str:
|
|
82
|
+
"""Returns the string representation of the model using alias"""
|
|
83
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
84
|
+
|
|
85
|
+
def to_json(self) -> str:
|
|
86
|
+
"""Returns the JSON representation of the model using alias"""
|
|
87
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
88
|
+
return json.dumps(self.to_dict())
|
|
89
|
+
|
|
90
|
+
@classmethod
|
|
91
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
92
|
+
"""Create an instance of Quote from a JSON string"""
|
|
93
|
+
return cls.from_dict(json.loads(json_str))
|
|
94
|
+
|
|
95
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
96
|
+
"""Return the dictionary representation of the model using alias.
|
|
97
|
+
|
|
98
|
+
This has the following differences from calling pydantic's
|
|
99
|
+
`self.model_dump(by_alias=True)`:
|
|
100
|
+
|
|
101
|
+
* `None` is only added to the output dict for nullable fields that
|
|
102
|
+
were set at model initialization. Other fields with value `None`
|
|
103
|
+
are ignored.
|
|
104
|
+
"""
|
|
105
|
+
excluded_fields: Set[str] = set([
|
|
106
|
+
])
|
|
107
|
+
|
|
108
|
+
_dict = self.model_dump(
|
|
109
|
+
by_alias=True,
|
|
110
|
+
exclude=excluded_fields,
|
|
111
|
+
exclude_none=True,
|
|
112
|
+
)
|
|
113
|
+
return _dict
|
|
114
|
+
|
|
115
|
+
@classmethod
|
|
116
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
117
|
+
"""Create an instance of Quote from a dict"""
|
|
118
|
+
if obj is None:
|
|
119
|
+
return None
|
|
120
|
+
|
|
121
|
+
if not isinstance(obj, dict):
|
|
122
|
+
return cls.model_validate(obj)
|
|
123
|
+
|
|
124
|
+
_obj = cls.model_validate({
|
|
125
|
+
"id": obj.get("id"),
|
|
126
|
+
"rfq_id": obj.get("rfq_id"),
|
|
127
|
+
"creator_id": obj.get("creator_id"),
|
|
128
|
+
"rfq_creator_id": obj.get("rfq_creator_id"),
|
|
129
|
+
"market_ticker": obj.get("market_ticker"),
|
|
130
|
+
"contracts": obj.get("contracts"),
|
|
131
|
+
"yes_bid": obj.get("yes_bid"),
|
|
132
|
+
"no_bid": obj.get("no_bid"),
|
|
133
|
+
"yes_bid_dollars": obj.get("yes_bid_dollars"),
|
|
134
|
+
"no_bid_dollars": obj.get("no_bid_dollars"),
|
|
135
|
+
"created_ts": obj.get("created_ts"),
|
|
136
|
+
"updated_ts": obj.get("updated_ts"),
|
|
137
|
+
"status": obj.get("status"),
|
|
138
|
+
"accepted_side": obj.get("accepted_side"),
|
|
139
|
+
"accepted_ts": obj.get("accepted_ts"),
|
|
140
|
+
"confirmed_ts": obj.get("confirmed_ts"),
|
|
141
|
+
"executed_ts": obj.get("executed_ts"),
|
|
142
|
+
"cancelled_ts": obj.get("cancelled_ts"),
|
|
143
|
+
"rest_remainder": obj.get("rest_remainder"),
|
|
144
|
+
"cancellation_reason": obj.get("cancellation_reason"),
|
|
145
|
+
"creator_user_id": obj.get("creator_user_id"),
|
|
146
|
+
"rfq_creator_user_id": obj.get("rfq_creator_user_id"),
|
|
147
|
+
"rfq_target_cost_centi_cents": obj.get("rfq_target_cost_centi_cents"),
|
|
148
|
+
"rfq_creator_order_id": obj.get("rfq_creator_order_id"),
|
|
149
|
+
"creator_order_id": obj.get("creator_order_id")
|
|
150
|
+
})
|
|
151
|
+
return _obj
|
|
152
|
+
|
|
153
|
+
|
|
@@ -0,0 +1,129 @@
|
|
|
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 datetime import datetime
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from kalshi_python_async.models.mve_selected_leg import MveSelectedLeg
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class RFQ(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
RFQ
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
id: StrictStr = Field(description="Unique identifier for the RFQ")
|
|
32
|
+
creator_id: StrictStr = Field(description="Public communications ID of the RFQ creator")
|
|
33
|
+
market_ticker: StrictStr = Field(description="The ticker of the market this RFQ is for")
|
|
34
|
+
contracts: StrictInt = Field(description="Number of contracts requested in the RFQ")
|
|
35
|
+
target_cost_centi_cents: Optional[StrictInt] = Field(default=None, description="Total value of the RFQ in centi-cents")
|
|
36
|
+
status: StrictStr = Field(description="Current status of the RFQ (open, closed)")
|
|
37
|
+
created_ts: datetime = Field(description="Timestamp when the RFQ was created")
|
|
38
|
+
mve_collection_ticker: Optional[StrictStr] = Field(default=None, description="Ticker of the MVE collection this market belongs to")
|
|
39
|
+
mve_selected_legs: Optional[List[MveSelectedLeg]] = Field(default=None, description="Selected legs for the MVE collection")
|
|
40
|
+
rest_remainder: Optional[StrictBool] = Field(default=None, description="Whether to rest the remainder of the RFQ after execution")
|
|
41
|
+
cancellation_reason: Optional[StrictStr] = Field(default=None, description="Reason for RFQ cancellation if cancelled")
|
|
42
|
+
creator_user_id: Optional[StrictStr] = Field(default=None, description="User ID of the RFQ creator (private field)")
|
|
43
|
+
cancelled_ts: Optional[datetime] = Field(default=None, description="Timestamp when the RFQ was cancelled")
|
|
44
|
+
updated_ts: Optional[datetime] = Field(default=None, description="Timestamp when the RFQ was last updated")
|
|
45
|
+
__properties: ClassVar[List[str]] = ["id", "creator_id", "market_ticker", "contracts", "target_cost_centi_cents", "status", "created_ts", "mve_collection_ticker", "mve_selected_legs", "rest_remainder", "cancellation_reason", "creator_user_id", "cancelled_ts", "updated_ts"]
|
|
46
|
+
|
|
47
|
+
@field_validator('status')
|
|
48
|
+
def status_validate_enum(cls, value):
|
|
49
|
+
"""Validates the enum"""
|
|
50
|
+
if value not in set(['open', 'closed']):
|
|
51
|
+
raise ValueError("must be one of enum values ('open', 'closed')")
|
|
52
|
+
return value
|
|
53
|
+
|
|
54
|
+
model_config = ConfigDict(
|
|
55
|
+
populate_by_name=True,
|
|
56
|
+
validate_assignment=True,
|
|
57
|
+
protected_namespaces=(),
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def to_str(self) -> str:
|
|
62
|
+
"""Returns the string representation of the model using alias"""
|
|
63
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
64
|
+
|
|
65
|
+
def to_json(self) -> str:
|
|
66
|
+
"""Returns the JSON representation of the model using alias"""
|
|
67
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
68
|
+
return json.dumps(self.to_dict())
|
|
69
|
+
|
|
70
|
+
@classmethod
|
|
71
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
72
|
+
"""Create an instance of RFQ from a JSON string"""
|
|
73
|
+
return cls.from_dict(json.loads(json_str))
|
|
74
|
+
|
|
75
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
76
|
+
"""Return the dictionary representation of the model using alias.
|
|
77
|
+
|
|
78
|
+
This has the following differences from calling pydantic's
|
|
79
|
+
`self.model_dump(by_alias=True)`:
|
|
80
|
+
|
|
81
|
+
* `None` is only added to the output dict for nullable fields that
|
|
82
|
+
were set at model initialization. Other fields with value `None`
|
|
83
|
+
are ignored.
|
|
84
|
+
"""
|
|
85
|
+
excluded_fields: Set[str] = set([
|
|
86
|
+
])
|
|
87
|
+
|
|
88
|
+
_dict = self.model_dump(
|
|
89
|
+
by_alias=True,
|
|
90
|
+
exclude=excluded_fields,
|
|
91
|
+
exclude_none=True,
|
|
92
|
+
)
|
|
93
|
+
# override the default output from pydantic by calling `to_dict()` of each item in mve_selected_legs (list)
|
|
94
|
+
_items = []
|
|
95
|
+
if self.mve_selected_legs:
|
|
96
|
+
for _item_mve_selected_legs in self.mve_selected_legs:
|
|
97
|
+
if _item_mve_selected_legs:
|
|
98
|
+
_items.append(_item_mve_selected_legs.to_dict())
|
|
99
|
+
_dict['mve_selected_legs'] = _items
|
|
100
|
+
return _dict
|
|
101
|
+
|
|
102
|
+
@classmethod
|
|
103
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
104
|
+
"""Create an instance of RFQ from a dict"""
|
|
105
|
+
if obj is None:
|
|
106
|
+
return None
|
|
107
|
+
|
|
108
|
+
if not isinstance(obj, dict):
|
|
109
|
+
return cls.model_validate(obj)
|
|
110
|
+
|
|
111
|
+
_obj = cls.model_validate({
|
|
112
|
+
"id": obj.get("id"),
|
|
113
|
+
"creator_id": obj.get("creator_id"),
|
|
114
|
+
"market_ticker": obj.get("market_ticker"),
|
|
115
|
+
"contracts": obj.get("contracts"),
|
|
116
|
+
"target_cost_centi_cents": obj.get("target_cost_centi_cents"),
|
|
117
|
+
"status": obj.get("status"),
|
|
118
|
+
"created_ts": obj.get("created_ts"),
|
|
119
|
+
"mve_collection_ticker": obj.get("mve_collection_ticker"),
|
|
120
|
+
"mve_selected_legs": [MveSelectedLeg.from_dict(_item) for _item in obj["mve_selected_legs"]] if obj.get("mve_selected_legs") is not None else None,
|
|
121
|
+
"rest_remainder": obj.get("rest_remainder"),
|
|
122
|
+
"cancellation_reason": obj.get("cancellation_reason"),
|
|
123
|
+
"creator_user_id": obj.get("creator_user_id"),
|
|
124
|
+
"cancelled_ts": obj.get("cancelled_ts"),
|
|
125
|
+
"updated_ts": obj.get("updated_ts")
|
|
126
|
+
})
|
|
127
|
+
return _obj
|
|
128
|
+
|
|
129
|
+
|
|
@@ -0,0 +1,105 @@
|
|
|
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_async.models.maintenance_window import MaintenanceWindow
|
|
23
|
+
from kalshi_python_async.models.weekly_schedule import WeeklySchedule
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class Schedule(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
Schedule
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
standard_hours: List[WeeklySchedule] = Field(description="The standard operating hours of the exchange. All times are expressed in ET. Outside of these times trading will be unavailable.")
|
|
32
|
+
maintenance_windows: List[MaintenanceWindow] = Field(description="Scheduled maintenance windows, during which the exchange may be unavailable.")
|
|
33
|
+
__properties: ClassVar[List[str]] = ["standard_hours", "maintenance_windows"]
|
|
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 Schedule 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 standard_hours (list)
|
|
75
|
+
_items = []
|
|
76
|
+
if self.standard_hours:
|
|
77
|
+
for _item_standard_hours in self.standard_hours:
|
|
78
|
+
if _item_standard_hours:
|
|
79
|
+
_items.append(_item_standard_hours.to_dict())
|
|
80
|
+
_dict['standard_hours'] = _items
|
|
81
|
+
# override the default output from pydantic by calling `to_dict()` of each item in maintenance_windows (list)
|
|
82
|
+
_items = []
|
|
83
|
+
if self.maintenance_windows:
|
|
84
|
+
for _item_maintenance_windows in self.maintenance_windows:
|
|
85
|
+
if _item_maintenance_windows:
|
|
86
|
+
_items.append(_item_maintenance_windows.to_dict())
|
|
87
|
+
_dict['maintenance_windows'] = _items
|
|
88
|
+
return _dict
|
|
89
|
+
|
|
90
|
+
@classmethod
|
|
91
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
92
|
+
"""Create an instance of Schedule from a dict"""
|
|
93
|
+
if obj is None:
|
|
94
|
+
return None
|
|
95
|
+
|
|
96
|
+
if not isinstance(obj, dict):
|
|
97
|
+
return cls.model_validate(obj)
|
|
98
|
+
|
|
99
|
+
_obj = cls.model_validate({
|
|
100
|
+
"standard_hours": [WeeklySchedule.from_dict(_item) for _item in obj["standard_hours"]] if obj.get("standard_hours") is not None else None,
|
|
101
|
+
"maintenance_windows": [MaintenanceWindow.from_dict(_item) for _item in obj["maintenance_windows"]] if obj.get("maintenance_windows") is not None else None
|
|
102
|
+
})
|
|
103
|
+
return _obj
|
|
104
|
+
|
|
105
|
+
|