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
kalshi_python_async/models/lookup_tickers_for_market_in_multivariate_event_collection_response.py
ADDED
|
@@ -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 LookupTickersForMarketInMultivariateEventCollectionResponse(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
LookupTickersForMarketInMultivariateEventCollectionResponse
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
event_ticker: StrictStr = Field(description="Event ticker for the looked up market.")
|
|
30
|
+
market_ticker: StrictStr = Field(description="Market ticker for the looked up market.")
|
|
31
|
+
__properties: ClassVar[List[str]] = ["event_ticker", "market_ticker"]
|
|
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 LookupTickersForMarketInMultivariateEventCollectionResponse 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 LookupTickersForMarketInMultivariateEventCollectionResponse 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
|
+
"event_ticker": obj.get("event_ticker"),
|
|
85
|
+
"market_ticker": obj.get("market_ticker")
|
|
86
|
+
})
|
|
87
|
+
return _obj
|
|
88
|
+
|
|
89
|
+
|
|
@@ -0,0 +1,90 @@
|
|
|
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
|
|
22
|
+
from typing import Any, ClassVar, Dict, List
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class MaintenanceWindow(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
MaintenanceWindow
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
start_datetime: datetime = Field(description="Start date and time of the maintenance window.")
|
|
31
|
+
end_datetime: datetime = Field(description="End date and time of the maintenance window.")
|
|
32
|
+
__properties: ClassVar[List[str]] = ["start_datetime", "end_datetime"]
|
|
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 MaintenanceWindow 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 MaintenanceWindow 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_datetime": obj.get("start_datetime"),
|
|
86
|
+
"end_datetime": obj.get("end_datetime")
|
|
87
|
+
})
|
|
88
|
+
return _obj
|
|
89
|
+
|
|
90
|
+
|
|
@@ -0,0 +1,307 @@
|
|
|
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, StrictFloat, StrictInt, StrictStr, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
23
|
+
from kalshi_python_async.models.mve_selected_leg import MveSelectedLeg
|
|
24
|
+
from kalshi_python_async.models.price_range import PriceRange
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
class Market(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
Market
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
ticker: StrictStr
|
|
33
|
+
event_ticker: StrictStr
|
|
34
|
+
market_type: StrictStr = Field(description="Identifies the type of market")
|
|
35
|
+
title: StrictStr
|
|
36
|
+
subtitle: StrictStr
|
|
37
|
+
yes_sub_title: StrictStr = Field(description="Shortened title for the yes side of this market")
|
|
38
|
+
no_sub_title: StrictStr = Field(description="Shortened title for the no side of this market")
|
|
39
|
+
created_time: datetime
|
|
40
|
+
open_time: datetime
|
|
41
|
+
close_time: datetime
|
|
42
|
+
expected_expiration_time: Optional[datetime] = Field(default=None, description="Time when this market is expected to expire")
|
|
43
|
+
expiration_time: datetime
|
|
44
|
+
latest_expiration_time: datetime = Field(description="Latest possible time for this market to expire")
|
|
45
|
+
settlement_timer_seconds: StrictInt = Field(description="The amount of time after determination that the market settles")
|
|
46
|
+
status: StrictStr
|
|
47
|
+
response_price_units: StrictStr = Field(description="The units used to express all price related fields")
|
|
48
|
+
yes_bid: Union[StrictFloat, StrictInt]
|
|
49
|
+
yes_bid_dollars: StrictStr = Field(description="US dollar amount as a fixed-point decimal string with exactly 4 decimal places")
|
|
50
|
+
yes_ask: Union[StrictFloat, StrictInt]
|
|
51
|
+
yes_ask_dollars: StrictStr = Field(description="US dollar amount as a fixed-point decimal string with exactly 4 decimal places")
|
|
52
|
+
no_bid: Union[StrictFloat, StrictInt]
|
|
53
|
+
no_bid_dollars: StrictStr = Field(description="US dollar amount as a fixed-point decimal string with exactly 4 decimal places")
|
|
54
|
+
no_ask: Union[StrictFloat, StrictInt]
|
|
55
|
+
no_ask_dollars: StrictStr = Field(description="US dollar amount as a fixed-point decimal string with exactly 4 decimal places")
|
|
56
|
+
last_price: Union[StrictFloat, StrictInt]
|
|
57
|
+
last_price_dollars: StrictStr = Field(description="US dollar amount as a fixed-point decimal string with exactly 4 decimal places")
|
|
58
|
+
volume: StrictInt
|
|
59
|
+
volume_24h: StrictInt
|
|
60
|
+
result: StrictStr
|
|
61
|
+
can_close_early: StrictBool
|
|
62
|
+
open_interest: StrictInt = Field(description="Number of contracts bought on this market disconsidering netting")
|
|
63
|
+
notional_value: StrictInt = Field(description="The total value of a single contract at settlement in cents")
|
|
64
|
+
notional_value_dollars: StrictStr = Field(description="US dollar amount as a fixed-point decimal string with exactly 4 decimal places")
|
|
65
|
+
previous_yes_bid: StrictInt = Field(description="Price for the highest YES buy offer on this market a day ago in cents")
|
|
66
|
+
previous_yes_bid_dollars: StrictStr = Field(description="US dollar amount as a fixed-point decimal string with exactly 4 decimal places")
|
|
67
|
+
previous_yes_ask: StrictInt = Field(description="Price for the lowest YES sell offer on this market a day ago in cents")
|
|
68
|
+
previous_yes_ask_dollars: StrictStr = Field(description="US dollar amount as a fixed-point decimal string with exactly 4 decimal places")
|
|
69
|
+
previous_price: StrictInt = Field(description="Price for the last traded YES contract on this market a day ago in cents")
|
|
70
|
+
previous_price_dollars: StrictStr = Field(description="US dollar amount as a fixed-point decimal string with exactly 4 decimal places")
|
|
71
|
+
liquidity: StrictInt = Field(description="Value for current offers in this market in cents")
|
|
72
|
+
liquidity_dollars: StrictStr = Field(description="US dollar amount as a fixed-point decimal string with exactly 4 decimal places")
|
|
73
|
+
settlement_value: Optional[StrictInt] = Field(default=None, description="The settlement value of the YES/LONG side of the contract in cents. Only filled after determination")
|
|
74
|
+
settlement_value_dollars: Optional[StrictStr] = Field(default=None, description="US dollar amount as a fixed-point decimal string with exactly 4 decimal places")
|
|
75
|
+
expiration_value: StrictStr = Field(description="The value that was considered for the settlement")
|
|
76
|
+
category: StrictStr
|
|
77
|
+
risk_limit_cents: StrictInt
|
|
78
|
+
fee_waiver_expiration_time: Optional[datetime] = Field(default=None, description="Time when this market's fee waiver expires")
|
|
79
|
+
early_close_condition: Optional[StrictStr] = Field(default=None, description="The condition under which the market can close early")
|
|
80
|
+
tick_size: StrictInt = Field(description="The minimum price movement in the market")
|
|
81
|
+
strike_type: Optional[StrictStr] = Field(default=None, description="Strike type defines how the market strike is defined and evaluated")
|
|
82
|
+
floor_strike: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Minimum expiration value that leads to a YES settlement")
|
|
83
|
+
cap_strike: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Maximum expiration value that leads to a YES settlement")
|
|
84
|
+
functional_strike: Optional[StrictStr] = Field(default=None, description="Mapping from expiration values to settlement values")
|
|
85
|
+
custom_strike: Optional[Dict[str, Any]] = Field(default=None, description="Expiration value for each target that leads to a YES settlement")
|
|
86
|
+
rules_primary: StrictStr = Field(description="A plain language description of the most important market terms")
|
|
87
|
+
rules_secondary: StrictStr = Field(description="A plain language description of secondary market terms")
|
|
88
|
+
mve_collection_ticker: Optional[StrictStr] = Field(default=None, description="The ticker of the multivariate event collection")
|
|
89
|
+
mve_selected_legs: Optional[List[MveSelectedLeg]] = None
|
|
90
|
+
primary_participant_key: Optional[StrictStr] = None
|
|
91
|
+
price_level_structure: StrictStr = Field(description="Price level structure for this market, defining price ranges and tick sizes")
|
|
92
|
+
price_ranges: List[PriceRange] = Field(description="Valid price ranges for orders on this market")
|
|
93
|
+
__properties: ClassVar[List[str]] = ["ticker", "event_ticker", "market_type", "title", "subtitle", "yes_sub_title", "no_sub_title", "created_time", "open_time", "close_time", "expected_expiration_time", "expiration_time", "latest_expiration_time", "settlement_timer_seconds", "status", "response_price_units", "yes_bid", "yes_bid_dollars", "yes_ask", "yes_ask_dollars", "no_bid", "no_bid_dollars", "no_ask", "no_ask_dollars", "last_price", "last_price_dollars", "volume", "volume_24h", "result", "can_close_early", "open_interest", "notional_value", "notional_value_dollars", "previous_yes_bid", "previous_yes_bid_dollars", "previous_yes_ask", "previous_yes_ask_dollars", "previous_price", "previous_price_dollars", "liquidity", "liquidity_dollars", "settlement_value", "settlement_value_dollars", "expiration_value", "category", "risk_limit_cents", "fee_waiver_expiration_time", "early_close_condition", "tick_size", "strike_type", "floor_strike", "cap_strike", "functional_strike", "custom_strike", "rules_primary", "rules_secondary", "mve_collection_ticker", "mve_selected_legs", "primary_participant_key", "price_level_structure", "price_ranges"]
|
|
94
|
+
|
|
95
|
+
@field_validator('market_type')
|
|
96
|
+
def market_type_validate_enum(cls, value):
|
|
97
|
+
"""Validates the enum"""
|
|
98
|
+
if value not in set(['binary', 'scalar']):
|
|
99
|
+
raise ValueError("must be one of enum values ('binary', 'scalar')")
|
|
100
|
+
return value
|
|
101
|
+
|
|
102
|
+
@field_validator('status')
|
|
103
|
+
def status_validate_enum(cls, value):
|
|
104
|
+
"""Validates the enum"""
|
|
105
|
+
if value not in set(['initialized', 'active', 'closed', 'settled', 'determined']):
|
|
106
|
+
raise ValueError("must be one of enum values ('initialized', 'active', 'closed', 'settled', 'determined')")
|
|
107
|
+
return value
|
|
108
|
+
|
|
109
|
+
@field_validator('response_price_units')
|
|
110
|
+
def response_price_units_validate_enum(cls, value):
|
|
111
|
+
"""Validates the enum"""
|
|
112
|
+
if value not in set(['usd_cent']):
|
|
113
|
+
raise ValueError("must be one of enum values ('usd_cent')")
|
|
114
|
+
return value
|
|
115
|
+
|
|
116
|
+
@field_validator('result')
|
|
117
|
+
def result_validate_enum(cls, value):
|
|
118
|
+
"""Validates the enum"""
|
|
119
|
+
if value not in set(['yes', 'no', '']):
|
|
120
|
+
raise ValueError("must be one of enum values ('yes', 'no', '')")
|
|
121
|
+
return value
|
|
122
|
+
|
|
123
|
+
@field_validator('strike_type')
|
|
124
|
+
def strike_type_validate_enum(cls, value):
|
|
125
|
+
"""Validates the enum"""
|
|
126
|
+
if value is None:
|
|
127
|
+
return value
|
|
128
|
+
|
|
129
|
+
if value not in set(['greater', 'greater_or_equal', 'less', 'less_or_equal', 'between', 'functional', 'custom', 'structured']):
|
|
130
|
+
raise ValueError("must be one of enum values ('greater', 'greater_or_equal', 'less', 'less_or_equal', 'between', 'functional', 'custom', 'structured')")
|
|
131
|
+
return value
|
|
132
|
+
|
|
133
|
+
model_config = ConfigDict(
|
|
134
|
+
populate_by_name=True,
|
|
135
|
+
validate_assignment=True,
|
|
136
|
+
protected_namespaces=(),
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def to_str(self) -> str:
|
|
141
|
+
"""Returns the string representation of the model using alias"""
|
|
142
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
143
|
+
|
|
144
|
+
def to_json(self) -> str:
|
|
145
|
+
"""Returns the JSON representation of the model using alias"""
|
|
146
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
147
|
+
return json.dumps(self.to_dict())
|
|
148
|
+
|
|
149
|
+
@classmethod
|
|
150
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
151
|
+
"""Create an instance of Market from a JSON string"""
|
|
152
|
+
return cls.from_dict(json.loads(json_str))
|
|
153
|
+
|
|
154
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
155
|
+
"""Return the dictionary representation of the model using alias.
|
|
156
|
+
|
|
157
|
+
This has the following differences from calling pydantic's
|
|
158
|
+
`self.model_dump(by_alias=True)`:
|
|
159
|
+
|
|
160
|
+
* `None` is only added to the output dict for nullable fields that
|
|
161
|
+
were set at model initialization. Other fields with value `None`
|
|
162
|
+
are ignored.
|
|
163
|
+
"""
|
|
164
|
+
excluded_fields: Set[str] = set([
|
|
165
|
+
])
|
|
166
|
+
|
|
167
|
+
_dict = self.model_dump(
|
|
168
|
+
by_alias=True,
|
|
169
|
+
exclude=excluded_fields,
|
|
170
|
+
exclude_none=True,
|
|
171
|
+
)
|
|
172
|
+
# override the default output from pydantic by calling `to_dict()` of each item in mve_selected_legs (list)
|
|
173
|
+
_items = []
|
|
174
|
+
if self.mve_selected_legs:
|
|
175
|
+
for _item_mve_selected_legs in self.mve_selected_legs:
|
|
176
|
+
if _item_mve_selected_legs:
|
|
177
|
+
_items.append(_item_mve_selected_legs.to_dict())
|
|
178
|
+
_dict['mve_selected_legs'] = _items
|
|
179
|
+
# override the default output from pydantic by calling `to_dict()` of each item in price_ranges (list)
|
|
180
|
+
_items = []
|
|
181
|
+
if self.price_ranges:
|
|
182
|
+
for _item_price_ranges in self.price_ranges:
|
|
183
|
+
if _item_price_ranges:
|
|
184
|
+
_items.append(_item_price_ranges.to_dict())
|
|
185
|
+
_dict['price_ranges'] = _items
|
|
186
|
+
# set to None if expected_expiration_time (nullable) is None
|
|
187
|
+
# and model_fields_set contains the field
|
|
188
|
+
if self.expected_expiration_time is None and "expected_expiration_time" in self.model_fields_set:
|
|
189
|
+
_dict['expected_expiration_time'] = None
|
|
190
|
+
|
|
191
|
+
# set to None if settlement_value (nullable) is None
|
|
192
|
+
# and model_fields_set contains the field
|
|
193
|
+
if self.settlement_value is None and "settlement_value" in self.model_fields_set:
|
|
194
|
+
_dict['settlement_value'] = None
|
|
195
|
+
|
|
196
|
+
# set to None if fee_waiver_expiration_time (nullable) is None
|
|
197
|
+
# and model_fields_set contains the field
|
|
198
|
+
if self.fee_waiver_expiration_time is None and "fee_waiver_expiration_time" in self.model_fields_set:
|
|
199
|
+
_dict['fee_waiver_expiration_time'] = None
|
|
200
|
+
|
|
201
|
+
# set to None if early_close_condition (nullable) is None
|
|
202
|
+
# and model_fields_set contains the field
|
|
203
|
+
if self.early_close_condition is None and "early_close_condition" in self.model_fields_set:
|
|
204
|
+
_dict['early_close_condition'] = None
|
|
205
|
+
|
|
206
|
+
# set to None if floor_strike (nullable) is None
|
|
207
|
+
# and model_fields_set contains the field
|
|
208
|
+
if self.floor_strike is None and "floor_strike" in self.model_fields_set:
|
|
209
|
+
_dict['floor_strike'] = None
|
|
210
|
+
|
|
211
|
+
# set to None if cap_strike (nullable) is None
|
|
212
|
+
# and model_fields_set contains the field
|
|
213
|
+
if self.cap_strike is None and "cap_strike" in self.model_fields_set:
|
|
214
|
+
_dict['cap_strike'] = None
|
|
215
|
+
|
|
216
|
+
# set to None if functional_strike (nullable) is None
|
|
217
|
+
# and model_fields_set contains the field
|
|
218
|
+
if self.functional_strike is None and "functional_strike" in self.model_fields_set:
|
|
219
|
+
_dict['functional_strike'] = None
|
|
220
|
+
|
|
221
|
+
# set to None if custom_strike (nullable) is None
|
|
222
|
+
# and model_fields_set contains the field
|
|
223
|
+
if self.custom_strike is None and "custom_strike" in self.model_fields_set:
|
|
224
|
+
_dict['custom_strike'] = None
|
|
225
|
+
|
|
226
|
+
# set to None if primary_participant_key (nullable) is None
|
|
227
|
+
# and model_fields_set contains the field
|
|
228
|
+
if self.primary_participant_key is None and "primary_participant_key" in self.model_fields_set:
|
|
229
|
+
_dict['primary_participant_key'] = None
|
|
230
|
+
|
|
231
|
+
return _dict
|
|
232
|
+
|
|
233
|
+
@classmethod
|
|
234
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
235
|
+
"""Create an instance of Market from a dict"""
|
|
236
|
+
if obj is None:
|
|
237
|
+
return None
|
|
238
|
+
|
|
239
|
+
if not isinstance(obj, dict):
|
|
240
|
+
return cls.model_validate(obj)
|
|
241
|
+
|
|
242
|
+
_obj = cls.model_validate({
|
|
243
|
+
"ticker": obj.get("ticker"),
|
|
244
|
+
"event_ticker": obj.get("event_ticker"),
|
|
245
|
+
"market_type": obj.get("market_type"),
|
|
246
|
+
"title": obj.get("title"),
|
|
247
|
+
"subtitle": obj.get("subtitle"),
|
|
248
|
+
"yes_sub_title": obj.get("yes_sub_title"),
|
|
249
|
+
"no_sub_title": obj.get("no_sub_title"),
|
|
250
|
+
"created_time": obj.get("created_time"),
|
|
251
|
+
"open_time": obj.get("open_time"),
|
|
252
|
+
"close_time": obj.get("close_time"),
|
|
253
|
+
"expected_expiration_time": obj.get("expected_expiration_time"),
|
|
254
|
+
"expiration_time": obj.get("expiration_time"),
|
|
255
|
+
"latest_expiration_time": obj.get("latest_expiration_time"),
|
|
256
|
+
"settlement_timer_seconds": obj.get("settlement_timer_seconds"),
|
|
257
|
+
"status": obj.get("status"),
|
|
258
|
+
"response_price_units": obj.get("response_price_units"),
|
|
259
|
+
"yes_bid": obj.get("yes_bid"),
|
|
260
|
+
"yes_bid_dollars": obj.get("yes_bid_dollars"),
|
|
261
|
+
"yes_ask": obj.get("yes_ask"),
|
|
262
|
+
"yes_ask_dollars": obj.get("yes_ask_dollars"),
|
|
263
|
+
"no_bid": obj.get("no_bid"),
|
|
264
|
+
"no_bid_dollars": obj.get("no_bid_dollars"),
|
|
265
|
+
"no_ask": obj.get("no_ask"),
|
|
266
|
+
"no_ask_dollars": obj.get("no_ask_dollars"),
|
|
267
|
+
"last_price": obj.get("last_price"),
|
|
268
|
+
"last_price_dollars": obj.get("last_price_dollars"),
|
|
269
|
+
"volume": obj.get("volume"),
|
|
270
|
+
"volume_24h": obj.get("volume_24h"),
|
|
271
|
+
"result": obj.get("result"),
|
|
272
|
+
"can_close_early": obj.get("can_close_early"),
|
|
273
|
+
"open_interest": obj.get("open_interest"),
|
|
274
|
+
"notional_value": obj.get("notional_value"),
|
|
275
|
+
"notional_value_dollars": obj.get("notional_value_dollars"),
|
|
276
|
+
"previous_yes_bid": obj.get("previous_yes_bid"),
|
|
277
|
+
"previous_yes_bid_dollars": obj.get("previous_yes_bid_dollars"),
|
|
278
|
+
"previous_yes_ask": obj.get("previous_yes_ask"),
|
|
279
|
+
"previous_yes_ask_dollars": obj.get("previous_yes_ask_dollars"),
|
|
280
|
+
"previous_price": obj.get("previous_price"),
|
|
281
|
+
"previous_price_dollars": obj.get("previous_price_dollars"),
|
|
282
|
+
"liquidity": obj.get("liquidity"),
|
|
283
|
+
"liquidity_dollars": obj.get("liquidity_dollars"),
|
|
284
|
+
"settlement_value": obj.get("settlement_value"),
|
|
285
|
+
"settlement_value_dollars": obj.get("settlement_value_dollars"),
|
|
286
|
+
"expiration_value": obj.get("expiration_value"),
|
|
287
|
+
"category": obj.get("category"),
|
|
288
|
+
"risk_limit_cents": obj.get("risk_limit_cents"),
|
|
289
|
+
"fee_waiver_expiration_time": obj.get("fee_waiver_expiration_time"),
|
|
290
|
+
"early_close_condition": obj.get("early_close_condition"),
|
|
291
|
+
"tick_size": obj.get("tick_size"),
|
|
292
|
+
"strike_type": obj.get("strike_type"),
|
|
293
|
+
"floor_strike": obj.get("floor_strike"),
|
|
294
|
+
"cap_strike": obj.get("cap_strike"),
|
|
295
|
+
"functional_strike": obj.get("functional_strike"),
|
|
296
|
+
"custom_strike": obj.get("custom_strike"),
|
|
297
|
+
"rules_primary": obj.get("rules_primary"),
|
|
298
|
+
"rules_secondary": obj.get("rules_secondary"),
|
|
299
|
+
"mve_collection_ticker": obj.get("mve_collection_ticker"),
|
|
300
|
+
"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,
|
|
301
|
+
"primary_participant_key": obj.get("primary_participant_key"),
|
|
302
|
+
"price_level_structure": obj.get("price_level_structure"),
|
|
303
|
+
"price_ranges": [PriceRange.from_dict(_item) for _item in obj["price_ranges"]] if obj.get("price_ranges") is not None else None
|
|
304
|
+
})
|
|
305
|
+
return _obj
|
|
306
|
+
|
|
307
|
+
|
|
@@ -0,0 +1,108 @@
|
|
|
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
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from kalshi_python_async.models.bid_ask_distribution import BidAskDistribution
|
|
23
|
+
from kalshi_python_async.models.price_distribution import PriceDistribution
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class MarketCandlestick(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
MarketCandlestick
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
end_period_ts: StrictInt = Field(description="Unix timestamp for the inclusive end of the candlestick period.")
|
|
32
|
+
yes_bid: BidAskDistribution
|
|
33
|
+
yes_ask: BidAskDistribution
|
|
34
|
+
price: PriceDistribution
|
|
35
|
+
volume: StrictInt = Field(description="Number of contracts bought on the market during the candlestick period.")
|
|
36
|
+
open_interest: StrictInt = Field(description="Number of contracts bought on the market by end of the candlestick period (end_period_ts).")
|
|
37
|
+
__properties: ClassVar[List[str]] = ["end_period_ts", "yes_bid", "yes_ask", "price", "volume", "open_interest"]
|
|
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 MarketCandlestick 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
|
+
# override the default output from pydantic by calling `to_dict()` of yes_bid
|
|
79
|
+
if self.yes_bid:
|
|
80
|
+
_dict['yes_bid'] = self.yes_bid.to_dict()
|
|
81
|
+
# override the default output from pydantic by calling `to_dict()` of yes_ask
|
|
82
|
+
if self.yes_ask:
|
|
83
|
+
_dict['yes_ask'] = self.yes_ask.to_dict()
|
|
84
|
+
# override the default output from pydantic by calling `to_dict()` of price
|
|
85
|
+
if self.price:
|
|
86
|
+
_dict['price'] = self.price.to_dict()
|
|
87
|
+
return _dict
|
|
88
|
+
|
|
89
|
+
@classmethod
|
|
90
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
91
|
+
"""Create an instance of MarketCandlestick from a dict"""
|
|
92
|
+
if obj is None:
|
|
93
|
+
return None
|
|
94
|
+
|
|
95
|
+
if not isinstance(obj, dict):
|
|
96
|
+
return cls.model_validate(obj)
|
|
97
|
+
|
|
98
|
+
_obj = cls.model_validate({
|
|
99
|
+
"end_period_ts": obj.get("end_period_ts"),
|
|
100
|
+
"yes_bid": BidAskDistribution.from_dict(obj["yes_bid"]) if obj.get("yes_bid") is not None else None,
|
|
101
|
+
"yes_ask": BidAskDistribution.from_dict(obj["yes_ask"]) if obj.get("yes_ask") is not None else None,
|
|
102
|
+
"price": PriceDistribution.from_dict(obj["price"]) if obj.get("price") is not None else None,
|
|
103
|
+
"volume": obj.get("volume"),
|
|
104
|
+
"open_interest": obj.get("open_interest")
|
|
105
|
+
})
|
|
106
|
+
return _obj
|
|
107
|
+
|
|
108
|
+
|