@muhammedaksam/borsats 0.5.0 → 0.8.4
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/dist/index.cjs +4 -3
- package/dist/index.d.cts +284 -46
- package/dist/index.d.ts +284 -46
- package/dist/index.js +4 -3
- package/package.json +16 -15
package/dist/index.d.cts
CHANGED
|
@@ -3,6 +3,7 @@ import { EventEmitter } from 'events';
|
|
|
3
3
|
|
|
4
4
|
type Period = "1d" | "5d" | "1w" | "1mo" | "3mo" | "6mo" | "1y" | "2y" | "5y" | "10y" | "ytd" | "max" | "1g" | "5g" | "1ay" | "3ay" | "1h" | "3h";
|
|
5
5
|
type Interval = "1m" | "3m" | "5m" | "15m" | "30m" | "45m" | "1h" | "4h" | "1d" | "1w" | "1mo";
|
|
6
|
+
type FundType = "YAT" | "EMK";
|
|
6
7
|
interface OHLCVData {
|
|
7
8
|
date: Date;
|
|
8
9
|
open: number;
|
|
@@ -161,6 +162,7 @@ interface Holding {
|
|
|
161
162
|
weight?: number;
|
|
162
163
|
pnl?: number;
|
|
163
164
|
pnlPct?: number;
|
|
165
|
+
purchaseDate?: Date | string;
|
|
164
166
|
}
|
|
165
167
|
interface RequestOptions {
|
|
166
168
|
method?: "GET" | "POST" | "PUT" | "DELETE";
|
|
@@ -248,6 +250,40 @@ declare class TradingViewETFProvider extends BaseProvider {
|
|
|
248
250
|
}
|
|
249
251
|
declare function getTradingViewETFProvider(): TradingViewETFProvider;
|
|
250
252
|
|
|
253
|
+
declare const OSCILLATOR_COLUMNS: string[];
|
|
254
|
+
declare const MOVING_AVERAGE_COLUMNS: string[];
|
|
255
|
+
declare const INTERVAL_MAP: Record<string, string>;
|
|
256
|
+
interface TASignalGroup {
|
|
257
|
+
recommendation: string;
|
|
258
|
+
buy: number;
|
|
259
|
+
sell: number;
|
|
260
|
+
neutral: number;
|
|
261
|
+
compute?: Record<string, string>;
|
|
262
|
+
values?: Record<string, number | null>;
|
|
263
|
+
}
|
|
264
|
+
interface TASignals {
|
|
265
|
+
symbol: string;
|
|
266
|
+
exchange: string;
|
|
267
|
+
interval: string;
|
|
268
|
+
summary: TASignalGroup;
|
|
269
|
+
oscillators: TASignalGroup;
|
|
270
|
+
moving_averages: TASignalGroup;
|
|
271
|
+
}
|
|
272
|
+
declare class TradingViewScannerProvider extends BaseProvider {
|
|
273
|
+
private static readonly SCANNER_URL;
|
|
274
|
+
private static readonly SCREENERS;
|
|
275
|
+
private static readonly CACHE_TTL;
|
|
276
|
+
constructor();
|
|
277
|
+
getTASignals(symbol: string, screener?: string, interval?: string): Promise<TASignals>;
|
|
278
|
+
private _getColumnsWithInterval;
|
|
279
|
+
private _calculateSignals;
|
|
280
|
+
private _processRec;
|
|
281
|
+
private _recToSignal;
|
|
282
|
+
private _countSignals;
|
|
283
|
+
private _getRecommendation;
|
|
284
|
+
}
|
|
285
|
+
declare function getScannerProvider(): TradingViewScannerProvider;
|
|
286
|
+
|
|
251
287
|
declare function calculateSMA(data: OHLCVData[], period?: number): number[];
|
|
252
288
|
declare function calculateEMA(data: OHLCVData[], period?: number): number[];
|
|
253
289
|
declare function calculateRSI(data: OHLCVData[], period?: number): number[];
|
|
@@ -276,6 +312,13 @@ declare function calculateSupertrend(data: OHLCVData[], atrPeriod?: number, mult
|
|
|
276
312
|
lower: number;
|
|
277
313
|
}>;
|
|
278
314
|
declare function calculateTilsonT3(data: OHLCVData[], period?: number, vfactor?: number): number[];
|
|
315
|
+
declare function calculateHHV(data: OHLCVData[], period?: number, column?: "high" | "low" | "close" | "open"): number[];
|
|
316
|
+
declare function calculateLLV(data: OHLCVData[], period?: number, column?: "high" | "low" | "close" | "open"): number[];
|
|
317
|
+
declare function calculateMOM(data: OHLCVData[], period?: number): number[];
|
|
318
|
+
declare function calculateROC(data: OHLCVData[], period?: number): number[];
|
|
319
|
+
declare function calculateWMA(data: OHLCVData[], period?: number): number[];
|
|
320
|
+
declare function calculateDEMA(data: OHLCVData[], period?: number): number[];
|
|
321
|
+
declare function calculateTEMA(data: OHLCVData[], period?: number): number[];
|
|
279
322
|
declare function calculateCCI(data: OHLCVData[], period?: number): number[];
|
|
280
323
|
declare function calculateWilliamsR(data: OHLCVData[], period?: number): number[];
|
|
281
324
|
declare function calculatePivotPoints(data: OHLCVData[]): Array<{
|
|
@@ -309,6 +352,13 @@ interface AddIndicatorsOptions {
|
|
|
309
352
|
supertrendMultiplier?: number;
|
|
310
353
|
cciPeriod?: number;
|
|
311
354
|
williamsRPeriod?: number;
|
|
355
|
+
hhvPeriod?: number;
|
|
356
|
+
llvPeriod?: number;
|
|
357
|
+
momPeriod?: number;
|
|
358
|
+
rocPeriod?: number;
|
|
359
|
+
wmaPeriod?: number;
|
|
360
|
+
demaPeriod?: number;
|
|
361
|
+
temaPeriod?: number;
|
|
312
362
|
}
|
|
313
363
|
declare function addIndicators(data: OHLCVData[], options?: AddIndicatorsOptions): IndicatorData[];
|
|
314
364
|
declare class TechnicalAnalyzer {
|
|
@@ -344,6 +394,13 @@ declare class TechnicalAnalyzer {
|
|
|
344
394
|
lower: number;
|
|
345
395
|
}>;
|
|
346
396
|
tilsonT3(period?: number, vfactor?: number): number[];
|
|
397
|
+
hhv(period?: number, column?: "high" | "low" | "close" | "open"): number[];
|
|
398
|
+
llv(period?: number, column?: "high" | "low" | "close" | "open"): number[];
|
|
399
|
+
mom(period?: number): number[];
|
|
400
|
+
roc(period?: number): number[];
|
|
401
|
+
wma(period?: number): number[];
|
|
402
|
+
dema(period?: number): number[];
|
|
403
|
+
tema(period?: number): number[];
|
|
347
404
|
cci(period?: number): number[];
|
|
348
405
|
williamsR(period?: number): number[];
|
|
349
406
|
pivotPoints(): Array<{
|
|
@@ -426,7 +483,9 @@ declare class Ticker {
|
|
|
426
483
|
start?: Date | string;
|
|
427
484
|
end?: Date | string;
|
|
428
485
|
actions?: boolean;
|
|
486
|
+
adjust?: boolean;
|
|
429
487
|
}): Promise<OHLCVWithActions[]>;
|
|
488
|
+
private _unadjustPrices;
|
|
430
489
|
private _mergeActions;
|
|
431
490
|
get balanceSheet(): Promise<BalanceSheet>;
|
|
432
491
|
get incomeStmt(): Promise<IncomeStatement>;
|
|
@@ -434,6 +493,21 @@ declare class Ticker {
|
|
|
434
493
|
get quarterlyBalanceSheet(): Promise<BalanceSheet>;
|
|
435
494
|
get quarterlyIncomeStmt(): Promise<IncomeStatement>;
|
|
436
495
|
get quarterlyCashflow(): Promise<CashFlowStatement>;
|
|
496
|
+
getBalanceSheet(options?: {
|
|
497
|
+
quarterly?: boolean;
|
|
498
|
+
lastN?: number | string;
|
|
499
|
+
financialGroup?: string;
|
|
500
|
+
}): Promise<BalanceSheet>;
|
|
501
|
+
getIncomeStmt(options?: {
|
|
502
|
+
quarterly?: boolean;
|
|
503
|
+
lastN?: number | string;
|
|
504
|
+
financialGroup?: string;
|
|
505
|
+
}): Promise<IncomeStatement>;
|
|
506
|
+
getCashflow(options?: {
|
|
507
|
+
quarterly?: boolean;
|
|
508
|
+
lastN?: number | string;
|
|
509
|
+
financialGroup?: string;
|
|
510
|
+
}): Promise<CashFlowStatement>;
|
|
437
511
|
get dividends(): Promise<DividendData[]>;
|
|
438
512
|
get splits(): Promise<CapitalIncreaseData[]>;
|
|
439
513
|
get majorHolders(): Promise<HolderData[]>;
|
|
@@ -442,6 +516,10 @@ declare class Ticker {
|
|
|
442
516
|
get priceTarget(): Promise<PriceTarget | null>;
|
|
443
517
|
get isin(): Promise<string>;
|
|
444
518
|
technicals(period?: Period, interval?: Interval): Promise<TechnicalAnalyzer>;
|
|
519
|
+
taSignals(interval?: Interval): Promise<TASignals>;
|
|
520
|
+
taSignalsAllTimeframes(): Promise<Record<string, TASignals | {
|
|
521
|
+
error: string;
|
|
522
|
+
}>>;
|
|
445
523
|
rsi(period?: Period, rsiPeriod?: number): Promise<number>;
|
|
446
524
|
sma(period?: Period, smaPeriod?: number): Promise<number>;
|
|
447
525
|
ema(period?: Period, emaPeriod?: number): Promise<number>;
|
|
@@ -463,6 +541,13 @@ declare class Ticker {
|
|
|
463
541
|
obv(period?: Period): Promise<number>;
|
|
464
542
|
vwap(period?: Period): Promise<number>;
|
|
465
543
|
adx(period?: Period, adxPeriod?: number): Promise<number>;
|
|
544
|
+
hhv(period?: Period, hhvPeriod?: number): Promise<number>;
|
|
545
|
+
llv(period?: Period, llvPeriod?: number): Promise<number>;
|
|
546
|
+
mom(period?: Period, momPeriod?: number): Promise<number>;
|
|
547
|
+
roc(period?: Period, rocPeriod?: number): Promise<number>;
|
|
548
|
+
wma(period?: Period, wmaPeriod?: number): Promise<number>;
|
|
549
|
+
dema(period?: Period, demaPeriod?: number): Promise<number>;
|
|
550
|
+
tema(period?: Period, temaPeriod?: number): Promise<number>;
|
|
466
551
|
heikinAshi(period?: Period, interval?: Interval): Promise<OHLCVData[]>;
|
|
467
552
|
private calculateStartDate;
|
|
468
553
|
private daysYTD;
|
|
@@ -558,9 +643,13 @@ interface FundRiskMetrics {
|
|
|
558
643
|
declare class Fund {
|
|
559
644
|
private _fundCode;
|
|
560
645
|
private _infoCache;
|
|
561
|
-
|
|
646
|
+
private _fundType;
|
|
647
|
+
private _detectedFundType;
|
|
648
|
+
constructor(fundCode: string, fundType?: FundType | null);
|
|
562
649
|
get fundCode(): string;
|
|
563
650
|
get symbol(): string;
|
|
651
|
+
get fundType(): Promise<FundType>;
|
|
652
|
+
private detectFundType;
|
|
564
653
|
get info(): Promise<FundDetail>;
|
|
565
654
|
get detail(): Promise<FundDetail>;
|
|
566
655
|
get performance(): Promise<Partial<FundDetail>>;
|
|
@@ -578,6 +667,13 @@ declare class Fund {
|
|
|
578
667
|
technicals(period?: string): Promise<TechnicalAnalyzer>;
|
|
579
668
|
riskMetrics(period?: string, rfRate?: number): Promise<FundRiskMetrics>;
|
|
580
669
|
sharpeRatio(period?: string, rfRate?: number): Promise<number>;
|
|
670
|
+
get managementFee(): Promise<{
|
|
671
|
+
applied_fee: number | null;
|
|
672
|
+
prospectus_fee: number | null;
|
|
673
|
+
max_expense_ratio: number | null;
|
|
674
|
+
} | null>;
|
|
675
|
+
get taxCategory(): Promise<string>;
|
|
676
|
+
withholdingTaxRate(purchaseDate?: Date, holdingDays?: number): Promise<number>;
|
|
581
677
|
}
|
|
582
678
|
declare function searchFunds(query: string): Promise<{
|
|
583
679
|
fund_code: string;
|
|
@@ -585,6 +681,16 @@ declare function searchFunds(query: string): Promise<{
|
|
|
585
681
|
fund_type: string;
|
|
586
682
|
return_1y?: number;
|
|
587
683
|
}[]>;
|
|
684
|
+
declare function managementFees(fundType?: "YAT" | "EMK", founder?: string): Promise<{
|
|
685
|
+
fund_code: string;
|
|
686
|
+
name: string;
|
|
687
|
+
fund_category: string;
|
|
688
|
+
founder_code: string;
|
|
689
|
+
applied_fee: number | null;
|
|
690
|
+
prospectus_fee: number | null;
|
|
691
|
+
max_expense_ratio: number | null;
|
|
692
|
+
annual_return: number | null;
|
|
693
|
+
}[]>;
|
|
588
694
|
declare function screenFunds(options: Record<string, unknown>): Promise<unknown[]>;
|
|
589
695
|
declare function compareFunds(fundCodes: string[]): Promise<{
|
|
590
696
|
funds: FundDetail[];
|
|
@@ -603,12 +709,12 @@ declare class Screener {
|
|
|
603
709
|
}>;
|
|
604
710
|
static readonly TEMPLATES: string[];
|
|
605
711
|
constructor();
|
|
606
|
-
addFilter(criteria: string, min?: number, max?: number, required?: boolean):
|
|
712
|
+
addFilter(criteria: string, min?: number, max?: number, required?: boolean): Screener;
|
|
607
713
|
setSector(sector: string): Screener;
|
|
608
714
|
setIndex(index: string): Screener;
|
|
609
715
|
setRecommendation(recommendation: string): Screener;
|
|
610
716
|
clear(): Screener;
|
|
611
|
-
run(
|
|
717
|
+
run(template?: string): Promise<ScreenerResult[]>;
|
|
612
718
|
private _filterByIndex;
|
|
613
719
|
}
|
|
614
720
|
declare function screenStocks(options: {
|
|
@@ -620,8 +726,16 @@ declare function screenStocks(options: {
|
|
|
620
726
|
market_cap_max?: number;
|
|
621
727
|
pe_min?: number;
|
|
622
728
|
pe_max?: number;
|
|
729
|
+
pb_min?: number;
|
|
730
|
+
pb_max?: number;
|
|
623
731
|
dividend_yield_min?: number;
|
|
624
732
|
dividend_yield_max?: number;
|
|
733
|
+
upside_potential_min?: number;
|
|
734
|
+
upside_potential_max?: number;
|
|
735
|
+
net_margin_min?: number;
|
|
736
|
+
net_margin_max?: number;
|
|
737
|
+
roe_min?: number;
|
|
738
|
+
roe_max?: number;
|
|
625
739
|
[key: string]: unknown;
|
|
626
740
|
}): Promise<ScreenerResult[]>;
|
|
627
741
|
declare function screenerCriteria(): Promise<ScreenerCriteria[]>;
|
|
@@ -640,7 +754,7 @@ interface ScanResult$1 {
|
|
|
640
754
|
conditionsMet: string[];
|
|
641
755
|
timestamp: Date;
|
|
642
756
|
}
|
|
643
|
-
declare function scan(universe: string | string[], condition: string, interval?:
|
|
757
|
+
declare function scan(universe: string | string[], condition: string, interval?: Interval, limit?: number): Promise<ScanResult$1[]>;
|
|
644
758
|
declare class TechnicalScanner {
|
|
645
759
|
private _symbols;
|
|
646
760
|
private _conditions;
|
|
@@ -653,11 +767,13 @@ declare class TechnicalScanner {
|
|
|
653
767
|
addCondition(condition: string, name?: string): TechnicalScanner;
|
|
654
768
|
removeCondition(nameOrCondition: string): TechnicalScanner;
|
|
655
769
|
clearConditions(): TechnicalScanner;
|
|
656
|
-
setInterval(interval:
|
|
770
|
+
setInterval(interval: Interval): TechnicalScanner;
|
|
657
771
|
addColumn(column: string): TechnicalScanner;
|
|
658
772
|
run(limit?: number): Promise<ScanResult$1[]>;
|
|
659
773
|
private _evaluateCondition;
|
|
660
774
|
private _getValue;
|
|
775
|
+
private _requiresLocalCalc;
|
|
776
|
+
private _getRequiredHistoryLength;
|
|
661
777
|
get symbols(): string[];
|
|
662
778
|
get conditions(): string[];
|
|
663
779
|
toString(): string;
|
|
@@ -704,6 +820,10 @@ declare class Crypto {
|
|
|
704
820
|
end?: Date | string;
|
|
705
821
|
}): Promise<OHLCVData[]>;
|
|
706
822
|
technicals(interval?: string): Promise<TechnicalAnalyzer>;
|
|
823
|
+
taSignals(interval?: Interval): Promise<TASignals>;
|
|
824
|
+
taSignalsAllTimeframes(): Promise<Record<string, TASignals | {
|
|
825
|
+
error: string;
|
|
826
|
+
}>>;
|
|
707
827
|
}
|
|
708
828
|
declare function cryptoList(): Promise<string[]>;
|
|
709
829
|
|
|
@@ -722,12 +842,22 @@ declare class FX {
|
|
|
722
842
|
get info(): Promise<CurrentData>;
|
|
723
843
|
get bankRates(): Promise<BankRate[]>;
|
|
724
844
|
institutionRates(): Promise<MetalInstitutionRate[]>;
|
|
845
|
+
institutionRate(institution: string): Promise<MetalInstitutionRate>;
|
|
846
|
+
institutionHistory(institution: string, options?: {
|
|
847
|
+
period?: string;
|
|
848
|
+
start?: Date | string;
|
|
849
|
+
end?: Date | string;
|
|
850
|
+
}): Promise<OHLCVData[]>;
|
|
725
851
|
history(options?: {
|
|
726
852
|
period?: string;
|
|
727
853
|
interval?: string;
|
|
728
854
|
start?: Date | string;
|
|
729
855
|
end?: Date | string;
|
|
730
856
|
}): Promise<OHLCVData[]>;
|
|
857
|
+
taSignals(interval?: Interval): Promise<TASignals>;
|
|
858
|
+
taSignalsAllTimeframes(): Promise<Record<string, TASignals | {
|
|
859
|
+
error: string;
|
|
860
|
+
}>>;
|
|
731
861
|
}
|
|
732
862
|
declare function banks(): string[];
|
|
733
863
|
declare function metalInstitutions(): string[];
|
|
@@ -743,14 +873,17 @@ declare function searchCompanies(query: string): Promise<CompanyInfo[]>;
|
|
|
743
873
|
declare class Portfolio {
|
|
744
874
|
private holdings;
|
|
745
875
|
private benchmark;
|
|
876
|
+
private targetWeights;
|
|
746
877
|
add(symbol: string, options: {
|
|
747
878
|
shares: number;
|
|
748
879
|
cost?: number;
|
|
749
880
|
assetType?: "stock" | "fx" | "crypto" | "fund";
|
|
881
|
+
purchaseDate?: Date | string;
|
|
750
882
|
}): Portfolio;
|
|
751
883
|
update(symbol: string, options: {
|
|
752
884
|
shares?: number;
|
|
753
885
|
cost?: number;
|
|
886
|
+
purchaseDate?: Date | string;
|
|
754
887
|
}): Portfolio;
|
|
755
888
|
remove(symbol: string): Portfolio;
|
|
756
889
|
setBenchmark(symbol: string): Portfolio;
|
|
@@ -765,12 +898,14 @@ declare class Portfolio {
|
|
|
765
898
|
holdings: Array<Holding & {
|
|
766
899
|
symbol: string;
|
|
767
900
|
}>;
|
|
901
|
+
targetWeights?: Record<string, number>;
|
|
768
902
|
};
|
|
769
903
|
static fromDict(data: {
|
|
770
904
|
benchmark?: string;
|
|
771
905
|
holdings: Array<Holding & {
|
|
772
906
|
symbol: string;
|
|
773
907
|
}>;
|
|
908
|
+
targetWeights?: Record<string, number>;
|
|
774
909
|
}): Portfolio;
|
|
775
910
|
clear(): Portfolio;
|
|
776
911
|
private detectAssetType;
|
|
@@ -811,6 +946,34 @@ declare class Portfolio {
|
|
|
811
946
|
sortinoRatio(period?: string): Promise<number>;
|
|
812
947
|
beta(benchmarkSymbol?: string, period?: string): Promise<number>;
|
|
813
948
|
correlationMatrix(period?: string): Promise<Record<string, Record<string, number>>>;
|
|
949
|
+
setTargetWeights(weights: Record<string, number>): Portfolio;
|
|
950
|
+
getTargetWeights(): Record<string, number>;
|
|
951
|
+
drift(): Promise<Array<{
|
|
952
|
+
symbol: string;
|
|
953
|
+
currentWeight: number;
|
|
954
|
+
targetWeight: number;
|
|
955
|
+
drift: number;
|
|
956
|
+
driftPct: number;
|
|
957
|
+
}>>;
|
|
958
|
+
rebalancePlan(threshold?: number): Promise<Array<{
|
|
959
|
+
symbol: string;
|
|
960
|
+
action: "buy" | "sell";
|
|
961
|
+
currentWeight: number;
|
|
962
|
+
targetWeight: number;
|
|
963
|
+
weightDelta: number;
|
|
964
|
+
valueDelta: number;
|
|
965
|
+
}>>;
|
|
966
|
+
rebalance(threshold?: number, dryRun?: boolean): Promise<{
|
|
967
|
+
plan: Array<{
|
|
968
|
+
symbol: string;
|
|
969
|
+
action: "buy" | "sell";
|
|
970
|
+
currentWeight: number;
|
|
971
|
+
targetWeight: number;
|
|
972
|
+
weightDelta: number;
|
|
973
|
+
valueDelta: number;
|
|
974
|
+
}>;
|
|
975
|
+
executed: boolean;
|
|
976
|
+
}>;
|
|
814
977
|
}
|
|
815
978
|
|
|
816
979
|
declare function calculateHeikinAshi(data: OHLCVData[] | null): OHLCVData[];
|
|
@@ -837,40 +1000,6 @@ declare class PineFacadeProvider extends BaseProvider {
|
|
|
837
1000
|
}
|
|
838
1001
|
declare function getPineFacadeProvider(): PineFacadeProvider;
|
|
839
1002
|
|
|
840
|
-
declare const OSCILLATOR_COLUMNS: string[];
|
|
841
|
-
declare const MOVING_AVERAGE_COLUMNS: string[];
|
|
842
|
-
declare const INTERVAL_MAP: Record<string, string>;
|
|
843
|
-
interface TASignalGroup {
|
|
844
|
-
recommendation: string;
|
|
845
|
-
buy: number;
|
|
846
|
-
sell: number;
|
|
847
|
-
neutral: number;
|
|
848
|
-
compute?: Record<string, string>;
|
|
849
|
-
values?: Record<string, number | null>;
|
|
850
|
-
}
|
|
851
|
-
interface TASignals {
|
|
852
|
-
symbol: string;
|
|
853
|
-
exchange: string;
|
|
854
|
-
interval: string;
|
|
855
|
-
summary: TASignalGroup;
|
|
856
|
-
oscillators: TASignalGroup;
|
|
857
|
-
moving_averages: TASignalGroup;
|
|
858
|
-
}
|
|
859
|
-
declare class TradingViewScannerProvider extends BaseProvider {
|
|
860
|
-
private static readonly SCANNER_URL;
|
|
861
|
-
private static readonly SCREENERS;
|
|
862
|
-
private static readonly CACHE_TTL;
|
|
863
|
-
constructor();
|
|
864
|
-
getTASignals(symbol: string, screener?: string, interval?: string): Promise<TASignals>;
|
|
865
|
-
private _getColumnsWithInterval;
|
|
866
|
-
private _calculateSignals;
|
|
867
|
-
private _processRec;
|
|
868
|
-
private _recToSignal;
|
|
869
|
-
private _countSignals;
|
|
870
|
-
private _getRecommendation;
|
|
871
|
-
}
|
|
872
|
-
declare function getScannerProvider(): TradingViewScannerProvider;
|
|
873
|
-
|
|
874
1003
|
interface SearchResult {
|
|
875
1004
|
symbol: string;
|
|
876
1005
|
full_name: string;
|
|
@@ -881,6 +1010,17 @@ interface SearchResult {
|
|
|
881
1010
|
country: string;
|
|
882
1011
|
provider_id?: string;
|
|
883
1012
|
}
|
|
1013
|
+
interface VIOPContract$1 {
|
|
1014
|
+
symbol: string;
|
|
1015
|
+
full_name: string;
|
|
1016
|
+
description: string;
|
|
1017
|
+
base: string;
|
|
1018
|
+
month_code: string;
|
|
1019
|
+
year: string;
|
|
1020
|
+
is_continuous: boolean;
|
|
1021
|
+
exchange: string;
|
|
1022
|
+
type: string;
|
|
1023
|
+
}
|
|
884
1024
|
declare class TradingViewSearchProvider extends BaseProvider {
|
|
885
1025
|
private static readonly SEARCH_URL_V3;
|
|
886
1026
|
private static readonly SEARCH_URL_LEGACY;
|
|
@@ -894,6 +1034,10 @@ declare class TradingViewSearchProvider extends BaseProvider {
|
|
|
894
1034
|
searchBist(query: string, limit?: number): Promise<SearchResult[]>;
|
|
895
1035
|
searchCrypto(query: string, limit?: number): Promise<SearchResult[]>;
|
|
896
1036
|
searchForex(query: string, limit?: number): Promise<SearchResult[]>;
|
|
1037
|
+
searchViop(query: string, limit?: number): Promise<SearchResult[]>;
|
|
1038
|
+
static readonly VIOP_MONTH_CODES: Record<string, string>;
|
|
1039
|
+
static monthCodeToName(code: string): string;
|
|
1040
|
+
getVIOPContracts(baseSymbol: string): Promise<VIOPContract$1[]>;
|
|
897
1041
|
private _fetch;
|
|
898
1042
|
private _parseResults;
|
|
899
1043
|
}
|
|
@@ -923,6 +1067,7 @@ interface Trade {
|
|
|
923
1067
|
profitPct?: number;
|
|
924
1068
|
duration?: number;
|
|
925
1069
|
}
|
|
1070
|
+
type BacktestSummaryData = Omit<BacktestResult, "equityCurve" | "drawdownCurve" | "buyHoldCurve" | "toObject" | "summary">;
|
|
926
1071
|
interface BacktestResult {
|
|
927
1072
|
symbol: string;
|
|
928
1073
|
period: string;
|
|
@@ -938,8 +1083,12 @@ interface BacktestResult {
|
|
|
938
1083
|
winningTrades: number;
|
|
939
1084
|
losingTrades: number;
|
|
940
1085
|
winRate: number;
|
|
941
|
-
profitFactor: number;
|
|
1086
|
+
profitFactor: number | string;
|
|
942
1087
|
avgTrade: number;
|
|
1088
|
+
avgWinningTrade: number;
|
|
1089
|
+
avgLosingTrade: number;
|
|
1090
|
+
maxConsecutiveWins: number;
|
|
1091
|
+
maxConsecutiveLosses: number;
|
|
943
1092
|
maxDrawdown: number;
|
|
944
1093
|
maxDrawdownDuration: number;
|
|
945
1094
|
sharpeRatio: number;
|
|
@@ -959,27 +1108,40 @@ interface BacktestResult {
|
|
|
959
1108
|
date: Date;
|
|
960
1109
|
value: number;
|
|
961
1110
|
}[];
|
|
1111
|
+
toObject(): BacktestSummaryData;
|
|
1112
|
+
summary(): string;
|
|
962
1113
|
}
|
|
963
1114
|
declare class BacktestEngine {
|
|
1115
|
+
static readonly WARMUP_PERIOD = 50;
|
|
964
1116
|
private symbol;
|
|
965
1117
|
private strategy;
|
|
966
1118
|
private period;
|
|
967
1119
|
private interval;
|
|
968
1120
|
private capital;
|
|
969
1121
|
private commission;
|
|
1122
|
+
private slippage;
|
|
970
1123
|
private indicators;
|
|
971
|
-
private warmupPeriod;
|
|
972
1124
|
constructor(symbol: string, strategy: StrategyFunc, options?: {
|
|
973
1125
|
period?: Period;
|
|
974
1126
|
interval?: Interval;
|
|
975
1127
|
capital?: number;
|
|
976
1128
|
commission?: number;
|
|
1129
|
+
slippage?: number;
|
|
977
1130
|
indicators?: string[];
|
|
978
1131
|
});
|
|
979
1132
|
run(): Promise<BacktestResult>;
|
|
980
1133
|
private _calculateIndicators;
|
|
981
1134
|
private _merge;
|
|
982
1135
|
}
|
|
1136
|
+
declare const Backtest: typeof BacktestEngine;
|
|
1137
|
+
declare function backtest(symbol: string, strategy: StrategyFunc, options?: {
|
|
1138
|
+
period?: Period;
|
|
1139
|
+
interval?: Interval;
|
|
1140
|
+
capital?: number;
|
|
1141
|
+
commission?: number;
|
|
1142
|
+
slippage?: number;
|
|
1143
|
+
indicators?: string[];
|
|
1144
|
+
}): Promise<BacktestResult>;
|
|
983
1145
|
|
|
984
1146
|
interface Quote {
|
|
985
1147
|
symbol: string;
|
|
@@ -1148,7 +1310,7 @@ declare function index(symbol: string): Index;
|
|
|
1148
1310
|
declare class Index {
|
|
1149
1311
|
readonly symbol: string;
|
|
1150
1312
|
constructor(symbol: string);
|
|
1151
|
-
get info(): Promise<IndexInfo
|
|
1313
|
+
get info(): Promise<IndexInfo & Record<string, unknown>>;
|
|
1152
1314
|
history(options?: {
|
|
1153
1315
|
period?: Period;
|
|
1154
1316
|
interval?: Interval;
|
|
@@ -1157,6 +1319,14 @@ declare class Index {
|
|
|
1157
1319
|
}): Promise<OHLCVData[]>;
|
|
1158
1320
|
get components(): Promise<IndexComponent[]>;
|
|
1159
1321
|
componentSymbols(): Promise<string[]>;
|
|
1322
|
+
taSignals(interval?: Interval): Promise<TASignals>;
|
|
1323
|
+
taSignalsAllTimeframes(): Promise<Record<string, TASignals | {
|
|
1324
|
+
error: string;
|
|
1325
|
+
}>>;
|
|
1326
|
+
scan(condition: string, options?: {
|
|
1327
|
+
period?: Period;
|
|
1328
|
+
interval?: Interval;
|
|
1329
|
+
}): Promise<ScanResult$1[]>;
|
|
1160
1330
|
private calculateStartDate;
|
|
1161
1331
|
}
|
|
1162
1332
|
|
|
@@ -1180,6 +1350,8 @@ declare function searchBist(query: string, limit?: number): Promise<string[]>;
|
|
|
1180
1350
|
declare function searchCrypto(query: string, limit?: number): Promise<string[]>;
|
|
1181
1351
|
declare function searchForex(query: string, limit?: number): Promise<string[]>;
|
|
1182
1352
|
declare function searchIndex(query: string, limit?: number): Promise<string[]>;
|
|
1353
|
+
declare function searchViop(query: string, limit?: number): Promise<string[]>;
|
|
1354
|
+
declare function viopContracts(baseSymbol: string, fullInfo?: boolean): Promise<string[] | VIOPContract$1[]>;
|
|
1183
1355
|
|
|
1184
1356
|
interface VIOPContract {
|
|
1185
1357
|
code: string;
|
|
@@ -1275,9 +1447,37 @@ declare function economicCalendar(options?: {
|
|
|
1275
1447
|
importance?: "low" | "mid" | "high";
|
|
1276
1448
|
}): Promise<CalendarEvent[]>;
|
|
1277
1449
|
|
|
1450
|
+
interface InflationData {
|
|
1451
|
+
date: Date;
|
|
1452
|
+
yearMonth: string;
|
|
1453
|
+
yearlyInflation: number;
|
|
1454
|
+
monthlyInflation: number;
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1278
1457
|
declare class Inflation {
|
|
1279
|
-
latest(): Promise<
|
|
1280
|
-
|
|
1458
|
+
latest(inflationType?: "tufe" | "ufe"): Promise<{
|
|
1459
|
+
year: number;
|
|
1460
|
+
month: number;
|
|
1461
|
+
value: number;
|
|
1462
|
+
monthlyChange: number;
|
|
1463
|
+
annualChange: number;
|
|
1464
|
+
}>;
|
|
1465
|
+
tufe(options?: {
|
|
1466
|
+
start?: string | Date;
|
|
1467
|
+
end?: string | Date;
|
|
1468
|
+
limit?: number;
|
|
1469
|
+
}): Promise<InflationData[]>;
|
|
1470
|
+
ufe(options?: {
|
|
1471
|
+
start?: string | Date;
|
|
1472
|
+
end?: string | Date;
|
|
1473
|
+
limit?: number;
|
|
1474
|
+
}): Promise<InflationData[]>;
|
|
1475
|
+
calculate(amount: number, startDate: string, endDate: string): Promise<{
|
|
1476
|
+
initialAmount: number;
|
|
1477
|
+
finalAmount: number;
|
|
1478
|
+
totalInflation: number;
|
|
1479
|
+
multiplier: number;
|
|
1480
|
+
}>;
|
|
1281
1481
|
}
|
|
1282
1482
|
|
|
1283
1483
|
interface EurobondData {
|
|
@@ -1294,8 +1494,16 @@ declare function eurobonds(currency?: string): Promise<EurobondData[]>;
|
|
|
1294
1494
|
declare class Eurobond$1 {
|
|
1295
1495
|
readonly isin: string;
|
|
1296
1496
|
constructor(isin: string);
|
|
1297
|
-
|
|
1497
|
+
maturity(): Promise<Date | null>;
|
|
1498
|
+
daysToMaturity(): Promise<number>;
|
|
1499
|
+
currency(): Promise<string>;
|
|
1500
|
+
bidPrice(): Promise<number | null>;
|
|
1501
|
+
bidYield(): Promise<number | null>;
|
|
1502
|
+
yieldRate(): Promise<number | null>;
|
|
1503
|
+
askPrice(): Promise<number | null>;
|
|
1504
|
+
askYield(): Promise<number | null>;
|
|
1298
1505
|
getData(): Promise<EurobondData | null>;
|
|
1506
|
+
info(): Promise<EurobondData | null>;
|
|
1299
1507
|
}
|
|
1300
1508
|
|
|
1301
1509
|
declare class BorsaTSError extends Error {
|
|
@@ -1326,6 +1534,36 @@ declare class InvalidIntervalError extends BorsaTSError {
|
|
|
1326
1534
|
constructor(interval: string, validIntervals: string[]);
|
|
1327
1535
|
}
|
|
1328
1536
|
|
|
1537
|
+
declare const TAX_CATEGORIES: {
|
|
1538
|
+
readonly HISSE_YOĞUN: "Hisse Yoğun Fon";
|
|
1539
|
+
readonly HISSE_ENDEKS: "Hisse Endeks Fon";
|
|
1540
|
+
readonly DIGER: "Diğer Fon";
|
|
1541
|
+
readonly GIRISIM_SERMAYESI: "Girişim Sermayesi Fon";
|
|
1542
|
+
readonly GAYRIMENKUL: "Gayrimenkul Yatırım Fon";
|
|
1543
|
+
readonly ALTIN_GUMUS: "Altın/Gümüş ve Kıymetli Maden Fonları";
|
|
1544
|
+
readonly DOVIZ: "Döviz Fonları";
|
|
1545
|
+
readonly KATILIM: "Katılım Fonları (Faiz Dışı)";
|
|
1546
|
+
readonly BYF_HISSE: "BYF Hisse";
|
|
1547
|
+
readonly BYF_DIGER: "BYF Diğer";
|
|
1548
|
+
};
|
|
1549
|
+
type TaxCategory = (typeof TAX_CATEGORIES)[keyof typeof TAX_CATEGORIES];
|
|
1550
|
+
interface TaxPeriod {
|
|
1551
|
+
startDate: Date;
|
|
1552
|
+
endDate: Date | null;
|
|
1553
|
+
label: string;
|
|
1554
|
+
}
|
|
1555
|
+
declare const TAX_PERIODS: TaxPeriod[];
|
|
1556
|
+
declare function classifyFundTaxCategory(category: string, fundName?: string): string;
|
|
1557
|
+
declare function getWithholdingTaxRate(taxCategory: string, purchaseDate?: Date, _holdingDays?: number): number;
|
|
1558
|
+
declare function withholdingTaxRate(fundCode: string, purchaseDate?: Date, holdingDays?: number): Promise<number>;
|
|
1559
|
+
declare function withholdingTaxTable(): Array<{
|
|
1560
|
+
category: string;
|
|
1561
|
+
periods: Array<{
|
|
1562
|
+
label: string;
|
|
1563
|
+
rate: number;
|
|
1564
|
+
}>;
|
|
1565
|
+
}>;
|
|
1566
|
+
|
|
1329
1567
|
declare const FIELD_MAP: Record<string, string>;
|
|
1330
1568
|
declare const OPERATORS: Record<string, string>;
|
|
1331
1569
|
declare const LOCAL_CALC_FIELDS: Set<string>;
|
|
@@ -1390,4 +1628,4 @@ declare class ZiraatEurobondProvider extends BaseProvider {
|
|
|
1390
1628
|
}
|
|
1391
1629
|
declare function getEurobondProvider(): ZiraatEurobondProvider;
|
|
1392
1630
|
|
|
1393
|
-
export { APIError, type ActionData, type AddIndicatorsOptions, type AllRatesRecord, type AllocationData, type AssetType, AuthenticationError, BacktestEngine, type BacktestResult, type BalanceSheet, type BankRate, Bond, BorsaTSError, COUNTRIES, type CacheOptions, type CalendarEvent, type Candle, type CashFlowStatement, type CompanyInfo, Crypto, type CryptoPair, type CurrentData, DEFAULT_COLUMNS, DataNotAvailableError, type DividendData, type ETFHolder, EconomicCalendar, type EnrichedInfo, Eurobond$1 as Eurobond, type EurobondData, FIELD_MAP, FX, FastInfo, type FinancialRow, Fund, type FundInfo, type FundRiskMetrics, type HolderData, type Holding, INDICATOR_OUTPUTS, INDICES, INTERVAL_MAP, type IncomeStatement, Index, type IndexComponent, type IndexInfo, type IndicatorData, type IndicatorMetadata, Inflation, type InstitutionRate, type Interval, InvalidIntervalError, InvalidPeriodError, LOCAL_CALC_FIELDS, MOVING_AVERAGE_COLUMNS, type MetalInstitutionRate, type NewsItem, type OHLCVData, type OHLCVWithActions, OPERATORS, OSCILLATOR_COLUMNS, type Period, PineFacadeProvider, type PineStudy, Portfolio, type Position, type PriceTarget, type ProviderConfig, type Quote, RateLimitError, type RateRecord, type Recommendation, type ReplayCandle, ReplaySession, type ReplayStats, type RequestOptions, type RiskMetrics, STANDARD_INDICATORS, type ScanOptions, type ScanResult$1 as ScanResult, Screener, type ScreenerCriteria, type ScreenerResult, type SearchResult, type Signal, type SplitData, type StrategyFunc, type StreamCandle, StudySession, type TASignalGroup, type TASignals, TCMB, type ScanResult as TVScanResult, TVScreenerProvider, TechnicalAnalyzer, TechnicalScanner, Ticker, TickerNotFoundError, type Trade, TradingViewETFProvider, TradingViewScannerProvider, TradingViewSearchProvider, TradingViewStream, type UnifiedSearchResult, VIOP, type VIOPContract, type Eurobond as ZiraatEurobondData, ZiraatEurobondProvider, addIndicators, allIndices, banks, bonds, calculateADX, calculateATR, calculateBollingerBands, calculateCCI, calculateEMA, calculateHeikinAshi, calculateIchimoku, calculateMACD, calculateOBV, calculatePivotPoints, calculateRSI, calculateSMA, calculateStochastic, calculateSupertrend, calculateTilsonT3, calculateVWAP, calculateWilliamsR, companies, compareFunds, createReplay, cryptoList, economicCalendar, eurobonds, getEurobondProvider, getPineFacadeProvider, getScannerProvider, getSearchProvider, getTVScreenerProvider, getTradingViewETFProvider, index, indices, metalInstitutions, policyRate, riskFreeRate, scan, screenFunds, screenStocks, screenerCriteria, search, searchBist, searchCompanies, searchCrypto, searchForex, searchFunds, searchIndex, sectors, stockIndices };
|
|
1631
|
+
export { APIError, type ActionData, type AddIndicatorsOptions, type AllRatesRecord, type AllocationData, type AssetType, AuthenticationError, Backtest, BacktestEngine, type BacktestResult, type BacktestSummaryData, type BalanceSheet, type BankRate, Bond, BorsaTSError, COUNTRIES, type CacheOptions, type CalendarEvent, type Candle, type CashFlowStatement, type CompanyInfo, Crypto, type CryptoPair, type CurrentData, DEFAULT_COLUMNS, DataNotAvailableError, type DividendData, type ETFHolder, EconomicCalendar, type EnrichedInfo, Eurobond$1 as Eurobond, type EurobondData, FIELD_MAP, FX, FastInfo, type FinancialRow, Fund, type FundInfo, type FundRiskMetrics, type FundType, type HolderData, type Holding, INDICATOR_OUTPUTS, INDICES, INTERVAL_MAP, type IncomeStatement, Index, type IndexComponent, type IndexInfo, type IndicatorData, type IndicatorMetadata, Inflation, type InstitutionRate, type Interval, InvalidIntervalError, InvalidPeriodError, LOCAL_CALC_FIELDS, MOVING_AVERAGE_COLUMNS, type MetalInstitutionRate, type NewsItem, type OHLCVData, type OHLCVWithActions, OPERATORS, OSCILLATOR_COLUMNS, type Period, PineFacadeProvider, type PineStudy, Portfolio, type Position, type PriceTarget, type ProviderConfig, type Quote, RateLimitError, type RateRecord, type Recommendation, type ReplayCandle, ReplaySession, type ReplayStats, type RequestOptions, type RiskMetrics, STANDARD_INDICATORS, type ScanOptions, type ScanResult$1 as ScanResult, Screener, type ScreenerCriteria, type ScreenerResult, type SearchResult, type Signal, type SplitData, type StrategyFunc, type StreamCandle, StudySession, type TASignalGroup, type TASignals, TAX_CATEGORIES, TAX_PERIODS, TCMB, type ScanResult as TVScanResult, TVScreenerProvider, type TaxCategory, type TaxPeriod, TechnicalAnalyzer, TechnicalScanner, Ticker, TickerNotFoundError, type Trade, TradingViewETFProvider, TradingViewScannerProvider, TradingViewSearchProvider, TradingViewStream, type UnifiedSearchResult, VIOP, type VIOPContract, type Eurobond as ZiraatEurobondData, ZiraatEurobondProvider, addIndicators, allIndices, backtest, banks, bonds, calculateADX, calculateATR, calculateBollingerBands, calculateCCI, calculateDEMA, calculateEMA, calculateHHV, calculateHeikinAshi, calculateIchimoku, calculateLLV, calculateMACD, calculateMOM, calculateOBV, calculatePivotPoints, calculateROC, calculateRSI, calculateSMA, calculateStochastic, calculateSupertrend, calculateTEMA, calculateTilsonT3, calculateVWAP, calculateWMA, calculateWilliamsR, classifyFundTaxCategory, companies, compareFunds, createReplay, cryptoList, economicCalendar, eurobonds, getEurobondProvider, getPineFacadeProvider, getScannerProvider, getSearchProvider, getTVScreenerProvider, getTradingViewETFProvider, getWithholdingTaxRate, index, indices, managementFees, metalInstitutions, policyRate, riskFreeRate, scan, screenFunds, screenStocks, screenerCriteria, search, searchBist, searchCompanies, searchCrypto, searchForex, searchFunds, searchIndex, searchViop, sectors, stockIndices, viopContracts, withholdingTaxRate, withholdingTaxTable };
|