pinets 0.9.4 → 0.9.5
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/README.md +3 -2
- package/dist/pinets.min.browser.es.js +15 -15
- package/dist/pinets.min.browser.es.js.map +1 -1
- package/dist/pinets.min.browser.js +16 -16
- package/dist/pinets.min.browser.js.map +1 -1
- package/dist/pinets.min.cjs +12 -12
- package/dist/pinets.min.cjs.map +1 -1
- package/dist/pinets.min.es.js +12 -12
- package/dist/pinets.min.es.js.map +1 -1
- package/dist/types/Context.class.d.ts +1 -0
- package/dist/types/PineTS.class.d.ts +9 -0
- package/dist/types/marketData/Binance/BinanceProvider.class.d.ts +12 -0
- package/dist/types/marketData/IProvider.d.ts +12 -0
- package/dist/types/marketData/Mock/MockProvider.class.d.ts +7 -0
- package/dist/types/namespaces/Log.d.ts +1 -0
- package/package.json +1 -1
|
@@ -31,6 +31,15 @@ export declare class PineTS {
|
|
|
31
31
|
private _isSecondaryContext;
|
|
32
32
|
markAsSecondary(): void;
|
|
33
33
|
private _syminfo;
|
|
34
|
+
private _chartTimezone;
|
|
35
|
+
/**
|
|
36
|
+
* Set the chart display timezone (like TradingView's timezone picker).
|
|
37
|
+
* This only affects log timestamp formatting — it does NOT change the timezone
|
|
38
|
+
* used by computation functions (timestamp(), dayofmonth, hour, etc.), which
|
|
39
|
+
* always use the exchange timezone from syminfo.timezone.
|
|
40
|
+
* @param timezone IANA timezone name (e.g. 'America/New_York'), UTC offset ('UTC+5'), or 'UTC'
|
|
41
|
+
*/
|
|
42
|
+
setTimezone(timezone: string): void;
|
|
34
43
|
constructor(source: IProvider | any[], tickerId?: string, timeframe?: string, limit?: number, sDate?: number, eDate?: number);
|
|
35
44
|
setDebugSettings({ ln, debug }: {
|
|
36
45
|
ln: boolean;
|
|
@@ -3,12 +3,24 @@ export declare class BinanceProvider implements IProvider {
|
|
|
3
3
|
private cacheManager;
|
|
4
4
|
private activeApiUrl;
|
|
5
5
|
constructor();
|
|
6
|
+
/**
|
|
7
|
+
* Normalize closeTime to TradingView convention: closeTime = next bar's openTime.
|
|
8
|
+
* Binance raw API returns closeTime as (nextBarOpen - 1ms). For all bars except the
|
|
9
|
+
* last, we use the next bar's actual openTime (exact). For the last bar, we add 1ms
|
|
10
|
+
* to the raw value.
|
|
11
|
+
*/
|
|
12
|
+
private _normalizeCloseTime;
|
|
6
13
|
/**
|
|
7
14
|
* Resolves the working Binance API endpoint.
|
|
8
15
|
* Tries default first, then falls back to US endpoint.
|
|
9
16
|
* Caches the working endpoint for future calls.
|
|
10
17
|
*/
|
|
11
18
|
private getBaseUrl;
|
|
19
|
+
/**
|
|
20
|
+
* Fetch a single chunk of raw kline data from the Binance API (no closeTime normalization).
|
|
21
|
+
* Used internally by pagination methods that assemble chunks before normalizing.
|
|
22
|
+
*/
|
|
23
|
+
private _fetchRawChunk;
|
|
12
24
|
getMarketDataInterval(tickerId: string, timeframe: string, sDate: number, eDate: number): Promise<any>;
|
|
13
25
|
private getMarketDataBackwards;
|
|
14
26
|
getMarketData(tickerId: string, timeframe: string, limit?: number, sDate?: number, eDate?: number): Promise<any>;
|
|
@@ -40,6 +40,18 @@ export type ISymbolInfo = {
|
|
|
40
40
|
target_price_low: number;
|
|
41
41
|
target_price_median: number;
|
|
42
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* Market data provider interface.
|
|
45
|
+
*
|
|
46
|
+
* ## closeTime convention
|
|
47
|
+
* Providers MUST return `closeTime` following the TradingView convention:
|
|
48
|
+
* `closeTime` = the timestamp of the **start of the next bar** (not the last
|
|
49
|
+
* millisecond of the current bar). For example, a weekly bar opening on
|
|
50
|
+
* Monday 2019-01-07T00:00Z should have `closeTime = 2019-01-14T00:00Z`.
|
|
51
|
+
*
|
|
52
|
+
* If a provider's raw data uses a different convention (e.g., Binance returns
|
|
53
|
+
* `nextBarOpen - 1ms`), the provider must normalize before returning.
|
|
54
|
+
*/
|
|
43
55
|
export interface IProvider {
|
|
44
56
|
getMarketData(tickerId: string, timeframe: string, limit?: number, sDate?: number, eDate?: number): Promise<any>;
|
|
45
57
|
getSymbolInfo(tickerId: string): Promise<ISymbolInfo>;
|
|
@@ -80,6 +80,13 @@ export declare class MockProvider implements IProvider {
|
|
|
80
80
|
* @returns Promise<ISymbolInfo> - Symbol information
|
|
81
81
|
*/
|
|
82
82
|
getSymbolInfo(tickerId: string): Promise<ISymbolInfo>;
|
|
83
|
+
/**
|
|
84
|
+
* Normalize closeTime to TradingView convention: closeTime = next bar's openTime.
|
|
85
|
+
* Mock data files contain raw Binance data where closeTime = (nextBarOpen - 1ms).
|
|
86
|
+
* For all bars except the last, we use the next bar's actual openTime. For the
|
|
87
|
+
* last bar, we add 1ms to the raw value.
|
|
88
|
+
*/
|
|
89
|
+
private _normalizeCloseTime;
|
|
83
90
|
/**
|
|
84
91
|
* Clears the data cache
|
|
85
92
|
*/
|
|
@@ -4,6 +4,7 @@ export declare class Log {
|
|
|
4
4
|
constructor(context: Context);
|
|
5
5
|
private logFormat;
|
|
6
6
|
param(source: any, index?: number, name?: string): any;
|
|
7
|
+
private _formatTimestamp;
|
|
7
8
|
warning(message: string, ...args: any[]): void;
|
|
8
9
|
error(message: string, ...args: any[]): void;
|
|
9
10
|
info(message: string, ...args: any[]): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pinets",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.5",
|
|
4
4
|
"description": "Run Pine Script anywhere. PineTS is an open-source transpiler and runtime that brings Pine Script logic to Node.js and the browser with 1:1 syntax compatibility. Reliably write, port, and run indicators or strategies on your own infrastructure.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Pine Script",
|