Example
<cr-component id="component" name="portfolio-tlh-report"></cr-component>
<script>
const component = document.querySelector("#component");
component.init({
trades: [
{
date: "20210603",
type: "buy",
symbolId: 86953,
price: 130.12,
shares: 93.35558,
},
{
date: "20210603",
type: "buy",
symbolId: 128992,
price: 160.25,
shares: 59.45048,
},
{
date: "20210603",
type: "buy",
symbolId: 160809,
price: 9862.9019,
shares: 1.08875,
},
{
date: "20210603",
type: "buy",
symbolId: 181926,
price: 11.7458,
shares: 370.68347,
},
{
date: "20210604",
type: "buy",
symbolId: 27321,
price: 27.0168,
shares: 26048967,
},
{
date: "20210604",
type: "buy",
symbolId: 66648,
price: 30.04,
shares: 235.17536,
},
{
date: "20210604",
type: "buy",
symbolId: 79191,
price: 119.93,
shares: 25.04592,
},
{
date: "20210604",
type: "buy",
symbolId: 86953,
price: 130.14,
shares: 0.0453,
},
{
date: "20210604",
type: "buy",
symbolId: 89785,
price: 255.95,
shares: 21.82357,
},
{
date: "20210604",
type: "buy",
symbolId: 114010,
price: 135.79,
shares: 24.11588,
},
{
date: "20210604",
type: "buy",
symbolId: 128992,
price: 160.28,
shares: 0.01373,
},
{
date: "20210604",
type: "buy",
symbolId: 129649,
price: 19.0433,
shares: 236.92861,
},
{
date: "20210604",
type: "buy",
symbolId: 130970,
price: 164.4,
shares: 36.64122,
},
{
date: "20210604",
type: "buy",
symbolId: 181926,
price: 105.96,
shares: 3047294,
},
{
date: "20210604",
type: "buy",
symbolId: 160809,
price: 9862.4368,
shares: 0.00032,
},
{
date: "20210604",
type: "buy",
symbolId: 165614,
price: 26.44,
shares: 161.35692,
},
{
date: "20210604",
type: "buy",
symbolId: 172940,
price: 127.6746395261,
shares: 34.43688,
},
{
date: "20210604",
type: "buy",
symbolId: 172944,
price: 107.8236407362,
shares: 121.40636,
},
{
date: "20210604",
type: "buy",
symbolId: 178394,
price: 121.9,
shares: 25.63542,
},
{
date: "20210604",
type: "sell",
symbolId: 181926,
price: 11.8479,
shares: 0.00257,
},
{
date: "20210610",
type: "buy",
symbolId: 27321,
price: 27.0857,
shares: 5054068,
},
{
date: "20210610",
type: "buy",
symbolId: 79191,
price: 119.97,
shares: 10.36397,
},
{
date: "20210610",
type: "buy",
symbolId: 86953,
price: 130.21,
shares: 0.26867,
},
{
date: "20210610",
type: "buy",
symbolId: 110833,
price: 15.83,
shares: 200.45274,
},
{
date: "20210610",
type: "buy",
symbolId: 114010,
price: 136.14,
shares: 0,
},
{
date: "20210610",
type: "sell",
symbolId: 128992,
price: 160.62,
shares: 5.9927,
},
{
date: "20210610",
type: "sell",
symbolId: 160809,
price: 9861.749,
shares: 0.03708,
},
{
date: "20210610",
type: "buy",
symbolId: 172940,
price: 127.3682228024,
shares: 0,
},
{
date: "20210610",
type: "sell",
symbolId: 178394,
price: 122.91,
shares: 25.63542,
},
{
date: "20210610",
type: "sell",
symbolId: 181926,
price: 11.9424,
shares: 114.3862,
},
{
date: "20210611",
type: "sell",
symbolId: 79191,
price: 119.99,
shares: 0.02438,
},
{
date: "20210611",
type: "buy",
symbolId: 86953,
price: 130.24,
shares: 0.07506,
},
{
date: "20210611",
type: "sell",
symbolId: 110833,
price: 15.84,
shares: 0.3816,
},
{
date: "20210611",
type: "buy",
symbolId: 114010,
price: 136.49,
shares: 0,
},
{
date: "20210611",
type: "buy",
symbolId: 128992,
price: 160.74,
shares: 0.00967,
},
{
date: "20210611",
type: "buy",
symbolId: 160809,
price: 9861.2741,
shares: 0.00036,
},
{
date: "20210611",
type: "buy",
symbolId: 172940,
price: 128.2446667513,
shares: 0,
},
{
date: "20210614",
type: "buy",
symbolId: 79191,
price: 119.89,
shares: 0.57039,
},
{
date: "20210614",
type: "buy",
symbolId: 86953,
price: 130.24,
shares: 0.07993,
},
{
date: "20210614",
type: "sell",
symbolId: 110833,
price: 15.83,
shares: 2.30201,
},
{
date: "20210614",
type: "buy",
symbolId: 114010,
price: 136.12,
shares: 0,
},
{
date: "20210614",
type: "sell",
symbolId: 128992,
price: 160.88,
shares: 0.19392,
},
{
date: "20210614",
type: "buy",
symbolId: 160809,
price: 9861.1049,
shares: 0.00447,
},
{
date: "20210614",
type: "buy",
symbolId: 172940,
price: 127.789349869,
shares: 0,
},
{
date: "20210615",
type: "buy",
symbolId: 79191,
price: 119.99,
shares: 0.04877,
},
{
date: "20210615",
type: "buy",
symbolId: 86953,
price: 130.23,
shares: 0.03806,
},
{
date: "20210615",
type: "buy",
symbolId: 110833,
price: 15.82,
shares: 0.22009,
},
{
date: "20210615",
type: "buy",
symbolId: 114010,
price: 135.32,
shares: 0,
},
{
date: "20210615",
type: "sell",
symbolId: 128992,
price: 160.85,
shares: 0.05197,
},
{
date: "20210615",
type: "buy",
symbolId: 160809,
price: 9860.9325,
shares: 0.00003,
},
{
date: "20210615",
type: "buy",
symbolId: 172940,
price: 127.9033851145,
shares: 0,
},
{
date: "20210616",
type: "sell",
symbolId: 79191,
price: 119.98,
shares: 0.84477,
},
{
date: "20210616",
type: "buy",
symbolId: 86953,
price: 130.23,
shares: 0.01333,
},
{
date: "20210616",
type: "buy",
symbolId: 110833,
price: 15.81,
shares: 4.1918,
},
{
date: "20210616",
type: "buy",
symbolId: 114010,
price: 135.51,
shares: 0,
},
{
date: "20210616",
type: "buy",
symbolId: 128992,
price: 160.89,
shares: 0.19623,
},
{
date: "20210616",
type: "sell",
symbolId: 160809,
price: 9860.7757,
shares: 0.00301,
},
{
date: "20210616",
type: "buy",
symbolId: 172940,
price: 128.0448850893,
shares: 0,
},
{
date: "20210617",
type: "buy",
symbolId: 79191,
price: 119.94,
shares: 0.32022,
},
{
date: "20210617",
type: "sell",
symbolId: 86953,
price: 130.2,
shares: 0.86284,
},
{
date: "20210617",
type: "buy",
symbolId: 110833,
price: 15.8,
shares: 3.8706,
},
{
date: "20210617",
type: "buy",
symbolId: 114010,
price: 135.75,
shares: 0,
},
{
date: "20210617",
type: "buy",
symbolId: 128992,
price: 160.71,
shares: 0.03748,
},
{
date: "20210617",
type: "buy",
symbolId: 160809,
price: 9860.6107,
shares: 0.00034,
},
{
date: "20210617",
type: "buy",
symbolId: 172940,
price: 127.9144030861,
shares: 0,
},
{
date: "20210618",
type: "buy",
symbolId: 79191,
price: 119.95,
shares: 0.04372,
},
{
date: "20210618",
type: "sell",
symbolId: 86953,
price: 130.2,
shares: 0.09557,
},
{
date: "20210618",
type: "buy",
symbolId: 110833,
price: 15.8,
shares: 0.33093,
},
{
date: "20210618",
type: "buy",
symbolId: 114010,
price: 135.76,
shares: 0,
},
{
date: "20210618",
type: "sell",
symbolId: 128992,
price: 160.73,
shares: 0.03519,
},
{
date: "20210618",
type: "sell",
symbolId: 160809,
price: 9860.2089,
shares: 0.00126,
},
{
date: "20210618",
type: "buy",
symbolId: 172940,
price: 126.4077412027,
shares: 0,
},
{
date: "20210621",
type: "sell",
symbolId: 79191,
price: 119.91,
shares: 10.47792,
},
{
date: "20210621",
type: "buy",
symbolId: 86953,
price: 130.15,
shares: 0.00665,
},
{
date: "20210621",
type: "buy",
symbolId: 110833,
price: 15.8,
shares: 20.4865,
},
{
date: "20210621",
type: "buy",
symbolId: 114010,
price: 135.05,
shares: 0,
},
{
date: "20210621",
type: "buy",
symbolId: 128992,
price: 160.64,
shares: 1.99758,
},
{
date: "20210621",
type: "buy",
symbolId: 160809,
price: 9860.0406,
shares: 0.03186,
},
{
date: "20210621",
type: "buy",
symbolId: 172940,
price: 127.1478635181,
shares: 0,
},
{
date: "20210622",
type: "sell",
symbolId: 79191,
price: 119.91,
shares: 0,
},
{
date: "20210622",
type: "buy",
symbolId: 114010,
price: 134.89,
shares: 0,
},
{
date: "20210622",
type: "buy",
symbolId: 172940,
price: 127.3107419568,
shares: 0,
},
{
date: "20210623",
type: "sell",
symbolId: 79191,
price: 119.91,
shares: 0,
},
{
date: "20210623",
type: "buy",
symbolId: 114010,
price: 134.89,
shares: 0,
},
{
date: "20210623",
type: "buy",
symbolId: 172940,
price: 126.5494141995,
shares: 0,
},
{
date: "20210624",
type: "buy",
symbolId: 114010,
price: 135.45,
shares: 0,
},
{
date: "20210624",
type: "buy",
symbolId: 172940,
price: 127.4179692697,
shares: 0,
},
{
date: "20210625",
type: "buy",
symbolId: 114010,
price: 135.64,
shares: 0,
},
{
date: "20210625",
type: "buy",
symbolId: 172940,
price: 127.4179692697,
shares: 0,
},
{
date: "20210628",
type: "buy",
symbolId: 114010,
price: 136.03,
shares: 0,
},
{
date: "20210628",
type: "buy",
symbolId: 172940,
price: 127.218400654,
shares: 0,
},
{
date: "20210629",
type: "buy",
symbolId: 114010,
price: 136,
shares: 0,
},
{
date: "20210629",
type: "buy",
symbolId: 172940,
price: 127.3662670555,
shares: 0,
},
{
date: "20210630",
type: "buy",
symbolId: 114010,
price: 136.32,
shares: 0,
},
{
date: "20210630",
type: "buy",
symbolId: 172940,
price: 126.6706137981,
shares: 0,
},
{
date: "20210701",
type: "buy",
symbolId: 114010,
price: 135.71,
shares: 0,
},
{
date: "20210701",
type: "buy",
symbolId: 172940,
price: 127.3678074792,
shares: 0,
},
{
date: "20210702",
type: "buy",
symbolId: 114010,
price: 135.98,
shares: 0,
},
{
date: "20210702",
type: "buy",
symbolId: 172940,
price: 127.947457747,
shares: 0,
},
{
date: "20210705",
type: "buy",
symbolId: 114010,
price: 136.1,
shares: 0,
},
{
date: "20210705",
type: "buy",
symbolId: 172940,
price: 128.3334058582,
shares: 0,
},
{
date: "20210706",
type: "buy",
symbolId: 114010,
price: 135.64,
shares: 0,
},
{
date: "20210706",
type: "buy",
symbolId: 172940,
price: 127.2487460769,
shares: 0,
},
{
date: "20210707",
type: "buy",
symbolId: 114010,
price: 135.51,
shares: 0,
},
{
date: "20210707",
type: "buy",
symbolId: 172940,
price: 127.98922725,
shares: 0,
},
{
date: "20210708",
type: "buy",
symbolId: 114010,
price: 134.8,
shares: 0,
},
{
date: "20210708",
type: "buy",
symbolId: 172940,
price: 126.407910386,
shares: 0,
},
{
date: "20210712",
type: "buy",
symbolId: 114010,
price: 135.14,
shares: 0,
},
{
date: "20210712",
type: "buy",
symbolId: 172940,
price: 128.3287040921,
shares: 0,
},
{
date: "20210713",
type: "buy",
symbolId: 114010,
price: 135.09,
shares: 0,
},
{
date: "20210713",
type: "buy",
symbolId: 172940,
price: 128.3863849505,
shares: 0,
},
{
date: "20210714",
type: "buy",
symbolId: 114010,
price: 135.42,
shares: 0,
},
{
date: "20210714",
type: "buy",
symbolId: 172940,
price: 128.152074694,
shares: 0,
},
{
date: "20210715",
type: "buy",
symbolId: 114010,
price: 135.54,
shares: 0,
},
{
date: "20210715",
type: "buy",
symbolId: 172940,
price: 127.2591282279,
shares: 0,
},
{
date: "20210716",
type: "buy",
symbolId: 114010,
price: 135.9,
shares: 0,
},
{
date: "20210716",
type: "buy",
symbolId: 172940,
price: 126.502927413,
shares: 0,
},
{
date: "20210719",
type: "buy",
symbolId: 114010,
price: 135.28,
shares: 0,
},
{
date: "20210719",
type: "buy",
symbolId: 172940,
price: 124.065616156,
shares: 0,
},
{
date: "20210720",
type: "buy",
symbolId: 114010,
price: 135.42,
shares: 0,
},
{
date: "20210720",
type: "buy",
symbolId: 172940,
price: 125.2429871465,
shares: 0,
},
{
date: "20210721",
type: "buy",
symbolId: 114010,
price: 135.07,
shares: 0,
},
{
date: "20210721",
type: "buy",
symbolId: 172940,
price: 126.6679557286,
shares: 0,
},
{
date: "20210722",
type: "buy",
symbolId: 114010,
price: 135.35,
shares: 0,
},
{
date: "20210722",
type: "buy",
symbolId: 172940,
price: 127.39679665,
shares: 0,
},
{
date: "20210723",
type: "buy",
symbolId: 114010,
price: 135.56,
shares: 0,
},
{
date: "20210723",
type: "buy",
symbolId: 172940,
price: 128.6352305056,
shares: 0,
},
{
date: "20210726",
type: "buy",
symbolId: 114010,
price: 135.11,
shares: 0,
},
{
date: "20210726",
type: "buy",
symbolId: 172940,
price: 128.3695346597,
shares: 0,
},
{
date: "20210727",
type: "buy",
symbolId: 114010,
price: 135.09,
shares: 0,
},
{
date: "20210727",
type: "buy",
symbolId: 172940,
price: 128.0125924914,
shares: 0,
},
{
date: "20210728",
type: "buy",
symbolId: 114010,
price: 135.19,
shares: 0,
},
],
});
</script>
Schema
{
"type": "object",
"properties": {
"trades": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"additionalProperties": false,
"required": [],
"properties": {
"symbolId": {
"type": "number"
},
"shares": {
"type": "number",
"minimum": 0
},
"price": {
"type": "number"
},
"type": {
"type": "string"
},
"date": {
"type": "string"
},
"isin": {
"type": "string"
}
}
},
"description": "List of valid trades"
},
"enableFileUploader": {
"type": "boolean",
"description": "To allow the user to upload a .csv file to upload trades",
"default": false
}
},
"additionalProperties": true,
"oneOf": [
{
"required": [
"enableFileUploader"
],
"prohibited": [
"symbolId"
],
"properties": {
"trades": {
"type": "array",
"items": {
"type": "object",
"required": [
"isin"
]
}
}
}
},
{
"required": [
"trades"
],
"prohibited": [
"symbolId",
"enableFileUploader"
],
"properties": {
"trades": {
"type": "array",
"items": {
"type": "object",
"required": [
"symbolId"
]
}
}
}
},
{
"required": [
"symbolId"
],
"prohibited": [
"trades",
"enableFileUploader"
]
}
]
}
Complete Schema
{}
Locales
{
"positions": {
"title": "Proposed capital losses",
"columns": {
"capitalLoss": "Capital loss"
}
},
"columns": {
"name": "Asset",
"currency": "Currency",
"market": "Mercat",
"assetType": "Asset type"
},
"messages": {
"insufficientData": "Not enough data to show"
},
"csvErrors": {
"shares": "The shares column must have numbers and they must be greater than 0",
"price": "The price column must have numbers and they must be greater than 0",
"type": "The type column can be only 'buy' or 'shell'",
"parse": "Error parsing the file",
"%s notFound": {
"one": "The asset {{ symbolIds }} has not been found",
"other": "The asset {{ symbolIds }} has not been found"
},
"required": "The file mus have the following columns: symbolId, shares, price, type y date"
},
"fileUploader": {
"iconText": "Drag or select a CSV file with portfolio trades",
"description": "The file must have each trade in a row and its data separated by commas, the required columns are: symbolId, price, shares, date and type, the type can be 'buy' or 'sell' ",
"extraDescription": "Files cannot exceed 10MB",
"reloadText": "Select another file",
"uploadText": "Select file",
"duplicatedIsinsTitle": "There are several matches for the following ISINs, select one of them"
},
"buttons": {
"cancel": "Cancel",
"accept": "Accept"
}
}