Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE - to be superceded] 442 Define more context types used to visualize (or otherwise represent) financial data #443

Closed
wants to merge 19 commits into from
Closed
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.log
.DS_Store
.project
node_modules
dist
coverage
Expand Down
88 changes: 88 additions & 0 deletions docs/context/ref/Chart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
id: Chart
sidebar_label: Chart
title: Chart
hide_title: true
---
# `Chart`

A Chart is a visualization of data for a financial instrument or a set of instruments. A chart displays the data for a specific date range, and uses a specific style, such as lines, bars, etc. [Indicators](Indicator) may be added to a chart to enhance the visualization.

Notes:

- Chart Data is not included in this schema.
- The 'style' property may be set to 'line', 'mountain', 'bar', 'candle', etc.
- The first instrument is always the primary instrument for the chart, any additional instruments are secondary.


## 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 | `[instrument1, instrument2]` |
| `range` | DateRange | No | `dateRange` |
| `style` | string | No | `'line'` |
| `indicators` | Indicator[] | No | `[indicator1, indicator2]` |

## Example

```js
const chart = {
type: "fdc3.chart",
instruments: [
{
type: "fdc3.instrument",
id: {
ticker: "AAPL"
}
},
{
type: "fdc3.instrument",
id: {
ticker: "GOOG"
}
}
],
range: {
type: "fdc3.dateRange",
starttime: "2020-09-01T08:00:00.000Z",
endtime: "2020-10-31T08:00:00.000Z"
},
style: "line",
indicators: [
{
type: "fdc3.indicator",
name: "ma",
parameters: {
period: 14,
type: "ema"
}
},
{
type: "fdc3.indicator",
name: "volume"
}
]
}

fdc3.raiseIntent("ViewChart", chart)
```

## See Also

Other Types
- [DateRange](DateRange)
- [Indicator](Indicator)
- [Instrument](Instrument)

Intents
- [ViewChart](../../intents/ref/ViewChart)
1 change: 1 addition & 0 deletions docs/context/ref/ContactList.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const contacts = {
},
]
}

fdc3.raiseIntent("StartChat", contacts)
```

Expand Down
47 changes: 47 additions & 0 deletions docs/context/ref/Currency.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
id: Currency
sidebar_label: Currency
title: Currency
hide_title: true
---
# `Currency`

An entity that can be used when referencing currency that can be used on its own as well as in other contexts when adding additional attributes e.g. when adding details to a Valuation. The currency code used to identify the currency should conform to ISO 4217.

## Type

`fdc3.currency`

## Schema

https://fdc3.finos.org/schemas/next/currency.schema.json

## Details

| Property | Type | Required | Example Value |
|------------------|---------|----------|----------------------|
| `type` | string | Yes | `'fdc3.currency'` |
| `name` | string | No | `'US Dollar'` |
| `ISOCODE` | string | Yes | `'USD'` |


## Example

```js
const currency = {
type: "fdc3.currency",
name: "US Dollar",
ISOCODE: "USD"
}

fdc3.broadcast(currency)
```

## See Also

Other Types
- [Valuation](Valuation)

Intents
- [ViewAnalysis](../../intents/ref/viewAnalysis)
- [ViewNews](../../intents/ref/ViewNews)
47 changes: 47 additions & 0 deletions docs/context/ref/DateRange.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
id: DateRange
sidebar_label: DateRange
title: DateRange
hide_title: true
---
# `DateRange`

A DateRange is a definition of a range of time, consisting of a start and end time. This type is a good example of a building block type, which can be used as a component of another type, such as [Chart](Chart).


## Type

`fdc3.dateRange`

## Schema

https://fdc3.finos.org/schemas/next/dateRange.schema.json

## Details

| Property | Type | Required | Example Value |
|------------------|---------|----------|---------------------------------|
| `type` | string | Yes | `'fdc3.dateRange'` |
| `starttime` | string | No | `'2020-09-01T08:00:00.000Z'` |
| `endtime` | string | No | `'2020-10-31T08:00:00.000Z'` |

## Example

```js
const dateRange = {
type: "fdc3.dateRange",
starttime: "2020-09-01T08:00:00.000Z",
endtime: "2020-10-31T08:00:00.000Z"
}

