<!-- Public documentation export; not library implementation source. -->
# PineChartRuntimeApi

[Integration guide](https://docs.lumencharts.com/charting-library/reference/compatibility) · [Reference index](https://docs.lumencharts.com/charting-library/api/)

Public contract reference. This declaration describes types and callback shapes; availability is constrained by the linked integration guide and the runtime capability. Legacy product-specific fields are not a promise of implementation.

## chartEpoch {#chartepoch}

```ts
chartEpoch(): number;
```

Use the type signature above and the integration guide for the owning capability.

## compile {#compile}

```ts
compile(
    source: string,
    options?: { signal?: AbortSignal },
  ): Promise<PineScriptCompileResult>;
```

Use the type signature above and the integration guide for the owning capability.

| Parameter | Type | Required |
| --- | --- | --- |
| `source` | `string` | Yes |
| `options` | `{ signal?: AbortSignal }` | No |

## run {#run}

```ts
run(input: {
    source: string;
    sourceHash: string;
    studyId?: string | null;
  }): Promise<{
    chartEpoch: number;
    compile: PineScriptCompileResult;
    sourceHash: string;
    strategyReportBaseline: {
      revision: number;
      studyId: string | null;
    };
    studyId: string;
  }>;
```

Use the type signature above and the integration guide for the owning capability.

| Parameter | Type | Required |
| --- | --- | --- |
| `input` | `{     source: string;     sourceHash: string;     studyId?: string &#124; null;   }` | Yes |

## remove {#remove}

```ts
remove(studyId: string): Promise<void>;
```

Use the type signature above and the integration guide for the owning capability.

| Parameter | Type | Required |
| --- | --- | --- |
| `studyId` | `string` | Yes |

## getExecutionProgress {#getexecutionprogress}

```ts
getExecutionProgress(studyId: string): PineExecutionProgress | null;
```

Use the type signature above and the integration guide for the owning capability.

| Parameter | Type | Required |
| --- | --- | --- |
| `studyId` | `string` | Yes |

## getStrategyReport {#getstrategyreport}

```ts
getStrategyReport(studyId: string): PineStrategyReport | null;
```

Use the type signature above and the integration guide for the owning capability.

| Parameter | Type | Required |
| --- | --- | --- |
| `studyId` | `string` | Yes |

## getStrategySnapshot {#getstrategysnapshot}

```ts
getStrategySnapshot(studyId: string): {
    report: PineStrategyReport;
    revision: number;
  } | null;
```

Use the type signature above and the integration guide for the owning capability.

| Parameter | Type | Required |
| --- | --- | --- |
| `studyId` | `string` | Yes |

## getLogSnapshot {#getlogsnapshot}

```ts
getLogSnapshot(studyId: string): { logs: PineLogPage; revision: number } | null;
```

Use the type signature above and the integration guide for the owning capability.

| Parameter | Type | Required |
| --- | --- | --- |
| `studyId` | `string` | Yes |

## subscribeLogs {#subscribelogs}

```ts
subscribeLogs(studyId: string, listener: (change: { revision: number; logs: PineLogPage | null }) => void): () => void;
```

Use the type signature above and the integration guide for the owning capability.

| Parameter | Type | Required |
| --- | --- | --- |
| `studyId` | `string` | Yes |
| `listener` | `(change: { revision: number; logs: PineLogPage &#124; null }) => void` | Yes |

## readLogPage {#readlogpage}

```ts
readLogPage(studyId: string, cursor: PineLogCursor, options?: { signal?: AbortSignal }): Promise<PineLogPage>;
```

Use the type signature above and the integration guide for the owning capability.

| Parameter | Type | Required |
| --- | --- | --- |
| `studyId` | `string` | Yes |
| `cursor` | `PineLogCursor` | Yes |
| `options` | `{ signal?: AbortSignal }` | No |

## focusLogBar {#focuslogbar}

```ts
focusLogBar(studyId: string, barOpenTimeMs: number): Promise<void>;
```

Use the type signature above and the integration guide for the owning capability.

| Parameter | Type | Required |
| --- | --- | --- |
| `studyId` | `string` | Yes |
| `barOpenTimeMs` | `number` | Yes |

## subscribeExecutionProgress {#subscribeexecutionprogress}

```ts
subscribeExecutionProgress(
    studyId: string,
    listener: (progress: PineExecutionProgress) => void,
  ): () => void;
```

Use the type signature above and the integration guide for the owning capability.

| Parameter | Type | Required |
| --- | --- | --- |
| `studyId` | `string` | Yes |
| `listener` | `(progress: PineExecutionProgress) => void` | Yes |

## subscribeStrategyReport {#subscribestrategyreport}

```ts
subscribeStrategyReport(
    studyId: string,
    listener: (change: {
      revision: number;
      report: PineStrategyReport;
    }) => void,
  ): () => void;
```

Use the type signature above and the integration guide for the owning capability.

| Parameter | Type | Required |
| --- | --- | --- |
| `studyId` | `string` | Yes |
| `listener` | `(change: {       revision: number;       report: PineStrategyReport;     }) => void` | Yes |

## focusStrategyTrade {#focusstrategytrade}

```ts
focusStrategyTrade(studyId: string, tradeId: string): Promise<void>;
```

Use the type signature above and the integration guide for the owning capability.

| Parameter | Type | Required |
| --- | --- | --- |
| `studyId` | `string` | Yes |
| `tradeId` | `string` | Yes |

## Related types

- [PineScriptCompileResult](https://docs.lumencharts.com/charting-library/api/PineScriptCompileResult)
- [PineStrategyReport](https://docs.lumencharts.com/charting-library/api/PineStrategyReport)
- [PineLogPage](https://docs.lumencharts.com/charting-library/api/PineLogPage)
- [PineLogCursor](https://docs.lumencharts.com/charting-library/api/PineLogCursor)

---
Documentation page: https://docs.lumencharts.com/charting-library/api/PineChartRuntimeApi
