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.
- kalshi_python_sync/__init__.py +272 -0
- kalshi_python_sync/api/__init__.py +19 -0
- kalshi_python_sync/api/api_keys_api.py +1098 -0
- kalshi_python_sync/api/communications_api.py +3216 -0
- kalshi_python_sync/api/events_api.py +1941 -0
- kalshi_python_sync/api/exchange_api.py +1263 -0
- kalshi_python_sync/api/fcm_api.py +792 -0
- kalshi_python_sync/api/incentive_programs_api.py +346 -0
- kalshi_python_sync/api/live_data_api.py +564 -0
- kalshi_python_sync/api/market_api.py +2568 -0
- kalshi_python_sync/api/milestone_api.py +689 -0
- kalshi_python_sync/api/multivariate_api.py +1486 -0
- kalshi_python_sync/api/order_groups_api.py +1375 -0
- kalshi_python_sync/api/orders_api.py +2913 -0
- kalshi_python_sync/api/portfolio_api.py +1572 -0
- kalshi_python_sync/api/search_api.py +516 -0
- kalshi_python_sync/api/structured_targets_api.py +605 -0
- kalshi_python_sync/api_client.py +830 -0
- kalshi_python_sync/api_response.py +21 -0
- kalshi_python_sync/auth.py +89 -0
- kalshi_python_sync/configuration.py +626 -0
- kalshi_python_sync/exceptions.py +216 -0
- kalshi_python_sync/models/__init__.py +136 -0
- kalshi_python_sync/models/accept_quote_request.py +94 -0
- kalshi_python_sync/models/amend_order_request.py +120 -0
- kalshi_python_sync/models/amend_order_response.py +96 -0
- kalshi_python_sync/models/announcement.py +108 -0
- kalshi_python_sync/models/api_key.py +89 -0
- kalshi_python_sync/models/associated_event.py +105 -0
- kalshi_python_sync/models/batch_cancel_orders_individual_response.py +111 -0
- kalshi_python_sync/models/batch_cancel_orders_request.py +87 -0
- kalshi_python_sync/models/batch_cancel_orders_response.py +95 -0
- kalshi_python_sync/models/batch_create_orders_individual_response.py +114 -0
- kalshi_python_sync/models/batch_create_orders_request.py +95 -0
- kalshi_python_sync/models/batch_create_orders_response.py +95 -0
- kalshi_python_sync/models/batch_get_market_candlesticks_response.py +95 -0
- kalshi_python_sync/models/bid_ask_distribution.py +101 -0
- kalshi_python_sync/models/cancel_order_response.py +93 -0
- kalshi_python_sync/models/create_api_key_request.py +89 -0
- kalshi_python_sync/models/create_api_key_response.py +87 -0
- kalshi_python_sync/models/create_market_in_multivariate_event_collection_request.py +95 -0
- kalshi_python_sync/models/create_market_in_multivariate_event_collection_response.py +89 -0
- kalshi_python_sync/models/create_order_group_request.py +88 -0
- kalshi_python_sync/models/create_order_group_response.py +87 -0
- kalshi_python_sync/models/create_order_request.py +159 -0
- kalshi_python_sync/models/create_order_response.py +91 -0
- kalshi_python_sync/models/create_quote_request.py +93 -0
- kalshi_python_sync/models/create_quote_response.py +87 -0
- kalshi_python_sync/models/create_rfq_request.py +97 -0
- kalshi_python_sync/models/create_rfq_response.py +87 -0
- kalshi_python_sync/models/daily_schedule.py +89 -0
- kalshi_python_sync/models/decrease_order_request.py +90 -0
- kalshi_python_sync/models/decrease_order_response.py +91 -0
- kalshi_python_sync/models/error_response.py +93 -0
- kalshi_python_sync/models/event_data.py +133 -0
- kalshi_python_sync/models/event_position.py +105 -0
- kalshi_python_sync/models/exchange_status.py +97 -0
- kalshi_python_sync/models/fill.py +134 -0
- kalshi_python_sync/models/forecast_percentiles_point.py +101 -0
- kalshi_python_sync/models/generate_api_key_request.py +87 -0
- kalshi_python_sync/models/generate_api_key_response.py +89 -0
- kalshi_python_sync/models/get_api_keys_response.py +95 -0
- kalshi_python_sync/models/get_balance_response.py +91 -0
- kalshi_python_sync/models/get_communications_id_response.py +87 -0
- kalshi_python_sync/models/get_event_candlesticks_response.py +104 -0
- kalshi_python_sync/models/get_event_forecast_percentiles_history_response.py +95 -0
- kalshi_python_sync/models/get_event_metadata_response.py +123 -0
- kalshi_python_sync/models/get_event_response.py +101 -0
- kalshi_python_sync/models/get_events_response.py +107 -0
- kalshi_python_sync/models/get_exchange_announcements_response.py +95 -0
- kalshi_python_sync/models/get_exchange_schedule_response.py +91 -0
- kalshi_python_sync/models/get_fills_response.py +97 -0
- kalshi_python_sync/models/get_filters_by_sports_response.py +102 -0
- kalshi_python_sync/models/get_incentive_programs_response.py +97 -0
- kalshi_python_sync/models/get_live_data_response.py +91 -0
- kalshi_python_sync/models/get_live_datas_response.py +95 -0
- kalshi_python_sync/models/get_market_candlesticks_response.py +97 -0
- kalshi_python_sync/models/get_market_orderbook_response.py +91 -0
- kalshi_python_sync/models/get_market_response.py +91 -0
- kalshi_python_sync/models/get_markets_response.py +97 -0
- kalshi_python_sync/models/get_milestone_response.py +91 -0
- kalshi_python_sync/models/get_milestones_response.py +97 -0
- kalshi_python_sync/models/get_multivariate_event_collection_lookup_history_response.py +95 -0
- kalshi_python_sync/models/get_multivariate_event_collection_response.py +91 -0
- kalshi_python_sync/models/get_multivariate_event_collections_response.py +97 -0
- kalshi_python_sync/models/get_multivariate_events_response.py +97 -0
- kalshi_python_sync/models/get_order_group_response.py +89 -0
- kalshi_python_sync/models/get_order_groups_response.py +95 -0
- kalshi_python_sync/models/get_order_queue_position_response.py +87 -0
- kalshi_python_sync/models/get_order_queue_positions_response.py +95 -0
- kalshi_python_sync/models/get_order_response.py +91 -0
- kalshi_python_sync/models/get_orders_response.py +97 -0
- kalshi_python_sync/models/get_portfolio_resting_order_total_value_response.py +87 -0
- kalshi_python_sync/models/get_positions_response.py +107 -0
- kalshi_python_sync/models/get_quote_response.py +91 -0
- kalshi_python_sync/models/get_quotes_response.py +97 -0
- kalshi_python_sync/models/get_rfq_response.py +91 -0
- kalshi_python_sync/models/get_rfqs_response.py +97 -0
- kalshi_python_sync/models/get_series_fee_changes_response.py +95 -0
- kalshi_python_sync/models/get_series_list_response.py +95 -0
- kalshi_python_sync/models/get_series_response.py +91 -0
- kalshi_python_sync/models/get_settlements_response.py +97 -0
- kalshi_python_sync/models/get_structured_target_response.py +91 -0
- kalshi_python_sync/models/get_structured_targets_response.py +97 -0
- kalshi_python_sync/models/get_tags_for_series_categories_response.py +87 -0
- kalshi_python_sync/models/get_trades_response.py +97 -0
- kalshi_python_sync/models/get_user_data_timestamp_response.py +88 -0
- kalshi_python_sync/models/incentive_program.py +121 -0
- kalshi_python_sync/models/live_data.py +91 -0
- kalshi_python_sync/models/lookup_point.py +102 -0
- kalshi_python_sync/models/lookup_tickers_for_market_in_multivariate_event_collection_request.py +95 -0
- kalshi_python_sync/models/lookup_tickers_for_market_in_multivariate_event_collection_response.py +89 -0
- kalshi_python_sync/models/maintenance_window.py +90 -0
- kalshi_python_sync/models/market.py +307 -0
- kalshi_python_sync/models/market_candlestick.py +108 -0
- kalshi_python_sync/models/market_candlesticks_response.py +97 -0
- kalshi_python_sync/models/market_metadata.py +91 -0
- kalshi_python_sync/models/market_position.py +110 -0
- kalshi_python_sync/models/milestone.py +120 -0
- kalshi_python_sync/models/multivariate_event_collection.py +122 -0
- kalshi_python_sync/models/mve_selected_leg.py +91 -0
- kalshi_python_sync/models/order.py +189 -0
- kalshi_python_sync/models/order_group.py +89 -0
- kalshi_python_sync/models/order_queue_position.py +91 -0
- kalshi_python_sync/models/order_status.py +38 -0
- kalshi_python_sync/models/orderbook.py +94 -0
- kalshi_python_sync/models/percentile_point.py +93 -0
- kalshi_python_sync/models/price_distribution.py +157 -0
- kalshi_python_sync/models/price_range.py +91 -0
- kalshi_python_sync/models/quote.py +153 -0
- kalshi_python_sync/models/rfq.py +129 -0
- kalshi_python_sync/models/schedule.py +105 -0
- kalshi_python_sync/models/scope_list.py +87 -0
- kalshi_python_sync/models/self_trade_prevention_type.py +37 -0
- kalshi_python_sync/models/series.py +129 -0
- kalshi_python_sync/models/series_fee_change.py +103 -0
- kalshi_python_sync/models/settlement.py +118 -0
- kalshi_python_sync/models/settlement_source.py +89 -0
- kalshi_python_sync/models/sport_filter_details.py +102 -0
- kalshi_python_sync/models/structured_target.py +98 -0
- kalshi_python_sync/models/ticker_pair.py +98 -0
- kalshi_python_sync/models/trade.py +113 -0
- kalshi_python_sync/models/weekly_schedule.py +154 -0
- kalshi_python_sync/py.typed +0 -0
- kalshi_python_sync/rest.py +258 -0
- kalshi_python_sync-3.0.0.dist-info/METADATA +77 -0
- kalshi_python_sync-3.0.0.dist-info/RECORD +149 -0
- kalshi_python_sync-3.0.0.dist-info/WHEEL +5 -0
- kalshi_python_sync-3.0.0.dist-info/top_level.txt +1 -0
|
@@ -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 kalshi_python_sync.models.percentile_point import PercentilePoint
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class ForecastPercentilesPoint(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
ForecastPercentilesPoint
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
event_ticker: StrictStr = Field(description="The event ticker this forecast is for.")
|
|
31
|
+
end_period_ts: StrictInt = Field(description="Unix timestamp for the inclusive end of the forecast period.")
|
|
32
|
+
period_interval: StrictInt = Field(description="Length of the forecast period in minutes.")
|
|
33
|
+
percentile_points: List[PercentilePoint] = Field(description="Array of forecast values at different percentiles.")
|
|
34
|
+
__properties: ClassVar[List[str]] = ["event_ticker", "end_period_ts", "period_interval", "percentile_points"]
|
|
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 ForecastPercentilesPoint from a JSON string"""
|
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
|
56
|
+
|
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
|
59
|
+
|
|
60
|
+
This has the following differences from calling pydantic's
|
|
61
|
+
`self.model_dump(by_alias=True)`:
|
|
62
|
+
|
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
|
64
|
+
were set at model initialization. Other fields with value `None`
|
|
65
|
+
are ignored.
|
|
66
|
+
"""
|
|
67
|
+
excluded_fields: Set[str] = set([
|
|
68
|
+
])
|
|
69
|
+
|
|
70
|
+
_dict = self.model_dump(
|
|
71
|
+
by_alias=True,
|
|
72
|
+
exclude=excluded_fields,
|
|
73
|
+
exclude_none=True,
|
|
74
|
+
)
|
|
75
|
+
# override the default output from pydantic by calling `to_dict()` of each item in percentile_points (list)
|
|
76
|
+
_items = []
|
|
77
|
+
if self.percentile_points:
|
|
78
|
+
for _item_percentile_points in self.percentile_points:
|
|
79
|
+
if _item_percentile_points:
|
|
80
|
+
_items.append(_item_percentile_points.to_dict())
|
|
81
|
+
_dict['percentile_points'] = _items
|
|
82
|
+
return _dict
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
86
|
+
"""Create an instance of ForecastPercentilesPoint from a dict"""
|
|
87
|
+
if obj is None:
|
|
88
|
+
return None
|
|
89
|
+
|
|
90
|
+
if not isinstance(obj, dict):
|
|
91
|
+
return cls.model_validate(obj)
|
|
92
|
+
|
|
93
|
+
_obj = cls.model_validate({
|
|
94
|
+
"event_ticker": obj.get("event_ticker"),
|
|
95
|
+
"end_period_ts": obj.get("end_period_ts"),
|
|
96
|
+
"period_interval": obj.get("period_interval"),
|
|
97
|
+
"percentile_points": [PercentilePoint.from_dict(_item) for _item in obj["percentile_points"]] if obj.get("percentile_points") is not None else None
|
|
98
|
+
})
|
|
99
|
+
return _obj
|
|
100
|
+
|
|
101
|
+
|
|
@@ -0,0 +1,87 @@
|
|
|
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 GenerateApiKeyRequest(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
GenerateApiKeyRequest
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
name: StrictStr = Field(description="Name for the API key. This helps identify the key's purpose")
|
|
30
|
+
__properties: ClassVar[List[str]] = ["name"]
|
|
31
|
+
|
|
32
|
+
model_config = ConfigDict(
|
|
33
|
+
populate_by_name=True,
|
|
34
|
+
validate_assignment=True,
|
|
35
|
+
protected_namespaces=(),
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def to_str(self) -> str:
|
|
40
|
+
"""Returns the string representation of the model using alias"""
|
|
41
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
42
|
+
|
|
43
|
+
def to_json(self) -> str:
|
|
44
|
+
"""Returns the JSON representation of the model using alias"""
|
|
45
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
46
|
+
return json.dumps(self.to_dict())
|
|
47
|
+
|
|
48
|
+
@classmethod
|
|
49
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
50
|
+
"""Create an instance of GenerateApiKeyRequest from a JSON string"""
|
|
51
|
+
return cls.from_dict(json.loads(json_str))
|
|
52
|
+
|
|
53
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
54
|
+
"""Return the dictionary representation of the model using alias.
|
|
55
|
+
|
|
56
|
+
This has the following differences from calling pydantic's
|
|
57
|
+
`self.model_dump(by_alias=True)`:
|
|
58
|
+
|
|
59
|
+
* `None` is only added to the output dict for nullable fields that
|
|
60
|
+
were set at model initialization. Other fields with value `None`
|
|
61
|
+
are ignored.
|
|
62
|
+
"""
|
|
63
|
+
excluded_fields: Set[str] = set([
|
|
64
|
+
])
|
|
65
|
+
|
|
66
|
+
_dict = self.model_dump(
|
|
67
|
+
by_alias=True,
|
|
68
|
+
exclude=excluded_fields,
|
|
69
|
+
exclude_none=True,
|
|
70
|
+
)
|
|
71
|
+
return _dict
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
75
|
+
"""Create an instance of GenerateApiKeyRequest from a dict"""
|
|
76
|
+
if obj is None:
|
|
77
|
+
return None
|
|
78
|
+
|
|
79
|
+
if not isinstance(obj, dict):
|
|
80
|
+
return cls.model_validate(obj)
|
|
81
|
+
|
|
82
|
+
_obj = cls.model_validate({
|
|
83
|
+
"name": obj.get("name")
|
|
84
|
+
})
|
|
85
|
+
return _obj
|
|
86
|
+
|
|
87
|
+
|
|
@@ -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 GenerateApiKeyResponse(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
GenerateApiKeyResponse
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
api_key_id: StrictStr = Field(description="Unique identifier for the newly generated API key")
|
|
30
|
+
private_key: StrictStr = Field(description="RSA private key in PEM format. This must be stored securely and cannot be retrieved again after this response")
|
|
31
|
+
__properties: ClassVar[List[str]] = ["api_key_id", "private_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 GenerateApiKeyResponse 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 GenerateApiKeyResponse 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
|
+
"api_key_id": obj.get("api_key_id"),
|
|
85
|
+
"private_key": obj.get("private_key")
|
|
86
|
+
})
|
|
87
|
+
return _obj
|
|
88
|
+
|
|
89
|
+
|
|
@@ -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.api_key import ApiKey
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class GetApiKeysResponse(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
GetApiKeysResponse
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
api_keys: List[ApiKey] = Field(description="List of all API keys associated with the user")
|
|
31
|
+
__properties: ClassVar[List[str]] = ["api_keys"]
|
|
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 GetApiKeysResponse 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 api_keys (list)
|
|
73
|
+
_items = []
|
|
74
|
+
if self.api_keys:
|
|
75
|
+
for _item_api_keys in self.api_keys:
|
|
76
|
+
if _item_api_keys:
|
|
77
|
+
_items.append(_item_api_keys.to_dict())
|
|
78
|
+
_dict['api_keys'] = _items
|
|
79
|
+
return _dict
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
83
|
+
"""Create an instance of GetApiKeysResponse 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
|
+
"api_keys": [ApiKey.from_dict(_item) for _item in obj["api_keys"]] if obj.get("api_keys") is not None else None
|
|
92
|
+
})
|
|
93
|
+
return _obj
|
|
94
|
+
|
|
95
|
+
|
|
@@ -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, StrictInt
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class GetBalanceResponse(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
GetBalanceResponse
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
balance: StrictInt = Field(description="Member's available balance in cents. This represents the amount available for trading.")
|
|
30
|
+
portfolio_value: StrictInt = Field(description="Member's portfolio value in cents. This is the current value of all positions held.")
|
|
31
|
+
updated_ts: StrictInt = Field(description="Unix timestamp of the last update to the balance.")
|
|
32
|
+
__properties: ClassVar[List[str]] = ["balance", "portfolio_value", "updated_ts"]
|
|
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 GetBalanceResponse 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 GetBalanceResponse 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
|
+
"balance": obj.get("balance"),
|
|
86
|
+
"portfolio_value": obj.get("portfolio_value"),
|
|
87
|
+
"updated_ts": obj.get("updated_ts")
|
|
88
|
+
})
|
|
89
|
+
return _obj
|
|
90
|
+
|
|
91
|
+
|
|
@@ -0,0 +1,87 @@
|
|
|
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 GetCommunicationsIDResponse(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
GetCommunicationsIDResponse
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
communications_id: StrictStr = Field(description="A public communications ID which is used to identify the user")
|
|
30
|
+
__properties: ClassVar[List[str]] = ["communications_id"]
|
|
31
|
+
|
|
32
|
+
model_config = ConfigDict(
|
|
33
|
+
populate_by_name=True,
|
|
34
|
+
validate_assignment=True,
|
|
35
|
+
protected_namespaces=(),
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def to_str(self) -> str:
|
|
40
|
+
"""Returns the string representation of the model using alias"""
|
|
41
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
42
|
+
|
|
43
|
+
def to_json(self) -> str:
|
|
44
|
+
"""Returns the JSON representation of the model using alias"""
|
|
45
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
46
|
+
return json.dumps(self.to_dict())
|
|
47
|
+
|
|
48
|
+
@classmethod
|
|
49
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
50
|
+
"""Create an instance of GetCommunicationsIDResponse from a JSON string"""
|
|
51
|
+
return cls.from_dict(json.loads(json_str))
|
|
52
|
+
|
|
53
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
54
|
+
"""Return the dictionary representation of the model using alias.
|
|
55
|
+
|
|
56
|
+
This has the following differences from calling pydantic's
|
|
57
|
+
`self.model_dump(by_alias=True)`:
|
|
58
|
+
|
|
59
|
+
* `None` is only added to the output dict for nullable fields that
|
|
60
|
+
were set at model initialization. Other fields with value `None`
|
|
61
|
+
are ignored.
|
|
62
|
+
"""
|
|
63
|
+
excluded_fields: Set[str] = set([
|
|
64
|
+
])
|
|
65
|
+
|
|
66
|
+
_dict = self.model_dump(
|
|
67
|
+
by_alias=True,
|
|
68
|
+
exclude=excluded_fields,
|
|
69
|
+
exclude_none=True,
|
|
70
|
+
)
|
|
71
|
+
return _dict
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
75
|
+
"""Create an instance of GetCommunicationsIDResponse from a dict"""
|
|
76
|
+
if obj is None:
|
|
77
|
+
return None
|
|
78
|
+
|
|
79
|
+
if not isinstance(obj, dict):
|
|
80
|
+
return cls.model_validate(obj)
|
|
81
|
+
|
|
82
|
+
_obj = cls.model_validate({
|
|
83
|
+
"communications_id": obj.get("communications_id")
|
|
84
|
+
})
|
|
85
|
+
return _obj
|
|
86
|
+
|
|
87
|
+
|
|
@@ -0,0 +1,104 @@
|
|
|
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 kalshi_python_sync.models.market_candlestick import MarketCandlestick
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class GetEventCandlesticksResponse(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
GetEventCandlesticksResponse
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
market_tickers: List[StrictStr] = Field(description="Array of market tickers in the event.")
|
|
31
|
+
market_candlesticks: List[List[MarketCandlestick]] = Field(description="Array of market candlestick arrays, one for each market in the event.")
|
|
32
|
+
adjusted_end_ts: StrictInt = Field(description="Adjusted end timestamp if the requested candlesticks would be larger than maxAggregateCandidates.")
|
|
33
|
+
__properties: ClassVar[List[str]] = ["market_tickers", "market_candlesticks", "adjusted_end_ts"]
|
|
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 GetEventCandlesticksResponse 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 market_candlesticks (list of list)
|
|
75
|
+
_items = []
|
|
76
|
+
if self.market_candlesticks:
|
|
77
|
+
for _item_market_candlesticks in self.market_candlesticks:
|
|
78
|
+
if _item_market_candlesticks:
|
|
79
|
+
_items.append(
|
|
80
|
+
[_inner_item.to_dict() for _inner_item in _item_market_candlesticks if _inner_item is not None]
|
|
81
|
+
)
|
|
82
|
+
_dict['market_candlesticks'] = _items
|
|
83
|
+
return _dict
|
|
84
|
+
|
|
85
|
+
@classmethod
|
|
86
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
87
|
+
"""Create an instance of GetEventCandlesticksResponse from a dict"""
|
|
88
|
+
if obj is None:
|
|
89
|
+
return None
|
|
90
|
+
|
|
91
|
+
if not isinstance(obj, dict):
|
|
92
|
+
return cls.model_validate(obj)
|
|
93
|
+
|
|
94
|
+
_obj = cls.model_validate({
|
|
95
|
+
"market_tickers": obj.get("market_tickers"),
|
|
96
|
+
"market_candlesticks": [
|
|
97
|
+
[MarketCandlestick.from_dict(_inner_item) for _inner_item in _item]
|
|
98
|
+
for _item in obj["market_candlesticks"]
|
|
99
|
+
] if obj.get("market_candlesticks") is not None else None,
|
|
100
|
+
"adjusted_end_ts": obj.get("adjusted_end_ts")
|
|
101
|
+
})
|
|
102
|
+
return _obj
|
|
103
|
+
|
|
104
|
+
|