parser-de-notas-de-corretagem 0.5.0 → 0.5.2
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/asset-crawler.d.ts +76 -0
- package/notes-parser.d.ts +11 -3
- package/notes-parser.js +1 -1
- package/notes-parser.js.map +1 -1
- package/package.json +1 -1
- package/types/common.d.ts +23 -0
- package/types/corporative-events.d.ts +378 -0
- package/types/listed-real-estates.d.ts +102 -0
- package/types/listed-stocks.d.ts +49 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Asset } from "./types/common";
|
|
2
|
+
import { StockInfos } from "./types/listed-stocks";
|
|
3
|
+
import { FiiInfos } from "./types/listed-real-estates";
|
|
4
|
+
import { CashDividendShortVersion, StockDividendShortVersion } from "./types/corporative-events";
|
|
5
|
+
/** Types of asset verbosity */
|
|
6
|
+
export type AssetVerbosity = 'off' | 'all' | 'minimal';
|
|
7
|
+
/** Assets crawler manager */
|
|
8
|
+
export declare class AssetCrawler {
|
|
9
|
+
/** Assets cached */
|
|
10
|
+
protected assets: Array<StockInfos | FiiInfos>;
|
|
11
|
+
/** Assets defined on runtime */
|
|
12
|
+
customAssets: Asset[];
|
|
13
|
+
/** Auto-update flag */
|
|
14
|
+
private _autoUpdate;
|
|
15
|
+
/** Auto-update flag */
|
|
16
|
+
set autoUpdate(v: boolean);
|
|
17
|
+
get autoUpdate(): boolean;
|
|
18
|
+
private autoUpdateTimer;
|
|
19
|
+
/** Auto-update timeout */
|
|
20
|
+
private updaterTimeout;
|
|
21
|
+
/** Auto-update timeout when any failure happens */
|
|
22
|
+
private updaterTimeoutIfFailed;
|
|
23
|
+
/** Set the verbosity level */
|
|
24
|
+
verbosity: AssetVerbosity;
|
|
25
|
+
/** Max number of retries when fetching data. Default is 20 */
|
|
26
|
+
maxRetries: number;
|
|
27
|
+
/** Manage the keys being listened to */
|
|
28
|
+
private listenerKey;
|
|
29
|
+
/** Keys generated on update */
|
|
30
|
+
private listeners;
|
|
31
|
+
/**
|
|
32
|
+
* Instantiate a new `AssetCrawler`
|
|
33
|
+
* @param autoUpdate whether the application should auto-update
|
|
34
|
+
* the list of assets for new changes. Default is `false`. Require internet connection
|
|
35
|
+
* @param verbose set the verbosity level. Default is `off`
|
|
36
|
+
*/
|
|
37
|
+
constructor(autoUpdate?: boolean, verbose?: AssetVerbosity);
|
|
38
|
+
/**
|
|
39
|
+
* Update the listed assets after a timeout
|
|
40
|
+
* @param timeout update after `timeout` milliseconds
|
|
41
|
+
*/
|
|
42
|
+
private updater;
|
|
43
|
+
/**
|
|
44
|
+
* Update the current listed assets. May take several minutes.
|
|
45
|
+
* If `maxRetires` is reached, an Error is thrown and the fetch
|
|
46
|
+
* process is interrupted
|
|
47
|
+
*/
|
|
48
|
+
fetchListedAssets(): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Parse the stock name and returns the stock code
|
|
51
|
+
* @param name title of the stock in the brokerage note
|
|
52
|
+
* @returns the stock code
|
|
53
|
+
*/
|
|
54
|
+
getCodeFromTitle(name: string): Asset;
|
|
55
|
+
/**
|
|
56
|
+
* Get the stock dividends and the cash dividends of a given asset, if any
|
|
57
|
+
* @param code the asset code (letter only)
|
|
58
|
+
* @returns and `Array` where the first position is the list of stock dividends
|
|
59
|
+
* and the second position is a list of the cash dividends
|
|
60
|
+
*/
|
|
61
|
+
getDividends(code: string): [StockDividendShortVersion[], CashDividendShortVersion[]];
|
|
62
|
+
/**
|
|
63
|
+
* Subscribe to updates when `autoUpdate` is `on` or
|
|
64
|
+
* when `fetchListedAssets` is manually called
|
|
65
|
+
* @param callback function to be called when the data is updated
|
|
66
|
+
* @returns the key number referring to the listener. Can be used to `unsubscribeToUpdates`
|
|
67
|
+
*/
|
|
68
|
+
subscribeToUpdates(callback: (assets: Array<StockInfos | FiiInfos>) => void): number;
|
|
69
|
+
/**
|
|
70
|
+
* Unsubscribe to updates when `autoUpdate` is `on` or
|
|
71
|
+
* when `fetchListedAssets` is manually called
|
|
72
|
+
* @param key the subscription key returned by `subscribeToUpdates`
|
|
73
|
+
*/
|
|
74
|
+
unsubscribeToUpdates(key: number): void;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=asset-crawler.d.ts.map
|
package/notes-parser.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { AssetCrawler, AssetVerbosity } from "./asset-crawler";
|
|
1
2
|
import { CashDividendShortVersion, StockDividendShortVersion } from './types/corporative-events';
|
|
3
|
+
export { AssetCrawler, CashDividendShortVersion, StockDividendShortVersion };
|
|
4
|
+
export type { AssetVerbosity };
|
|
2
5
|
/** Deal made in a `NegotiationNote` type */
|
|
3
6
|
export interface Deal {
|
|
4
7
|
/** Deal type */
|
|
@@ -64,17 +67,22 @@ export declare class UnknownAsset extends Error {
|
|
|
64
67
|
}
|
|
65
68
|
/** Brokerage notes parser */
|
|
66
69
|
export declare class NoteParser {
|
|
67
|
-
/**
|
|
68
|
-
|
|
70
|
+
/** Info about the assets */
|
|
71
|
+
assetCrawler: AssetCrawler;
|
|
69
72
|
/** The date format used. Default is `dd/MM/yyyy` */
|
|
70
73
|
private dateFormat;
|
|
74
|
+
/** Set the verbosity level. Actually it's the same as the crawler */
|
|
75
|
+
private _verbosity;
|
|
76
|
+
/** Set the verbosity level */
|
|
77
|
+
set verbosity(v: AssetVerbosity);
|
|
78
|
+
get verbosity(): AssetVerbosity;
|
|
71
79
|
/**
|
|
72
80
|
* Instantiate a new `NoteParser`
|
|
73
81
|
* @param autoUpdateLookUpList whether the application should auto-update
|
|
74
82
|
* the list of assets for new changes every week. Default is `false`. Require internet connection.
|
|
75
83
|
* Updating this package to the latest version also gets the latest infos
|
|
76
84
|
*/
|
|
77
|
-
constructor(autoUpdateLookUpList?: boolean);
|
|
85
|
+
constructor(autoUpdateLookUpList?: boolean, verbosity?: AssetVerbosity);
|
|
78
86
|
/**
|
|
79
87
|
* Set the date format
|
|
80
88
|
* @param format a `DateFormat`
|