lusid-sdk 2.1.242__py3-none-any.whl → 2.1.254__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.

Potentially problematic release.


This version of lusid-sdk might be problematic. Click here for more details.

@@ -22,7 +22,7 @@ from typing import overload, Optional, Union, Awaitable
22
22
  from typing_extensions import Annotated
23
23
  from pydantic.v1 import Field, StrictBool, conlist, constr, validator
24
24
 
25
- from typing import Optional
25
+ from typing import Dict, Optional
26
26
 
27
27
  from lusid.models.allocation_service_run_response import AllocationServiceRunResponse
28
28
  from lusid.models.block_and_orders_create_request import BlockAndOrdersCreateRequest
@@ -30,10 +30,12 @@ from lusid.models.book_transactions_request import BookTransactionsRequest
30
30
  from lusid.models.book_transactions_response import BookTransactionsResponse
31
31
  from lusid.models.move_orders_to_different_blocks_request import MoveOrdersToDifferentBlocksRequest
32
32
  from lusid.models.place_blocks_request import PlaceBlocksRequest
33
+ from lusid.models.placement_update_request import PlacementUpdateRequest
33
34
  from lusid.models.resource_id import ResourceId
34
35
  from lusid.models.resource_list_of_block_and_orders import ResourceListOfBlockAndOrders
35
36
  from lusid.models.resource_list_of_moved_order_to_different_block_response import ResourceListOfMovedOrderToDifferentBlockResponse
36
37
  from lusid.models.resource_list_of_placement import ResourceListOfPlacement
38
+ from lusid.models.update_placements_response import UpdatePlacementsResponse
37
39
 
38
40
  from lusid.api_client import ApiClient
39
41
  from lusid.api_response import ApiResponse
@@ -860,3 +862,161 @@ class OrderManagementApi:
860
862
  _request_timeout=_params.get('_request_timeout'),
861
863
  collection_formats=_collection_formats,
862
864
  _request_auth=_params.get('_request_auth'))
