-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #715 from finos/654-chart-context-type
654 chart context type
- Loading branch information
Showing
10 changed files
with
215 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
--- | ||
id: Chart | ||
sidebar_label: Chart | ||
title: Chart | ||
hide_title: true | ||
--- | ||
# `Chart` | ||
|
||
A context type representing details of a Chart, which may be used to request plotting of a particular chart or to otherwise share details of its composition, such as: | ||
|
||
* A list of instruments for comparison | ||
* The time period to plot the chart over | ||
* The style of chart (line, bar, mountain, candle etc.) | ||
* Other settings such as indicators to calculate, or data representing drawings and annotations | ||
|
||
In addition to handling requests to plot charts, a charting application may use this type to output a representation of what it is currently displaying so that it can be recorded by another application. | ||
|
||
## Type | ||
|
||
`fdc3.chart` | ||
|
||
## Schema | ||
|
||
https://fdc3.finos.org/schemas/next/chart.schema.json | ||
|
||
## Details | ||
|
||
| Property | Type | Required | Example Value | | ||
|------------------|-----------------|----------|----------------------| | ||
| `type` | string | Yes | `'fdc3.chart'` | | ||
| `instruments` | Instrument[] | Yes | <pre>[<br>  {<br>    "type": "fdc3.instrument",<br>    "id": {<br>      "ticker": "AAPL"<br>    }<br>  },<br>  {<br>    "type": "fdc3.instrument",<br>    "id": {<br>      "ticker": "MSFT"<br>    }<br>  }<br>]</pre> | | ||
| `range` | TimeRange | No | <pre>{<br>  "type": "fdc3.timerange",<br>  "startTime": "2022-03-30T15:44:44+00:00",<br>  "endTime": "2022-04-30T23:59:59+00:00"<br>}</pre> | | ||
| `style` | string | No | one of: `'line'`, `'bar'`, `'stacked-bar'`, `'mountain'`, `'candle'`, `'pie'`, `'scatter'`, `'histogram'`, `'heatmap'`, `'custom'` | | ||
| `otherConfig`* | object | No | `{ /* unstandardized additional config */}` | | ||
|
||
\* It is common for charts to support other configuration, such as indicators, annotations etc., which do not have standarized formats, but may be included in the `otherConfig` element. | ||
|
||
## Example | ||
|
||
```js | ||
const chart = { | ||
type: "fdc3.chart", | ||
instruments: [ | ||
{ | ||
type: "fdc3.instrument", | ||
id: { | ||
ticker: "AAPL" | ||
} | ||
}, | ||
{ | ||
type: "fdc3.instrument", | ||
id: { | ||
ticker: "GOOG" | ||
} | ||
} | ||
], | ||
range: { | ||
type: "fdc3.timeRange", | ||
startTime: "2020-09-01T08:00:00.000Z", | ||
endTime: "2020-10-31T08:00:00.000Z" | ||
}, | ||
style: "line", | ||
otherConfig: { | ||
indicators: [ | ||
{ | ||
name: "ma", | ||
parameters: { | ||
period: 14, | ||
type: "ema" | ||
} | ||
}, | ||
{ | ||
name: "volume" | ||
} | ||
] | ||
} | ||
}; | ||
|
||
fdc3.raiseIntent("ViewChart", chart); | ||
``` | ||
|
||
## See Also | ||
|
||
Other Types | ||
|
||
* [Instrument](Instrument) | ||
* [TimeRange](TimeRange) | ||
|
||
Intents | ||
|
||
* [ViewChart](../../intents/ref/ViewChart) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,3 +75,9 @@ const timeRange = { | |
endTime: "2022-03-30T16:44:44.123Z" | ||
} | ||
``` | ||
|
||
## See Also | ||
|
||
Other Types | ||
|
||
- [Chart](Chart) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "https://fdc3.finos.org/schemas/next/chart.schema.json", | ||
"type": "object", | ||
"title": "Chart", | ||
"allOf": [{ "$ref": "context.schema.json#" }], | ||
"properties": { | ||
"type": { "const": "fdc3.chart" }, | ||
"instruments": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "instrument.schema.json#" | ||
} | ||
}, | ||
"range": { | ||
"$ref": "timerange.schema.json#" | ||
}, | ||
"style": { | ||
"type": "string", | ||
"enum": [ "line", "bar", "stacked-bar", "mountain", "candle", "pie", "scatter", "histogram", "heatmap", "custom"] | ||
}, | ||
"otherConfig": { | ||
"type": "object" | ||
} | ||
}, | ||
"required": ["instruments"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "https://fdc3.finos.org/schemas/next/chart.schema.json", | ||
"type": "object", | ||
"title": "Chart", | ||
"allOf": [{ "$ref": "context.schema.json#" }], | ||
"properties": { | ||
"type": { "const": "fdc3.chart" }, | ||
"instruments": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "instrument.schema.json#" | ||
} | ||
}, | ||
"range": { | ||
"$ref": "timerange.schema.json#" | ||
}, | ||
"style": { | ||
"type": "string", | ||
"enum": [ "line", "bar", "stacked-bar", "mountain", "candle", "pie", "scatter", "histogram", "heatmap", "custom"] | ||
}, | ||
"otherConfig": { | ||
"type": "object" | ||
} | ||
}, | ||
"required": ["instruments"] | ||
} |