fdc3.broadcast(dateRange)
```

## See Also

Other Types
- [Chart](Chart)
- [Trade](Trade)

Intents
- [ViewChart](../../intents/ref/ViewChart)
73 changes: 73 additions & 0 deletions docs/context/ref/Indicator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
id: Indicator
sidebar_label: Indicator
title: Indicator
hide_title: true
---
# `Indicator`

An Indicator is a function or transformation performed on data and used to measure current conditions as well as to forecast trends. It is usually seen plotted on a financial chart. This context type is a good example of a building block which can be used as a component of another context type, such as [Chart](Chart).

Indicators usually utilize some input arguments. This specification enumerates some of the more common ones.

Notes:


- values for matype are generally 'simple', 'exponential', etc, or whatever is supported by chart.
- values for field are generally: 'Close', 'Open', 'High', 'Low', 'Volume', or `refid` value of another indicator.
- The following indicators should be implemented by consumers of this message:
- Moving Average. name='ma'.
- Volume. name='volume'.
- Standard Deviation. name='stddev'.
- Average True Range. name='atr'.
- Bollinger Bands. name='bollbands'.
- Price Relative. name='pricerel'.
- More indicators can be supported at a later revision of the schema. As of now any other indicator would be implementation specific.
- Uncommon properties of an indicator are not defined explicitly in the specification; however, they can be included in the 'custom' object. To direct custom parameters to specific implementation, add a 'vendor' key to the custom object.
- Missing parameters will be assigned by the receiving application according to its implementation.

## Type

`fdc3.indicator`

## Schema

https://fdc3.finos.org/schemas/next/indicator.schema.json

## Details

| Property | Type | Required | Example Value |
|----------------------------|------------|----------|--------------------|
| `type` | string | Yes | `'fdc3.indicator'` |
| `name` | string | Yes | `'ma'` |
| `refid` | string | No | `'ma-1'` |
| `parameters.period` | number | No | `14` |
| `parameters.matype` | string | No | `'ema'` |
| `parameters.field` | string | No | `'Close'` |
| `parameters.instrument` | Instrument | No | `instrument` |
| `parameters.custom.vendor` | string | No | `vendor1` |
| `parameters.custom.fields` | object | No | `{'Offset': 2}` |

## Example

```js
const indicator = {
type: "fdc3.indicator",
name: "ma",
parameters: {
period: 14,
matype: "ema"
}
}

fdc3.broadcast(indicator)
```

## See Also

Other Types
- [Chart](Chart)
- [Instrument](Instrument)

Intents
- [ViewChart](../../intents/ref/ViewChart)
84 changes: 79 additions & 5 deletions docs/context/ref/Position.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ hide_title: true
---
# `Position`

A financial position made up of an instrument and a holding in that instrument. This type is a good
A financial position is made up of an instrument and a holding in that instrument. This type is a good
example of how new context types can be composed from existing types.

In this case, the instrument and the holding amount for that instrument are required values.
Expand All @@ -16,8 +16,7 @@ multiple holdings in a combination of instruments.

Notes:

- Like all other FDC3 context types, extra properties for the position can be added, the schema just
specifies the minimum contract.
- Some of the more common additional properties of a position are provided in the schema. Depending on the type of application sending the context, these properties may be populated or left out.

- The position schema does not explicitly include identifiers in the `id` section, as there
is not a common standard for such identifiers. Applications can, however, populate
Expand All @@ -38,8 +37,13 @@ https://fdc3.finos.org/schemas/next/position.schema.json
| `type` | string | Yes | `'fdc3.position'` |
| `id` | object | No | `{ positionId: '6475' }` |
| `name` | string | No | `'My Apple shares'` |
| `holding` | number | Yes | `2000000` |
| `instrument` | Instrument | Yes | `{ type: 'fdc3.instrument', ... }` |
| `holding` | number | Yes | `2000000` |
| `trades` | Trade[] | No | `[trade1, trade2]` |
| `basis` | Valuation | No | `{ type: 'fdc3.valuation', ... }` |
| `current` | Valuation | No | `{ type: 'fdc3.valuation', ... }` |
| `gain` | number | No | `8000000` |
| `restricted` | number | No | `4000` |

## Example

Expand All @@ -52,7 +56,75 @@ const position = {
ticker: "AAPL"
}
},
holding: 2000000
holding: 2000000,
trades: [
{
type: "fdc3.trade",
tradedaterange: {
type: "fdc3.dateRange",
starttime: "2020-09-01T08:00:00.000Z"
},
settledaterange: {
type: "fdc3.dateRange",
starttime: "2020-09-02T08:00:00.000Z"
},
units: 1000000,
open: {
type: "fdc3.valuation",
price: 20.00,
value: 20000000,
currency: {
type: "fdc3.currency",
code: "USD"
}
},
location: "XYZ",
account: "cash"
},
{
type: "fdc3.trade",
tradedaterange: {
type: "fdc3.dateRange",
starttime: "2020-09-08T08:00:00.000Z"
},
settledaterange: {
type: "fdc3.dateRange",
starttime: "2020-09-09T08:00:00.000Z"
},
units: 1000000,
open: {
type: "fdc3.valuation",
price: 22.00,
value: 22000000,
currency: {
type: "fdc3.currency",
code: "USD"
}
},
location: "XYZ",
account: "cash"
}
],
basis: {
type: "fdc3.valuation",
price: 21.00,
value: 42000000,
currency: {
type: "fdc3.currency",
code: "USD"
}
},
current: {
type: "fdc3.valuation",
price: 25.00,
value: 50000000,
currency: {
type: "fdc3.currency",
code: "USD"
}
},
gain: 8000000,
restricted: 0
}

fdc3.raiseIntent("ViewChart", position)
Expand All @@ -62,7 +134,9 @@ fdc3.raiseIntent("ViewChart", position)

Other Types
- [Instrument](Instrument)
- [Trade](Trade)
- [Portfolio](Portfolio)
- [Valuation](Valuation)

Intents
- [ViewAnalysis](../../intents/ref/ViewAnalysis)
Expand Down
Loading