865
+
866
+ @overload
867
+ async def update_placements(self, request_body : Annotated[Dict[str, PlacementUpdateRequest], Field(..., description="The request containing the placements to be updated.")], **kwargs) -> UpdatePlacementsResponse: # noqa: E501
868
+ ...
869
+
870
+ @overload
871
+ def update_placements(self, request_body : Annotated[Dict[str, PlacementUpdateRequest], Field(..., description="The request containing the placements to be updated.")], async_req: Optional[bool]=True, **kwargs) -> UpdatePlacementsResponse: # noqa: E501
872
+ ...
873
+
874
+ @validate_arguments
875
+ def update_placements(self, request_body : Annotated[Dict[str, PlacementUpdateRequest], Field(..., description="The request containing the placements to be updated.")], async_req: Optional[bool]=None, **kwargs) -> Union[UpdatePlacementsResponse, Awaitable[UpdatePlacementsResponse]]: # noqa: E501
876
+ """[EARLY ACCESS] UpdatePlacements: Update existing placements # noqa: E501
877
+
878
+ The response returns both the collection of successfully created or updated instruments, as well as those that failed. For each failure, a reason is provided. It is important to check the failed set for unsuccessful results. # noqa: E501
879
+ This method makes a synchronous HTTP request by default. To make an
880
+ asynchronous HTTP request, please pass async_req=True
881
+
882
+ >>> thread = api.update_placements(request_body, async_req=True)
883
+ >>> result = thread.get()
884
+
885
+ :param request_body: The request containing the placements to be updated. (required)
886
+ :type request_body: Dict[str, PlacementUpdateRequest]
887
+ :param async_req: Whether to execute the request asynchronously.
888
+ :type async_req: bool, optional
889
+ :param _request_timeout: timeout setting for this request.
890
+ If one number provided, it will be total request
891
+ timeout. It can also be a pair (tuple) of
892
+ (connection, read) timeouts.
893
+ :return: Returns the result object.
894
+ If the method is called asynchronously,
895
+ returns the request thread.
896
+ :rtype: UpdatePlacementsResponse
897
+ """
898
+ kwargs['_return_http_data_only'] = True
899
+ if '_preload_content' in kwargs:
900
+ message = "Error! Please call the update_placements_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
901
+ raise ValueError(message)
902
+ if async_req is not None:
903
+ kwargs['async_req'] = async_req
904
+ return self.update_placements_with_http_info(request_body, **kwargs) # noqa: E501
905
+
906
+ @validate_arguments
907
+ def update_placements_with_http_info(self, request_body : Annotated[Dict[str, PlacementUpdateRequest], Field(..., description="The request containing the placements to be updated.")], **kwargs) -> ApiResponse: # noqa: E501
908
+ """[EARLY ACCESS] UpdatePlacements: Update existing placements # noqa: E501
909
+
910
+ The response returns both the collection of successfully created or updated instruments, as well as those that failed. For each failure, a reason is provided. It is important to check the failed set for unsuccessful results. # noqa: E501
911
+ This method makes a synchronous HTTP request by default. To make an
912
+ asynchronous HTTP request, please pass async_req=True
913
+
914
+ >>> thread = api.update_placements_with_http_info(request_body, async_req=True)
915
+ >>> result = thread.get()
916
+
917
+ :param request_body: The request containing the placements to be updated. (required)
918
+ :type request_body: Dict[str, PlacementUpdateRequest]
919
+ :param async_req: Whether to execute the request asynchronously.
920
+ :type async_req: bool, optional
921
+ :param _preload_content: if False, the ApiResponse.data will
922
+ be set to none and raw_data will store the
923
+ HTTP response body without reading/decoding.
924
+ Default is True.
925
+ :type _preload_content: bool, optional
926
+ :param _return_http_data_only: response data instead of ApiResponse
927
+ object with status code, headers, etc
928
+ :type _return_http_data_only: bool, optional
929
+ :param _request_timeout: timeout setting for this request. If one
930
+ number provided, it will be total request
931
+ timeout. It can also be a pair (tuple) of
932
+ (connection, read) timeouts.
933
+ :param _request_auth: set to override the auth_settings for an a single
934
+ request; this effectively ignores the authentication
935
+ in the spec for a single request.
936
+ :type _request_auth: dict, optional
937
+ :type _content_type: string, optional: force content-type for the request
938
+ :return: Returns the result object.
939
+ If the method is called asynchronously,
940
+ returns the request thread.
941
+ :rtype: tuple(UpdatePlacementsResponse, status_code(int), headers(HTTPHeaderDict))
942
+ """
943
+
944
+ _params = locals()
945
+
946
+ _all_params = [
947
+ 'request_body'
948
+ ]
949
+ _all_params.extend(
950
+ [
951
+ 'async_req',
952
+ '_return_http_data_only',
953
+ '_preload_content',
954
+ '_request_timeout',
955
+ '_request_auth',
956
+ '_content_type',
957
+ '_headers'
958
+ ]
959
+ )
960
+
961
+ # validate the arguments
962
+ for _key, _val in _params['kwargs'].items():
963
+ if _key not in _all_params:
964
+ raise ApiTypeError(
965
+ "Got an unexpected keyword argument '%s'"
966
+ " to method update_placements" % _key
967
+ )
968
+ _params[_key] = _val
969
+ del _params['kwargs']
970
+
971
+ _collection_formats = {}
972
+
973
+ # process the path parameters
974
+ _path_params = {}
975
+
976
+ # process the query parameters
977
+ _query_params = []
978
+ # process the header parameters
979
+ _header_params = dict(_params.get('_headers', {}))
980
+ # process the form parameters
981
+ _form_params = []
982
+ _files = {}
983
+ # process the body parameter
984
+ _body_params = None
985
+ if _params['request_body'] is not None:
986
+ _body_params = _params['request_body']
987
+
988
+ # set the HTTP header `Accept`
989
+ _header_params['Accept'] = self.api_client.select_header_accept(
990
+ ['text/plain', 'application/json', 'text/json']) # noqa: E501
991
+
992
+ # set the HTTP header `Content-Type`
993
+ _content_types_list = _params.get('_content_type',
994
+ self.api_client.select_header_content_type(
995
+ ['application/json-patch+json', 'application/json', 'text/json', 'application/*+json']))
996
+ if _content_types_list:
997
+ _header_params['Content-Type'] = _content_types_list
998
+
999
+ # authentication setting
1000
+ _auth_settings = ['oauth2'] # noqa: E501
1001
+
1002
+ _response_types_map = {
1003
+ '200': "UpdatePlacementsResponse",
1004
+ '400': "LusidValidationProblemDetails",
1005
+ }
1006
+
1007
+ return self.api_client.call_api(
1008
+ '/api/ordermanagement/$updateplacements', 'POST',
1009
+ _path_params,
1010
+ _query_params,
1011
+ _header_params,
1012
+ body=_body_params,
1013
+ post_params=_form_params,
1014
+ files=_files,
1015
+ response_types_map=_response_types_map,
1016
+ auth_settings=_auth_settings,
1017
+ async_req=_params.get('async_req'),
1018
+ _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501
1019
+ _preload_content=_params.get('_preload_content', True),
1020
+ _request_timeout=_params.get('_request_timeout'),
1021
+ collection_formats=_collection_formats,
1022
+ _request_auth=_params.get('_request_auth'))
lusid/configuration.py CHANGED
@@ -373,7 +373,7 @@ class Configuration:
373
373
  return "Python SDK Debug Report:\n"\
