laplace-api 1.4.9 → 2.0.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.
package/package.json
CHANGED
|
@@ -14,38 +14,103 @@ export interface StockSectorFinancialRatioComparisonDetail {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export interface StockHistoricalRatios {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
slug: string;
|
|
18
|
+
finalValue: number;
|
|
19
|
+
threeYearGrowth: number;
|
|
20
|
+
yearGrowth: number;
|
|
21
|
+
finalSectorValue: number;
|
|
22
|
+
currency: Currency;
|
|
23
|
+
format: HistoricalRatiosFormat;
|
|
24
|
+
name: string;
|
|
25
|
+
items: StockHistoricalRatiosData[]
|
|
20
26
|
}
|
|
21
27
|
|
|
22
28
|
export interface StockHistoricalRatiosData {
|
|
23
|
-
|
|
24
|
-
fiscalQuarter: number;
|
|
25
|
-
values: Record<string, StockHistoricalRatiosValue>;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface StockHistoricalRatiosValue {
|
|
29
|
+
period: string;
|
|
29
30
|
value: number;
|
|
30
|
-
|
|
31
|
+
sectorMean: number;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
export
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
multiplier: number;
|
|
38
|
-
suffix: string;
|
|
39
|
-
prefix: string;
|
|
40
|
-
interval: string;
|
|
41
|
-
description: string;
|
|
34
|
+
export enum HistoricalRatiosFormat {
|
|
35
|
+
CURRENCY = "currency",
|
|
36
|
+
PERCENTAGE = "percentage",
|
|
37
|
+
DECIMAL = "decimal"
|
|
42
38
|
}
|
|
43
39
|
|
|
44
40
|
export enum HistoricalRatiosKey {
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
Revenue = 'satislar',
|
|
42
|
+
EBITDA = 'ebitda',
|
|
43
|
+
NetProfit = 'net_kar',
|
|
44
|
+
GrossMargin = 'gross-margin',
|
|
45
|
+
NetMargin = 'net-margin',
|
|
47
46
|
ReturnOnAssets = 'roa',
|
|
48
|
-
|
|
47
|
+
ReturnOnEquity = 'roe',
|
|
48
|
+
ReturnOnCapitalEmployed = 'roce',
|
|
49
|
+
ReturnOnInvestedCapital = 'roic',
|
|
50
|
+
PriceToEarningsRatio = 'pe-ratio',
|
|
51
|
+
PriceToEarnings = 'poe',
|
|
52
|
+
PriceToBookRatio = 'pb-ratio',
|
|
53
|
+
EnterpriseValueToEBITDA = 'ev-to-ebitda',
|
|
54
|
+
EnterpriseValueToInvestedCapital = 'evic',
|
|
55
|
+
InterestCoverage = 'interestCoverage',
|
|
56
|
+
QuickRatio = 'quick-ratio',
|
|
57
|
+
LeverageRatio = 'leverage-ratio',
|
|
58
|
+
DebtToEquity = 'debt-to-equity',
|
|
59
|
+
RevenueGrowth = 'satis_buyumesi',
|
|
60
|
+
EBITDAGrowth = 'favok_buyumesi',
|
|
61
|
+
NetProfitGrowth = 'net_kar_buyumesi',
|
|
62
|
+
FreeCashFlowGrowth = 'serbest_nakit_akisi_buyumesi',
|
|
63
|
+
CashConversionCycle = 'cash-conversion-cycle',
|
|
64
|
+
DaysSalesOutstanding = 'days-sales-outstanding',
|
|
65
|
+
DaysPayable = 'days-payable',
|
|
66
|
+
DaysInventory = 'days-inventory',
|
|
67
|
+
|
|
68
|
+
EBITDAMargin = 'favok_marji',
|
|
69
|
+
InventoryTurnover = 'inventory-turnover',
|
|
70
|
+
DepositGrowth = 'mevduat_buyumesi',
|
|
71
|
+
NetInterestMargin = 'net_faiz_marji',
|
|
72
|
+
CompensationGrowth = 'gerceklesen_tazminatlar_buyumesi',
|
|
73
|
+
PremiumPerCompensation = 'prim_basina_tazminat_orani',
|
|
74
|
+
EnterpriseValueToOperatingCashFlow = 'evOcf',
|
|
75
|
+
EarningsBeforeTax = 'ebt',
|
|
76
|
+
CapitalExpenditure = 'capex',
|
|
77
|
+
FinancialInvestments = 'financial_investments',
|
|
78
|
+
RealtimeEarningsPerShare = 'realtime_eps-basic',
|
|
79
|
+
RealtimeMarketValue = 'realtime_piyasa_degeri',
|
|
80
|
+
RealtimePriceToBookRatio = 'realtime_pb-ratio',
|
|
81
|
+
RealtimePriceToEarningsRatio = 'realtime_pe-ratio',
|
|
82
|
+
CurrentRatio = 'current-ratio',
|
|
83
|
+
AssetTurnover = 'asset-turnover',
|
|
84
|
+
TotalOperationalExpense = 'total_operational_expense',
|
|
85
|
+
TotalOperationalExpenseToGrossProfit = 'total_operational_expense_gross_profit_ratio',
|
|
86
|
+
CashAndCashEquivalents = 'cash_and_cash_equivalents',
|
|
87
|
+
CashToAssets = 'cash_to_assets',
|
|
88
|
+
CapexToNetProfit = 'capex_to_net_profit',
|
|
89
|
+
RealtimeEnterpriseValueToEBITDA = 'realtime_ev-to-ebitda',
|
|
90
|
+
ReceivablesTurnover = 'alacak_devir_hizi',
|
|
91
|
+
EarningsPerShare = 'eps-basic',
|
|
92
|
+
CreditToAssetRatio = 'kredi_aktif_orani',
|
|
93
|
+
CreditToDepositRatio = 'kredi_mevduat_orani',
|
|
94
|
+
TechnicalProfitGrowth = 'teknik_kar_buyumesi',
|
|
95
|
+
NetEarnedPremiumGrowth = 'net_kazanilan_prim_buyumesi',
|
|
96
|
+
EBITGrowth = 'ebitGrowth',
|
|
97
|
+
CashReturnOnInvestedCapital = 'croic',
|
|
98
|
+
MarketCapitalization = 'piyasa_degeri',
|
|
99
|
+
ShortTermToLongTermObligations = 'short_term_obligations_long_term_obligations',
|
|
100
|
+
RetainedEarnings = 'retained_earnings',
|
|
101
|
+
ThreeYearCAGRFreeCashFlow = 'three_year_cagr_free_cash_flow',
|
|
102
|
+
LongTermLoansToPeriodicProfitRatio = 'long_term_loans_period_profit_ratio',
|
|
103
|
+
LongTermLoans = 'long_term_loans',
|
|
104
|
+
CommercialReceivablesToTotalCurrentAssets = 'commercial_receivables_total_current_assets',
|
|
105
|
+
StockGrowth = 'stock_growth',
|
|
106
|
+
FiveYearRetainedEarningsChange = 'five_year_retained_earnings_change',
|
|
107
|
+
ThreeYearCAGRRetainedEarnings = 'three_year_cagr_retained_earnings',
|
|
108
|
+
PotentialOperatingCashFlow = 'pocf',
|
|
109
|
+
FreeCashFlowToEnterpriseValue = 'fcfEv',
|
|
110
|
+
DebtToDeposit = 'dd',
|
|
111
|
+
NetDebt = 'net_borc',
|
|
112
|
+
PaidCapital = 'odenmis_sermaye',
|
|
113
|
+
FinancialExpensesToEBIT = 'financial_expenses_ebit_ratio'
|
|
49
114
|
}
|
|
50
115
|
|
|
51
116
|
export interface StockHistoricalRatiosDescription {
|
|
@@ -114,13 +179,13 @@ export class FinancialClient extends Client {
|
|
|
114
179
|
});
|
|
115
180
|
}
|
|
116
181
|
|
|
117
|
-
async getHistoricalRatios(symbol: string, keys: HistoricalRatiosKey[], region: Region): Promise<StockHistoricalRatios> {
|
|
118
|
-
const url = new URL(`${this['baseUrl']}/api/
|
|
182
|
+
async getHistoricalRatios(symbol: string, keys: HistoricalRatiosKey[], region: Region): Promise<StockHistoricalRatios[]> {
|
|
183
|
+
const url = new URL(`${this['baseUrl']}/api/v2/stock/historical-ratios`);
|
|
119
184
|
url.searchParams.append('symbol', symbol);
|
|
120
185
|
url.searchParams.append('region', region);
|
|
121
186
|
url.searchParams.append('slugs', keys.join(','));
|
|
122
187
|
|
|
123
|
-
return this.sendRequest<StockHistoricalRatios>({
|
|
188
|
+
return this.sendRequest<StockHistoricalRatios[]>({
|
|
124
189
|
method: 'GET',
|
|
125
190
|
url: url.toString(),
|
|
126
191
|
});
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import { Logger } from
|
|
2
|
-
import { LaplaceConfiguration } from
|
|
3
|
-
import { Client, createClient } from
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { Logger } from "winston";
|
|
2
|
+
import { LaplaceConfiguration } from "../utilities/configuration";
|
|
3
|
+
import { Client, createClient } from "../client/client";
|
|
4
|
+
import {
|
|
5
|
+
FinancialClient,
|
|
6
|
+
HistoricalRatiosKey,
|
|
7
|
+
FinancialSheetType,
|
|
8
|
+
FinancialSheetPeriod,
|
|
9
|
+
Currency,
|
|
10
|
+
} from "../client/financial_ratios";
|
|
11
|
+
import { Region, Locale } from "../client/collections";
|
|
12
|
+
import "./client_test_suite";
|
|
13
|
+
import { equal } from "assert";
|
|
7
14
|
|
|
8
15
|
describe('FinancialRatios', () => {
|
|
9
16
|
let financialClient: FinancialClient;
|
|
@@ -25,16 +32,34 @@ describe('FinancialRatios', () => {
|
|
|
25
32
|
expect(resp).not.toBeEmpty();
|
|
26
33
|
});
|
|
27
34
|
|
|
28
|
-
test(
|
|
29
|
-
const resp = await financialClient.getHistoricalRatios(
|
|
35
|
+
test("GetHistoricalRatios", async () => {
|
|
36
|
+
const resp = await financialClient.getHistoricalRatios(
|
|
37
|
+
"TUPRS",
|
|
38
|
+
Object.values(HistoricalRatiosKey).flat(),
|
|
39
|
+
Region.Tr
|
|
40
|
+
);
|
|
30
41
|
expect(resp).not.toBeEmpty();
|
|
31
|
-
for (const
|
|
32
|
-
expect(
|
|
42
|
+
for (const ratio of resp) {
|
|
43
|
+
expect(typeof ratio.finalValue).toBe("number");
|
|
44
|
+
expect(typeof ratio.threeYearGrowth).toBe("number");
|
|
45
|
+
expect(typeof ratio.yearGrowth).toBe("number");
|
|
46
|
+
expect(typeof ratio.finalSectorValue).toBe("number");
|
|
47
|
+
expect(equal(ratio.currency, Currency.TRY));
|
|
48
|
+
expect(typeof ratio.format).toBe("string");
|
|
49
|
+
expect(typeof ratio.name).toBe("string");
|
|
50
|
+
expect(ratio.items).not.toBeEmpty();
|
|
51
|
+
expect(ratio.items.at(0)).toBeTruthy();
|
|
52
|
+
expect(typeof ratio.items.at(0)?.period).toBe("string");
|
|
53
|
+
expect(typeof ratio.items.at(0)?.sectorMean).toBe("number");
|
|
54
|
+
expect(typeof ratio.items.at(0)?.value).toBe("number");
|
|
33
55
|
}
|
|
34
56
|
});
|
|
35
57
|
|
|
36
|
-
test(
|
|
37
|
-
const resp = await financialClient.getHistoricalRatiosDescriptions(
|
|
58
|
+
test("GetHistoricalRatiosDescriptions", async () => {
|
|
59
|
+
const resp = await financialClient.getHistoricalRatiosDescriptions(
|
|
60
|
+
Locale.Tr,
|
|
61
|
+
Region.Tr
|
|
62
|
+
);
|
|
38
63
|
expect(resp).not.toBeEmpty();
|
|
39
64
|
});
|
|
40
65
|
|