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,352 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import datetime
|
|
4
|
+
from collections.abc import Mapping
|
|
5
|
+
from typing import TYPE_CHECKING, Any, TypeVar, cast
|
|
6
|
+
|
|
7
|
+
from attrs import define as _attrs_define
|
|
8
|
+
from attrs import field as _attrs_field
|
|
9
|
+
from dateutil.parser import isoparse
|
|
10
|
+
|
|
11
|
+
from ..types import UNSET, Unset
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from ..models.com_hellopublic_userapigateway_api_rest_portfolio_gain_type_0 import (
|
|
15
|
+
ComHellopublicUserapigatewayApiRestPortfolioGainType0,
|
|
16
|
+
)
|
|
17
|
+
from ..models.com_hellopublic_userapigateway_api_rest_portfolio_gateway_cost_basis_type_0 import (
|
|
18
|
+
ComHellopublicUserapigatewayApiRestPortfolioGatewayCostBasisType0,
|
|
19
|
+
)
|
|
20
|
+
from ..models.com_hellopublic_userapigateway_api_rest_portfolio_gateway_portfolio_instrument import (
|
|
21
|
+
ComHellopublicUserapigatewayApiRestPortfolioGatewayPortfolioInstrument,
|
|
22
|
+
)
|
|
23
|
+
from ..models.com_hellopublic_userapigateway_api_rest_portfolio_price_type_0 import (
|
|
24
|
+
ComHellopublicUserapigatewayApiRestPortfolioPriceType0,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
T = TypeVar("T", bound="ComHellopublicUserapigatewayApiRestPortfolioGatewayPortfolioPosition")
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@_attrs_define
|
|
32
|
+
class ComHellopublicUserapigatewayApiRestPortfolioGatewayPortfolioPosition:
|
|
33
|
+
"""Position in portfolio
|
|
34
|
+
|
|
35
|
+
Attributes:
|
|
36
|
+
instrument (ComHellopublicUserapigatewayApiRestPortfolioGatewayPortfolioInstrument):
|
|
37
|
+
quantity (str): The quantity of the position.
|
|
38
|
+
strategy_ids (list[str]): List of strategy IDs this position is part of. Empty list for single-leg positions not
|
|
39
|
+
part of any strategy.
|
|
40
|
+
opened_at (datetime.datetime | None | Unset): When was this position opened. Null if unknown.
|
|
41
|
+
current_value (None | str | Unset): How much the position is worth. Calculated from quantity * lastSalePrice.
|
|
42
|
+
percent_of_portfolio (None | str | Unset): The percent that this position makes of the entire portfolio.
|
|
43
|
+
last_price (ComHellopublicUserapigatewayApiRestPortfolioPriceType0 | None | Unset):
|
|
44
|
+
instrument_gain (ComHellopublicUserapigatewayApiRestPortfolioGainType0 | None | Unset):
|
|
45
|
+
position_daily_gain (ComHellopublicUserapigatewayApiRestPortfolioGainType0 | None | Unset):
|
|
46
|
+
cost_basis (ComHellopublicUserapigatewayApiRestPortfolioGatewayCostBasisType0 | None | Unset): Cost basis of a
|
|
47
|
+
position. What the member paid for entering the position. The cost basis is
|
|
48
|
+
based on tax lots and will factor in wash sales.
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
instrument: ComHellopublicUserapigatewayApiRestPortfolioGatewayPortfolioInstrument
|
|
52
|
+
quantity: str
|
|
53
|
+
strategy_ids: list[str]
|
|
54
|
+
opened_at: datetime.datetime | None | Unset = UNSET
|
|
55
|
+
current_value: None | str | Unset = UNSET
|
|
56
|
+
percent_of_portfolio: None | str | Unset = UNSET
|
|
57
|
+
last_price: ComHellopublicUserapigatewayApiRestPortfolioPriceType0 | None | Unset = UNSET
|
|
58
|
+
instrument_gain: ComHellopublicUserapigatewayApiRestPortfolioGainType0 | None | Unset = UNSET
|
|
59
|
+
position_daily_gain: ComHellopublicUserapigatewayApiRestPortfolioGainType0 | None | Unset = (
|
|
60
|
+
UNSET
|
|
61
|
+
)
|
|
62
|
+
cost_basis: ComHellopublicUserapigatewayApiRestPortfolioGatewayCostBasisType0 | None | Unset = (
|
|
63
|
+
UNSET
|
|
64
|
+
)
|
|
65
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
66
|
+
|
|
67
|
+
def to_dict(self) -> dict[str, Any]:
|
|
68
|
+
from ..models.com_hellopublic_userapigateway_api_rest_portfolio_gain_type_0 import (
|
|
69
|
+
ComHellopublicUserapigatewayApiRestPortfolioGainType0,
|
|
70
|
+
)
|
|
71
|
+
from ..models.com_hellopublic_userapigateway_api_rest_portfolio_gateway_cost_basis_type_0 import (
|
|
72
|
+
ComHellopublicUserapigatewayApiRestPortfolioGatewayCostBasisType0,
|
|
73
|
+
)
|
|
74
|
+
from ..models.com_hellopublic_userapigateway_api_rest_portfolio_price_type_0 import (
|
|
75
|
+
ComHellopublicUserapigatewayApiRestPortfolioPriceType0,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
instrument = self.instrument.to_dict()
|
|
79
|
+
|
|
80
|
+
quantity = self.quantity
|
|
81
|
+
|
|
82
|
+
strategy_ids = self.strategy_ids
|
|
83
|
+
|
|
84
|
+
opened_at: None | str | Unset
|
|
85
|
+
if isinstance(self.opened_at, Unset):
|
|
86
|
+
opened_at = UNSET
|
|
87
|
+
elif isinstance(self.opened_at, datetime.datetime):
|
|
88
|
+
opened_at = self.opened_at.isoformat()
|
|
89
|
+
else:
|
|
90
|
+
opened_at = self.opened_at
|
|
91
|
+
|
|
92
|
+
current_value: None | str | Unset
|
|
93
|
+
if isinstance(self.current_value, Unset):
|
|
94
|
+
current_value = UNSET
|
|
95
|
+
else:
|
|
96
|
+
current_value = self.current_value
|
|
97
|
+
|
|
98
|
+
percent_of_portfolio: None | str | Unset
|
|
99
|
+
if isinstance(self.percent_of_portfolio, Unset):
|
|
100
|
+
percent_of_portfolio = UNSET
|
|
101
|
+
else:
|
|
102
|
+
percent_of_portfolio = self.percent_of_portfolio
|
|
103
|
+
|
|
104
|
+
last_price: dict[str, Any] | None | Unset
|
|
105
|
+
if isinstance(self.last_price, Unset):
|
|
106
|
+
last_price = UNSET
|
|
107
|
+
elif isinstance(self.last_price, ComHellopublicUserapigatewayApiRestPortfolioPriceType0):
|
|
108
|
+
last_price = self.last_price.to_dict()
|
|
109
|
+
else:
|
|
110
|
+
last_price = self.last_price
|
|
111
|
+
|
|
112
|
+
instrument_gain: dict[str, Any] | None | Unset
|
|
113
|
+
if isinstance(self.instrument_gain, Unset):
|
|
114
|
+
instrument_gain = UNSET
|
|
115
|
+
elif isinstance(
|
|
116
|
+
self.instrument_gain, ComHellopublicUserapigatewayApiRestPortfolioGainType0
|
|
117
|
+
):
|
|
118
|
+
instrument_gain = self.instrument_gain.to_dict()
|
|
119
|
+
else:
|
|
120
|
+
instrument_gain = self.instrument_gain
|
|
121
|
+
|
|
122
|
+
position_daily_gain: dict[str, Any] | None | Unset
|
|
123
|
+
if isinstance(self.position_daily_gain, Unset):
|
|
124
|
+
position_daily_gain = UNSET
|
|
125
|
+
elif isinstance(
|
|
126
|
+
self.position_daily_gain, ComHellopublicUserapigatewayApiRestPortfolioGainType0
|
|
127
|
+
):
|
|
128
|
+
position_daily_gain = self.position_daily_gain.to_dict()
|
|
129
|
+
else:
|
|
130
|
+
position_daily_gain = self.position_daily_gain
|
|
131
|
+
|
|
132
|
+
cost_basis: dict[str, Any] | None | Unset
|
|
133
|
+
if isinstance(self.cost_basis, Unset):
|
|
134
|
+
cost_basis = UNSET
|
|
135
|
+
elif isinstance(
|
|
136
|
+
self.cost_basis, ComHellopublicUserapigatewayApiRestPortfolioGatewayCostBasisType0
|
|
137
|
+
):
|
|
138
|
+
cost_basis = self.cost_basis.to_dict()
|
|
139
|
+
else:
|
|
140
|
+
cost_basis = self.cost_basis
|
|
141
|
+
|
|
142
|
+
field_dict: dict[str, Any] = {}
|
|
143
|
+
field_dict.update(self.additional_properties)
|
|
144
|
+
field_dict.update(
|
|
145
|
+
{
|
|
146
|
+
"instrument": instrument,
|
|
147
|
+
"quantity": quantity,
|
|
148
|
+
"strategyIds": strategy_ids,
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
if opened_at is not UNSET:
|
|
152
|
+
field_dict["openedAt"] = opened_at
|
|
153
|
+
if current_value is not UNSET:
|
|
154
|
+
field_dict["currentValue"] = current_value
|
|
155
|
+
if percent_of_portfolio is not UNSET:
|
|
156
|
+
field_dict["percentOfPortfolio"] = percent_of_portfolio
|
|
157
|
+
if last_price is not UNSET:
|
|
158
|
+
field_dict["lastPrice"] = last_price
|
|
159
|
+
if instrument_gain is not UNSET:
|
|
160
|
+
field_dict["instrumentGain"] = instrument_gain
|
|
161
|
+
if position_daily_gain is not UNSET:
|
|
162
|
+
field_dict["positionDailyGain"] = position_daily_gain
|
|
163
|
+
if cost_basis is not UNSET:
|
|
164
|
+
field_dict["costBasis"] = cost_basis
|
|
165
|
+
|
|
166
|
+
return field_dict
|
|
167
|
+
|
|
168
|
+
@classmethod
|
|
169
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
170
|
+
from ..models.com_hellopublic_userapigateway_api_rest_portfolio_gain_type_0 import (
|
|
171
|
+
ComHellopublicUserapigatewayApiRestPortfolioGainType0,
|
|
172
|
+
)
|
|
173
|
+
from ..models.com_hellopublic_userapigateway_api_rest_portfolio_gateway_cost_basis_type_0 import (
|
|
174
|
+
ComHellopublicUserapigatewayApiRestPortfolioGatewayCostBasisType0,
|
|
175
|
+
)
|
|
176
|
+
from ..models.com_hellopublic_userapigateway_api_rest_portfolio_gateway_portfolio_instrument import (
|
|
177
|
+
ComHellopublicUserapigatewayApiRestPortfolioGatewayPortfolioInstrument,
|
|
178
|
+
)
|
|
179
|
+
from ..models.com_hellopublic_userapigateway_api_rest_portfolio_price_type_0 import (
|
|
180
|
+
ComHellopublicUserapigatewayApiRestPortfolioPriceType0,
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
d = dict(src_dict)
|
|
184
|
+
instrument = (
|
|
185
|
+
ComHellopublicUserapigatewayApiRestPortfolioGatewayPortfolioInstrument.from_dict(
|
|
186
|
+
d.pop("instrument")
|
|
187
|
+
)
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
quantity = d.pop("quantity")
|
|
191
|
+
|
|
192
|
+
strategy_ids = cast(list[str], d.pop("strategyIds"))
|
|
193
|
+
|
|
194
|
+
def _parse_opened_at(data: object) -> datetime.datetime | None | Unset:
|
|
195
|
+
if data is None:
|
|
196
|
+
return data
|
|
197
|
+
if isinstance(data, Unset):
|
|
198
|
+
return data
|
|
199
|
+
try:
|
|
200
|
+
if not isinstance(data, str):
|
|
201
|
+
raise TypeError()
|
|
202
|
+
opened_at_type_0 = isoparse(data)
|
|
203
|
+
|
|
204
|
+
return opened_at_type_0
|
|
205
|
+
except (TypeError, ValueError, AttributeError, KeyError):
|
|
206
|
+
pass
|
|
207
|
+
return cast(datetime.datetime | None | Unset, data)
|
|
208
|
+
|
|
209
|
+
opened_at = _parse_opened_at(d.pop("openedAt", UNSET))
|
|
210
|
+
|
|
211
|
+
def _parse_current_value(data: object) -> None | str | Unset:
|
|
212
|
+
if data is None:
|
|
213
|
+
return data
|
|
214
|
+
if isinstance(data, Unset):
|
|
215
|
+
return data
|
|
216
|
+
return cast(None | str | Unset, data)
|
|
217
|
+
|
|
218
|
+
current_value = _parse_current_value(d.pop("currentValue", UNSET))
|
|
219
|
+
|
|
220
|
+
def _parse_percent_of_portfolio(data: object) -> None | str | Unset:
|
|
221
|
+
if data is None:
|
|
222
|
+
return data
|
|
223
|
+
if isinstance(data, Unset):
|
|
224
|
+
return data
|
|
225
|
+
return cast(None | str | Unset, data)
|
|
226
|
+
|
|
227
|
+
percent_of_portfolio = _parse_percent_of_portfolio(d.pop("percentOfPortfolio", UNSET))
|
|
228
|
+
|
|
229
|
+
def _parse_last_price(
|
|
230
|
+
data: object,
|
|
231
|
+
) -> ComHellopublicUserapigatewayApiRestPortfolioPriceType0 | None | Unset:
|
|
232
|
+
if data is None:
|
|
233
|
+
return data
|
|
234
|
+
if isinstance(data, Unset):
|
|
235
|
+
return data
|
|
236
|
+
try:
|
|
237
|
+
if not isinstance(data, dict):
|
|
238
|
+
raise TypeError()
|
|
239
|
+
componentsschemascom_hellopublic_userapigateway_api_rest_portfolio_price_type_0 = (
|
|
240
|
+
ComHellopublicUserapigatewayApiRestPortfolioPriceType0.from_dict(data)
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
return (
|
|
244
|
+
componentsschemascom_hellopublic_userapigateway_api_rest_portfolio_price_type_0
|
|
245
|
+
)
|
|
246
|
+
except (TypeError, ValueError, AttributeError, KeyError):
|
|
247
|
+
pass
|
|
248
|
+
return cast(ComHellopublicUserapigatewayApiRestPortfolioPriceType0 | None | Unset, data)
|
|
249
|
+
|
|
250
|
+
last_price = _parse_last_price(d.pop("lastPrice", UNSET))
|
|
251
|
+
|
|
252
|
+
def _parse_instrument_gain(
|
|
253
|
+
data: object,
|
|
254
|
+
) -> ComHellopublicUserapigatewayApiRestPortfolioGainType0 | None | Unset:
|
|
255
|
+
if data is None:
|
|
256
|
+
return data
|
|
257
|
+
if isinstance(data, Unset):
|
|
258
|
+
return data
|
|
259
|
+
try:
|
|
260
|
+
if not isinstance(data, dict):
|
|
261
|
+
raise TypeError()
|
|
262
|
+
componentsschemascom_hellopublic_userapigateway_api_rest_portfolio_gain_type_0 = (
|
|
263
|
+
ComHellopublicUserapigatewayApiRestPortfolioGainType0.from_dict(data)
|
|
264
|
+
)
|
|
265
|
+
|
|
266
|
+
return (
|
|
267
|
+
componentsschemascom_hellopublic_userapigateway_api_rest_portfolio_gain_type_0
|
|
268
|
+
)
|
|
269
|
+
except (TypeError, ValueError, AttributeError, KeyError):
|
|
270
|
+
pass
|
|
271
|
+
return cast(ComHellopublicUserapigatewayApiRestPortfolioGainType0 | None | Unset, data)
|
|
272
|
+
|
|
273
|
+
instrument_gain = _parse_instrument_gain(d.pop("instrumentGain", UNSET))
|
|
274
|
+
|
|
275
|
+
def _parse_position_daily_gain(
|
|
276
|
+
data: object,
|
|
277
|
+
) -> ComHellopublicUserapigatewayApiRestPortfolioGainType0 | None | Unset:
|
|
278
|
+
if data is None:
|
|
279
|
+
return data
|
|
280
|
+
if isinstance(data, Unset):
|
|
281
|
+
return data
|
|
282
|
+
try:
|
|
283
|
+
if not isinstance(data, dict):
|
|
284
|
+
raise TypeError()
|
|
285
|
+
componentsschemascom_hellopublic_userapigateway_api_rest_portfolio_gain_type_0 = (
|
|
286
|
+
ComHellopublicUserapigatewayApiRestPortfolioGainType0.from_dict(data)
|
|
287
|
+
)
|
|
288
|
+
|
|
289
|
+
return (
|
|
290
|
+
componentsschemascom_hellopublic_userapigateway_api_rest_portfolio_gain_type_0
|
|
291
|
+
)
|
|
292
|
+
except (TypeError, ValueError, AttributeError, KeyError):
|
|
293
|
+
pass
|
|
294
|
+
return cast(ComHellopublicUserapigatewayApiRestPortfolioGainType0 | None | Unset, data)
|
|
295
|
+
|
|
296
|
+
position_daily_gain = _parse_position_daily_gain(d.pop("positionDailyGain", UNSET))
|
|
297
|
+
|
|
298
|
+
def _parse_cost_basis(
|
|
299
|
+
data: object,
|
|
300
|
+
) -> ComHellopublicUserapigatewayApiRestPortfolioGatewayCostBasisType0 | None | Unset:
|
|
301
|
+
if data is None:
|
|
302
|
+
return data
|
|
303
|
+
if isinstance(data, Unset):
|
|
304
|
+
return data
|
|
305
|
+
try:
|
|
306
|
+
if not isinstance(data, dict):
|
|
307
|
+
raise TypeError()
|
|
308
|
+
componentsschemascom_hellopublic_userapigateway_api_rest_portfolio_gateway_cost_basis_type_0 = ComHellopublicUserapigatewayApiRestPortfolioGatewayCostBasisType0.from_dict(
|
|
309
|
+
data
|
|
310
|
+
)
|
|
311
|
+
|
|
312
|
+
return componentsschemascom_hellopublic_userapigateway_api_rest_portfolio_gateway_cost_basis_type_0
|
|
313
|
+
except (TypeError, ValueError, AttributeError, KeyError):
|
|
314
|
+
pass
|
|
315
|
+
return cast(
|
|
316
|
+
ComHellopublicUserapigatewayApiRestPortfolioGatewayCostBasisType0 | None | Unset,
|
|
317
|
+
data,
|
|
318
|
+
)
|
|
319
|
+
|
|
320
|
+
cost_basis = _parse_cost_basis(d.pop("costBasis", UNSET))
|
|
321
|
+
|
|
322
|
+
com_hellopublic_userapigateway_api_rest_portfolio_gateway_portfolio_position = cls(
|
|
323
|
+
instrument=instrument,
|
|
324
|
+
quantity=quantity,
|
|
325
|
+
strategy_ids=strategy_ids,
|
|
326
|
+
opened_at=opened_at,
|
|
327
|
+
current_value=current_value,
|
|
328
|
+
percent_of_portfolio=percent_of_portfolio,
|
|
329
|
+
last_price=last_price,
|
|
330
|
+
instrument_gain=instrument_gain,
|
|
331
|
+
position_daily_gain=position_daily_gain,
|
|
332
|
+
cost_basis=cost_basis,
|
|
333
|
+
)
|
|
334
|
+
|
|
335
|
+
com_hellopublic_userapigateway_api_rest_portfolio_gateway_portfolio_position.additional_properties = d
|
|
336
|
+
return com_hellopublic_userapigateway_api_rest_portfolio_gateway_portfolio_position
|
|
337
|
+
|
|
338
|
+
@property
|
|
339
|
+
def additional_keys(self) -> list[str]:
|
|
340
|
+
return list(self.additional_properties.keys())
|
|
341
|
+
|
|
342
|
+
def __getitem__(self, key: str) -> Any:
|
|
343
|
+
return self.additional_properties[key]
|
|
344
|
+
|
|
345
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
346
|
+
self.additional_properties[key] = value
|
|
347
|
+
|
|
348
|
+
def __delitem__(self, key: str) -> None:
|
|
349
|
+
del self.additional_properties[key]
|
|
350
|
+
|
|
351
|
+
def __contains__(self, key: str) -> bool:
|
|
352
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import TYPE_CHECKING, Any, TypeVar, cast
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
from ..types import UNSET, Unset
|
|
10
|
+
|
|
11
|
+
if TYPE_CHECKING:
|
|
12
|
+
from ..models.com_hellopublic_userapigateway_api_rest_portfolio_gain_type_0 import (
|
|
13
|
+
ComHellopublicUserapigatewayApiRestPortfolioGainType0,
|
|
14
|
+
)
|
|
15
|
+
from ..models.com_hellopublic_userapigateway_api_rest_portfolio_gateway_cost_basis_type_0 import (
|
|
16
|
+
ComHellopublicUserapigatewayApiRestPortfolioGatewayCostBasisType0,
|
|
17
|
+
)
|
|
18
|
+
from ..models.com_hellopublic_userapigateway_api_rest_portfolio_gateway_strategy_leg import (
|
|
19
|
+
ComHellopublicUserapigatewayApiRestPortfolioGatewayStrategyLeg,
|
|
20
|
+
)
|
|
21
|
+
from ..models.com_hellopublic_userapigateway_api_rest_portfolio_price_type_0 import (
|
|
22
|
+
ComHellopublicUserapigatewayApiRestPortfolioPriceType0,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
T = TypeVar("T", bound="ComHellopublicUserapigatewayApiRestPortfolioGatewayStrategy")
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@_attrs_define
|
|
30
|
+
class ComHellopublicUserapigatewayApiRestPortfolioGatewayStrategy:
|
|
31
|
+
"""Represents a multi-leg option strategy in the portfolio
|
|
32
|
+
|
|
33
|
+
Attributes:
|
|
34
|
+
strategy_id (str): Unique identifier for the strategy
|
|
35
|
+
display_name (str): Display name for the strategy (e.g., "$180/$185 Call Spread")
|
|
36
|
+
quantity (str): Quantity of the strategy
|
|
37
|
+
option_legs (list[ComHellopublicUserapigatewayApiRestPortfolioGatewayStrategyLeg]): List of option legs that
|
|
38
|
+
make up this strategy
|
|
39
|
+
current_value (str | Unset): Current value of the strategy
|
|
40
|
+
percent_of_portfolio (str | Unset): Percentage of the total portfolio this strategy represents
|
|
41
|
+
last_price (ComHellopublicUserapigatewayApiRestPortfolioPriceType0 | None | Unset):
|
|
42
|
+
position_daily_gain (ComHellopublicUserapigatewayApiRestPortfolioGainType0 | None | Unset):
|
|
43
|
+
cost_basis (ComHellopublicUserapigatewayApiRestPortfolioGatewayCostBasisType0 | None | Unset): Cost basis of a
|
|
44
|
+
position. What the member paid for entering the position. The cost basis is
|
|
45
|
+
based on tax lots and will factor in wash sales.
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
strategy_id: str
|
|
49
|
+
display_name: str
|
|
50
|
+
quantity: str
|
|
51
|
+
option_legs: list[ComHellopublicUserapigatewayApiRestPortfolioGatewayStrategyLeg]
|
|
52
|
+
current_value: str | Unset = UNSET
|
|
53
|
+
percent_of_portfolio: str | Unset = UNSET
|
|
54
|
+
last_price: ComHellopublicUserapigatewayApiRestPortfolioPriceType0 | None | Unset = UNSET
|
|
55
|
+
position_daily_gain: ComHellopublicUserapigatewayApiRestPortfolioGainType0 | None | Unset = (
|
|
56
|
+
UNSET
|
|
57
|
+
)
|
|
58
|
+
cost_basis: ComHellopublicUserapigatewayApiRestPortfolioGatewayCostBasisType0 | None | Unset = (
|
|
59
|
+
UNSET
|
|
60
|
+
)
|
|
61
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
62
|
+
|
|
63
|
+
def to_dict(self) -> dict[str, Any]:
|
|
64
|
+
from ..models.com_hellopublic_userapigateway_api_rest_portfolio_gain_type_0 import (
|
|
65
|
+
ComHellopublicUserapigatewayApiRestPortfolioGainType0,
|
|
66
|
+
)
|
|
67
|
+
from ..models.com_hellopublic_userapigateway_api_rest_portfolio_gateway_cost_basis_type_0 import (
|
|
68
|
+
ComHellopublicUserapigatewayApiRestPortfolioGatewayCostBasisType0,
|
|
69
|
+
)
|
|
70
|
+
from ..models.com_hellopublic_userapigateway_api_rest_portfolio_price_type_0 import (
|
|
71
|
+
ComHellopublicUserapigatewayApiRestPortfolioPriceType0,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
strategy_id = self.strategy_id
|
|
75
|
+
|
|
76
|
+
display_name = self.display_name
|
|
77
|
+
|
|
78
|
+
quantity = self.quantity
|
|
79
|
+
|
|
80
|
+
option_legs = []
|
|
81
|
+
for option_legs_item_data in self.option_legs:
|
|
82
|
+
option_legs_item = option_legs_item_data.to_dict()
|
|
83
|
+
option_legs.append(option_legs_item)
|
|
84
|
+
|
|
85
|
+
current_value = self.current_value
|
|
86
|
+
|
|
87
|
+
percent_of_portfolio = self.percent_of_portfolio
|
|
88
|
+
|
|
89
|
+
last_price: dict[str, Any] | None | Unset
|
|
90
|
+
if isinstance(self.last_price, Unset):
|
|
91
|
+
last_price = UNSET
|
|
92
|
+
elif isinstance(self.last_price, ComHellopublicUserapigatewayApiRestPortfolioPriceType0):
|
|
93
|
+
last_price = self.last_price.to_dict()
|
|
94
|
+
else:
|
|
95
|
+
last_price = self.last_price
|
|
96
|
+
|
|
97
|
+
position_daily_gain: dict[str, Any] | None | Unset
|
|
98
|
+
if isinstance(self.position_daily_gain, Unset):
|
|
99
|
+
position_daily_gain = UNSET
|
|
100
|
+
elif isinstance(
|
|
101
|
+
self.position_daily_gain, ComHellopublicUserapigatewayApiRestPortfolioGainType0
|
|
102
|
+
):
|
|
103
|
+
position_daily_gain = self.position_daily_gain.to_dict()
|
|
104
|
+
else:
|
|
105
|
+
position_daily_gain = self.position_daily_gain
|
|
106
|
+
|
|
107
|
+
cost_basis: dict[str, Any] | None | Unset
|
|
108
|
+
if isinstance(self.cost_basis, Unset):
|
|
109
|
+
cost_basis = UNSET
|
|
110
|
+
elif isinstance(
|
|
111
|
+
self.cost_basis, ComHellopublicUserapigatewayApiRestPortfolioGatewayCostBasisType0
|
|
112
|
+
):
|
|
113
|
+
cost_basis = self.cost_basis.to_dict()
|
|
114
|
+
else:
|
|
115
|
+
cost_basis = self.cost_basis
|
|
116
|
+
|
|
117
|
+
field_dict: dict[str, Any] = {}
|
|
118
|
+
field_dict.update(self.additional_properties)
|
|
119
|
+
field_dict.update(
|
|
120
|
+
{
|
|
121
|
+
"strategyId": strategy_id,
|
|
122
|
+
"displayName": display_name,
|
|
123
|
+
"quantity": quantity,
|
|
124
|
+
"optionLegs": option_legs,
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
if current_value is not UNSET:
|
|
128
|
+
field_dict["currentValue"] = current_value
|
|
129
|
+
if percent_of_portfolio is not UNSET:
|
|
130
|
+
field_dict["percentOfPortfolio"] = percent_of_portfolio
|
|
131
|
+
if last_price is not UNSET:
|
|
132
|
+
field_dict["lastPrice"] = last_price
|
|
133
|
+
if position_daily_gain is not UNSET:
|
|
134
|
+
field_dict["positionDailyGain"] = position_daily_gain
|
|
135
|
+
if cost_basis is not UNSET:
|
|
136
|
+
field_dict["costBasis"] = cost_basis
|
|
137
|
+
|
|
138
|
+
return field_dict
|
|
139
|
+
|
|
140
|
+
@classmethod
|
|
141
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
142
|
+
from ..models.com_hellopublic_userapigateway_api_rest_portfolio_gain_type_0 import (
|
|
143
|
+
ComHellopublicUserapigatewayApiRestPortfolioGainType0,
|
|
144
|
+
)
|
|
145
|
+
from ..models.com_hellopublic_userapigateway_api_rest_portfolio_gateway_cost_basis_type_0 import (
|
|
146
|
+
ComHellopublicUserapigatewayApiRestPortfolioGatewayCostBasisType0,
|
|
147
|
+
)
|
|
148
|
+
from ..models.com_hellopublic_userapigateway_api_rest_portfolio_gateway_strategy_leg import (
|
|
149
|
+
ComHellopublicUserapigatewayApiRestPortfolioGatewayStrategyLeg,
|
|
150
|
+
)
|
|
151
|
+
from ..models.com_hellopublic_userapigateway_api_rest_portfolio_price_type_0 import (
|
|
152
|
+
ComHellopublicUserapigatewayApiRestPortfolioPriceType0,
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
d = dict(src_dict)
|
|
156
|
+
strategy_id = d.pop("strategyId")
|
|
157
|
+
|
|
158
|
+
display_name = d.pop("displayName")
|
|
159
|
+
|
|
160
|
+
quantity = d.pop("quantity")
|
|
161
|
+
|
|
162
|
+
option_legs = []
|
|
163
|
+
_option_legs = d.pop("optionLegs")
|
|
164
|
+
for option_legs_item_data in _option_legs:
|
|
165
|
+
option_legs_item = (
|
|
166
|
+
ComHellopublicUserapigatewayApiRestPortfolioGatewayStrategyLeg.from_dict(
|
|
167
|
+
option_legs_item_data
|
|
168
|
+
)
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
option_legs.append(option_legs_item)
|
|
172
|
+
|
|
173
|
+
current_value = d.pop("currentValue", UNSET)
|
|
174
|
+
|
|
175
|
+
percent_of_portfolio = d.pop("percentOfPortfolio", UNSET)
|
|
176
|
+
|
|
177
|
+
def _parse_last_price(
|
|
178
|
+
data: object,
|
|
179
|
+
) -> ComHellopublicUserapigatewayApiRestPortfolioPriceType0 | None | Unset:
|
|
180
|
+
if data is None:
|
|
181
|
+
return data
|
|
182
|
+
if isinstance(data, Unset):
|
|
183
|
+
return data
|
|
184
|
+
try:
|
|
185
|
+
if not isinstance(data, dict):
|
|
186
|
+
raise TypeError()
|
|
187
|
+
componentsschemascom_hellopublic_userapigateway_api_rest_portfolio_price_type_0 = (
|
|
188
|
+
ComHellopublicUserapigatewayApiRestPortfolioPriceType0.from_dict(data)
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
return (
|
|
192
|
+
componentsschemascom_hellopublic_userapigateway_api_rest_portfolio_price_type_0
|
|
193
|
+
)
|
|
194
|
+
except (TypeError, ValueError, AttributeError, KeyError):
|
|
195
|
+
pass
|
|
196
|
+
return cast(ComHellopublicUserapigatewayApiRestPortfolioPriceType0 | None | Unset, data)
|
|
197
|
+
|
|
198
|
+
last_price = _parse_last_price(d.pop("lastPrice", UNSET))
|
|
199
|
+
|
|
200
|
+
def _parse_position_daily_gain(
|
|
201
|
+
data: object,
|
|
202
|
+
) -> ComHellopublicUserapigatewayApiRestPortfolioGainType0 | None | Unset:
|
|
203
|
+
if data is None:
|
|
204
|
+
return data
|
|
205
|
+
if isinstance(data, Unset):
|
|
206
|
+
return data
|
|
207
|
+
try:
|
|
208
|
+
if not isinstance(data, dict):
|
|
209
|
+
raise TypeError()
|
|
210
|
+
componentsschemascom_hellopublic_userapigateway_api_rest_portfolio_gain_type_0 = (
|
|
211
|
+
ComHellopublicUserapigatewayApiRestPortfolioGainType0.from_dict(data)
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
return (
|
|
215
|
+
componentsschemascom_hellopublic_userapigateway_api_rest_portfolio_gain_type_0
|
|
216
|
+
)
|
|
217
|
+
except (TypeError, ValueError, AttributeError, KeyError):
|
|
218
|
+
pass
|
|
219
|
+
return cast(ComHellopublicUserapigatewayApiRestPortfolioGainType0 | None | Unset, data)
|
|
220
|
+
|
|
221
|
+
position_daily_gain = _parse_position_daily_gain(d.pop("positionDailyGain", UNSET))
|
|
222
|
+
|
|
223
|
+
def _parse_cost_basis(
|
|
224
|
+
data: object,
|
|
225
|
+
) -> ComHellopublicUserapigatewayApiRestPortfolioGatewayCostBasisType0 | None | Unset:
|
|
226
|
+
if data is None:
|
|
227
|
+
return data
|
|
228
|
+
if isinstance(data, Unset):
|
|
229
|
+
return data
|
|
230
|
+
try:
|
|
231
|
+
if not isinstance(data, dict):
|
|
232
|
+
raise TypeError()
|
|
233
|
+
componentsschemascom_hellopublic_userapigateway_api_rest_portfolio_gateway_cost_basis_type_0 = ComHellopublicUserapigatewayApiRestPortfolioGatewayCostBasisType0.from_dict(
|
|
234
|
+
data
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
return componentsschemascom_hellopublic_userapigateway_api_rest_portfolio_gateway_cost_basis_type_0
|
|
238
|
+
except (TypeError, ValueError, AttributeError, KeyError):
|
|
239
|
+
pass
|
|
240
|
+
return cast(
|
|
241
|
+
ComHellopublicUserapigatewayApiRestPortfolioGatewayCostBasisType0 | None | Unset,
|
|
242
|
+
data,
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
cost_basis = _parse_cost_basis(d.pop("costBasis", UNSET))
|
|
246
|
+
|
|
247
|
+
com_hellopublic_userapigateway_api_rest_portfolio_gateway_strategy = cls(
|
|
248
|
+
strategy_id=strategy_id,
|
|
249
|
+
display_name=display_name,
|
|
250
|
+
quantity=quantity,
|
|
251
|
+
option_legs=option_legs,
|
|
252
|
+
current_value=current_value,
|
|
253
|
+
percent_of_portfolio=percent_of_portfolio,
|
|
254
|
+
last_price=last_price,
|
|
255
|
+
position_daily_gain=position_daily_gain,
|
|
256
|
+
cost_basis=cost_basis,
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
com_hellopublic_userapigateway_api_rest_portfolio_gateway_strategy.additional_properties = d
|
|
260
|
+
return com_hellopublic_userapigateway_api_rest_portfolio_gateway_strategy
|
|
261
|
+
|
|
262
|
+
@property
|
|
263
|
+
def additional_keys(self) -> list[str]:
|
|
264
|
+
return list(self.additional_properties.keys())
|
|
265
|
+
|
|
266
|
+
def __getitem__(self, key: str) -> Any:
|
|
267
|
+
return self.additional_properties[key]
|
|
268
|
+
|
|
269
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
270
|
+
self.additional_properties[key] = value
|
|
271
|
+
|
|
272
|
+
def __delitem__(self, key: str) -> None:
|
|
273
|
+
del self.additional_properties[key]
|
|
274
|
+
|
|
275
|
+
def __contains__(self, key: str) -> bool:
|
|
276
|
+
return key in self.additional_properties
|