publicdotcom-cli 1.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.
- publicdotcom_cli/__init__.py +3 -0
- publicdotcom_cli/__main__.py +5 -0
- publicdotcom_cli/_generated/__init__.py +8 -0
- publicdotcom_cli/_generated/api/__init__.py +1 -0
- publicdotcom_cli/_generated/api/account_details/__init__.py +1 -0
- publicdotcom_cli/_generated/api/account_details/get_account_portfolio_v2.py +182 -0
- publicdotcom_cli/_generated/api/account_details/get_history.py +250 -0
- publicdotcom_cli/_generated/api/authorization/__init__.py +1 -0
- publicdotcom_cli/_generated/api/authorization/create_personal_access_token.py +230 -0
- publicdotcom_cli/_generated/api/instrument_details/__init__.py +1 -0
- publicdotcom_cli/_generated/api/instrument_details/get_all_instruments.py +303 -0
- publicdotcom_cli/_generated/api/instrument_details/get_instrument.py +170 -0
- publicdotcom_cli/_generated/api/list_accounts/__init__.py +1 -0
- publicdotcom_cli/_generated/api/list_accounts/get_accounts.py +172 -0
- publicdotcom_cli/_generated/api/market_data/__init__.py +1 -0
- publicdotcom_cli/_generated/api/market_data/get_option_chain.py +200 -0
- publicdotcom_cli/_generated/api/market_data/get_option_expirations.py +210 -0
- publicdotcom_cli/_generated/api/market_data/get_quotes.py +200 -0
- publicdotcom_cli/_generated/api/option_details/__init__.py +1 -0
- publicdotcom_cli/_generated/api/option_details/get_option_greeks.py +194 -0
- publicdotcom_cli/_generated/api/order_placement/__init__.py +1 -0
- publicdotcom_cli/_generated/api/order_placement/cancel_order.py +123 -0
- publicdotcom_cli/_generated/api/order_placement/get_order.py +206 -0
- publicdotcom_cli/_generated/api/order_placement/place_multileg_order.py +214 -0
- publicdotcom_cli/_generated/api/order_placement/place_order.py +222 -0
- publicdotcom_cli/_generated/api/order_placement/preflight_multi_leg.py +276 -0
- publicdotcom_cli/_generated/api/order_placement/preflight_single_leg.py +220 -0
- publicdotcom_cli/_generated/api/order_placement/replace_order.py +222 -0
- publicdotcom_cli/_generated/client.py +272 -0
- publicdotcom_cli/_generated/errors.py +16 -0
- publicdotcom_cli/_generated/models/__init__.py +417 -0
- publicdotcom_cli/_generated/models/com_hellopublic_holdingsystem_core_types_option_price_increment.py +71 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapiauthservice_api_personal_create_access_token_request.py +84 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapiauthservice_api_personal_create_access_token_response.py +61 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapiauthservice_domain_error_error_body.py +70 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_account_account_settings.py +161 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_account_account_settings_account_type.py +14 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_account_account_settings_brokerage_account_type.py +9 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_account_account_settings_options_level.py +12 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_account_account_settings_response.py +85 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_account_account_settings_trade_permissions.py +11 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_history_gateway_history_response_page.py +195 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_history_gateway_history_transaction.py +263 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_history_gateway_history_transaction_direction.py +9 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_history_gateway_history_transaction_security_type.py +13 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_history_gateway_history_transaction_side.py +9 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_history_gateway_history_transaction_sub_type.py +19 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_history_gateway_history_transaction_type.py +10 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_marketdata_quote_gateway_option_chain_request.py +85 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_marketdata_quote_gateway_option_chain_response.py +115 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_marketdata_quote_gateway_option_expirations_request.py +75 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_marketdata_quote_gateway_option_expirations_response.py +81 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_marketdata_quote_gateway_quote.py +272 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_marketdata_quote_gateway_quote_outcome.py +9 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_marketdata_quote_gateway_quote_request.py +84 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_marketdata_quote_gateway_quote_response.py +87 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_marketdata_quote_one_day_change.py +74 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_marketdata_quote_option_details.py +135 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_options_greek_response.py +113 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_options_greeks_response.py +86 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_options_option_greeks_type_0.py +117 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_api_cancel_replace_order_request.py +139 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_api_cancel_replace_order_request_order_type.py +11 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_api_instrument_dto.py +265 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_api_instrument_dto_fractional_trading.py +10 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_api_instrument_dto_option_spread_trading.py +10 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_api_instrument_dto_option_trading.py +10 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_api_instrument_dto_shorting_availability.py +10 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_api_instrument_dto_trading.py +10 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_api_instrument_response.py +87 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_api_multileg_order_request.py +141 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_api_multileg_order_request_type.py +11 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_api_order_request.py +231 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_api_order_request_equity_market_session.py +9 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_api_order_request_open_close_indicator.py +9 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_api_order_request_order_side.py +9 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_api_order_request_order_type.py +11 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_api_order_result.py +69 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_gateway_leg_instrument.py +73 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_gateway_leg_instrument_type.py +9 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_gateway_order.py +334 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_gateway_order_instrument.py +73 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_gateway_order_instrument_type.py +15 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_gateway_order_leg.py +125 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_gateway_order_leg_open_close_indicator.py +9 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_gateway_order_leg_side.py +9 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_gateway_order_open_close_indicator.py +9 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_gateway_order_side.py +9 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_gateway_order_status.py +17 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_gateway_order_type.py +11 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_gateway_short_selling.py +127 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_gateway_short_selling_availability.py +10 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_gateway_short_selling_uptick_rule.py +9 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_instrumentdetails_api_instrument_details.py +67 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_instrumentdetails_api_instrument_details_bond.py +74 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_instrumentdetails_api_instrument_details_crypto.py +92 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_order_expiration.py +87 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_order_order_expiration_time_in_force.py +9 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_portfolio_gain_type_0.py +88 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_portfolio_gateway_buying_power.py +77 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_portfolio_gateway_cost_basis_type_0.py +167 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_portfolio_gateway_portfolio_account_v2.py +233 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_portfolio_gateway_portfolio_account_v2_account_type.py +14 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_portfolio_gateway_portfolio_equity_v2.py +100 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_portfolio_gateway_portfolio_equity_v2_type.py +14 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_portfolio_gateway_portfolio_instrument.py +93 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_portfolio_gateway_portfolio_instrument_type.py +14 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_portfolio_gateway_portfolio_position.py +352 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_portfolio_gateway_strategy.py +276 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_portfolio_gateway_strategy_leg.py +78 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_portfolio_price_type_0.py +79 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_preflight_gateway_margin_impact.py +70 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_preflight_gateway_margin_requirement.py +70 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_preflight_gateway_option_details.py +91 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_preflight_gateway_option_details_type.py +9 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_preflight_gateway_option_rebate.py +79 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_preflight_gateway_price_increment.py +80 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_preflight_gateway_regulatory_fees.py +118 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_preflight_preflight_leg_response.py +167 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_preflight_preflight_leg_response_open_close_indicator.py +9 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_preflight_preflight_leg_response_side.py +9 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_preflight_preflight_multi_leg_request.py +148 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_preflight_preflight_multi_leg_request_order_type.py +11 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_preflight_preflight_multi_leg_response.py +313 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_preflight_preflight_single_leg_request.py +225 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_preflight_preflight_single_leg_request_equity_market_session.py +11 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_preflight_preflight_single_leg_request_open_close_indicator.py +11 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_preflight_preflight_single_leg_request_order_side.py +9 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_preflight_preflight_single_leg_request_order_type.py +11 -0
- publicdotcom_cli/_generated/models/com_hellopublic_userapigateway_api_rest_preflight_preflight_single_leg_response.py +410 -0
- publicdotcom_cli/_generated/models/get_all_instruments_fractional_trading_filter_item.py +10 -0
- publicdotcom_cli/_generated/models/get_all_instruments_option_spread_trading_filter_item.py +10 -0
- publicdotcom_cli/_generated/models/get_all_instruments_option_trading_filter_item.py +10 -0
- publicdotcom_cli/_generated/models/get_all_instruments_trading_filter_item.py +10 -0
- publicdotcom_cli/_generated/models/get_all_instruments_type_filter_item.py +15 -0
- publicdotcom_cli/_generated/models/get_instrument_type.py +15 -0
- publicdotcom_cli/_generated/types.py +54 -0
- publicdotcom_cli/cli.py +761 -0
- publicdotcom_cli/client.py +83 -0
- publicdotcom_cli/config.py +222 -0
- publicdotcom_cli/output.py +77 -0
- publicdotcom_cli/payloads.py +36 -0
- publicdotcom_cli-1.0.0.dist-info/METADATA +256 -0
- publicdotcom_cli-1.0.0.dist-info/RECORD +146 -0
- publicdotcom_cli-1.0.0.dist-info/WHEEL +4 -0
- publicdotcom_cli-1.0.0.dist-info/entry_points.txt +2 -0
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import AuthenticatedClient, Client
|
|
9
|
+
from ...models.com_hellopublic_userapigateway_api_rest_preflight_preflight_multi_leg_request import (
|
|
10
|
+
ComHellopublicUserapigatewayApiRestPreflightPreflightMultiLegRequest,
|
|
11
|
+
)
|
|
12
|
+
from ...models.com_hellopublic_userapigateway_api_rest_preflight_preflight_multi_leg_response import (
|
|
13
|
+
ComHellopublicUserapigatewayApiRestPreflightPreflightMultiLegResponse,
|
|
14
|
+
)
|
|
15
|
+
from ...types import Response
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _get_kwargs(
|
|
19
|
+
account_id: str,
|
|
20
|
+
*,
|
|
21
|
+
body: ComHellopublicUserapigatewayApiRestPreflightPreflightMultiLegRequest,
|
|
22
|
+
) -> dict[str, Any]:
|
|
23
|
+
headers: dict[str, Any] = {}
|
|
24
|
+
|
|
25
|
+
_kwargs: dict[str, Any] = {
|
|
26
|
+
"method": "post",
|
|
27
|
+
"url": "/userapigateway/trading/{account_id}/preflight/multi-leg".format(
|
|
28
|
+
account_id=quote(str(account_id), safe=""),
|
|
29
|
+
),
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
_kwargs["json"] = body.to_dict()
|
|
33
|
+
|
|
34
|
+
headers["Content-Type"] = "application/json"
|
|
35
|
+
|
|
36
|
+
_kwargs["headers"] = headers
|
|
37
|
+
return _kwargs
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _parse_response(
|
|
41
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
42
|
+
) -> Any | ComHellopublicUserapigatewayApiRestPreflightPreflightMultiLegResponse | None:
|
|
43
|
+
if response.status_code == 200:
|
|
44
|
+
response_200 = (
|
|
45
|
+
ComHellopublicUserapigatewayApiRestPreflightPreflightMultiLegResponse.from_dict(
|
|
46
|
+
response.json()
|
|
47
|
+
)
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
return response_200
|
|
51
|
+
|
|
52
|
+
if response.status_code == 400:
|
|
53
|
+
response_400 = cast(Any, None)
|
|
54
|
+
return response_400
|
|
55
|
+
|
|
56
|
+
if client.raise_on_unexpected_status:
|
|
57
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
58
|
+
else:
|
|
59
|
+
return None
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def _build_response(
|
|
63
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
64
|
+
) -> Response[Any | ComHellopublicUserapigatewayApiRestPreflightPreflightMultiLegResponse]:
|
|
65
|
+
return Response(
|
|
66
|
+
status_code=HTTPStatus(response.status_code),
|
|
67
|
+
content=response.content,
|
|
68
|
+
headers=response.headers,
|
|
69
|
+
parsed=_parse_response(client=client, response=response),
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def sync_detailed(
|
|
74
|
+
account_id: str,
|
|
75
|
+
*,
|
|
76
|
+
client: AuthenticatedClient | Client,
|
|
77
|
+
body: ComHellopublicUserapigatewayApiRestPreflightPreflightMultiLegRequest,
|
|
78
|
+
) -> Response[Any | ComHellopublicUserapigatewayApiRestPreflightPreflightMultiLegResponse]:
|
|
79
|
+
"""Calculates the estimated financial impact of a complex multi-leg trade before execution
|
|
80
|
+
|
|
81
|
+
Performs preflight calculations for a multi-leg order (a transaction involving multiple securities
|
|
82
|
+
or options strategies such as spreads, straddles, or combinations) to provide comprehensive cost
|
|
83
|
+
estimates and account impact details. Returns estimated commission, regulatory fees, total order
|
|
84
|
+
value, buying power requirements, margin impact, net credit/debit amounts, and strategy-specific
|
|
85
|
+
information to help users make informed trading decisions before order placement. This endpoint
|
|
86
|
+
handles complex options strategies and calculates the combined effect of all legs in the trade. Note
|
|
87
|
+
that these are estimates only, and actual execution values may vary depending on market conditions
|
|
88
|
+
and fill prices. This endpoint may be called before submitting an actual multi-leg order to
|
|
89
|
+
understand the potential financial implications of the strategy.
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
account_id (str):
|
|
93
|
+
body (ComHellopublicUserapigatewayApiRestPreflightPreflightMultiLegRequest): #
|
|
94
|
+
PreflightMultiLegRequest
|
|
95
|
+
Request for preflight calculations on multi-leg orders.
|
|
96
|
+
|
|
97
|
+
## Fields
|
|
98
|
+
- **orderType** - The type of order (only LIMIT orders are allowed for multi-leg)
|
|
99
|
+
- **expiration** - The order expiration configuration
|
|
100
|
+
- **quantity** - The order quantity (number of strategies)
|
|
101
|
+
- **limitPrice** - The limit price for the order (required for LIMIT orders)
|
|
102
|
+
- **legs** - List of order legs (2-6 legs allowed, at most 1 equity leg)
|
|
103
|
+
- **equityMarketSession** - The market session for equity legs
|
|
104
|
+
- **validateOrder** - If true, the order will be validated against current account state.
|
|
105
|
+
Defaults to true.
|
|
106
|
+
|
|
107
|
+
Raises:
|
|
108
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
109
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
110
|
+
|
|
111
|
+
Returns:
|
|
112
|
+
Response[Any | ComHellopublicUserapigatewayApiRestPreflightPreflightMultiLegResponse]
|
|
113
|
+
"""
|
|
114
|
+
|
|
115
|
+
kwargs = _get_kwargs(
|
|
116
|
+
account_id=account_id,
|
|
117
|
+
body=body,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
response = client.get_httpx_client().request(
|
|
121
|
+
**kwargs,
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
return _build_response(client=client, response=response)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def sync(
|
|
128
|
+
account_id: str,
|
|
129
|
+
*,
|
|
130
|
+
client: AuthenticatedClient | Client,
|
|
131
|
+
body: ComHellopublicUserapigatewayApiRestPreflightPreflightMultiLegRequest,
|
|
132
|
+
) -> Any | ComHellopublicUserapigatewayApiRestPreflightPreflightMultiLegResponse | None:
|
|
133
|
+
"""Calculates the estimated financial impact of a complex multi-leg trade before execution
|
|
134
|
+
|
|
135
|
+
Performs preflight calculations for a multi-leg order (a transaction involving multiple securities
|
|
136
|
+
or options strategies such as spreads, straddles, or combinations) to provide comprehensive cost
|
|
137
|
+
estimates and account impact details. Returns estimated commission, regulatory fees, total order
|
|
138
|
+
value, buying power requirements, margin impact, net credit/debit amounts, and strategy-specific
|
|
139
|
+
information to help users make informed trading decisions before order placement. This endpoint
|
|
140
|
+
handles complex options strategies and calculates the combined effect of all legs in the trade. Note
|
|
141
|
+
that these are estimates only, and actual execution values may vary depending on market conditions
|
|
142
|
+
and fill prices. This endpoint may be called before submitting an actual multi-leg order to
|
|
143
|
+
understand the potential financial implications of the strategy.
|
|
144
|
+
|
|
145
|
+
Args:
|
|
146
|
+
account_id (str):
|
|
147
|
+
body (ComHellopublicUserapigatewayApiRestPreflightPreflightMultiLegRequest): #
|
|
148
|
+
PreflightMultiLegRequest
|
|
149
|
+
Request for preflight calculations on multi-leg orders.
|
|
150
|
+
|
|
151
|
+
## Fields
|
|
152
|
+
- **orderType** - The type of order (only LIMIT orders are allowed for multi-leg)
|
|
153
|
+
- **expiration** - The order expiration configuration
|
|
154
|
+
- **quantity** - The order quantity (number of strategies)
|
|
155
|
+
- **limitPrice** - The limit price for the order (required for LIMIT orders)
|
|
156
|
+
- **legs** - List of order legs (2-6 legs allowed, at most 1 equity leg)
|
|
157
|
+
- **equityMarketSession** - The market session for equity legs
|
|
158
|
+
- **validateOrder** - If true, the order will be validated against current account state.
|
|
159
|
+
Defaults to true.
|
|
160
|
+
|
|
161
|
+
Raises:
|
|
162
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
163
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
164
|
+
|
|
165
|
+
Returns:
|
|
166
|
+
Any | ComHellopublicUserapigatewayApiRestPreflightPreflightMultiLegResponse
|
|
167
|
+
"""
|
|
168
|
+
|
|
169
|
+
return sync_detailed(
|
|
170
|
+
account_id=account_id,
|
|
171
|
+
client=client,
|
|
172
|
+
body=body,
|
|
173
|
+
).parsed
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
async def asyncio_detailed(
|
|
177
|
+
account_id: str,
|
|
178
|
+
*,
|
|
179
|
+
client: AuthenticatedClient | Client,
|
|
180
|
+
body: ComHellopublicUserapigatewayApiRestPreflightPreflightMultiLegRequest,
|
|
181
|
+
) -> Response[Any | ComHellopublicUserapigatewayApiRestPreflightPreflightMultiLegResponse]:
|
|
182
|
+
"""Calculates the estimated financial impact of a complex multi-leg trade before execution
|
|
183
|
+
|
|
184
|
+
Performs preflight calculations for a multi-leg order (a transaction involving multiple securities
|
|
185
|
+
or options strategies such as spreads, straddles, or combinations) to provide comprehensive cost
|
|
186
|
+
estimates and account impact details. Returns estimated commission, regulatory fees, total order
|
|
187
|
+
value, buying power requirements, margin impact, net credit/debit amounts, and strategy-specific
|
|
188
|
+
information to help users make informed trading decisions before order placement. This endpoint
|
|
189
|
+
handles complex options strategies and calculates the combined effect of all legs in the trade. Note
|
|
190
|
+
that these are estimates only, and actual execution values may vary depending on market conditions
|
|
191
|
+
and fill prices. This endpoint may be called before submitting an actual multi-leg order to
|
|
192
|
+
understand the potential financial implications of the strategy.
|
|
193
|
+
|
|
194
|
+
Args:
|
|
195
|
+
account_id (str):
|
|
196
|
+
body (ComHellopublicUserapigatewayApiRestPreflightPreflightMultiLegRequest): #
|
|
197
|
+
PreflightMultiLegRequest
|
|
198
|
+
Request for preflight calculations on multi-leg orders.
|
|
199
|
+
|
|
200
|
+
## Fields
|
|
201
|
+
- **orderType** - The type of order (only LIMIT orders are allowed for multi-leg)
|
|
202
|
+
- **expiration** - The order expiration configuration
|
|
203
|
+
- **quantity** - The order quantity (number of strategies)
|
|
204
|
+
- **limitPrice** - The limit price for the order (required for LIMIT orders)
|
|
205
|
+
- **legs** - List of order legs (2-6 legs allowed, at most 1 equity leg)
|
|
206
|
+
- **equityMarketSession** - The market session for equity legs
|
|
207
|
+
- **validateOrder** - If true, the order will be validated against current account state.
|
|
208
|
+
Defaults to true.
|
|
209
|
+
|
|
210
|
+
Raises:
|
|
211
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
212
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
213
|
+
|
|
214
|
+
Returns:
|
|
215
|
+
Response[Any | ComHellopublicUserapigatewayApiRestPreflightPreflightMultiLegResponse]
|
|
216
|
+
"""
|
|
217
|
+
|
|
218
|
+
kwargs = _get_kwargs(
|
|
219
|
+
account_id=account_id,
|
|
220
|
+
body=body,
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
224
|
+
|
|
225
|
+
return _build_response(client=client, response=response)
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
async def asyncio(
|
|
229
|
+
account_id: str,
|
|
230
|
+
*,
|
|
231
|
+
client: AuthenticatedClient | Client,
|
|
232
|
+
body: ComHellopublicUserapigatewayApiRestPreflightPreflightMultiLegRequest,
|
|
233
|
+
) -> Any | ComHellopublicUserapigatewayApiRestPreflightPreflightMultiLegResponse | None:
|
|
234
|
+
"""Calculates the estimated financial impact of a complex multi-leg trade before execution
|
|
235
|
+
|
|
236
|
+
Performs preflight calculations for a multi-leg order (a transaction involving multiple securities
|
|
237
|
+
or options strategies such as spreads, straddles, or combinations) to provide comprehensive cost
|
|
238
|
+
estimates and account impact details. Returns estimated commission, regulatory fees, total order
|
|
239
|
+
value, buying power requirements, margin impact, net credit/debit amounts, and strategy-specific
|
|
240
|
+
information to help users make informed trading decisions before order placement. This endpoint
|
|
241
|
+
handles complex options strategies and calculates the combined effect of all legs in the trade. Note
|
|
242
|
+
that these are estimates only, and actual execution values may vary depending on market conditions
|
|
243
|
+
and fill prices. This endpoint may be called before submitting an actual multi-leg order to
|
|
244
|
+
understand the potential financial implications of the strategy.
|
|
245
|
+
|
|
246
|
+
Args:
|
|
247
|
+
account_id (str):
|
|
248
|
+
body (ComHellopublicUserapigatewayApiRestPreflightPreflightMultiLegRequest): #
|
|
249
|
+
PreflightMultiLegRequest
|
|
250
|
+
Request for preflight calculations on multi-leg orders.
|
|
251
|
+
|
|
252
|
+
## Fields
|
|
253
|
+
- **orderType** - The type of order (only LIMIT orders are allowed for multi-leg)
|
|
254
|
+
- **expiration** - The order expiration configuration
|
|
255
|
+
- **quantity** - The order quantity (number of strategies)
|
|
256
|
+
- **limitPrice** - The limit price for the order (required for LIMIT orders)
|
|
257
|
+
- **legs** - List of order legs (2-6 legs allowed, at most 1 equity leg)
|
|
258
|
+
- **equityMarketSession** - The market session for equity legs
|
|
259
|
+
- **validateOrder** - If true, the order will be validated against current account state.
|
|
260
|
+
Defaults to true.
|
|
261
|
+
|
|
262
|
+
Raises:
|
|
263
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
264
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
265
|
+
|
|
266
|
+
Returns:
|
|
267
|
+
Any | ComHellopublicUserapigatewayApiRestPreflightPreflightMultiLegResponse
|
|
268
|
+
"""
|
|
269
|
+
|
|
270
|
+
return (
|
|
271
|
+
await asyncio_detailed(
|
|
272
|
+
account_id=account_id,
|
|
273
|
+
client=client,
|
|
274
|
+
body=body,
|
|
275
|
+
)
|
|
276
|
+
).parsed
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import AuthenticatedClient, Client
|
|
9
|
+
from ...models.com_hellopublic_userapigateway_api_rest_preflight_preflight_single_leg_request import (
|
|
10
|
+
ComHellopublicUserapigatewayApiRestPreflightPreflightSingleLegRequest,
|
|
11
|
+
)
|
|
12
|
+
from ...models.com_hellopublic_userapigateway_api_rest_preflight_preflight_single_leg_response import (
|
|
13
|
+
ComHellopublicUserapigatewayApiRestPreflightPreflightSingleLegResponse,
|
|
14
|
+
)
|
|
15
|
+
from ...types import Response
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _get_kwargs(
|
|
19
|
+
account_id: str,
|
|
20
|
+
*,
|
|
21
|
+
body: ComHellopublicUserapigatewayApiRestPreflightPreflightSingleLegRequest,
|
|
22
|
+
) -> dict[str, Any]:
|
|
23
|
+
headers: dict[str, Any] = {}
|
|
24
|
+
|
|
25
|
+
_kwargs: dict[str, Any] = {
|
|
26
|
+
"method": "post",
|
|
27
|
+
"url": "/userapigateway/trading/{account_id}/preflight/single-leg".format(
|
|
28
|
+
account_id=quote(str(account_id), safe=""),
|
|
29
|
+
),
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
_kwargs["json"] = body.to_dict()
|
|
33
|
+
|
|
34
|
+
headers["Content-Type"] = "application/json"
|
|
35
|
+
|
|
36
|
+
_kwargs["headers"] = headers
|
|
37
|
+
return _kwargs
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _parse_response(
|
|
41
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
42
|
+
) -> Any | ComHellopublicUserapigatewayApiRestPreflightPreflightSingleLegResponse | None:
|
|
43
|
+
if response.status_code == 200:
|
|
44
|
+
response_200 = (
|
|
45
|
+
ComHellopublicUserapigatewayApiRestPreflightPreflightSingleLegResponse.from_dict(
|
|
46
|
+
response.json()
|
|
47
|
+
)
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
return response_200
|
|
51
|
+
|
|
52
|
+
if response.status_code == 400:
|
|
53
|
+
response_400 = cast(Any, None)
|
|
54
|
+
return response_400
|
|
55
|
+
|
|
56
|
+
if client.raise_on_unexpected_status:
|
|
57
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
58
|
+
else:
|
|
59
|
+
return None
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def _build_response(
|
|
63
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
64
|
+
) -> Response[Any | ComHellopublicUserapigatewayApiRestPreflightPreflightSingleLegResponse]:
|
|
65
|
+
return Response(
|
|
66
|
+
status_code=HTTPStatus(response.status_code),
|
|
67
|
+
content=response.content,
|
|
68
|
+
headers=response.headers,
|
|
69
|
+
parsed=_parse_response(client=client, response=response),
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def sync_detailed(
|
|
74
|
+
account_id: str,
|
|
75
|
+
*,
|
|
76
|
+
client: AuthenticatedClient | Client,
|
|
77
|
+
body: ComHellopublicUserapigatewayApiRestPreflightPreflightSingleLegRequest,
|
|
78
|
+
) -> Response[Any | ComHellopublicUserapigatewayApiRestPreflightPreflightSingleLegResponse]:
|
|
79
|
+
"""Calculates the estimated financial impact of a potential trade before execution
|
|
80
|
+
|
|
81
|
+
Performs preflight calculations for a single-leg order (a transaction involving a single security)
|
|
82
|
+
to provide comprehensive cost estimates and account impact details. Returns estimated commission,
|
|
83
|
+
regulatory fees, order value, buying power requirements, margin impact, and other trade-specific
|
|
84
|
+
information to help users make informed trading decisions before order placement. Note that these
|
|
85
|
+
are estimates only, and actual execution values may vary depending on market conditions. This
|
|
86
|
+
endpoint may be called before submitting an actual order to understand the potential financial
|
|
87
|
+
implications.
|
|
88
|
+
|
|
89
|
+
Args:
|
|
90
|
+
account_id (str):
|
|
91
|
+
body (ComHellopublicUserapigatewayApiRestPreflightPreflightSingleLegRequest):
|
|
92
|
+
|
|
93
|
+
Raises:
|
|
94
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
95
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
96
|
+
|
|
97
|
+
Returns:
|
|
98
|
+
Response[Any | ComHellopublicUserapigatewayApiRestPreflightPreflightSingleLegResponse]
|
|
99
|
+
"""
|
|
100
|
+
|
|
101
|
+
kwargs = _get_kwargs(
|
|
102
|
+
account_id=account_id,
|
|
103
|
+
body=body,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
response = client.get_httpx_client().request(
|
|
107
|
+
**kwargs,
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
return _build_response(client=client, response=response)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def sync(
|
|
114
|
+
account_id: str,
|
|
115
|
+
*,
|
|
116
|
+
client: AuthenticatedClient | Client,
|
|
117
|
+
body: ComHellopublicUserapigatewayApiRestPreflightPreflightSingleLegRequest,
|
|
118
|
+
) -> Any | ComHellopublicUserapigatewayApiRestPreflightPreflightSingleLegResponse | None:
|
|
119
|
+
"""Calculates the estimated financial impact of a potential trade before execution
|
|
120
|
+
|
|
121
|
+
Performs preflight calculations for a single-leg order (a transaction involving a single security)
|
|
122
|
+
to provide comprehensive cost estimates and account impact details. Returns estimated commission,
|
|
123
|
+
regulatory fees, order value, buying power requirements, margin impact, and other trade-specific
|
|
124
|
+
information to help users make informed trading decisions before order placement. Note that these
|
|
125
|
+
are estimates only, and actual execution values may vary depending on market conditions. This
|
|
126
|
+
endpoint may be called before submitting an actual order to understand the potential financial
|
|
127
|
+
implications.
|
|
128
|
+
|
|
129
|
+
Args:
|
|
130
|
+
account_id (str):
|
|
131
|
+
body (ComHellopublicUserapigatewayApiRestPreflightPreflightSingleLegRequest):
|
|
132
|
+
|
|
133
|
+
Raises:
|
|
134
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
135
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
136
|
+
|
|
137
|
+
Returns:
|
|
138
|
+
Any | ComHellopublicUserapigatewayApiRestPreflightPreflightSingleLegResponse
|
|
139
|
+
"""
|
|
140
|
+
|
|
141
|
+
return sync_detailed(
|
|
142
|
+
account_id=account_id,
|
|
143
|
+
client=client,
|
|
144
|
+
body=body,
|
|
145
|
+
).parsed
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
async def asyncio_detailed(
|
|
149
|
+
account_id: str,
|
|
150
|
+
*,
|
|
151
|
+
client: AuthenticatedClient | Client,
|
|
152
|
+
body: ComHellopublicUserapigatewayApiRestPreflightPreflightSingleLegRequest,
|
|
153
|
+
) -> Response[Any | ComHellopublicUserapigatewayApiRestPreflightPreflightSingleLegResponse]:
|
|
154
|
+
"""Calculates the estimated financial impact of a potential trade before execution
|
|
155
|
+
|
|
156
|
+
Performs preflight calculations for a single-leg order (a transaction involving a single security)
|
|
157
|
+
to provide comprehensive cost estimates and account impact details. Returns estimated commission,
|
|
158
|
+
regulatory fees, order value, buying power requirements, margin impact, and other trade-specific
|
|
159
|
+
information to help users make informed trading decisions before order placement. Note that these
|
|
160
|
+
are estimates only, and actual execution values may vary depending on market conditions. This
|
|
161
|
+
endpoint may be called before submitting an actual order to understand the potential financial
|
|
162
|
+
implications.
|
|
163
|
+
|
|
164
|
+
Args:
|
|
165
|
+
account_id (str):
|
|
166
|
+
body (ComHellopublicUserapigatewayApiRestPreflightPreflightSingleLegRequest):
|
|
167
|
+
|
|
168
|
+
Raises:
|
|
169
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
170
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
171
|
+
|
|
172
|
+
Returns:
|
|
173
|
+
Response[Any | ComHellopublicUserapigatewayApiRestPreflightPreflightSingleLegResponse]
|
|
174
|
+
"""
|
|
175
|
+
|
|
176
|
+
kwargs = _get_kwargs(
|
|
177
|
+
account_id=account_id,
|
|
178
|
+
body=body,
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
182
|
+
|
|
183
|
+
return _build_response(client=client, response=response)
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
async def asyncio(
|
|
187
|
+
account_id: str,
|
|
188
|
+
*,
|
|
189
|
+
client: AuthenticatedClient | Client,
|
|
190
|
+
body: ComHellopublicUserapigatewayApiRestPreflightPreflightSingleLegRequest,
|
|
191
|
+
) -> Any | ComHellopublicUserapigatewayApiRestPreflightPreflightSingleLegResponse | None:
|
|
192
|
+
"""Calculates the estimated financial impact of a potential trade before execution
|
|
193
|
+
|
|
194
|
+
Performs preflight calculations for a single-leg order (a transaction involving a single security)
|
|
195
|
+
to provide comprehensive cost estimates and account impact details. Returns estimated commission,
|
|
196
|
+
regulatory fees, order value, buying power requirements, margin impact, and other trade-specific
|
|
197
|
+
information to help users make informed trading decisions before order placement. Note that these
|
|
198
|
+
are estimates only, and actual execution values may vary depending on market conditions. This
|
|
199
|
+
endpoint may be called before submitting an actual order to understand the potential financial
|
|
200
|
+
implications.
|
|
201
|
+
|
|
202
|
+
Args:
|
|
203
|
+
account_id (str):
|
|
204
|
+
body (ComHellopublicUserapigatewayApiRestPreflightPreflightSingleLegRequest):
|
|
205
|
+
|
|
206
|
+
Raises:
|
|
207
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
208
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
209
|
+
|
|
210
|
+
Returns:
|
|
211
|
+
Any | ComHellopublicUserapigatewayApiRestPreflightPreflightSingleLegResponse
|
|
212
|
+
"""
|
|
213
|
+
|
|
214
|
+
return (
|
|
215
|
+
await asyncio_detailed(
|
|
216
|
+
account_id=account_id,
|
|
217
|
+
client=client,
|
|
218
|
+
body=body,
|
|
219
|
+
)
|
|
220
|
+
).parsed
|