374
374
  "OS: {env}\n"\
375
375
  "Python Version: {pyversion}\n"\
376
- "Version of the API: 0.11.6675\n"\
376
+ "Version of the API: 0.11.6687\n"\
377
377
  "SDK Package Version: {package_version}".\
378
378
  format(env=sys.platform, pyversion=sys.version, package_version=package_version)
379
379
 
lusid/models/__init__.py CHANGED
@@ -317,6 +317,7 @@ from lusid.models.fee_request import FeeRequest
317
317
  from lusid.models.fee_rule import FeeRule
318
318
  from lusid.models.fee_rule_upsert_request import FeeRuleUpsertRequest
319
319
  from lusid.models.fee_rule_upsert_response import FeeRuleUpsertResponse
320
+ from lusid.models.fee_transaction_template_specification import FeeTransactionTemplateSpecification
320
321
  from lusid.models.fee_type import FeeType
321
322
  from lusid.models.fee_type_request import FeeTypeRequest
322
323
  from lusid.models.field_definition import FieldDefinition
@@ -417,6 +418,7 @@ from lusid.models.instrument_cash_flow import InstrumentCashFlow
417
418
  from lusid.models.instrument_definition import InstrumentDefinition
418
419
  from lusid.models.instrument_definition_format import InstrumentDefinitionFormat
419
420
  from lusid.models.instrument_delete_modes import InstrumentDeleteModes
421
+ from lusid.models.instrument_entity import InstrumentEntity
420
422
  from lusid.models.instrument_event import InstrumentEvent
421
423
  from lusid.models.instrument_event_configuration import InstrumentEventConfiguration
422
424
  from lusid.models.instrument_event_holder import InstrumentEventHolder
@@ -613,6 +615,7 @@ from lusid.models.place_blocks_request import PlaceBlocksRequest
613
615
  from lusid.models.placement import Placement
614
616
  from lusid.models.placement_request import PlacementRequest
615
617
  from lusid.models.placement_set_request import PlacementSetRequest
618
+ from lusid.models.placement_update_request import PlacementUpdateRequest
616
619
  from lusid.models.portfolio import Portfolio
617
620
  from lusid.models.portfolio_cash_flow import PortfolioCashFlow
618
621
  from lusid.models.portfolio_cash_ladder import PortfolioCashLadder
@@ -649,6 +652,7 @@ from lusid.models.pricing_model import PricingModel
649
652
  from lusid.models.pricing_options import PricingOptions
650
653
  from lusid.models.processed_command import ProcessedCommand
651
654
  from lusid.models.property_definition import PropertyDefinition
655
+ from lusid.models.property_definition_entity import PropertyDefinitionEntity
652
656
  from lusid.models.property_definition_search_result import PropertyDefinitionSearchResult
