Skip to content

Commit

Permalink
feat: short start and finish date and anchor in wsp
Browse files Browse the repository at this point in the history
  • Loading branch information
simoneb committed May 30, 2024
1 parent 95d859d commit e97a0e6
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions src/parsers/wsp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ const columns = [
{
field: 'tif',
headerName: 'TIF',
valueFormatter({ value }) {
switch (value) {
valueFormatter(data) {
switch (data?.value) {
case 0:
return 'DAY'
case 1:
Expand Down Expand Up @@ -57,6 +57,9 @@ const columns = [
<TableCell>Timeframe</TableCell>
<TableCell>Session</TableCell>
<TableCell>Timezone</TableCell>
<TableCell>Start date</TableCell>
<TableCell>Finish date</TableCell>
<TableCell>Finish anchored</TableCell>
</TableRow>
</TableHead>
<TableBody>
Expand All @@ -66,6 +69,9 @@ const columns = [
<TableCell>{chart.timeframe}</TableCell>
<TableCell>{chart.sessionName}</TableCell>
<TableCell>{chart.timezone}</TableCell>
<TableCell>{formatDate(chart.startDate)}</TableCell>
<TableCell>{formatDate(chart.finishDate)}</TableCell>
<TableCell>{chart.finishDateAnchored ? 'Yes' : 'No'}</TableCell>
</TableRow>
))}
</TableBody>
Expand All @@ -77,6 +83,14 @@ const columns = [

export const extension = 'wsp'

function formatDate(date) {
return date.toLocaleDateString('it-IT', {
year: 'numeric',
month: 'numeric',
day: 'numeric'
})
}

function getIds(parsed, regexp) {
return Array.from(
new Set(
Expand Down Expand Up @@ -115,10 +129,13 @@ function getCharts(parsed, windowId) {

if (dataSeriesRequest) {
return {
symbol: dataSeriesRequest?.Symbol,
timeframe: `${dataSeriesRequest?.ResolutionSizeId} ${dataSeriesRequest?.ResolutionName}`,
sessionName: dataSeriesRequest?.SessionsName,
timezone: dataSeriesRequest?.TimeZoneName
symbol: dataSeriesRequest.Symbol,
timeframe: `${dataSeriesRequest.ResolutionSizeId} ${dataSeriesRequest.ResolutionName}`,
sessionName: dataSeriesRequest.SessionsName,
timezone: dataSeriesRequest.TimeZoneName,
startDate: new Date(1899, 11, 30 + dataSeriesRequest.StartDateId),
finishDate: new Date(1899, 11, 30 + dataSeriesRequest.FinishDateId),
finishDateAnchored: dataSeriesRequest.AnchorFinishDate === '1'
}
}
})
Expand Down

0 comments on commit e97a0e6

Please sign in to comment.