/* auto-generated by NAPI-RS */
/* eslint-disable */
export declare class NodeBacktest {
  constructor(ctx: NodeCtx, initialCapital?: number | undefined | null, processOrdersOnClose?: boolean | undefined | null, riskFreeRate?: number | undefined | null, annualizationFactor?: number | undefined | null)
  get initialCapital(): number
  get processOrdersOnClose(): boolean
  get ctx(): NodeCtx
  get equity(): number
  get equityList(): Array<number>
  get netEquity(): number
  get netEquityList(): Array<number>
  get pnlList(): Array<number>
  get openProfit(): number
  get netProfit(): number
  get netProfitPct(): number
  get grossProfit(): number
  get grossProfitPct(): number
  get grossLoss(): number
  get grossLossPct(): number
  get winRate(): number
  get profitFactor(): number
  get avgTrade(): number
  get avgWinningTrade(): number
  get avgLosingTrade(): number
  get avgWinLossRatio(): number
  get returnsList(): Array<number>
  sharpeRatio(): number
  sortinoRatio(): number
  expectancy(): number
  winningTradesCount(): bigint
  get losingTradesCount(): bigint
  get positionSize(): number
  get openTrades(): Array<NodeTrade>
  get closedTrades(): Array<NodeTrade>
  get trades(): Array<NodeTrade>
  get openLongsCount(): bigint
  get openShortsCount(): bigint
  get closedLongsCount(): bigint
  get closedShortsCount(): bigint
  get firstEntryBarIndex(): bigint | null
  get instrumentSize(): number
  onBarOpen(): void
  onBarClose(): void
  signal(signal: NodeSignal): void
  skip(skip: NodeCtxSkip): void
  length(): number
  next(): number | null
  toPine(): string
  display(): void
}

export declare class NodeCtx {
  constructor(ohlcv?: NodeOhlcv | undefined | null, sym?: NodeSym | undefined | null)
  get barIndex(): number
  get bar(): NodeOhlcvBar
  get isInitialized(): boolean
  get sym(): NodeSym
  get ohlcv(): NodeOhlcv
  copy(): NodeCtx
  reset(): void
  next(): number | null
  get length(): number
  skip(skip: NodeCtxSkip): void
  ref(): NodeCtx
}

export declare class NodeCtxSkip {
  static end(): NodeCtxSkip
  static bars(bars: number): NodeCtxSkip
  static barIndex(barIndex: number): NodeCtxSkip
  static openTimeEq(openTime: Date): NodeCtxSkip
  static openTimeGeq(openTime: Date): NodeCtxSkip
}

export declare class NodeOhlcv {
  constructor()
  static fromBars(bars: Array<NodeOhlcvBar>): NodeOhlcv
  get timeframe(): NodeTimeframe
  set timeframe(timeframe: NodeTimeframe)
  get openTime(): Array<Date | undefined | null>
  get closeTime(): Array<Date | undefined | null>
  get open(): Array<number>
  get high(): Array<number>
  get low(): Array<number>
  get close(): Array<number>
  get volume(): Array<number>
  get bars(): Array<NodeOhlcvBar>
  at(index: number): NodeOhlcvBar | null
  get length(): number
  slice(start: number, end: number): NodeOhlcv
  head(count: number): NodeOhlcv
  tail(count: number): NodeOhlcv
  copy(): NodeOhlcv
  extend(other: NodeOhlcv): void
  resample(timeframe: NodeTimeframe, alignUtc: boolean): NodeOhlcv
  sort(ascending: boolean): void
  reverse(): void
  clear(): void
  pop(): NodeOhlcvBar | null
  shift(): NodeOhlcvBar | null
  push(bar: NodeOhlcvBar): void
  pushMany(bars: Array<NodeOhlcvBar>): void
  toString(): string
  ref(): NodeOhlcv
  static readCsv(path: string, timeframe?: NodeTimeframe | undefined | null): NodeOhlcv
  static readParquet(path: string, timeframe?: NodeTimeframe | undefined | null): NodeOhlcv
  writeCsv(path: string): void
  writeParquet(path: string): void
}

