Skip to content

Conversation

arnonm
Copy link
Contributor

@arnonm arnonm commented Sep 11, 2025

First PR for #4963
Adds a Tel-Aviv Stock Exchange calendar.
Since the TLV Stock Exchange uses Jewish holidays, added an implemention of Jewish holidays, addition of Holiday names
and a correction of a spelling mistake for the NIS - New Israeli Shekel (and not Sheqel in English)
Tests are added to check all the dates

Closes #4963

Copy link
Member

@buchen buchen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @arnonm, thanks for the contribution. Overall it looks good. I have added a couple of smaller comments.

I have a local commit which removes some of the unnecessary changes (particularly to the project files). So feel free to comment and I can also apply changes on to my local branch.

One thing about the weekend: because the code runs very often, my idea was to cache the calculated holidays per year. But because the weekend is static, it is a set of days which is always checked always (usually Saturday and Sunday) and not cached per year.

From the code comments, I realized that maybe the weekend changed for the Tel Aviv stock exchange. It appears that starting 2026, trading is Monday through Friday, instead of Sunday through Thursday. Let's handle this in a separate pull request after this one is merged. We could add some specific logic in the TradeCalendar itself (or extend it).

Comment on lines 102 to 110
@Ignore
@Test
public void Israeli_Memorial_Day_should_be_a_holiday()
{
TradeCalendar calendar = TradeCalendarManager.getInstance("tlv");
assertThat(calendar.isHoliday(LocalDate.parse("2024-05-13")), is(true));
assertThat(calendar.isHoliday(LocalDate.parse("2025-04-30")), is(true));
assertThat(calendar.isHoliday(LocalDate.parse("2026-04-21")), is(true));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason to "@ignore" these tests?

I would prefer to either remove them (why test something that is not there?) or have a reason why this is ignored.

@@ -273,6 +275,28 @@ public void post(String body) throws IOException
});
}

public String postReturn(String body) throws IOException
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears that these changes are unrelated to the proposed trade calendar.


// Tel Aviv Stock Exchange starting 2026
// https://www.tase.co.il/en/content/knowledge_center/trading_vacation_schedule#vacations
tc = new TradeCalendar("tlv", Messages.LabelTradeCalendarTLV, STANDARD_WEEKEND); //$NON-NLS-1$
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What not use the TLV_WEEKEND here?
It is defined above, but then not used here.
I see the test differs between weekends "before 2016" and "after 2016"

Comment on lines 42 to 47
// JewishCalendarDate(JewishCalendarDate date)
// {
// this.day = date.getDay();
// this.month = date.getMonth();
// this.year = date.getYear();
// }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid commented out code. In this case, I propose to delete it. If needed later, we can add such a constructor

return year;
}

@SuppressWarnings("unused")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why suppress this warning? It is a private class. Delete the method (and we reduce noise)

private int year;
}

private static class CalendarImpl
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it makes sense to extract this class a package private class JewishCalendar in the same package. (Back when creating this class, I was a fan of private classes to keep the implementations hidden, but as the file is growing, then it could make sense to keep it separate).

@@ -270,4 +805,31 @@ public Holiday getHoliday(int year)
}

protected abstract Holiday doGetHoliday(int year);

public JewishCalendarDate JewishHoliday(int georg_year, int jewish_month, int jewish_day, int add)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a method, so the first character those be lower case.

@arnonm
Copy link
Contributor Author

arnonm commented Sep 14, 2025 via email

@Nirus2000 Nirus2000 moved this to In Progress in Feature Shortlist Sep 14, 2025
@arnonm
Copy link
Contributor Author

arnonm commented Sep 16, 2025

All issues closed and last bug resolved. Ready to merge

Fix typo
Improve calender
Add more test cases
Sort Members in HolidayNames
Sort holiday-names.properties
@buchen
Copy link
Member

buchen commented Sep 16, 2025

Hey @arnonm, thanks for the update.

I am a little confused on the of the JewishCalendarDate class. For example, the method absoluteFromGregorianDate says it in its name that it converts a Gregorian date, but it gets passed a JewishCalendarDate. There are more such cases. I think for future readability, it makes sense to adopt this.

    /**
     * Converts a Gregorian date to absolute day number.
     */
    public int absoluteFromGregorianDate(JewishCalendarDate date)

If you do not mind I will take your pull request and do some cosmetic changes here and there (such as the variable use, remove deprecated methods, etc). Give me a couple days as I am very busy at the moment.

It reads a little bit that some ai generator converted the python code to Java... ;-)

@Nirus2000 Nirus2000 force-pushed the JewishCalendar branch 2 times, most recently from 123ac87 to bd868a0 Compare September 17, 2025 05:12
@arnonm
Copy link
Contributor Author

arnonm commented Sep 17, 2025

No argument on the comment. I can fix it if you want

@buchen
Copy link
Member

buchen commented Sep 17, 2025

@arnonm

I have a two more questions:

First, can you look at the passover II non-trading days.
They seem to be off if I compare what PP calculates now and what the TASE web site says.

(The other differences are - to my understanding - because PP shows the holiday because it is on a weekend - understood as Saturday/Sunday for the time being, and the TASE calendar does not always show them)

Bildschirmfoto 2025-09-17 um 20 30 28 Bildschirmfoto 2025-09-17 um 20 34 15

Second, there is a IsraeliHolocaustCalendarHolidayType defined which doesn't seem to be used. Is that correct? Then we should remove the code.

@buchen buchen marked this pull request as draft September 17, 2025 18:44
@arnonm
Copy link
Contributor Author

arnonm commented Sep 18, 2025

Fixed the Passover II, thanks for catching that. Nice work on the commenting - always happy to learn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

[Feature Request] Support for Tel-Aviv Exchange
3 participants