Improve the definition of the Position context type
- Dominant language
- TypeScript
- Stars
- 270
- Forks
- 193
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 32
Description
## Enhancement Request
FDC3 already defines a Position context type, however, it is more simplistic than necessary. Enhance the existing type to better represent a Position.
### Use Case:
Provide a more accurate represent a financial position relating to a specified instrument, which may be used to visualize or otherwise analyze that position. May also be used to compose a type representing a Portfolio.
### Contexts
#### Position
Represents a financial position (a holding in a particular instrument).
The `Position` type goes hand-in-hand with the `Portfolio` type, which represents
multiple holdings in a combination of instruments.
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 this part of the contract with custom identifiers if so desired.
##### Details
| Property | Type | Required | Example Value |
|--------------|------------|----------|------------------------------------|
| `type` | string | Yes | `'fdc3.position'` |
| `id` | object | No | `{ positionId: '6475' }` |
| `name` | string | No | `'My Apple shares'` |
| `instrument` | Instrument | Yes | `{ type: 'fdc3.instrument', ... }` |
| `holding` | number | Yes | `2000000` |
| `trades` | TradeList * | No | `[{ type: 'fdc3.trade, ... }, ... ]` |
| `basis` | Valuation ** | No | `{ type: 'fdc3.valuation', ... }` |
| `current` | Valuation ** | No | `{ type: 'fdc3.valuation', ... }` |
| `gain` | number | No | `8000000` |
| `restricted` | number | No | `4000` |
\* See issue #655
\*\* See issue #652
##### Example
```js
const position = {
type: "fdc3.position",
instrument: {
type: "fdc3.instrument",
id: {
ticker: "AAPL"
}
},
holding: 2000000,
trades: [{
type: "fdc3.trade",
instrument: {
type: "fdc3.instrument",
id: {
ticker: "AAPL"
}
},
tradeTimeRange: {
type: "fdc3.timeRange",
starttime: "2020-09-01T08:00:00.000Z"
},
settleTimeRange: {
type: "fdc3.timeRange",
starttime: "2020-09-02T08:00:00.000Z"
},
quantity: {
units: 1000000
},
open: {
type: 'fdc3.valuation',
value: 20000000.0,
price: 20.0,
CURRENCY_ISOCODE: 'USD'
},
location: "XYZ",
account: "cash"
},
{
type: "fdc3.trade",
instrument: {
type: "fdc3.instrument",
id: {
ticker: "AAPL"
}
},
tradeTimeRange: {
type: "fdc3.timeRange",
starttime: "2020-09-08T08:00:00.000Z"
},
settleTimeRange: {
type: "fdc3.timeRange",
starttime: "2020-09-09T08:00:00.000Z"
},
quantity: {
units: 1000000
},
open: {
type: 'fdc3.valuation',
value: 22000000.0,
price: 22.0,
CURRENCY_ISOCODE: 'USD'
},
location: "XYZ",
account: "cash"
}
],
basis: {
type: "fdc3.valuation",
price: 21.00,
value: 42000000,
CURRENCY_ISOCODE: 'USD'
},
current: {
type: "fdc3.valuation",
price: 25.00,
value: 50000000,
CURRENCY_ISOCODE: 'USD'
code: "USD"
}
},
gain: 8000000,
restricted: 0
};
fdc3.raiseIntent("ViewChart", position);
```
### Additional Information
... please add any other information that can provide additional detail for this enhancement request
Contributor guide
Assessment
This issue has not been assessed yet.