UNPKG

@uzh-bf/react-option-charts

Version:
86 lines (85 loc) 5.27 kB
import * as React from "react"; import { ChartCanvas } from "@react-financial-charts/core"; export interface OptionLeg { k: number; t: number; v: number; callPut: "call" | "put"; quantity?: number; } export interface IOptionStrategy { name: string; color?: string; payoffColor?: string; optionLegs: OptionLeg[]; showPayoff?: boolean; payoffTitle?: string; } export type OptionStrategyValue = { total: number; optionLegValues: number[]; }; export type OptionPayoffChartProps = Omit<ConstructorParameters<typeof ChartCanvas>[0], "data" | "displayXAccessor" | "margin" | "xScale" | "xAccessor" | "xExtents"> & { s: number; r: number; strategies: IOptionStrategy[]; onCurrentValueChanged?: (x: number, start: { [strategyName: string]: OptionStrategyValue; }, current: { [strategyName: string]: OptionStrategyValue; }) => void; }; declare const _default: { new (props: Omit<Omit<OptionPayoffChartProps, "ratio">, "height" | "width"> | Readonly<Omit<Omit<OptionPayoffChartProps, "ratio">, "height" | "width">>): { render(): JSX.Element; context: any; setState<K extends never>(state: {} | Pick<{}, K> | ((prevState: Readonly<{}>, props: Readonly<Omit<Omit<OptionPayoffChartProps, "ratio">, "height" | "width">>) => {} | Pick<{}, K> | null) | null, callback?: (() => void) | undefined): void; forceUpdate(callback?: (() => void) | undefined): void; readonly props: Readonly<Omit<Omit<OptionPayoffChartProps, "ratio">, "height" | "width">> & Readonly<{ children?: React.ReactNode; }>; state: Readonly<{}>; refs: { [key: string]: React.ReactInstance; }; componentDidMount?(): void; shouldComponentUpdate?(nextProps: Readonly<Omit<Omit<OptionPayoffChartProps, "ratio">, "height" | "width">>, nextState: Readonly<{}>, nextContext: any): boolean; componentWillUnmount?(): void; componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void; getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<Omit<OptionPayoffChartProps, "ratio">, "height" | "width">>, prevState: Readonly<{}>): any; componentDidUpdate?(prevProps: Readonly<Omit<Omit<OptionPayoffChartProps, "ratio">, "height" | "width">>, prevState: Readonly<{}>, snapshot?: any): void; componentWillMount?(): void; UNSAFE_componentWillMount?(): void; componentWillReceiveProps?(nextProps: Readonly<Omit<Omit<OptionPayoffChartProps, "ratio">, "height" | "width">>, nextContext: any): void; UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<Omit<OptionPayoffChartProps, "ratio">, "height" | "width">>, nextContext: any): void; componentWillUpdate?(nextProps: Readonly<Omit<Omit<OptionPayoffChartProps, "ratio">, "height" | "width">>, nextState: Readonly<{}>, nextContext: any): void; UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<Omit<OptionPayoffChartProps, "ratio">, "height" | "width">>, nextState: Readonly<{}>, nextContext: any): void; }; new (props: Omit<Omit<OptionPayoffChartProps, "ratio">, "height" | "width">, context: any): { render(): JSX.Element; context: any; setState<K_1 extends never>(state: {} | Pick<{}, K_1> | ((prevState: Readonly<{}>, props: Readonly<Omit<Omit<OptionPayoffChartProps, "ratio">, "height" | "width">>) => {} | Pick<{}, K_1> | null) | null, callback?: (() => void) | undefined): void; forceUpdate(callback?: (() => void) | undefined): void; readonly props: Readonly<Omit<Omit<OptionPayoffChartProps, "ratio">, "height" | "width">> & Readonly<{ children?: React.ReactNode; }>; state: Readonly<{}>; refs: { [key: string]: React.ReactInstance; }; componentDidMount?(): void; shouldComponentUpdate?(nextProps: Readonly<Omit<Omit<OptionPayoffChartProps, "ratio">, "height" | "width">>, nextState: Readonly<{}>, nextContext: any): boolean; componentWillUnmount?(): void; componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void; getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<Omit<OptionPayoffChartProps, "ratio">, "height" | "width">>, prevState: Readonly<{}>): any; componentDidUpdate?(prevProps: Readonly<Omit<Omit<OptionPayoffChartProps, "ratio">, "height" | "width">>, prevState: Readonly<{}>, snapshot?: any): void; componentWillMount?(): void; UNSAFE_componentWillMount?(): void; componentWillReceiveProps?(nextProps: Readonly<Omit<Omit<OptionPayoffChartProps, "ratio">, "height" | "width">>, nextContext: any): void; UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<Omit<OptionPayoffChartProps, "ratio">, "height" | "width">>, nextContext: any): void; componentWillUpdate?(nextProps: Readonly<Omit<Omit<OptionPayoffChartProps, "ratio">, "height" | "width">>, nextState: Readonly<{}>, nextContext: any): void; UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<Omit<OptionPayoffChartProps, "ratio">, "height" | "width">>, nextState: Readonly<{}>, nextContext: any): void; }; contextType?: React.Context<any> | undefined; }; export default _default;