@fugle/node-twstock 2.2.1-alpha.0 → 2.2.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -49,14 +49,6 @@ export declare class TwseScraper extends Scraper {
|
|
|
49
49
|
symbol: string;
|
|
50
50
|
date: string;
|
|
51
51
|
}): Promise<Record<string, any> | null>;
|
|
52
|
-
fetchStocksDividendsAnnouncementDetail(options: {
|
|
53
|
-
date: string;
|
|
54
|
-
symbol: string;
|
|
55
|
-
}): Promise<Record<string, any> | null>;
|
|
56
|
-
fetchStocksCapitalReductionAnnouncementDetail(options: {
|
|
57
|
-
symbol: string;
|
|
58
|
-
date: string;
|
|
59
|
-
}): Promise<Record<string, any> | null>;
|
|
60
52
|
fetchStocksSplitAnnouncementDetail(options: {
|
|
61
53
|
symbol: string;
|
|
62
54
|
date: string;
|
|
@@ -400,7 +400,7 @@ class TwseScraper extends scraper_1.Scraper {
|
|
|
400
400
|
// Include detail API call if requested (default: false for announcements)
|
|
401
401
|
if (includeDetail) {
|
|
402
402
|
try {
|
|
403
|
-
const detail = await this.
|
|
403
|
+
const detail = await this.fetchStocksDividendsDetail({
|
|
404
404
|
symbol: data.symbol,
|
|
405
405
|
date: data.exdividendDate
|
|
406
406
|
});
|
|
@@ -457,54 +457,6 @@ class TwseScraper extends scraper_1.Scraper {
|
|
|
457
457
|
return symbol ? data.filter((data) => data.symbol === symbol) : data;
|
|
458
458
|
}
|
|
459
459
|
async fetchStockCapitalReductionDetail(options) {
|
|
460
|
-
const { date, symbol } = options;
|
|
461
|
-
const query = new URLSearchParams({
|
|
462
|
-
STK_NO: symbol,
|
|
463
|
-
FILE_DATE: luxon_1.DateTime.fromISO(date).toFormat('yyyyMMdd'),
|
|
464
|
-
response: 'json',
|
|
465
|
-
});
|
|
466
|
-
const url = `https://www.twse.com.tw/rwd/zh/reducation/TWTAVUDetail?${query}`;
|
|
467
|
-
const response = await this.httpService.get(url);
|
|
468
|
-
const json = response.data.stat === 'OK' && response.data;
|
|
469
|
-
if (!json)
|
|
470
|
-
return null;
|
|
471
|
-
const [, name, ...values] = json.data[0];
|
|
472
|
-
const data = {};
|
|
473
|
-
data.symbol = symbol;
|
|
474
|
-
data.name = name.trim();
|
|
475
|
-
data.haltDate = (0, utils_1.rocToWestern)(values[0]);
|
|
476
|
-
data.sharesPerThousand = (0, utils_1.parseNumeric)(values[1]);
|
|
477
|
-
data.refundPerShare = (0, utils_1.parseNumeric)(values[2]);
|
|
478
|
-
return data;
|
|
479
|
-
}
|
|
480
|
-
async fetchStocksDividendsAnnouncementDetail(options) {
|
|
481
|
-
const { date, symbol } = options;
|
|
482
|
-
const query = new URLSearchParams({
|
|
483
|
-
STK_NO: symbol,
|
|
484
|
-
T1: luxon_1.DateTime.fromISO(date).toFormat('yyyyMMdd'),
|
|
485
|
-
response: 'json',
|
|
486
|
-
});
|
|
487
|
-
const url = `https://www.twse.com.tw/rwd/zh/exRight/TWT49UDetail?${query}`;
|
|
488
|
-
const response = await this.httpService.get(url);
|
|
489
|
-
const json = response.data.stat === 'ok' && response.data;
|
|
490
|
-
if (!json)
|
|
491
|
-
return null;
|
|
492
|
-
const [, name, ...values] = json.data[0];
|
|
493
|
-
const data = {};
|
|
494
|
-
data.symbol = symbol;
|
|
495
|
-
data.name = name.trim();
|
|
496
|
-
data.cashDividend = (0, utils_1.parseNumeric)(values[0]);
|
|
497
|
-
data.stockDividendShares = (0, utils_1.parseNumeric)(values[2]);
|
|
498
|
-
data.employeeBonusShares = (0, utils_1.parseNumeric)(values[3]);
|
|
499
|
-
data.paidCapitalIncrease = (0, utils_1.parseNumeric)(values[4]);
|
|
500
|
-
data.subscriptionPrice = (0, utils_1.parseNumeric)(values[5]);
|
|
501
|
-
data.publicOffering = (0, utils_1.parseNumeric)(values[6]);
|
|
502
|
-
data.employeeSubscription = (0, utils_1.parseNumeric)(values[7]);
|
|
503
|
-
data.existingShareholderSubscription = (0, utils_1.parseNumeric)(values[8]);
|
|
504
|
-
data.sharesPerThousand = (0, utils_1.parseNumeric)(values[9]);
|
|
505
|
-
return data;
|
|
506
|
-
}
|
|
507
|
-
async fetchStocksCapitalReductionAnnouncementDetail(options) {
|
|
508
460
|
const { date, symbol } = options;
|
|
509
461
|
const query = new URLSearchParams({
|
|
510
462
|
STK_NO: symbol,
|
|
@@ -582,7 +534,7 @@ class TwseScraper extends scraper_1.Scraper {
|
|
|
582
534
|
// Include detail API call if requested (default: false for announcements)
|
|
583
535
|
if (includeDetail) {
|
|
584
536
|
try {
|
|
585
|
-
const detail = await this.
|
|
537
|
+
const detail = await this.fetchStockCapitalReductionDetail({
|
|
586
538
|
symbol: data.symbol,
|
|
587
539
|
date: data.haltDate
|
|
588
540
|
});
|