653
657
  from lusid.models.property_definition_type import PropertyDefinitionType
654
658
  from lusid.models.property_domain import PropertyDomain
@@ -928,6 +932,7 @@ from lusid.models.update_data_type_request import UpdateDataTypeRequest
928
932
  from lusid.models.update_derived_property_definition_request import UpdateDerivedPropertyDefinitionRequest
929
933
  from lusid.models.update_fee_type_request import UpdateFeeTypeRequest
930
934
  from lusid.models.update_instrument_identifier_request import UpdateInstrumentIdentifierRequest
935
+ from lusid.models.update_placements_response import UpdatePlacementsResponse
931
936
  from lusid.models.update_portfolio_group_request import UpdatePortfolioGroupRequest
932
937
  from lusid.models.update_portfolio_request import UpdatePortfolioRequest
933
938
  from lusid.models.update_property_definition_request import UpdatePropertyDefinitionRequest
@@ -1316,6 +1321,7 @@ __all__ = [
1316
1321
  "FeeRule",
1317
1322
  "FeeRuleUpsertRequest",
1318
1323
  "FeeRuleUpsertResponse",
1324
+ "FeeTransactionTemplateSpecification",
1319
1325
  "FeeType",
1320
1326
  "FeeTypeRequest",
1321
1327
  "FieldDefinition",
@@ -1416,6 +1422,7 @@ __all__ = [
1416
1422
  "InstrumentDefinition",
1417
1423
  "InstrumentDefinitionFormat",
1418
1424
  "InstrumentDeleteModes",
1425
+ "InstrumentEntity",
1419
1426
  "InstrumentEvent",
1420
1427
  "InstrumentEventConfiguration",
1421
1428
  "InstrumentEventHolder",
@@ -1612,6 +1619,7 @@ __all__ = [
1612
1619
  "Placement",
1613
1620
  "PlacementRequest",
1614
1621
  "PlacementSetRequest",
1622
+ "PlacementUpdateRequest",
1615
1623
  "Portfolio",
1616
1624
  "PortfolioCashFlow",
1617
1625
  "PortfolioCashLadder",
@@ -1648,6 +1656,7 @@ __all__ = [
1648
1656
  "PricingOptions",
1649
1657
  "ProcessedCommand",
1650
1658
  "PropertyDefinition",
1659
+ "PropertyDefinitionEntity",
1651
1660
  "PropertyDefinitionSearchResult",
1652
1661
  "PropertyDefinitionType",
1653
1662
  "PropertyDomain",
@@ -1927,6 +1936,7 @@ __all__ = [
1927
1936
  "UpdateDerivedPropertyDefinitionRequest",
1928
1937
  "UpdateFeeTypeRequest",
1929
1938
  "UpdateInstrumentIdentifierRequest",
1939
+ "UpdatePlacementsResponse",
1930
1940
  "UpdatePortfolioGroupRequest",
1931
1941
  "UpdatePortfolioRequest",
1932
1942
  "UpdatePropertyDefinitionRequest",
@@ -28,7 +28,8 @@ class DependencySourceFilter(BaseModel):
28
28
  instrument_type: Optional[constr(strict=True, max_length=32, min_length=0)] = Field(None, alias="instrumentType", description="Specify that a rule should only apply if the market data is requested by an instrument of a given instrument type. If null, then no filtering on instrument type is applied.")
29
29
  asset_class: Optional[constr(strict=True, max_length=32, min_length=0)] = Field(None, alias="assetClass", description="Specify that a rule should only apply if the market data is requested by an instrument of a given asset class. If null, then no filtering on asset class is applied.")
30
30
  dom_ccy: Optional[StrictStr] = Field(None, alias="domCcy", description="Specify that a rule should only apply if the market data is requested by an instrument with a given domestic currency. If null, then no filtering on currency is applied.")
31
- __properties = ["instrumentType", "assetClass", "domCcy"]
31
+ long_or_short_indicator: Optional[StrictStr] = Field(None, alias="longOrShortIndicator", description="Specify that a rule should apply if the market data is requested by a model with a given long or short indicator. If none, then no filtering on LongOrShortIndicator is applied.")
32
+ __properties = ["instrumentType", "assetClass", "domCcy", "longOrShortIndicator"]
32
33
 
33
34
  class Config:
34
35
  """Pydantic configuration"""
@@ -69,6 +70,11 @@ class DependencySourceFilter(BaseModel):
69
70
  if self.dom_ccy is None and "dom_ccy" in self.__fields_set__:
70
71
  _dict['domCcy'] = None
71
72
 
73
+ # set to None if long_or_short_indicator (nullable) is None
74
+ # and __fields_set__ contains the field
75
+ if self.long_or_short_indicator is None and "long_or_short_indicator" in self.__fields_set__:
76
+ _dict['longOrShortIndicator'] = None
77
+
72
78
  return _dict
73
79
 
74
80
  @classmethod
@@ -83,6 +89,7 @@ class DependencySourceFilter(BaseModel):
83
89
  _obj = DependencySourceFilter.parse_obj({
84
90
  "instrument_type": obj.get("instrumentType"),
85
91
  "asset_class": obj.get("assetClass"),
86
- "dom_ccy": obj.get("domCcy")
92
+ "dom_ccy": obj.get("domCcy"),
93
+ "long_or_short_indicator": obj.get("longOrShortIndicator")
87
94
  })
88
95
  return _obj
@@ -0,0 +1,79 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ LUSID API
5
+
6
+ FINBOURNE Technology # noqa: E501
7
+
8
+ Contact: info@finbourne.com
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+
21
+ from typing import Any, Dict, List
22
+ from pydantic.v1 import BaseModel, Field, conlist, constr
23
+ from lusid.models.template_field import TemplateField
24
+
25
+ class FeeTransactionTemplateSpecification(BaseModel):
26
+ """
27
+ FeeTransactionTemplateSpecification
28
+ """
29
+ specification_type_name: constr(strict=True, min_length=1) = Field(..., alias="specificationTypeName")
30
+ supported_template_fields: conlist(TemplateField) = Field(..., alias="supportedTemplateFields")
31
+ __properties = ["specificationTypeName", "supportedTemplateFields"]
32
+
33
+ class Config:
34
+ """Pydantic configuration"""
35
+ allow_population_by_field_name = True
36
+ validate_assignment = True
37
+
38
+ def to_str(self) -> str:
39
+ """Returns the string representation of the model using alias"""
40
+ return pprint.pformat(self.dict(by_alias=True))
41
+
42
+ def to_json(self) -> str:
43
+ """Returns the JSON representation of the model using alias"""
44
+ return json.dumps(self.to_dict())
45
+
46
+ @classmethod
47
+ def from_json(cls, json_str: str) -> FeeTransactionTemplateSpecification:
48
+ """Create an instance of FeeTransactionTemplateSpecification from a JSON string"""
49
+ return cls.from_dict(json.loads(json_str))
50
+
51
+ def to_dict(self):
52
+ """Returns the dictionary representation of the model using alias"""
53
+ _dict = self.dict(by_alias=True,
54
+ exclude={
55
+ },
56
+ exclude_none=True)
57
+ # override the default output from pydantic by calling `to_dict()` of each item in supported_template_fields (list)
58
+ _items = []
59
+ if self.supported_template_fields:
60
+ for _item in self.supported_template_fields:
61
+ if _item:
62
+ _items.append(_item.to_dict())
63
+ _dict['supportedTemplateFields'] = _items
64
+ return _dict
65
+
66
+ @classmethod
67
+ def from_dict(cls, obj: dict) -> FeeTransactionTemplateSpecification:
68
+ """Create an instance of FeeTransactionTemplateSpecification from a dict"""
69
+ if obj is None:
70
+ return None
71
+
72
+ if not isinstance(obj, dict):
73
+ return FeeTransactionTemplateSpecification.parse_obj(obj)
74
+
75
+ _obj = FeeTransactionTemplateSpecification.parse_obj({
76
+ "specification_type_name": obj.get("specificationTypeName"),
77
+ "supported_template_fields": [TemplateField.from_dict(_item) for _item in obj.get("supportedTemplateFields")] if obj.get("supportedTemplateFields") is not None else None
78
+ })
79
+ return _obj
@@ -0,0 +1,146 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ LUSID API
5
+
6
+ FINBOURNE Technology # noqa: E501
7
+
8
+ Contact: info@finbourne.com
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from datetime import datetime
21
+ from typing import Any, Dict, List, Optional
22
+ from pydantic.v1 import BaseModel, Field, StrictInt, StrictStr, conlist, constr
23
+ from lusid.models.instrument import Instrument
24
+ from lusid.models.link import Link
25
+
26
+ class InstrumentEntity(BaseModel):
27
+ """
28
+ A list of instruments. # noqa: E501
29
+ """
30
+ href: StrictStr = Field(..., description="The specific Uniform Resource Identifier (URI) for this resource at the requested effective and asAt datetime.")
31
+ entity_unique_id: constr(strict=True, min_length=1) = Field(..., alias="entityUniqueId", description="The unique id of the entity.")
32
+ as_at_version_number: Optional[StrictInt] = Field(None, alias="asAtVersionNumber", description="The integer version number for the entity (the entity was created at version 1)")
33
+ status: constr(strict=True, min_length=1) = Field(..., description="The status of the entity at the current time.")
34
+ as_at_deleted: Optional[datetime] = Field(None, alias="asAtDeleted", description="The asAt datetime at which the entity was deleted.")
35
+ user_id_deleted: Optional[StrictStr] = Field(None, alias="userIdDeleted", description="The unique id of the user who deleted the entity.")
36
+ request_id_deleted: Optional[StrictStr] = Field(None, alias="requestIdDeleted", description="The unique request id of the command that deleted the entity.")
37
+ effective_at_created: Optional[datetime] = Field(None, alias="effectiveAtCreated", description="The EffectiveAt this Entity is created, if entity does not currently exist in EffectiveAt.")
38
+ prevailing_instrument: Optional[Instrument] = Field(None, alias="prevailingInstrument")
39
+ deleted_instrument: Optional[Instrument] = Field(None, alias="deletedInstrument")
40
+ previewed_status: Optional[StrictStr] = Field(None, alias="previewedStatus", description="The status of the previewed entity.")
41
+ previewed_instrument: Optional[Instrument] = Field(None, alias="previewedInstrument")
42
+ links: Optional[conlist(Link)] = None
43
+ __properties = ["href", "entityUniqueId", "asAtVersionNumber", "status", "asAtDeleted", "userIdDeleted", "requestIdDeleted", "effectiveAtCreated", "prevailingInstrument", "deletedInstrument", "previewedStatus", "previewedInstrument", "links"]
44
+
45
+ class Config:
46
+ """Pydantic configuration"""
47
+ allow_population_by_field_name = True
48
+ validate_assignment = True
49
+
50
+ def to_str(self) -> str:
51
+ """Returns the string representation of the model using alias"""
52
+ return pprint.pformat(self.dict(by_alias=True))
53
+
54
+ def to_json(self) -> str:
55
+ """Returns the JSON representation of the model using alias"""
56
+ return json.dumps(self.to_dict())
57
+
58
+ @classmethod
59
+ def from_json(cls, json_str: str) -> InstrumentEntity:
60
+ """Create an instance of InstrumentEntity from a JSON string"""
61
+ return cls.from_dict(json.loads(json_str))
62
+
63
+ def to_dict(self):
64
+ """Returns the dictionary representation of the model using alias"""
65
+ _dict = self.dict(by_alias=True,
66
+ exclude={
67
+ },
68
+ exclude_none=True)
69
+ # override the default output from pydantic by calling `to_dict()` of prevailing_instrument
70
+ if self.prevailing_instrument:
71
+ _dict['prevailingInstrument'] = self.prevailing_instrument.to_dict()
72
+ # override the default output from pydantic by calling `to_dict()` of deleted_instrument
73
+ if self.deleted_instrument:
74
+ _dict['deletedInstrument'] = self.deleted_instrument.to_dict()
75
+ # override the default output from pydantic by calling `to_dict()` of previewed_instrument
76
+ if self.previewed_instrument:
77
+ _dict['previewedInstrument'] = self.previewed_instrument.to_dict()
78
+ # override the default output from pydantic by calling `to_dict()` of each item in links (list)
79
+ _items = []
80
+ if self.links:
81
+ for _item in self.links:
82
+ if _item:
83
+ _items.append(_item.to_dict())
84
+ _dict['links'] = _items
85
+ # set to None if as_at_version_number (nullable) is None
86
+ # and __fields_set__ contains the field
87
+ if self.as_at_version_number is None and "as_at_version_number" in self.__fields_set__:
88
+ _dict['asAtVersionNumber'] = None
89
+
90
+ # set to None if as_at_deleted (nullable) is None
91
+ # and __fields_set__ contains the field
92
+ if self.as_at_deleted is None and "as_at_deleted" in self.__fields_set__:
93
+ _dict['asAtDeleted'] = None
94
+
95
+ # set to None if user_id_deleted (nullable) is None
96
+ # and __fields_set__ contains the field
97
+ if self.user_id_deleted is None and "user_id_deleted" in self.__fields_set__:
98
+ _dict['userIdDeleted'] = None
99
+
100
+ # set to None if request_id_deleted (nullable) is None
101
+ # and __fields_set__ contains the field
102
+ if self.request_id_deleted is None and "request_id_deleted" in self.__fields_set__:
103
+ _dict['requestIdDeleted'] = None
104
+
105
+ # set to None if effective_at_created (nullable) is None
106
+ # and __fields_set__ contains the field
107
+ if self.effective_at_created is None and "effective_at_created" in self.__fields_set__:
108
+ _dict['effectiveAtCreated'] = None
109
+
110
+ # set to None if previewed_status (nullable) is None
111
+ # and __fields_set__ contains the field
112
+ if self.previewed_status is None and "previewed_status" in self.__fields_set__:
113
+ _dict['previewedStatus'] = None
114
+
115
+ # set to None if links (nullable) is None
116
+ # and __fields_set__ contains the field
117
+ if self.links is None and "links" in self.__fields_set__:
118
+ _dict['links'] = None
119
+
120
+ return _dict
121
+
122
+ @classmethod
123
+ def from_dict(cls, obj: dict) -> InstrumentEntity:
124
+ """Create an instance of InstrumentEntity from a dict"""
125
+ if obj is None:
126
+ return None
127
+
128
+ if not isinstance(obj, dict):
129
+ return InstrumentEntity.parse_obj(obj)
130
+
131
+ _obj = InstrumentEntity.parse_obj({
132
+ "href": obj.get("href"),
133
+ "entity_unique_id": obj.get("entityUniqueId"),
134
+ "as_at_version_number": obj.get("asAtVersionNumber"),
135
+ "status": obj.get("status"),
136
+ "as_at_deleted": obj.get("asAtDeleted"),
137
+ "user_id_deleted": obj.get("userIdDeleted"),
138
+ "request_id_deleted": obj.get("requestIdDeleted"),
139
+ "effective_at_created": obj.get("effectiveAtCreated"),
140
+ "prevailing_instrument": Instrument.from_dict(obj.get("prevailingInstrument")) if obj.get("prevailingInstrument") is not None else None,
141
+ "deleted_instrument": Instrument.from_dict(obj.get("deletedInstrument")) if obj.get("deletedInstrument") is not None else None,
142
+ "previewed_status": obj.get("previewedStatus"),
143
+ "previewed_instrument": Instrument.from_dict(obj.get("previewedInstrument")) if obj.get("previewedInstrument") is not None else None,
144
+ "links": [Link.from_dict(_item) for _item in obj.get("links")] if obj.get("links") is not None else None
145
+ })
146
+ return _obj
@@ -0,0 +1,116 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ LUSID API
5
+
6
+ FINBOURNE Technology # noqa: E501
7
+
8
+ Contact: info@finbourne.com
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+
21
+ from typing import Any, Dict, Optional, Union
22
+ from pydantic.v1 import BaseModel, Field, StrictFloat, StrictInt, StrictStr, constr
23
+ from lusid.models.perpetual_property import PerpetualProperty
24
+ from lusid.models.resource_id import ResourceId
25
+
26
+ class PlacementUpdateRequest(BaseModel):
27
+ """
28
+ A request to create or update a Placement. # noqa: E501
29
+ """
30
+ id: ResourceId = Field(...)
31
+ quantity: Union[StrictFloat, StrictInt] = Field(..., description="The quantity of given instrument ordered.")
32
+ properties: Optional[Dict[str, PerpetualProperty]] = Field(None, description="Client-defined properties associated with this placement.")
33
+ counterparty: Optional[StrictStr] = Field(None, description="Optionally specifies the market entity this placement is placed with.")
34
+ execution_system: Optional[constr(strict=True, max_length=256, min_length=1)] = Field(None, alias="executionSystem", description="Optionally specifies the execution system in use.")
35
+ entry_type: Optional[constr(strict=True, max_length=256, min_length=1)] = Field(None, alias="entryType", description="Optionally specifies the entry type of this placement.")
36
+ __properties = ["id", "quantity", "properties", "counterparty", "executionSystem", "entryType"]
37
+
38
+ class Config:
39
+ """Pydantic configuration"""
40
+ allow_population_by_field_name = True
41
+ validate_assignment = True
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.dict(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ return json.dumps(self.to_dict())
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> PlacementUpdateRequest:
53
+ """Create an instance of PlacementUpdateRequest from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self):
57
+ """Returns the dictionary representation of the model using alias"""
58
+ _dict = self.dict(by_alias=True,
59
+ exclude={
60
+ },
61
+ exclude_none=True)
62
+ # override the default output from pydantic by calling `to_dict()` of id
63
+ if self.id:
64
+ _dict['id'] = self.id.to_dict()
65
+ # override the default output from pydantic by calling `to_dict()` of each value in properties (dict)
66
+ _field_dict = {}
67
+ if self.properties:
68
+ for _key in self.properties:
69
+ if self.properties[_key]:
70
+ _field_dict[_key] = self.properties[_key].to_dict()
71
+ _dict['properties'] = _field_dict
72
+ # set to None if properties (nullable) is None
73
+ # and __fields_set__ contains the field
74
+ if self.properties is None and "properties" in self.__fields_set__:
75
+ _dict['properties'] = None
76
+
77
+ # set to None if counterparty (nullable) is None
78
+ # and __fields_set__ contains the field
79
+ if self.counterparty is None and "counterparty" in self.__fields_set__:
80
+ _dict['counterparty'] = None
81
+
82
+ # set to None if execution_system (nullable) is None
83
+ # and __fields_set__ contains the field
84
+ if self.execution_system is None and "execution_system" in self.__fields_set__:
85
+ _dict['executionSystem'] = None
86
+
87
+ # set to None if entry_type (nullable) is None
88
+ # and __fields_set__ contains the field
89
+ if self.entry_type is None and "entry_type" in self.__fields_set__:
90
+ _dict['entryType'] = None
91
+
92
+ return _dict
93
+
94
+ @classmethod
95
+ def from_dict(cls, obj: dict) -> PlacementUpdateRequest:
96
+ """Create an instance of PlacementUpdateRequest from a dict"""
97
+ if obj is None:
98
+ return None
99
+
100
+ if not isinstance(obj, dict):
101
+ return PlacementUpdateRequest.parse_obj(obj)
102
+
103
+ _obj = PlacementUpdateRequest.parse_obj({
104
+ "id": ResourceId.from_dict(obj.get("id")) if obj.get("id") is not None else None,
105
+ "quantity": obj.get("quantity"),
106
+ "properties": dict(
107
+ (_k, PerpetualProperty.from_dict(_v))
108
+ for _k, _v in obj.get("properties").items()
109
+ )
110
+ if obj.get("properties") is not None
111
+ else None,
112
+ "counterparty": obj.get("counterparty"),
113
+ "execution_system": obj.get("executionSystem"),
114
+ "entry_type": obj.get("entryType")
115
+ })
116
+ return _obj