Investment Orders
- We introduce the concept of 'order intent', allowing you to input partial order information and carry out investor suitability checks. Once all validation errors have been addressed, you can proceed to confirm the 'order intent', culminating in the placement of an order.
- Alternatively, you can opt to directly create an order. Should there be any investor suitability errors, the API will promptly respond with an error message.
# Fetch account to verify it is ready for trade
account_fetch_url = f"{base_url}/accounts/{account_id}"
headers = {
"accept": "application/json",
"caliber-api-key": caliber_api_key,
"caliber-individual-id": party_id
}
account_fetch_response = requests.get(account_fetch_url, headers=headers)
print(json.dumps(account_fetch_response.json(), indent = 2))
# Placing an order intent to go through order validations
# Start by choosing the order type, fund instrument and order amount
order_intent_creation_url = f"{base_url}/order-intents"
headers = {
"accept": "application/json",
"caliber-api-key": caliber_api_key,
"caliber-idempotency-key": str(uuid.uuid4())
}
partial_order_intent_object = {
"order_type": "buy",
"instrument_id": selected_instrument_id,
"amount": {
"currency": "USD",
"amount": 1000000
}
}
partial_order_intent_response = requests.post(order_intent_creation_url, headers=headers, json = partial_order_intent_object)
order_intent_id = partial_order_intent_response.json()['id']
print(f"Check order intent for 'requires_action':\n {json.dumps(partial_order_intent_response.json(), indent = 2)}")
#Now lets choose the account and funding method for the order
complete_order_intent = f"{base_url}/order-intents/{order_intent_id}"
headers = {
"accept": "application/json",
"caliber-api-key": caliber_api_key,
"caliber-idempotency-key": str(uuid.uuid4())
}
complete_order_intent_object = {
"account_id": account_id,
"payment_method_id": payment_method_id
}
complete_order_intent_response = requests.patch(complete_order_intent, headers=headers, json = complete_order_intent_object)
print(f"Check order intent for 'requires_action':\n {json.dumps(complete_order_intent_response.json(), indent = 2)}")
confirm_order_url = f"{base_url}/order-intents/{order_intent_id}/confirm"
headers = {
"accept": "application/json",
"caliber-api-key": caliber_api_key,
"caliber-idempotency-key": str(uuid.uuid4()),
"caliber-individual-id": party_id
}
confirm_order_intent_response = requests.post(confirm_order_url, headers=headers)
order_id = confirm_order_intent_response.json()['id']
print(f"Order created :\n {json.dumps(confirm_order_intent_response.json(), indent = 2)}")
{
"id": "5397aca9-ebe5-4055-80e2-9d0bbbbbc92e",
"account_type": "individual",
"name": "John Doe Individual Account",
"status": "ready_to_trade",
"created_at": "2023-06-22T16:44:41.693780Z",
"updated_at": "2023-06-22T16:44:41.694395Z",
"verifications": {
"identity": "approved",
"accreditation": "approved",
"authorized_signatories": "not_started"
},
"related_parties": [
{
"relationship_id": "801505e0-e2d7-4c08-bccc-10b907603fc9",
"related_account_id": "5397aca9-ebe5-4055-80e2-9d0bbbbbc92e",
"related_party_id": "783cb646-87bb-4866-a0e3-99aeb1cedf6e",
"related_party": {
"id": "783cb646-87bb-4866-a0e3-99aeb1cedf6e",
"party_type": "individual",
"verifications": {
"identity": "approved",
"accreditation": "approved",
"authorized_signatories": "not_started"
},
"relationships": {
"accounts": [
{
"relationship_id": "801505e0-e2d7-4c08-bccc-10b907603fc9",
"party_id": "783cb646-87bb-4866-a0e3-99aeb1cedf6e",
"related_account_id": "5397aca9-ebe5-4055-80e2-9d0bbbbbc92e",
"related_account": {
"id": "5397aca9-ebe5-4055-80e2-9d0bbbbbc92e",
"account_type": "individual",
"name": "John Doe Individual Account",
"ready_to_trade": "inactive",
"created_at": "2023-06-22T16:44:41.693780Z",
"updated_at": "2023-06-22T16:44:41.694395Z",
"verifications": {
"identity": "approved",
"accreditation": "approved",
"authorized_signatories": "not_started"
}
},
"metadata": {},
"relationship_properties": {
"relationship_percentage": 1.0,
"relationship_role": "owner"
}
}
],
"parties": {
"parent_parties": [],
"child_parties": []
}
},
"individual": {
"id": "783cb646-87bb-4866-a0e3-99aeb1cedf6e",
"status": "inactive",
"primary_phone": "+13124022333",
"primary_email": "[email protected]",
"addresses": [
{
"id": "e8a46bb5-e59b-45fa-a43c-32a8ca8eb213",
"address_type": "primary",
"address_line_1": "111 NE 2nd Ave",
"address_line_2": null,
"address_line_3": null,
"city": "Miami",
"region": "FL",
"postal_code": "33132",
"country": "US",
"created_at": "2023-06-22T16:02:51.750196Z",
"updated_at": "2023-06-22T16:02:51.750710Z",
"metadata": {}
},
{
"id": "c227a904-e93f-4ea3-bea6-5845b61ca3b1",
"address_type": "legal",
"address_line_1": "112 NE 2nd Ave",
"address_line_2": null,
"address_line_3": null,
"city": "Miami",
"region": "FL",
"postal_code": "33132",
"country": "US",
"created_at": "2023-06-22T16:03:03.666385Z",
"updated_at": "2023-06-22T16:03:03.667096Z",
"metadata": {}
}
],
"documents": [
{
"id": "7a03a92c-3387-4758-a809-1a3f109efbc0",
"name": "John Doe Passport",
"description": null,
"purpose": "identity",
"document_type": "passport",
"document_subtype": null,
"party_id": "783cb646-87bb-4866-a0e3-99aeb1cedf6e",
"file_url": "https://storage.googleapis.com/poolit-platform-development-usc1-poolit-platform-api/Document/7a03a92c-3387-4758-a809-1a3f109efbc0/e22711b8dbb44eea6d4e850c0010a986c30f285da17a379e95.jpg?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=poolit-platform-api%40poolit-platform-development.iam.gserviceaccount.com%2F20230622%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20230622T164823Z&X-Goog-Expires=86400&X-Goog-SignedHeaders=host&X-Goog-Signature=67212b54f98ea82c96c4f302e80a20585396d24949eb881de3de2a542fd3fcd38ccccc0f0be3b49e35e7b771da53c5ce6826f05f98d2421c91e43ea279732d213e85383bcad26e2973bede75f6bda211f1ae8b2b2ef5e0555354615b5d804ed5a558f5e7385c6f5b3297083baa2d6cff91c09b8dbdb34fb63824b838c55103ffef5a13278875e827b152b91dae1a784c937043e5c766efafed5cdc0f1a3f4aebd0f5867be81a9aef1c66219dc433379ec700514641840ef52934f7b38faeeaa8bf458901174bdf603cf3185ef2a8e7e3671cca8e18eb3b6caea2d9d7b31628760073e1c111fbb49a8da8a9b224a246336285d65116593a3250c3449d573ff75a",
"metadata": {}
},
{
"id": "d276aff0-b139-42f1-954a-5f991462a01a",
"name": "John Doe Passport",
"description": null,
"purpose": "identity",
"document_type": "passport",
"document_subtype": null,
"party_id": "783cb646-87bb-4866-a0e3-99aeb1cedf6e",
"file_url": "https://storage.googleapis.com/poolit-platform-development-usc1-poolit-platform-api/Document/d276aff0-b139-42f1-954a-5f991462a01a/e22711b8dbb44eea6d4e850c0010a986c30f285da17a379e95.jpg?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=poolit-platform-api%40poolit-platform-development.iam.gserviceaccount.com%2F20230622%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20230622T164823Z&X-Goog-Expires=86400&X-Goog-SignedHeaders=host&X-Goog-Signature=716959857147e9efbd3d2491bffb18e7200e3826981c64a987b0e1ef2f6924a8eb1acf2408a06864595a5063990eae950de4155343c5691ef46a197e56b8f935ccc1c97a490fb143105dd75517f57397ecf335afd0edc39ca6d7e4d9b0b9cf3bbb36e8d0bf98b76fbbf22c4b136549afd22c3b722edf7c6b308dc4f1b8fe0747807791749189647fa2be2f7730a92fe6466a835d21c89eb391cacc80a20ff1800087e2ae7a03a29618ba9b25f9fa346e721dc26d1fbc64a86c241c1bc06e24ed8a158aafdb97aea78ad11d3db05af236e8ece56663568837c4d62234185f5e93bb1a55004eb483fef195cc895d830e28320324b52726745461658f05734e0c29",
"metadata": {}
}
],
"tax_id": {
"tax_id_type": "ssn",
"tax_id_value": "312426550"
},
"created_at": "2023-06-22T16:02:51.743354Z",
"updated_at": "2023-06-22T16:02:51.743992Z",
"metadata": {},
"accredited_investor_type": "annual_income_over_threshold",
"first_name": "John",
"middle_name": "",
"last_name": "Doe",
"date_of_birth": "1990-04-21",
"country_of_residence": "US",
"region_of_residence": "FL"
}
},
"relationship_type": "owner",
"created_at": "2023-06-22T16:44:42.271353Z",
"updated_at": "2023-06-22T16:44:42.271949Z"
}
]
}
Check order intent for 'requires_action':
{
"id": "ca3950d3-6221-47c0-9de7-59923424afd0",
"instrument_id": "2a56f665-42ae-40bb-98de-2d0ba44c7338",
"instrument": 5,
"account": 15,
"account_id": "5397aca9-ebe5-4055-80e2-9d0bbbbbc92e",
"order_type": "buy",
"payment_method_id": "c21eb16e-f886-485f-b2e3-878c78201988",
"payment_method": 14,
"amount": {
"amount": "1000000.00",
"currency": "USD"
},
"net_amount": null,
"fees": {
"instrument_fees": {
"expense_cap_fee": {
"type": "recurring",
"fee_period": "quarterly",
"charge_period": "quarterly",
"fee_percentage": 0.625,
"fee_amount": null
},
"performance_fee": {
"type": "recurring",
"fee_period": "quarterly",
"charge_period": "quarterly",
"fee_percentage": 0.0,
"fee_amount": null
},
"management_fee": {
"type": "recurring",
"fee_period": "quarterly",
"charge_period": "quarterly",
"fee_percentage": 1.0,
"fee_amount": null
}
},
"origination": {
"fee_percentage": 0.0,
"amount": {
"amount": 0.0,
"currency": "USD"
}
},
"transaction": {
"fee_percentage": 0.0,
"amount": {
"amount": 0.0,
"currency": "USD"
}
}
},
"funding_schedules": [],
"requires_action": {},
"order_id": null,
"order": null,
"created_by_id": 57,
"created_by": 57,
"created_at": "2023-06-22T16:48:24.004191Z",
"updated_at": "2023-06-22T16:48:24.004814Z",
"metadata": null
}
Order created :
{
"id": "360ae68c-7a89-4785-a14d-3895fa3c565b",
"instrument_id": "2a56f665-42ae-40bb-98de-2d0ba44c7338",
"instrument": 5,
"account": 15,
"account_id": "5397aca9-ebe5-4055-80e2-9d0bbbbbc92e",
"order_type": "buy",
"payment_method_id": "c21eb16e-f886-485f-b2e3-878c78201988",
"payment_method": 14,
"amount": {
"amount": "1000000.00",
"currency": "USD"
},
"net_amount": {
"amount": "1000000.00",
"currency": "USD"
},
"fees": {
"instrument_fees": {
"expense_cap_fee": {
"type": "recurring",
"fee_period": "quarterly",
"charge_period": "quarterly",
"fee_percentage": 0.625,
"fee_amount": null
},
"performance_fee": {
"type": "recurring",
"fee_period": "quarterly",
"charge_period": "quarterly",
"fee_percentage": 0.0,
"fee_amount": null
},
"management_fee": {
"type": "recurring",
"fee_period": "quarterly",
"charge_period": "quarterly",
"fee_percentage": 1.0,
"fee_amount": null
}
},
"origination": {
"fee_percentage": 0.0,
"amount": {
"amount": 0.0,
"currency": "USD"
}
},
"transaction": {
"fee_percentage": 0.0,
"amount": {
"amount": 0.0,
"currency": "USD"
}
}
},
"funding_schedules": [],
"status": "requires_signature",
"order_reference": "ZQVB-5424",
"created_by_id": "51a4fbbc-9bc4-43f8-8e3c-086c93a5ffea",
"created_by": 57,
"created_at": "2023-06-22T16:48:24.519443Z",
"updated_at": "2023-06-22T16:48:24.520258Z",
"metadata": null
}
Updated over 1 year ago