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,214 @@
|
|
|
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_order_api_multileg_order_request import (
|
|
10
|
+
ComHellopublicUserapigatewayApiRestOrderApiMultilegOrderRequest,
|
|
11
|
+
)
|
|
12
|
+
from ...models.com_hellopublic_userapigateway_api_rest_order_api_order_result import (
|
|
13
|
+
ComHellopublicUserapigatewayApiRestOrderApiOrderResult,
|
|
14
|
+
)
|
|
15
|
+
from ...types import Response
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _get_kwargs(
|
|
19
|
+
account_id: str,
|
|
20
|
+
*,
|
|
21
|
+
body: ComHellopublicUserapigatewayApiRestOrderApiMultilegOrderRequest,
|
|
22
|
+
) -> dict[str, Any]:
|
|
23
|
+
headers: dict[str, Any] = {}
|
|
24
|
+
|
|
25
|
+
_kwargs: dict[str, Any] = {
|
|
26
|
+
"method": "post",
|
|
27
|
+
"url": "/userapigateway/trading/{account_id}/order/multileg".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 | ComHellopublicUserapigatewayApiRestOrderApiOrderResult | None:
|
|
43
|
+
if response.status_code == 200:
|
|
44
|
+
response_200 = ComHellopublicUserapigatewayApiRestOrderApiOrderResult.from_dict(
|
|
45
|
+
response.json()
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
return response_200
|
|
49
|
+
|
|
50
|
+
if response.status_code == 400:
|
|
51
|
+
response_400 = cast(Any, None)
|
|
52
|
+
return response_400
|
|
53
|
+
|
|
54
|
+
if client.raise_on_unexpected_status:
|
|
55
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
56
|
+
else:
|
|
57
|
+
return None
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def _build_response(
|
|
61
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
62
|
+
) -> Response[Any | ComHellopublicUserapigatewayApiRestOrderApiOrderResult]:
|
|
63
|
+
return Response(
|
|
64
|
+
status_code=HTTPStatus(response.status_code),
|
|
65
|
+
content=response.content,
|
|
66
|
+
headers=response.headers,
|
|
67
|
+
parsed=_parse_response(client=client, response=response),
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def sync_detailed(
|
|
72
|
+
account_id: str,
|
|
73
|
+
*,
|
|
74
|
+
client: AuthenticatedClient | Client,
|
|
75
|
+
body: ComHellopublicUserapigatewayApiRestOrderApiMultilegOrderRequest,
|
|
76
|
+
) -> Response[Any | ComHellopublicUserapigatewayApiRestOrderApiOrderResult]:
|
|
77
|
+
"""Place a new multi-leg order
|
|
78
|
+
|
|
79
|
+
Submits a new multi-leg order asynchronously for the specified account.
|
|
80
|
+
|
|
81
|
+
Note: Order placement is asynchronous. This response confirms submission only.
|
|
82
|
+
To verify the order status or execution details, use the GET /{orderId} endpoint after placement.
|
|
83
|
+
|
|
84
|
+
Args:
|
|
85
|
+
account_id (str):
|
|
86
|
+
body (ComHellopublicUserapigatewayApiRestOrderApiMultilegOrderRequest): Used for multileg
|
|
87
|
+
orders placed via the UserApiGatewayService or other service where the order is just a
|
|
88
|
+
single request and the orderId is generated by the client
|
|
89
|
+
|
|
90
|
+
Raises:
|
|
91
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
92
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
Response[Any | ComHellopublicUserapigatewayApiRestOrderApiOrderResult]
|
|
96
|
+
"""
|
|
97
|
+
|
|
98
|
+
kwargs = _get_kwargs(
|
|
99
|
+
account_id=account_id,
|
|
100
|
+
body=body,
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
response = client.get_httpx_client().request(
|
|
104
|
+
**kwargs,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
return _build_response(client=client, response=response)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def sync(
|
|
111
|
+
account_id: str,
|
|
112
|
+
*,
|
|
113
|
+
client: AuthenticatedClient | Client,
|
|
114
|
+
body: ComHellopublicUserapigatewayApiRestOrderApiMultilegOrderRequest,
|
|
115
|
+
) -> Any | ComHellopublicUserapigatewayApiRestOrderApiOrderResult | None:
|
|
116
|
+
"""Place a new multi-leg order
|
|
117
|
+
|
|
118
|
+
Submits a new multi-leg order asynchronously for the specified account.
|
|
119
|
+
|
|
120
|
+
Note: Order placement is asynchronous. This response confirms submission only.
|
|
121
|
+
To verify the order status or execution details, use the GET /{orderId} endpoint after placement.
|
|
122
|
+
|
|
123
|
+
Args:
|
|
124
|
+
account_id (str):
|
|
125
|
+
body (ComHellopublicUserapigatewayApiRestOrderApiMultilegOrderRequest): Used for multileg
|
|
126
|
+
orders placed via the UserApiGatewayService or other service where the order is just a
|
|
127
|
+
single request and the orderId is generated by the client
|
|
128
|
+
|
|
129
|
+
Raises:
|
|
130
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
131
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
132
|
+
|
|
133
|
+
Returns:
|
|
134
|
+
Any | ComHellopublicUserapigatewayApiRestOrderApiOrderResult
|
|
135
|
+
"""
|
|
136
|
+
|
|
137
|
+
return sync_detailed(
|
|
138
|
+
account_id=account_id,
|
|
139
|
+
client=client,
|
|
140
|
+
body=body,
|
|
141
|
+
).parsed
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
async def asyncio_detailed(
|
|
145
|
+
account_id: str,
|
|
146
|
+
*,
|
|
147
|
+
client: AuthenticatedClient | Client,
|
|
148
|
+
body: ComHellopublicUserapigatewayApiRestOrderApiMultilegOrderRequest,
|
|
149
|
+
) -> Response[Any | ComHellopublicUserapigatewayApiRestOrderApiOrderResult]:
|
|
150
|
+
"""Place a new multi-leg order
|
|
151
|
+
|
|
152
|
+
Submits a new multi-leg order asynchronously for the specified account.
|
|
153
|
+
|
|
154
|
+
Note: Order placement is asynchronous. This response confirms submission only.
|
|
155
|
+
To verify the order status or execution details, use the GET /{orderId} endpoint after placement.
|
|
156
|
+
|
|
157
|
+
Args:
|
|
158
|
+
account_id (str):
|
|
159
|
+
body (ComHellopublicUserapigatewayApiRestOrderApiMultilegOrderRequest): Used for multileg
|
|
160
|
+
orders placed via the UserApiGatewayService or other service where the order is just a
|
|
161
|
+
single request and the orderId is generated by the client
|
|
162
|
+
|
|
163
|
+
Raises:
|
|
164
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
165
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
166
|
+
|
|
167
|
+
Returns:
|
|
168
|
+
Response[Any | ComHellopublicUserapigatewayApiRestOrderApiOrderResult]
|
|
169
|
+
"""
|
|
170
|
+
|
|
171
|
+
kwargs = _get_kwargs(
|
|
172
|
+
account_id=account_id,
|
|
173
|
+
body=body,
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
177
|
+
|
|
178
|
+
return _build_response(client=client, response=response)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
async def asyncio(
|
|
182
|
+
account_id: str,
|
|
183
|
+
*,
|
|
184
|
+
client: AuthenticatedClient | Client,
|
|
185
|
+
body: ComHellopublicUserapigatewayApiRestOrderApiMultilegOrderRequest,
|
|
186
|
+
) -> Any | ComHellopublicUserapigatewayApiRestOrderApiOrderResult | None:
|
|
187
|
+
"""Place a new multi-leg order
|
|
188
|
+
|
|
189
|
+
Submits a new multi-leg order asynchronously for the specified account.
|
|
190
|
+
|
|
191
|
+
Note: Order placement is asynchronous. This response confirms submission only.
|
|
192
|
+
To verify the order status or execution details, use the GET /{orderId} endpoint after placement.
|
|
193
|
+
|
|
194
|
+
Args:
|
|
195
|
+
account_id (str):
|
|
196
|
+
body (ComHellopublicUserapigatewayApiRestOrderApiMultilegOrderRequest): Used for multileg
|
|
197
|
+
orders placed via the UserApiGatewayService or other service where the order is just a
|
|
198
|
+
single request and the orderId is generated by the client
|
|
199
|
+
|
|
200
|
+
Raises:
|
|
201
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
202
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
203
|
+
|
|
204
|
+
Returns:
|
|
205
|
+
Any | ComHellopublicUserapigatewayApiRestOrderApiOrderResult
|
|
206
|
+
"""
|
|
207
|
+
|
|
208
|
+
return (
|
|
209
|
+
await asyncio_detailed(
|
|
210
|
+
account_id=account_id,
|
|
211
|
+
client=client,
|
|
212
|
+
body=body,
|
|
213
|
+
)
|
|
214
|
+
).parsed
|
|
@@ -0,0 +1,222 @@
|
|
|
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_order_api_order_request import (
|
|
10
|
+
ComHellopublicUserapigatewayApiRestOrderApiOrderRequest,
|
|
11
|
+
)
|
|
12
|
+
from ...models.com_hellopublic_userapigateway_api_rest_order_api_order_result import (
|
|
13
|
+
ComHellopublicUserapigatewayApiRestOrderApiOrderResult,
|
|
14
|
+
)
|
|
15
|
+
from ...types import Response
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _get_kwargs(
|
|
19
|
+
account_id: str,
|
|
20
|
+
*,
|
|
21
|
+
body: ComHellopublicUserapigatewayApiRestOrderApiOrderRequest,
|
|
22
|
+
) -> dict[str, Any]:
|
|
23
|
+
headers: dict[str, Any] = {}
|
|
24
|
+
|
|
25
|
+
_kwargs: dict[str, Any] = {
|
|
26
|
+
"method": "post",
|
|
27
|
+
"url": "/userapigateway/trading/{account_id}/order".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 | ComHellopublicUserapigatewayApiRestOrderApiOrderResult | None:
|
|
43
|
+
if response.status_code == 200:
|
|
44
|
+
response_200 = ComHellopublicUserapigatewayApiRestOrderApiOrderResult.from_dict(
|
|
45
|
+
response.json()
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
return response_200
|
|
49
|
+
|
|
50
|
+
if response.status_code == 400:
|
|
51
|
+
response_400 = cast(Any, None)
|
|
52
|
+
return response_400
|
|
53
|
+
|
|
54
|
+
if client.raise_on_unexpected_status:
|
|
55
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
56
|
+
else:
|
|
57
|
+
return None
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def _build_response(
|
|
61
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
62
|
+
) -> Response[Any | ComHellopublicUserapigatewayApiRestOrderApiOrderResult]:
|
|
63
|
+
return Response(
|
|
64
|
+
status_code=HTTPStatus(response.status_code),
|
|
65
|
+
content=response.content,
|
|
66
|
+
headers=response.headers,
|
|
67
|
+
parsed=_parse_response(client=client, response=response),
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def sync_detailed(
|
|
72
|
+
account_id: str,
|
|
73
|
+
*,
|
|
74
|
+
client: AuthenticatedClient | Client,
|
|
75
|
+
body: ComHellopublicUserapigatewayApiRestOrderApiOrderRequest,
|
|
76
|
+
) -> Response[Any | ComHellopublicUserapigatewayApiRestOrderApiOrderResult]:
|
|
77
|
+
"""Place a new order
|
|
78
|
+
|
|
79
|
+
Submits a new order asynchronously for the specified account.
|
|
80
|
+
|
|
81
|
+
Note: Order placement is asynchronous. The returned result confirms submission, not execution or
|
|
82
|
+
visibility.
|
|
83
|
+
To retrieve the order status or execution details, query the GET /{orderId} endpoint after
|
|
84
|
+
submission.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
account_id (str):
|
|
88
|
+
body (ComHellopublicUserapigatewayApiRestOrderApiOrderRequest): Used for orders placed via
|
|
89
|
+
the UserApiGatewayService or other service where the order is just a single request and
|
|
90
|
+
the orderId is generated by the client
|
|
91
|
+
|
|
92
|
+
Raises:
|
|
93
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
94
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
95
|
+
|
|
96
|
+
Returns:
|
|
97
|
+
Response[Any | ComHellopublicUserapigatewayApiRestOrderApiOrderResult]
|
|
98
|
+
"""
|
|
99
|
+
|
|
100
|
+
kwargs = _get_kwargs(
|
|
101
|
+
account_id=account_id,
|
|
102
|
+
body=body,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
response = client.get_httpx_client().request(
|
|
106
|
+
**kwargs,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
return _build_response(client=client, response=response)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def sync(
|
|
113
|
+
account_id: str,
|
|
114
|
+
*,
|
|
115
|
+
client: AuthenticatedClient | Client,
|
|
116
|
+
body: ComHellopublicUserapigatewayApiRestOrderApiOrderRequest,
|
|
117
|
+
) -> Any | ComHellopublicUserapigatewayApiRestOrderApiOrderResult | None:
|
|
118
|
+
"""Place a new order
|
|
119
|
+
|
|
120
|
+
Submits a new order asynchronously for the specified account.
|
|
121
|
+
|
|
122
|
+
Note: Order placement is asynchronous. The returned result confirms submission, not execution or
|
|
123
|
+
visibility.
|
|
124
|
+
To retrieve the order status or execution details, query the GET /{orderId} endpoint after
|
|
125
|
+
submission.
|
|
126
|
+
|
|
127
|
+
Args:
|
|
128
|
+
account_id (str):
|
|
129
|
+
body (ComHellopublicUserapigatewayApiRestOrderApiOrderRequest): Used for orders placed via
|
|
130
|
+
the UserApiGatewayService or other service where the order is just a single request and
|
|
131
|
+
the orderId is generated by the client
|
|
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 | ComHellopublicUserapigatewayApiRestOrderApiOrderResult
|
|
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: ComHellopublicUserapigatewayApiRestOrderApiOrderRequest,
|
|
153
|
+
) -> Response[Any | ComHellopublicUserapigatewayApiRestOrderApiOrderResult]:
|
|
154
|
+
"""Place a new order
|
|
155
|
+
|
|
156
|
+
Submits a new order asynchronously for the specified account.
|
|
157
|
+
|
|
158
|
+
Note: Order placement is asynchronous. The returned result confirms submission, not execution or
|
|
159
|
+
visibility.
|
|
160
|
+
To retrieve the order status or execution details, query the GET /{orderId} endpoint after
|
|
161
|
+
submission.
|
|
162
|
+
|
|
163
|
+
Args:
|
|
164
|
+
account_id (str):
|
|
165
|
+
body (ComHellopublicUserapigatewayApiRestOrderApiOrderRequest): Used for orders placed via
|
|
166
|
+
the UserApiGatewayService or other service where the order is just a single request and
|
|
167
|
+
the orderId is generated by the client
|
|
168
|
+
|
|
169
|
+
Raises:
|
|
170
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
171
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
172
|
+
|
|
173
|
+
Returns:
|
|
174
|
+
Response[Any | ComHellopublicUserapigatewayApiRestOrderApiOrderResult]
|
|
175
|
+
"""
|
|
176
|
+
|
|
177
|
+
kwargs = _get_kwargs(
|
|
178
|
+
account_id=account_id,
|
|
179
|
+
body=body,
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
183
|
+
|
|
184
|
+
return _build_response(client=client, response=response)
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
async def asyncio(
|
|
188
|
+
account_id: str,
|
|
189
|
+
*,
|
|
190
|
+
client: AuthenticatedClient | Client,
|
|
191
|
+
body: ComHellopublicUserapigatewayApiRestOrderApiOrderRequest,
|
|
192
|
+
) -> Any | ComHellopublicUserapigatewayApiRestOrderApiOrderResult | None:
|
|
193
|
+
"""Place a new order
|
|
194
|
+
|
|
195
|
+
Submits a new order asynchronously for the specified account.
|
|
196
|
+
|
|
197
|
+
Note: Order placement is asynchronous. The returned result confirms submission, not execution or
|
|
198
|
+
visibility.
|
|
199
|
+
To retrieve the order status or execution details, query the GET /{orderId} endpoint after
|
|
200
|
+
submission.
|
|
201
|
+
|
|
202
|
+
Args:
|
|
203
|
+
account_id (str):
|
|
204
|
+
body (ComHellopublicUserapigatewayApiRestOrderApiOrderRequest): Used for orders placed via
|
|
205
|
+
the UserApiGatewayService or other service where the order is just a single request and
|
|
206
|
+
the orderId is generated by the client
|
|
207
|
+
|
|
208
|
+
Raises:
|
|
209
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
210
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
211
|
+
|
|
212
|
+
Returns:
|
|
213
|
+
Any | ComHellopublicUserapigatewayApiRestOrderApiOrderResult
|
|
214
|
+
"""
|
|
215
|
+
|
|
216
|
+
return (
|
|
217
|
+
await asyncio_detailed(
|
|
218
|
+
account_id=account_id,
|
|
219
|
+
client=client,
|
|
220
|
+
body=body,
|
|
221
|
+
)
|
|
222
|
+
).parsed
|