Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?
$brokerageName = "Terminal Link";
$deploymentDetails = [
"terminal-link-server-auth-id" => "The Server Auth Id, which is the unique user identifier (UUID) of the Bloomberg Anywhere user.",
"terminal-link-emsx-broker" => "The EMSX broker that receives the orders.",
"terminal-link-emsx-account" => "The EMSX account to which LEAN routes orders.",
"terminal-link-emsx-team" => "The EMSX team account that receives events of your team's orders. It's empty if you didn't set one."
];
include(DOCS_RESOURCES."/live-trading/deployment-details.php");
?>
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ <h4>200 Success</h4>
<td width="20%">serverStatistics</td> <td> <code>ServerStatistics object</code> <br/> Status of the node that runs the live algorithm, including its CPU and RAM usage. It's empty if the algorithm is not running.</td>
</tr>
<tr>
<td width="20%">deploymentDetails</td> <td> <code>string object</code> <br/> Details the brokerage, data provider or any other component shares about the deployment, like account information. It's omitted if the deployment reported none.</td>
</tr>
<tr>
<td width="20%">charts</td> <td> <code>ChartSummary object</code> <br/> Contains the names of all charts.</td>
</tr>
<tr>
Expand Down Expand Up @@ -113,6 +116,9 @@ <h4>200 Success</h4>
"LEAN Version": "v2.5.0.0.18009",
"Up Time": "0d 00:00:03"
},
"deploymentDetails": {
"key": "string"
},
"charts": {
"name": "string"
},
Expand Down
7 changes: 7 additions & 0 deletions QuantConnect-Platform-2.0.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5331,6 +5331,13 @@ components:
description: >-
Status of the node that runs the live algorithm, including its CPU and RAM usage.
It's empty if the algorithm is not running.
deploymentDetails:
type: object
additionalProperties:
type: string
description: >-
Details the brokerage, data provider or any other component shares about the deployment,
like account information. It's omitted if the deployment reported none.
charts:
$ref: '#/components/schemas/ChartSummary'
description: Chart updates for the live algorithm since the last result packet.
Expand Down
35 changes: 35 additions & 0 deletions Resources/live-trading/deployment-details.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?
// $brokerageName: the brokerage that shares the details.
// $deploymentDetails: key => description of each detail the brokerage shares.
?>
<p>When you deploy a live algorithm with <?=$brokerageName?>, the brokerage shares some details of the deployment, like the account it trades. Use them to tell concurrent deployments apart or to check that the algorithm connected to the account you expect. The details never include credentials.</p>

<p>The following table describes the deployment details that <?=$brokerageName?> shares:</p>

<table class="qc-table table" id="deployment-details-table">
<thead>
<tr>
<th>Key</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<? foreach ($deploymentDetails as $key => $description) { ?>
<tr>
<td><code><?=$key?></code></td>
<td><?=$description?></td>
</tr>
<? } ?>
</tbody>
</table>

<p>The<code class="csharp">DeploymentDetails</code><code class="python">deployment_details</code> property of your algorithm is a read-only dictionary of the details. LEAN populates it before it calls the <code class="csharp">Initialize</code><code class="python">initialize</code> method, so you can read it anywhere in your algorithm.</p>

<div class="section-example-container">
<pre class="csharp">var deploymentDetails = DeploymentDetails.Select(kvp => $"{kvp.Key}:{kvp.Value}");
Log($"deploymentDetails: {string.Join(", ", deploymentDetails)}");</pre>
<pre class="python">deployment_details = [f'{kvp.key}:{kvp.value}' for kvp in self.deployment_details]
self.log(f'deployment_details: {deployment_details}')</pre>
</div>

<p>The <a href='/docs/v2/cloud-platform/api-reference/live-management/read-live-algorithm/live-algorithm-statistics'>/live/read</a> API endpoint also returns the details in its <code>deploymentDetails</code> field, so you can read them outside of the algorithm.</p>
2 changes: 1 addition & 1 deletion code-generators/API-Reference-Code-Generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ def _example_additional_props(self, add_prop, ref_queue, indent):
if "type" in add_prop:
prop_type = self._normalize_type(add_prop["type"])
if isinstance(prop_type, str):
return f'"{prop_type}"', f"{prop_type} object"
return f'{{\n{tab} "key": "{prop_type}"\n{tab} }}', f"{prop_type} object"
# dict type with format (edge case)
fmt = prop_type.get("format", "")
type_label = f'{prop_type}$({fmt}) object'
Expand Down