Skip to content

Commit 4449c99

Browse files
committed
JStock 1.0.7.28
1 parent 0ec7075 commit 4449c99

File tree

7 files changed

+42
-33
lines changed

7 files changed

+42
-33
lines changed

docs/changelog.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
This file summarizes changes in JStock releases.
22
Numbers in parentheses refer to SourceForge.net tracker item numbers (#XXXXX)
33

4+
JStock 1.0.7.28 - 2017-09-12
5+
Bugfix: Fix India issue.
6+
47
JStock 1.0.7.27 - 2017-07-15
58
Bugfix: Fix DrieWealth buy limit order issue.
69

installer/windows/jstock.nsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Name ${PRODUCT_NAME}
1212
RequestExecutionLevel admin ;Workaround for Vista
1313

1414
; The file to write
15-
OutFile "jstock-1.0.7.27-setup.exe"
15+
OutFile "jstock-1.0.7.28-setup.exe"
1616
LicenseData "gpl-2.0.txt"
1717

1818
; The default installation directory

installer/windows/jstock.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
<maxHeapSize>512</maxHeapSize>
2626
</jre>
2727
<versionInfo>
28-
<fileVersion>1.1.5.6</fileVersion>
29-
<txtFileVersion>1.1.5.6</txtFileVersion>
28+
<fileVersion>1.1.5.7</fileVersion>
29+
<txtFileVersion>1.1.5.7</txtFileVersion>
3030
<fileDescription>JStock - Stock Market Software</fileDescription>
3131
<copyright>Yan Cheng Cheok &lt;[email protected]&gt;</copyright>
32-
<productVersion>1.1.5.6</productVersion>
33-
<txtProductVersion>1.1.5.6</txtProductVersion>
32+
<productVersion>1.1.5.7</productVersion>
33+
<txtProductVersion>1.1.5.7</txtProductVersion>
3434
<productName>JStock - Stock Market Software</productName>
3535
<companyName>Yan Cheng Cheok &lt;[email protected]&gt;</companyName>
3636
<internalName>jstock</internalName>

src/org/yccheok/jstock/gui/Utils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2736,11 +2736,11 @@ public ApplicationInfo(int applicationVersionID, String windowsDownloadLink, Str
27362736

27372737
////////////////////////////////////////////////////////////////////////////
27382738
////////////////////////////////////////////////////////////////////////////
2739-
private static final String ABOUT_BOX_VERSION_STRING = "1.0.7.27";
2739+
private static final String ABOUT_BOX_VERSION_STRING = "1.0.7.28";
27402740

2741-
// 1.0.7.27
2741+
// 1.0.7.28
27422742
// For About box comparision on latest version purpose.
2743-
private static final int APPLICATION_VERSION_ID = 1156;
2743+
private static final int APPLICATION_VERSION_ID = 1157;
27442744
////////////////////////////////////////////////////////////////////////////
27452745
////////////////////////////////////////////////////////////////////////////
27462746

src/org/yccheok/jstock/news/NewsServerFactory.java

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,3 @@
1-
/*
2-
* JStock - Free Stock Market Software
3-
* Copyright (C) 2016 Yan Cheng Cheok <[email protected]>
4-
*
5-
* This program is free software; you can redistribute it and/or modify
6-
* it under the terms of the GNU General Public License as published by
7-
* the Free Software Foundation; either version 2 of the License, or
8-
* (at your option) any later version.
9-
*
10-
* This program is distributed in the hope that it will be useful,
11-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13-
* GNU General Public License for more details.
14-
*
15-
* You should have received a copy of the GNU General Public License along
16-
* with this program; if not, write to the Free Software Foundation, Inc.,
17-
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18-
*/
19-
201
package org.yccheok.jstock.news;
212

223
import org.yccheok.jstock.engine.Country;
@@ -111,6 +92,7 @@ public int compare(NewsServer o1, NewsServer o2) {
11192
final List<NewsServer> netherlandsList = new CopyOnWriteArrayList<>();
11293
final List<NewsServer> newZealandList = new CopyOnWriteArrayList<>();
11394
final List<NewsServer> norwayList = new CopyOnWriteArrayList<>();
95+
final List<NewsServer> polandList = new CopyOnWriteArrayList<>();
11496
final List<NewsServer> portugalList = new CopyOnWriteArrayList<>();
11597
final List<NewsServer> russiaList = new CopyOnWriteArrayList<>();
11698
final List<NewsServer> saudiArabiaList = new CopyOnWriteArrayList<>();
@@ -146,12 +128,14 @@ public int compare(NewsServer o1, NewsServer o2) {
146128
denmarkList.add(new YahooFinanceNewsServer());
147129
denmarkList.add(new GoogleFinanceNewsServer());
148130
finlandList.add(new GoogleFinanceNewsServer());
131+
finlandList.add(new YahooFinanceNewsServer());
149132
franceList.add(new YahooFinanceNewsServer());
150133
franceList.add(new GoogleFinanceNewsServer());
151134
germanyList.add(new YahooFinanceNewsServer());
152135
germanyList.add(new GoogleSearchNewsServer());
153136
hongkongList.add(new YahooFinanceNewsServer());
154137
hongkongList.add(new GoogleFinanceNewsServer());
138+
indiaList.add(new YahooFinanceNewsServer());
155139
indiaList.add(new GoogleFinanceNewsServer());
156140
indonesiaList.add(new YahooFinanceNewsServer());
157141
indonesiaList.add(new GoogleFinanceNewsServer());
@@ -163,22 +147,23 @@ public int compare(NewsServer o1, NewsServer o2) {
163147
koreaList.add(new YahooFinanceNewsServer());
164148
koreaList.add(new GoogleFinanceNewsServer());
165149
malaysiaList.add(new YahooFinanceNewsServer());
166-
malaysiaList.add(new GoogleSearchNewsServer());
150+
malaysiaList.add(new GoogleFinanceNewsServer());
167151
netherlandsList.add(new YahooFinanceNewsServer());
168152
netherlandsList.add(new GoogleFinanceNewsServer());
169153
newZealandList.add(new YahooFinanceNewsServer());
170154
newZealandList.add(new GoogleFinanceNewsServer());
171155
norwayList.add(new YahooFinanceNewsServer());
172156
norwayList.add(new GoogleSearchNewsServer());
157+
polandList.add(new GoogleFinanceNewsServer());
173158
portugalList.add(new YahooFinanceNewsServer());
174159
portugalList.add(new GoogleFinanceNewsServer());
175160
russiaList.add(new GoogleFinanceNewsServer());
161+
russiaList.add(new YahooFinanceNewsServer());
176162
saudiArabiaList.add(new GoogleFinanceNewsServer());
177163
singaporeList.add(new YahooFinanceNewsServer());
178164
singaporeList.add(new GoogleFinanceNewsServer());
179165
southAfricaList.add(new GoogleFinanceNewsServer());
180-
spainList.add(new YahooFinanceNewsServer());
181-
spainList.add(new GoogleSearchNewsServer());
166+
spainList.add(new GoogleFinanceNewsServer());
182167
swedenList.add(new YahooFinanceNewsServer());
183168
swedenList.add(new GoogleFinanceNewsServer());
184169
switzerlandList.add(new YahooFinanceNewsServer());
@@ -218,6 +203,7 @@ public int compare(NewsServer o1, NewsServer o2) {
218203
map.put(Country.Netherlands, netherlandsList);
219204
map.put(Country.NewZealand, newZealandList);
220205
map.put(Country.Norway, norwayList);
206+
map.put(Country.Poland, polandList);
221207
map.put(Country.Portugal, portugalList);
222208
map.put(Country.Russia, russiaList);
223209
map.put(Country.SaudiArabia, saudiArabiaList);

src/org/yccheok/jstock/news/YahooFinanceNewsServer.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,36 @@
3232
import it.sauronsoftware.feed4j.FeedException;
3333
import org.apache.commons.logging.Log;
3434
import org.apache.commons.logging.LogFactory;
35+
import org.yccheok.jstock.engine.Code;
3536

3637
import org.yccheok.jstock.engine.StockInfo;
38+
import org.yccheok.jstock.engine.yahoo.quote.QuoteResponse;
39+
import org.yccheok.jstock.engine.yahoo.quote.QuoteResponse_;
40+
import retrofit2.Call;
3741

3842

3943
public class YahooFinanceNewsServer implements NewsServer {
4044

4145
@Override
4246
public List<FeedItem> getMessages(StockInfo stockInfo) {
47+
final Code code = stockInfo.code;
48+
49+
String query = org.yccheok.jstock.engine.Utils.toYahooFormat(code.toString());
50+
51+
if (org.yccheok.jstock.engine.Utils.needToResolveUnderlyingCode(code)) {
52+
Call<QuoteResponse> c = org.yccheok.jstock.engine.Utils.getYahooFinanceApi().quote(query);
53+
try {
54+
QuoteResponse quoteResponse = c.execute().body();
55+
QuoteResponse_ quoteResponse_ = quoteResponse.getQuoteResponse();
56+
List<org.yccheok.jstock.engine.yahoo.quote.Result> results = quoteResponse_.getResult();
57+
query = results.get(0).getUnderlyingSymbol();
58+
} catch (Exception e) {
59+
log.error(null, e);
60+
}
61+
}
62+
4363
// http://feeds.finance.yahoo.com/rss/2.0/headline?s=0005.HK&region=US&lang=en-US
44-
final String feedUrl = "https://feeds.finance.yahoo.com/rss/2.0/headline?s=" + stockInfo.code + "&region=US&lang=en-US";
64+
final String feedUrl = "https://feeds.finance.yahoo.com/rss/2.0/headline?s=" + query + "&region=US&lang=en-US";
4565
final List<FeedItem> messages = new ArrayList<>();
4666
final Set<String> titles = new HashSet<>();
4767

src/org/yccheok/jstock/portfolio/Utils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ public static double getTotalWithdraw(DepositSummary cashSummary) {
740740
for (int i = 0; i < size; i++) {
741741
final Deposit withdraw = cashSummary.get(i);
742742
final double amount = withdraw.getAmount();
743-
if (definitelyLessThan(amount, 0.0)) {
743+
if (definitelyLesserThan(amount, 0.0)) {
744744
totalWidthdraw += amount;
745745
}
746746
}
@@ -778,7 +778,7 @@ public static boolean definitelyGreaterThan(double a, double b)
778778
* @param b second double value
779779
* @return true if the a is definitely lesser than b
780780
*/
781-
public static boolean definitelyLessThan(double a, double b)
781+
public static boolean definitelyLesserThan(double a, double b)
782782
{
783783
return (b - a) > ( (Math.abs(a) < Math.abs(b) ? Math.abs(b) : Math.abs(a)) * EPSILON);
784784
}

0 commit comments

Comments
 (0)