export declare class NodeOhlcvBar {
  constructor(openTime?: Date | undefined | null, closeTime?: Date | undefined | null, open?: number | undefined | null, high?: number | undefined | null, low?: number | undefined | null, close?: number | undefined | null, volume?: number | undefined | null)
  get openTime(): Date | null
  set openTime(openTime?: Date | undefined | null)
  get closeTime(): Date | null
  set closeTime(closeTime?: Date | undefined | null)
  get open(): number
  set open(open: number)
  get high(): number
  set high(high: number)
  get low(): number
  set low(low: number)
  get close(): number
  set close(close: number)
  get volume(): number
  set volume(volume: number)
  merge(other: NodeOhlcvBar): NodeOhlcvBar
  toString(): string
  toJSON(): object
  static fromJSON(json: object): NodeOhlcvBar
}

export declare class NodeSignal {
  static Hold(): NodeSignal
  static Size(size: number): NodeSignal
  static EquityPct(equityPct: number): NodeSignal
  static CloseAll(): NodeSignal
  static Long(): NodeSignal
  static Short(): NodeSignal
  get id(): string | null
  set id(id?: string | undefined | null)
  get comment(): string | null
  set comment(comment?: string | undefined | null)
}

export declare class NodeSym {
  constructor()
  toString(): string
  get id(): string | null
  set id(id?: string | undefined | null)
  get tickerId(): string | null
  set tickerId(tickerId?: string | undefined | null)
  get kind(): NodeSymKind
  set kind(kind: NodeSymKind)
  get minTick(): number
  set minTick(v: number)
  get minQty(): number
  set minQty(v: number)
  get prefix(): string | null
  set prefix(v?: string | undefined | null)
  get currency(): string | null
  set currency(v?: string | undefined | null)
  get baseCurrency(): string | null
  set baseCurrency(v?: string | undefined | null)
  get ticker(): string | null
  set ticker(v?: string | undefined | null)
  get country(): string | null
  set country(v?: string | undefined | null)
  get priceScale(): number
  set priceScale(v: number)
  get pointValue(): number
  set pointValue(v: number)
  get metadata(): string | null
  set metadata(v?: string | undefined | null)
  get qtyScale(): number
  static BTC_USD(): NodeSym
  static ETH_USD(): NodeSym
  static SOL_USD(): NodeSym
  static DOGE_USD(): NodeSym
  eq(other: NodeSym): boolean
  toJSON(): object
  static fromJSON(json: object): NodeSym
}

export declare class NodeSymKind {
  toString(): string
  static fromString(text: string): NodeSymKind
  static Stock(): NodeSymKind
  static Future(): NodeSymKind
  static Option(): NodeSymKind
  static Forex(): NodeSymKind
  static Crypto(): NodeSymKind
  static Unknown(): NodeSymKind
  static Other(other: string): NodeSymKind
  eq(other: NodeSymKind): boolean
  get periods(): number
}

export declare class NodeTimeframe {
  toString(): string
  static fromString(timeframe: string): NodeTimeframe
  static Years(value: number): NodeTimeframe
  static Months(value: number): NodeTimeframe
  static Weeks(value: number): NodeTimeframe
  static Days(value: number): NodeTimeframe
  static Hours(value: number): NodeTimeframe
  static Minutes(value: number): NodeTimeframe
  static Seconds(value: number): NodeTimeframe
  static Ticks(value: number): NodeTimeframe
  static Ranges(value: number): NodeTimeframe
  static Unknown(): NodeTimeframe
  get years(): number | null
  get months(): number | null
  get weeks(): number | null
  get days(): number | null
  get hours(): number | null
  get minutes(): number | null
  get seconds(): number | null
  get ticks(): number | null
  get ranges(): number | null
  get unknown(): boolean
  eq(other: NodeTimeframe): boolean
  toDurationS(): number
  static fromDurationS(duration: number): NodeTimeframe
}

export declare class NodeTrade {
  get size(): number
  get entry(): NodeTradeEvent | null
  get exit(): NodeTradeEvent | null
  get pnl(): number
  get direction(): NodeTradeDirection
  get isActive(): boolean
  get isClosed(): boolean
}

export declare class NodeTradeDirection {
  Long(): NodeTradeDirection
  Short(): NodeTradeDirection
  toNumber(): number
  static fromNumber(value: number): NodeTradeDirection
}

export declare class NodeTradeEvent {
  get id(): string | null
  get orderBarIndex(): number
  get fillBarIndex(): number
  get price(): number
  get comment(): string | null
}

export declare function _getCoreVersion(): string

export declare function accuracy(tpCount: number, fpCount: number, fnCount: number, tnCount: number): number

export declare function annualization_factor(timeframe: NodeTimeframe, tradingDays: number): number

export declare function avgLosingTrade(grossLoss: number, losingTrades: number): number

export declare function avgTrade(netProfit: number, closedTrades: number): number

export declare function avgWinLossRatio(avgWinningTrade: number, avgLosingTrade: number): number

export declare function avgWinningTrade(grossProfit: number, winningTrades: number): number

export declare function expectancy(pnl: Float64Array): number

export declare function expectancyScore(expectancy: number, opportunityBars: number): number

export declare function f1(precision: number, recall: number): number

export declare function grossLossPct(grossLoss: number, initialCapital: number): number

export declare function grossProfitPct(grossProfit: number, initialCapital: number): number

export declare function longNetProfitPct(longNetProfit: number, initialCapital: number): number

export declare function longNetProfitRatio(longNetProfit: number, shortNetProfit: number): number

export declare function mean(values: Float64Array): number

export declare function netProfitPct(netProfit: number, initialCapital: number): number

export declare function omegaRatio(positiveReturnsSum: number, negativeReturnsSum: number, riskFreeRate: number): number

export declare function omegaRatioFromReturns(returns: Float64Array, riskFreeRate: number): number

export declare function orderSize(equityPct: number, equity: number, exchangeRate: number, instrumentPrice: number, pointValue: number): number

export declare function orderSizeForEquityPct(equityPct: number, equity: number, currentPosition: number, instrumentPrice: number, pointValue: number, exchangeRate: number): number

export declare function pnl(qty: number, entryPrice: number, currentPrice: number): number

export declare function precision(tpCount: number, fpCount: number): number

export declare function profitFactor(grossProfit: number, grossLoss: number): number

export declare function recall(tpCount: number, fnCount: number): number

export declare function returns(equity: Float64Array, skipFirst?: boolean | undefined | null): Array<number>

export declare function roundContracts(size: number, minQty: number, qtyScale: number): number

export declare function roundToMinTick(value: number, minTick: number): number

export declare function sharpeRatio(meanReturns: number, stdReturns: number, riskFreeRate: number): number

export declare function sharpeRatioFromReturns(returns: Float64Array, riskFreeRate: number): number

export declare function shortNetProfitPct(shortNetProfit: number, initialCapital: number): number

export declare function sortinoRatio(meanReturns: number, negativeReturnsStdev: number, riskFreeRate: number): number

export declare function sortinoRatioFromReturns(returns: Float64Array, riskFreeRate: number): number

export declare function stdev(values: Float64Array): number

export declare function sum(values: Float64Array): number

export declare function validateContracts(size: number, minQty: number): boolean

export declare function variance(values: Float64Array): number

export declare function winRate(profitableTrades: number, totalTrades: number): number

export declare function zipOhlcvBars(openTime?: Array<Date | undefined | null> | undefined | null, closeTime?: Array<Date | undefined | null> | undefined | null, open?: Array<number> | undefined | null, high?: Array<number> | undefined | null, low?: Array<number> | undefined | null, close?: Array<number> | undefined | null, volume?: Array<number> | undefined | null): Array<NodeOhlcvBar>
