@kodiak-finance/orderly-chart 2.8.16-rc.2 → 2.8.16-rc.4
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/dist/index.d.mts +47 -1
- package/dist/index.d.ts +47 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -92,6 +92,42 @@ type CombinedFeesChartProps = {
|
|
|
92
92
|
};
|
|
93
93
|
declare const CombinedFeesChart: React.FC<CombinedFeesChartProps>;
|
|
94
94
|
|
|
95
|
+
type CombinedPriceChartDataItem = {
|
|
96
|
+
date: string;
|
|
97
|
+
open: number | null;
|
|
98
|
+
high: number | null;
|
|
99
|
+
low: number | null;
|
|
100
|
+
close: number | null;
|
|
101
|
+
};
|
|
102
|
+
type CombinedPriceChartProps = {
|
|
103
|
+
data: ReadonlyArray<CombinedPriceChartDataItem> | CombinedPriceChartDataItem[];
|
|
104
|
+
aggregationWindow?: "15m" | "1h" | "1d";
|
|
105
|
+
isMobile?: boolean;
|
|
106
|
+
invisible?: boolean;
|
|
107
|
+
responsiveContainerProps?: Omit<Props, "children">;
|
|
108
|
+
className?: string;
|
|
109
|
+
};
|
|
110
|
+
declare const CombinedPriceChart: React.FC<CombinedPriceChartProps>;
|
|
111
|
+
|
|
112
|
+
type ChartEmptyStateProps = {
|
|
113
|
+
title?: string;
|
|
114
|
+
description?: string;
|
|
115
|
+
height?: string;
|
|
116
|
+
className?: string;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Reusable empty state component for charts when no data is available.
|
|
120
|
+
* Displays an icon, title, and optional description in a centered layout.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* <ChartEmptyState
|
|
124
|
+
* title="No Trading Activity"
|
|
125
|
+
* description="No trades were recorded for the selected period"
|
|
126
|
+
* height="300px"
|
|
127
|
+
* />
|
|
128
|
+
*/
|
|
129
|
+
declare const ChartEmptyState: React.FC<ChartEmptyStateProps>;
|
|
130
|
+
|
|
95
131
|
type AssetChartDataItem$1 = {
|
|
96
132
|
date: string;
|
|
97
133
|
account_value: number;
|
|
@@ -141,6 +177,16 @@ type VolChartProps = {
|
|
|
141
177
|
};
|
|
142
178
|
declare const VolBarChart: React.FC<VolChartProps>;
|
|
143
179
|
|
|
180
|
+
interface UnifiedChartProps {
|
|
181
|
+
volumeData: any[];
|
|
182
|
+
feesData: any[];
|
|
183
|
+
priceData: any[];
|
|
184
|
+
aggregationWindow: string;
|
|
185
|
+
includeFees: boolean;
|
|
186
|
+
className?: string;
|
|
187
|
+
}
|
|
188
|
+
declare const UnifiedSymbolPerformanceChart: React.FC<UnifiedChartProps>;
|
|
189
|
+
|
|
144
190
|
declare const chartPlugin: PluginCreator;
|
|
145
191
|
|
|
146
|
-
export { AssetAreaChart, type AssetChartDataItem$1 as AssetChartDataItem, AssetLineChart, CombinedFeesChart, type CombinedFeesChartDataItem, type CombinedFeesChartProps, CombinedPnLChart, type CombinedPnLChartDataItem, type CombinedPnLChartProps, CombinedVolumeChart, type CombinedVolumeChartDataItem, type CombinedVolumeChartProps, PnLBarChart, PnlAreaChart, type PnlAreaChartProps, PnlLineChart, type PnlLineChartProps, VolBarChart, type VolChartDataItem, chartPlugin };
|
|
192
|
+
export { AssetAreaChart, type AssetChartDataItem$1 as AssetChartDataItem, AssetLineChart, ChartEmptyState, type ChartEmptyStateProps, CombinedFeesChart, type CombinedFeesChartDataItem, type CombinedFeesChartProps, CombinedPnLChart, type CombinedPnLChartDataItem, type CombinedPnLChartProps, CombinedPriceChart, type CombinedPriceChartDataItem, type CombinedPriceChartProps, CombinedVolumeChart, type CombinedVolumeChartDataItem, type CombinedVolumeChartProps, PnLBarChart, PnlAreaChart, type PnlAreaChartProps, PnlLineChart, type PnlLineChartProps, type UnifiedChartProps, UnifiedSymbolPerformanceChart, VolBarChart, type VolChartDataItem, chartPlugin };
|
package/dist/index.d.ts
CHANGED
|
@@ -92,6 +92,42 @@ type CombinedFeesChartProps = {
|
|
|
92
92
|
};
|
|
93
93
|
declare const CombinedFeesChart: React.FC<CombinedFeesChartProps>;
|
|
94
94
|
|
|
95
|
+
type CombinedPriceChartDataItem = {
|
|
96
|
+
date: string;
|
|
97
|
+
open: number | null;
|
|
98
|
+
high: number | null;
|
|
99
|
+
low: number | null;
|
|
100
|
+
close: number | null;
|
|
101
|
+
};
|
|
102
|
+
type CombinedPriceChartProps = {
|
|
103
|
+
data: ReadonlyArray<CombinedPriceChartDataItem> | CombinedPriceChartDataItem[];
|
|
104
|
+
aggregationWindow?: "15m" | "1h" | "1d";
|
|
105
|
+
isMobile?: boolean;
|
|
106
|
+
invisible?: boolean;
|
|
107
|
+
responsiveContainerProps?: Omit<Props, "children">;
|
|
108
|
+
className?: string;
|
|
109
|
+
};
|
|
110
|
+
declare const CombinedPriceChart: React.FC<CombinedPriceChartProps>;
|
|
111
|
+
|
|
112
|
+
type ChartEmptyStateProps = {
|
|
113
|
+
title?: string;
|
|
114
|
+
description?: string;
|
|
115
|
+
height?: string;
|
|
116
|
+
className?: string;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Reusable empty state component for charts when no data is available.
|
|
120
|
+
* Displays an icon, title, and optional description in a centered layout.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* <ChartEmptyState
|
|
124
|
+
* title="No Trading Activity"
|
|
125
|
+
* description="No trades were recorded for the selected period"
|
|
126
|
+
* height="300px"
|
|
127
|
+
* />
|
|
128
|
+
*/
|
|
129
|
+
declare const ChartEmptyState: React.FC<ChartEmptyStateProps>;
|
|
130
|
+
|
|
95
131
|
type AssetChartDataItem$1 = {
|
|
96
132
|
date: string;
|
|
97
133
|
account_value: number;
|
|
@@ -141,6 +177,16 @@ type VolChartProps = {
|
|
|
141
177
|
};
|
|
142
178
|
declare const VolBarChart: React.FC<VolChartProps>;
|
|
143
179
|
|
|
180
|
+
interface UnifiedChartProps {
|
|
181
|
+
volumeData: any[];
|
|
182
|
+
feesData: any[];
|
|
183
|
+
priceData: any[];
|
|
184
|
+
aggregationWindow: string;
|
|
185
|
+
includeFees: boolean;
|
|
186
|
+
className?: string;
|
|
187
|
+
}
|
|
188
|
+
declare const UnifiedSymbolPerformanceChart: React.FC<UnifiedChartProps>;
|
|
189
|
+
|
|
144
190
|
declare const chartPlugin: PluginCreator;
|
|
145
191
|
|
|
146
|
-
export { AssetAreaChart, type AssetChartDataItem$1 as AssetChartDataItem, AssetLineChart, CombinedFeesChart, type CombinedFeesChartDataItem, type CombinedFeesChartProps, CombinedPnLChart, type CombinedPnLChartDataItem, type CombinedPnLChartProps, CombinedVolumeChart, type CombinedVolumeChartDataItem, type CombinedVolumeChartProps, PnLBarChart, PnlAreaChart, type PnlAreaChartProps, PnlLineChart, type PnlLineChartProps, VolBarChart, type VolChartDataItem, chartPlugin };
|
|
192
|
+
export { AssetAreaChart, type AssetChartDataItem$1 as AssetChartDataItem, AssetLineChart, ChartEmptyState, type ChartEmptyStateProps, CombinedFeesChart, type CombinedFeesChartDataItem, type CombinedFeesChartProps, CombinedPnLChart, type CombinedPnLChartDataItem, type CombinedPnLChartProps, CombinedPriceChart, type CombinedPriceChartDataItem, type CombinedPriceChartProps, CombinedVolumeChart, type CombinedVolumeChartDataItem, type CombinedVolumeChartProps, PnLBarChart, PnlAreaChart, type PnlAreaChartProps, PnlLineChart, type PnlLineChartProps, type UnifiedChartProps, UnifiedSymbolPerformanceChart, VolBarChart, type VolChartDataItem, chartPlugin };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var react=require('react'),recharts=require('recharts'),orderlyI18n=require('@kodiak-finance/orderly-i18n'),orderlyUi=require('@kodiak-finance/orderly-ui'),orderlyUtils=require('@kodiak-finance/orderly-utils'),jsxRuntime=require('react/jsx-runtime');var yt=Object.create;var E=Object.defineProperty;var Ct=Object.getOwnPropertyDescriptor;var bt=Object.getOwnPropertyNames;var vt=Object.getPrototypeOf,gt=Object.prototype.hasOwnProperty;var B=(t,r)=>()=>(r||t((r={exports:{}}).exports,r),r.exports);var xt=(t,r,e,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of bt(r))!gt.call(t,a)&&a!==e&&E(t,a,{get:()=>r[a],enumerable:!(o=Ct(r,a))||o.enumerable});return t};var Ft=(t,r,e)=>(e=t!=null?yt(vt(t)):{},xt(!t||!t.__esModule?E(e,"default",{value:t,enumerable:true}):e,t));var ut=B($=>{Object.defineProperty($,"__esModule",{value:true});Object.defineProperty($,"default",{enumerable:true,get:function(){return br}});function mt(t,r){return {handler:t,config:r}}mt.withOptions=function(t,r=()=>({})){let e=function(o){return {__options:o,handler:t(o),config:r(o)}};return e.__isOptionsFunction=true,e.__pluginFunction=t,e.__configFunction=r,e};var br=mt;});var pt=B(X=>{Object.defineProperty(X,"__esModule",{value:true});Object.defineProperty(X,"default",{enumerable:true,get:function(){return xr}});var vr=gr(ut());function gr(t){return t&&t.__esModule?t:{default:t}}var xr=vr.default;});var dt=B((di,ft)=>{var W=pt();ft.exports=(W.__esModule?W:{default:W}).default;});var F=t=>{let r=Math.abs(t),e=r===0?0:r<=10?2:r<=100?1:0,o=orderlyUtils.numberToHumanStyle(r,e);return t<0?`-${o}`:o};var f=t=>{let{label:r,value:e,prefix:o,unit:a="USDC",coloring:i=false,dp:n,rm:l}=t;return jsxRuntime.jsxs(orderlyUi.Box,{intensity:600,p:3,r:"md",children:[jsxRuntime.jsxs(orderlyUi.Flex,{direction:"row",className:t.titleClassName,children:[o,jsxRuntime.jsx(orderlyUi.Text.numeral,{unit:a,as:"div",size:"sm",coloring:i,showIdentifier:i,unitClassName:"oui-text-base-contrast-54 oui-ml-1",weight:"semibold",rm:l,dp:n,children:e})]}),jsxRuntime.jsx(orderlyUi.Text,{size:"2xs",intensity:54,weight:"semibold",children:r})]})};var Q=()=>{let t=document.documentElement,r=getComputedStyle(t);return {primary:k(r.getPropertyValue("--oui-color-primary")),primaryLight:k(r.getPropertyValue("--oui-color-primary-light")),secondary:k(r.getPropertyValue("--oui-color-secondary")),success:k(r.getPropertyValue("--oui-color-success")),warning:k(r.getPropertyValue("--oui-color-warning")),danger:k(r.getPropertyValue("--oui-color-danger")),info:k(r.getPropertyValue("--oui-color-info")),loss:k(r.getPropertyValue("--oui-color-trading-loss")),profit:k(r.getPropertyValue("--oui-color-trading-profit"))}},k=t=>`rgb(${t.split(" ").join(",")})`;var d=t=>react.useMemo(()=>{let e=Q();return {profit:t?.profit||e.profit,loss:t?.loss||e.loss,primary:e.primary,primaryLight:e.primaryLight}},[t]);var Nt=t=>{let{fill:r,x:e,y:o,width:a,height:i}=t,n=Math.abs(i);return jsxRuntime.jsx("rect",{rx:2,x:e,y:i>0?o:o+i,width:a,height:n,stroke:"none",fill:r})},_t=t=>{let{x:r,y:e,stroke:o,payload:a,index:i,width:n,containerWidth:l}=t,{t:s}=orderlyI18n.useTranslation(),w=i===0?48:l>0?l-10:n+a.offset;return jsxRuntime.jsx("g",{transform:`translate(${w},${e-6})`,children:jsxRuntime.jsx("text",{x:0,y:0,dy:16,textAnchor:i===0?"start":"end",fontSize:10,fill:"rgba(255,255,255,0.54)",children:i===0?a.value:s("chart.now")})})},zt=t=>{let{width:r,height:e,stroke:o,fill:a}=t;return jsxRuntime.jsx(recharts.Cross,{x:t.x+t.width/2,top:t.top,height:e,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},Gt=t=>{let{active:r,payload:e,label:o}=t,a=react.useRef(new Date().toISOString().split("T")[0]),{t:i}=orderlyI18n.useTranslation();return r&&e&&e.length?jsxRuntime.jsx(f,{label:o===a.current?i("chart.now"):o,value:e[0].value,coloring:true}):null},$t=t=>{let{invisible:r,data:e,responsiveContainerProps:o}=t,a=d(t.colors),i=react.useRef(0);return jsxRuntime.jsx(recharts.ResponsiveContainer,{className:orderlyUi.cn(r&&"chart-invisible"),onResize:n=>{i.current=n;},...o,children:jsxRuntime.jsxs(recharts.BarChart,{data:e,margin:{left:-10,top:10,right:10,bottom:30},children:[!r&&jsxRuntime.jsx(recharts.Tooltip,{cursor:jsxRuntime.jsx(zt,{}),content:jsxRuntime.jsx(Gt,{})}),jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.ReferenceLine,{y:0,stroke:"rgba(0,0,0,0.04)"}),!r&&jsxRuntime.jsx(recharts.Bar,{dataKey:"pnl",shape:jsxRuntime.jsx(Nt,{}),children:e.map((n,l)=>jsxRuntime.jsx(recharts.Cell,{fill:n.pnl>0?a.profit:a.loss},`cell-${l}`))}),jsxRuntime.jsx(recharts.YAxis,{tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickFormatter:n=>F(n),tickLine:false,axisLine:false,dataKey:"pnl"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",tickLine:false,interval:e.length-2,height:1,tick:jsxRuntime.jsx(_t,{containerWidth:i.current}),stroke:"#FFFFFF",strokeOpacity:.04})]})})};var P=t=>{let{x:r,y:e,stroke:o,payload:a,index:i}=t,{t:n}=orderlyI18n.useTranslation();return jsxRuntime.jsx("g",{transform:`translate(${r},${e-6})`,children:jsxRuntime.jsx("text",{x:0,y:0,dy:16,textAnchor:"end",fontSize:10,fill:"rgba(255,255,255,0.54)",children:i===0?a.value:n("chart.now")})})};var oe=t=>{let{active:r,payload:e,label:o}=t,a=react.useRef(new Date().toISOString().split("T")[0]),{t:i}=orderlyI18n.useTranslation();return r&&e&&e.length?jsxRuntime.jsx(f,{label:o===a.current?i("chart.now"):o,value:e[0].value,coloring:true}):null},re=t=>{let r=[];return t?.reduce((e,o)=>(e+=o.pnl,r.push({...o,pnl:e,_pnl:o.pnl}),e),0),r},ae=t=>{let{responsiveContainerProps:r}=t,e=d(t.colors),{isMobile:o}=orderlyUi.useScreen(),a=react.useMemo(()=>re(t.data),[t.data]),i=jsxRuntime.jsxs(recharts.LineChart,{data:a,margin:{top:20,right:10,left:-10,bottom:0},children:[jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsxRuntime.jsx(P,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.YAxis,{dataKey:"pnl",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:F}),!t.invisible&&jsxRuntime.jsx(recharts.Tooltip,{cursor:{strokeDasharray:"3 2",strokeOpacity:.16},content:jsxRuntime.jsx(oe,{})}),!t.invisible&&jsxRuntime.jsx(recharts.Line,{type:"natural",dataKey:"pnl",stroke:e.primary,strokeWidth:o?1.5:2,dot:false,isAnimationActive:false})]});return jsxRuntime.jsx(recharts.ResponsiveContainer,{className:t.invisible?"chart-invisible":void 0,...r,children:i})};var be=t=>{let{active:r,payload:e,label:o}=t,a=react.useRef(new Date().toISOString().split("T")[0]),{t:i}=orderlyI18n.useTranslation();return r&&e&&e.length?jsxRuntime.jsx(f,{label:o===a.current?i("chart.now"):o,value:e[0].value,coloring:true}):null},ve=t=>{let r=[];return t?.reduce((e,o)=>(e+=o.pnl,r.push({...o,pnl:e,_pnl:o.pnl}),e),0),r},ge=t=>{let{responsiveContainerProps:r}=t,e=d(t.colors),{isMobile:o}=orderlyUi.useScreen(),a=react.useId(),i=react.useMemo(()=>ve(t.data),[t.data]),n=jsxRuntime.jsxs(recharts.AreaChart,{data:i,margin:{top:20,right:10,left:-10,bottom:0},children:[jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsxRuntime.jsx(P,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.YAxis,{dataKey:"pnl",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:F}),!t.invisible&&jsxRuntime.jsx(recharts.Tooltip,{cursor:{strokeDasharray:"3 2",strokeOpacity:.16},content:jsxRuntime.jsx(be,{})}),!t.invisible&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsxs("linearGradient",{id:a,x1:"0",y1:"0",x2:"0",y2:"1",children:[jsxRuntime.jsx("stop",{stopColor:"#608CFF",offset:"0%",stopOpacity:.5}),jsxRuntime.jsx("stop",{stopColor:"#608CFF",offset:"100%",stopOpacity:0})]})}),jsxRuntime.jsx(recharts.Area,{type:"natural",dataKey:"pnl",stroke:e.primary,strokeWidth:o?1.5:2,dot:false,isAnimationActive:false,fill:`url(#${a})`})]})]});return jsxRuntime.jsx(recharts.ResponsiveContainer,{className:t.invisible?"chart-invisible":void 0,...r,children:n})};var Ie=t=>{let{fill:r,x:e,y:o,width:a,height:i}=t,n=Math.abs(i);return jsxRuntime.jsx("rect",{rx:2,x:e,y:i>0?o:o+i,width:a,height:n,stroke:"none",fill:r})},Se=t=>{let{width:r,height:e}=t;return jsxRuntime.jsx(recharts.Cross,{x:t.x+t.width/2,top:t.top,height:e,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},Be=t=>{let{active:r,payload:e,label:o}=t;if(r&&e&&e.length>=1){let i=e.find(s=>s.dataKey==="pnl")?.value??0,l=e.find(s=>s.dataKey==="cumulativePnL")?.value??0;return jsxRuntime.jsxs("div",{className:"oui-flex oui-flex-col oui-gap-3 oui-min-w-max",children:[jsxRuntime.jsx(f,{label:o,value:i,coloring:true,titleClassName:"oui-text-xs oui-font-semibold"}),jsxRuntime.jsxs("div",{className:"oui-text-xs oui-text-base-contrast-54 oui-flex oui-justify-between oui-gap-2",children:[jsxRuntime.jsx("span",{children:"Cumulative:"}),jsxRuntime.jsxs("span",{className:"oui-text-base-contrast-100 oui-font-semibold",children:[typeof l=="number"?l.toFixed(2):"--"," USDC"]})]})]})}return null},Ke=(t,r,e=false)=>{if(t<=12&&!e)return 0;let o;t>500||t>200?o=6:t>100?o=7:t>50?o=8:o=12,e&&(o=Math.ceil(o/2));let a=Math.ceil(t/o);if(r==="15m")return a>=96?Math.ceil(a/56)*56:a>=48?Math.ceil(a/28)*28:a>=24?Math.ceil(a/16)*16:Math.max(8,Math.ceil(a/4)*4);if(r==="1h")return a>=48?Math.ceil(a/28)*28:a>=24?Math.ceil(a/12)*12:Math.max(4,Math.ceil(a/4)*4);if(r==="1d"){if(a>=14)return Math.ceil(a/14)*14;if(a>=3)return Math.ceil(a/7)*7}return a},Ne=t=>{let r=0;return t.map(e=>(r+=e.pnl,{...e,cumulativePnL:r}))},_e=t=>{let{data:r,aggregationWindow:e="1d",isMobile:o=false,invisible:a,responsiveContainerProps:i,className:n}=t,l=d(t.colors),s=react.useMemo(()=>Ne(r),[r]),w=react.useMemo(()=>Ke(s.length,e,o),[s.length,e,o]),O=react.useMemo(()=>{if(s.length===0)return [0,1];let p=s.map(x=>x.pnl),b=s.map(x=>x.cumulativePnL),R=Math.min(...p,...b,0),M=Math.max(...p,...b,0),T=M-R,L=T===0?1:T*.1;return [Math.floor((R-L)*100)/100,Math.ceil((M+L)*100)/100]},[s]);return a||s.length===0?jsxRuntime.jsx(orderlyUi.Box,{className:orderlyUi.cn("oui-h-[300px]",n)}):jsxRuntime.jsx(orderlyUi.Box,{className:orderlyUi.cn("oui-w-full oui-h-full",n),children:jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:"100%",...i,children:jsxRuntime.jsxs(recharts.ComposedChart,{data:s,margin:{left:0,top:10,right:10,bottom:20},children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsxs("linearGradient",{id:"cumulativeGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[jsxRuntime.jsx("stop",{offset:"5%",stopColor:"#608CFF",stopOpacity:.4}),jsxRuntime.jsx("stop",{offset:"95%",stopColor:"#608CFF",stopOpacity:0})]})}),jsxRuntime.jsx(recharts.Tooltip,{cursor:jsxRuntime.jsx(Se,{}),content:jsxRuntime.jsx(Be,{})}),jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.ReferenceLine,{y:0,stroke:"rgba(0,0,0,0.04)"}),jsxRuntime.jsx(recharts.YAxis,{domain:O,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:p=>ze(p),width:45}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",tickLine:false,interval:w,minTickGap:50,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.Bar,{dataKey:"pnl",shape:jsxRuntime.jsx(Ie,{}),minPointSize:1,isAnimationActive:false,children:s.map((p,b)=>jsxRuntime.jsx(recharts.Cell,{fill:p.pnl>0?l.profit:l.loss},`cell-${b}`))}),jsxRuntime.jsx(recharts.Area,{type:"natural",dataKey:"cumulativePnL",fill:"url(#cumulativeGradient)",stroke:"none",isAnimationActive:false}),jsxRuntime.jsx(recharts.Line,{type:"natural",dataKey:"cumulativePnL",stroke:l.primary,strokeWidth:2,dot:false,isAnimationActive:false,strokeLinecap:"round",strokeLinejoin:"round"})]})})})};function ze(t){let r=["","K","M","B","T"],e=0,o=Math.abs(t);for(;o>=1e3&&e<r.length-1;)o/=1e3,e++;let a=t<0?"-":"",i=o<=10?1:0,n=o.toFixed(i);return `${a}${n}${r[e]}`}var je=t=>{let{fill:r,x:e,y:o,width:a,height:i}=t,n=Math.abs(i);return jsxRuntime.jsx("rect",{rx:2,x:e,y:i>0?o:o+i,width:a,height:n,stroke:"none",fill:r})},to=t=>{let{width:r,height:e}=t;return jsxRuntime.jsx(recharts.Cross,{x:t.x+t.width/2,top:t.top,height:e,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},eo=t=>{let{active:r,payload:e,label:o}=t;if(r&&e&&e.length>=1){let i=e.find(s=>s.dataKey==="volume")?.value??0,l=e.find(s=>s.dataKey==="cumulativeVolume")?.value??0;return jsxRuntime.jsxs("div",{className:"oui-flex oui-flex-col oui-gap-3 oui-min-w-max",children:[jsxRuntime.jsx(f,{label:o,value:rt(i),titleClassName:"oui-text-xs oui-font-semibold"}),jsxRuntime.jsxs("div",{className:"oui-text-xs oui-text-base-contrast-54 oui-flex oui-justify-between oui-gap-2",children:[jsxRuntime.jsx("span",{children:"Cumulative:"}),jsxRuntime.jsx("span",{className:"oui-text-base-contrast-100 oui-font-semibold",children:rt(l)})]})]})}return null},oo=(t,r,e=false)=>{if(t<=12&&!e)return 0;let o;t>500||t>200?o=6:t>100?o=7:t>50?o=8:o=12,e&&(o=Math.ceil(o/2));let a=Math.ceil(t/o);if(r==="15m")return a>=96?Math.ceil(a/56)*56:a>=48?Math.ceil(a/28)*28:a>=24?Math.ceil(a/16)*16:Math.max(8,Math.ceil(a/4)*4);if(r==="1h")return a>=48?Math.ceil(a/28)*28:a>=24?Math.ceil(a/12)*12:Math.max(4,Math.ceil(a/4)*4);if(r==="1d"){if(a>=14)return Math.ceil(a/14)*14;if(a>=3)return Math.ceil(a/7)*7}return a},ro=t=>{let r=0;return t.map(e=>(r+=e.volume,{...e,cumulativeVolume:r}))},ao=t=>{let{data:r,aggregationWindow:e="1d",isMobile:o=false,invisible:a,responsiveContainerProps:i,className:n}=t,l=d(t.colors?{profit:t.colors.fill,loss:t.colors.fill}:void 0),s=react.useMemo(()=>ro(r),[r]),w=react.useMemo(()=>oo(s.length,e,o),[s.length,e,o]),O=react.useMemo(()=>{if(s.length===0)return [0,1];let p=s.map(x=>x.volume),b=s.map(x=>x.cumulativeVolume),R=Math.min(...p,...b,0),M=Math.max(...p,...b,0),T=M-R,L=T===0?1:T*.1;return [Math.floor((R-L)*100)/100,Math.ceil((M+L)*100)/100]},[s]);return a||s.length===0?jsxRuntime.jsx(orderlyUi.Box,{className:orderlyUi.cn("oui-h-[300px]",n)}):jsxRuntime.jsx(orderlyUi.Box,{className:orderlyUi.cn("oui-w-full oui-h-full",n),children:jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:"100%",...i,children:jsxRuntime.jsxs(recharts.ComposedChart,{data:s,margin:{left:0,top:10,right:10,bottom:20},children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsxs("linearGradient",{id:"volumeGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[jsxRuntime.jsx("stop",{offset:"5%",stopColor:"#00B49E",stopOpacity:.4}),jsxRuntime.jsx("stop",{offset:"95%",stopColor:"#00B49E",stopOpacity:0})]})}),jsxRuntime.jsx(recharts.Tooltip,{cursor:jsxRuntime.jsx(to,{}),content:jsxRuntime.jsx(eo,{})}),jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.ReferenceLine,{y:0,stroke:"rgba(0,0,0,0.04)"}),jsxRuntime.jsx(recharts.YAxis,{domain:O,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:p=>io(p),width:45}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",tickLine:false,interval:w,minTickGap:50,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.Bar,{dataKey:"volume",shape:jsxRuntime.jsx(je,{}),minPointSize:1,isAnimationActive:false,children:s.map((p,b)=>jsxRuntime.jsx(recharts.Cell,{fill:l.profit,opacity:.8},`cell-${b}`))}),jsxRuntime.jsx(recharts.Area,{type:"natural",dataKey:"cumulativeVolume",fill:"url(#volumeGradient)",stroke:"none",isAnimationActive:false}),jsxRuntime.jsx(recharts.Line,{type:"natural",dataKey:"cumulativeVolume",stroke:l.primary,strokeWidth:2,dot:false,isAnimationActive:false,strokeLinecap:"round",strokeLinejoin:"round"})]})})})};function io(t){let r=["","K","M","B","T"],e=0,o=Math.abs(t);for(;o>=1e3&&e<r.length-1;)o/=1e3,e++;let a=t<0?"-":"",i=o<=10?1:0,n=o.toFixed(i);return `${a}${n}${r[e]}`}function rt(t){let r=["","K","M","B","T"],e=0,o=t;for(;o>=1e3&&e<r.length-1;)o/=1e3,e++;let a=o<=10?2:o<=100?1:0;return `${parseFloat(o.toFixed(a))}${r[e]}`}var vo=t=>{let{fill:r,x:e,y:o,width:a,height:i}=t,n=Math.abs(i);return jsxRuntime.jsx("rect",{rx:2,x:e,y:i>0?o:o+i,width:a,height:n,stroke:"none",fill:r})},go=t=>{let{width:r,height:e}=t;return jsxRuntime.jsx(recharts.Cross,{x:t.x+t.width/2,top:t.top,height:e,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},xo=t=>{let{active:r,payload:e,label:o}=t;if(r&&e&&e.length>=1){let i=e.find(s=>s.dataKey==="fees")?.value??0,l=e.find(s=>s.dataKey==="cumulativeFees")?.value??0;return jsxRuntime.jsxs("div",{className:"oui-flex oui-flex-col oui-gap-3 oui-min-w-max",children:[jsxRuntime.jsx(f,{label:o,value:nt(i),titleClassName:"oui-text-xs oui-font-semibold"}),jsxRuntime.jsxs("div",{className:"oui-text-xs oui-text-base-contrast-54 oui-flex oui-justify-between oui-gap-2",children:[jsxRuntime.jsx("span",{children:"Cumulative:"}),jsxRuntime.jsx("span",{className:"oui-text-base-contrast-100 oui-font-semibold",children:nt(l)})]})]})}return null},Fo=(t,r,e=false)=>{if(t<=12&&!e)return 0;let o;t>500||t>200?o=6:t>100?o=7:t>50?o=8:o=12,e&&(o=Math.ceil(o/2));let a=Math.ceil(t/o);if(r==="15m")return a>=96?Math.ceil(a/56)*56:a>=48?Math.ceil(a/28)*28:a>=24?Math.ceil(a/16)*16:Math.max(8,Math.ceil(a/4)*4);if(r==="1h")return a>=48?Math.ceil(a/28)*28:a>=24?Math.ceil(a/12)*12:Math.max(4,Math.ceil(a/4)*4);if(r==="1d"){if(a>=14)return Math.ceil(a/14)*14;if(a>=3)return Math.ceil(a/7)*7}return a},ko=t=>{let r=0;return t.map(e=>(r+=e.fees,{...e,cumulativeFees:r}))},Po=t=>{let{data:r,aggregationWindow:e="1d",isMobile:o=false,invisible:a,responsiveContainerProps:i,className:n}=t,l=d(t.colors?{profit:t.colors.fill,loss:t.colors.fill}:void 0),s=react.useMemo(()=>ko(r),[r]),w=react.useMemo(()=>Fo(s.length,e,o),[s.length,e,o]),O=react.useMemo(()=>{if(s.length===0)return [0,1];let p=s.map(x=>x.fees),b=s.map(x=>x.cumulativeFees),R=Math.min(...p,...b,0),M=Math.max(...p,...b,0),T=M-R,L=T===0?1:T*.1;return [Math.floor((R-L)*100)/100,Math.ceil((M+L)*100)/100]},[s]);return a||s.length===0?jsxRuntime.jsx(orderlyUi.Box,{className:orderlyUi.cn("oui-h-[300px]",n)}):jsxRuntime.jsx(orderlyUi.Box,{className:orderlyUi.cn("oui-w-full oui-h-full",n),children:jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:"100%",...i,children:jsxRuntime.jsxs(recharts.ComposedChart,{data:s,margin:{left:0,top:10,right:10,bottom:20},children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsxs("linearGradient",{id:"feesGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[jsxRuntime.jsx("stop",{offset:"5%",stopColor:"#00B49E",stopOpacity:.4}),jsxRuntime.jsx("stop",{offset:"95%",stopColor:"#00B49E",stopOpacity:0})]})}),jsxRuntime.jsx(recharts.Tooltip,{cursor:jsxRuntime.jsx(go,{}),content:jsxRuntime.jsx(xo,{})}),jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.ReferenceLine,{y:0,stroke:"rgba(0,0,0,0.04)"}),jsxRuntime.jsx(recharts.YAxis,{domain:O,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:p=>Ao(p),width:45}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",tickLine:false,interval:w,minTickGap:50,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.Bar,{dataKey:"fees",shape:jsxRuntime.jsx(vo,{}),minPointSize:1,isAnimationActive:false,children:s.map((p,b)=>jsxRuntime.jsx(recharts.Cell,{fill:l.profit,opacity:.8},`cell-${b}`))}),jsxRuntime.jsx(recharts.Area,{type:"natural",dataKey:"cumulativeFees",fill:"url(#feesGradient)",stroke:"none",isAnimationActive:false}),jsxRuntime.jsx(recharts.Line,{type:"natural",dataKey:"cumulativeFees",stroke:l.primary,strokeWidth:2,dot:false,isAnimationActive:false,strokeLinecap:"round",strokeLinejoin:"round"})]})})})};function Ao(t){let r=["","K","M","B","T"],e=0,o=Math.abs(t);for(;o>=1e3&&e<r.length-1;)o/=1e3,e++;let a=t<0?"-":"",i=o<=10?1:0,n=o.toFixed(i);return `${a}${n}${r[e]}`}function nt(t){let r=["","K","M","B","T"],e=0,o=t;for(;o>=1e3&&e<r.length-1;)o/=1e3,e++;let a=o<=10?2:o<=100?1:0;return `${parseFloat(o.toFixed(a))}${r[e]}`}var Bo=t=>{let{active:r,payload:e,label:o}=t,a=react.useRef(new Date().toISOString().split("T")[0]),{t:i}=orderlyI18n.useTranslation();return r&&e&&e.length?jsxRuntime.jsx(f,{label:o===a.current?i("chart.now"):o,value:e[0].value}):null},Ko=t=>{let{responsiveContainerProps:r}=t,e=d(t.colors),o=react.useId(),{isMobile:a}=orderlyUi.useScreen(),i=a?jsxRuntime.jsxs(recharts.AreaChart,{width:530,height:180,data:t.data,margin:{top:20,right:10,left:-20,bottom:-10},children:[jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsxRuntime.jsx(P,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.YAxis,{dataKey:"account_value",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:n=>F(n)}),!t.invisible&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsxs("linearGradient",{id:o,x1:"0",y1:"0",x2:"0",y2:"1",children:[jsxRuntime.jsx("stop",{stopColor:"#00B49E",offset:"0%",stopOpacity:.5}),jsxRuntime.jsx("stop",{stopColor:"#00B49E",offset:"100%",stopOpacity:0})]})}),jsxRuntime.jsx(recharts.Area,{type:"natural",dataKey:"account_value",stroke:e.profit,strokeWidth:a?1.5:2,dot:false,isAnimationActive:false,fill:`url(#${o})`})]})]}):jsxRuntime.jsxs(recharts.LineChart,{width:530,height:180,data:t.data,margin:{top:20,right:10,left:-20,bottom:-10},children:[jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsxRuntime.jsx(P,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.YAxis,{dataKey:"account_value",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:F}),!t.invisible&&jsxRuntime.jsx(recharts.Tooltip,{cursor:{strokeDasharray:"3 2",strokeOpacity:.16},content:jsxRuntime.jsx(Bo,{})}),!t.invisible&&jsxRuntime.jsx(recharts.Line,{type:"natural",dataKey:"account_value",stroke:e.profit,strokeWidth:a?1.5:2,dot:false,isAnimationActive:false})]});return jsxRuntime.jsx(recharts.ResponsiveContainer,{className:t.invisible?"chart-invisible":void 0,...r,children:i})};var Uo=t=>{let{active:r,payload:e,label:o}=t,a=react.useRef(new Date().toISOString().split("T")[0]),{t:i}=orderlyI18n.useTranslation();return r&&e&&e.length?jsxRuntime.jsx(f,{label:o===a.current?i("chart.now"):o,value:e[0].value}):null},Jo=t=>{let{responsiveContainerProps:r}=t,e=d(t.colors),o=react.useId(),{isMobile:a}=orderlyUi.useScreen(),i=jsxRuntime.jsxs(recharts.AreaChart,{width:530,height:180,data:t.data,margin:{top:20,right:10,left:-20,bottom:-10},children:[jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsxRuntime.jsx(P,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.YAxis,{dataKey:"account_value",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:F}),!t.invisible&&jsxRuntime.jsx(recharts.Tooltip,{cursor:{strokeDasharray:"3 2",strokeOpacity:.16},content:jsxRuntime.jsx(Uo,{})}),!t.invisible&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsxs("linearGradient",{id:o,x1:"0",y1:"0",x2:"0",y2:"1",children:[jsxRuntime.jsx("stop",{stopColor:"#00B49E",offset:"0%",stopOpacity:.5}),jsxRuntime.jsx("stop",{stopColor:"#00B49E",offset:"100%",stopOpacity:0})]})}),jsxRuntime.jsx(recharts.Area,{type:"natural",dataKey:"account_value",stroke:e.profit,strokeWidth:a?1.5:2,dot:false,isAnimationActive:false,fill:`url(#${o})`})]})]});return jsxRuntime.jsx(recharts.ResponsiveContainer,{className:t.invisible?"chart-invisible":void 0,...r,children:i})};var ur=t=>{let{fill:r,x:e,y:o,width:a,height:i,opacity:n}=t,l=Math.abs(i);return jsxRuntime.jsx("rect",{rx:2,x:e,y:i>0?o:o+i,width:a,height:l,stroke:"none",fill:r,opacity:n})},pr=t=>{let{width:r,height:e,payload:o,stroke:a,fill:i}=t;return o?.[0]?.value===0?null:jsxRuntime.jsx(recharts.Cross,{x:t.x+t.width/2,top:t.top,height:e,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},fr=t=>{let{active:r,payload:e,label:o,tooltip:a}=t;return e?.[0]?.value===0?null:r&&e&&e.length?jsxRuntime.jsx(f,{label:o,value:e[0].value,titleClassName:"oui-gap-4",rm:a?.rm,dp:a?.dp}):null},dr=t=>{let r=d(t.colors?.fill?{profit:t.colors?.fill,loss:t.colors?.fill}:void 0),e=t.data?.reduce((i,n)=>i+n.volume,0)===0,o=t.data?.reduce((i,n)=>i>n.volume?i:n.volume,0),a=o<=10?2:o<=100?1:0;return jsxRuntime.jsx(orderlyUi.Box,{className:orderlyUi.cn(t.className),children:jsxRuntime.jsx(recharts.ResponsiveContainer,{children:jsxRuntime.jsxs(recharts.BarChart,{data:t.data,margin:{left:-0,top:6,right:0,bottom:20},children:[jsxRuntime.jsx(recharts.Tooltip,{cursor:jsxRuntime.jsx(pr,{}),content:jsxRuntime.jsx(fr,{tooltip:t.tooltip})}),jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.08,repeatCount:6}),jsxRuntime.jsx(recharts.ReferenceLine,{y:0,stroke:"#000"}),jsxRuntime.jsx(recharts.Bar,{dataKey:"volume",shape:jsxRuntime.jsx(ur,{}),minPointSize:1,children:t.data.map((i,n)=>jsxRuntime.jsx(recharts.Cell,{fill:i.volume>0?r.profit:r.loss,opacity:i.opacity},`cell-${n}`))}),jsxRuntime.jsx(recharts.YAxis,{tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,dataKey:"volume",tickFormatter:(i,n)=>e?`${n*100}`:hr(i,a),width:45}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",tickLine:false,interval:t.data.length-2,height:1,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},stroke:"rgb(229, 231, 235)",strokeOpacity:.2})]})})})};function hr(t,r=0){let e=["","K","M","B","T"],o=0;for(;t>=1e3&&o<e.length-1;)t/=1e3,o++;return `${yr(t,r)}${e[o]}`}function yr(t,r){let e=t.toString(),o=e.indexOf(".");if(o===-1||r===0)return e.split(".")[0];let a=o+r+1;return e.slice(0,a)}var ht=Ft(dt()),Fr=()=>(0, ht.default)(function({addComponents:t,addBase:r}){t({".xAxis":{".recharts-cartesian-axis-tick:first-child text":{"text-anchor":"start"},".recharts-cartesian-axis-tick:last-child text":{"text-anchor":"end"}}},{respectPrefix:false});});Object.defineProperty(exports,"Area",{enumerable:true,get:function(){return recharts.Area}});Object.defineProperty(exports,"AreaChart",{enumerable:true,get:function(){return recharts.AreaChart}});Object.defineProperty(exports,"Bar",{enumerable:true,get:function(){return recharts.Bar}});Object.defineProperty(exports,"BarChart",{enumerable:true,get:function(){return recharts.BarChart}});Object.defineProperty(exports,"Cell",{enumerable:true,get:function(){return recharts.Cell}});Object.defineProperty(exports,"Line",{enumerable:true,get:function(){return recharts.Line}});Object.defineProperty(exports,"LineChart",{enumerable:true,get:function(){return recharts.LineChart}});exports.AssetAreaChart=Jo;exports.AssetLineChart=Ko;exports.CombinedFeesChart=Po;exports.CombinedPnLChart=_e;exports.CombinedVolumeChart=ao;exports.PnLBarChart=$t;exports.PnlAreaChart=ge;exports.PnlLineChart=ae;exports.VolBarChart=dr;exports.chartPlugin=Fr;//# sourceMappingURL=index.js.map
|
|
1
|
+
'use strict';var react=require('react'),recharts=require('recharts'),orderlyI18n=require('@kodiak-finance/orderly-i18n'),orderlyUi=require('@kodiak-finance/orderly-ui'),orderlyUtils=require('@kodiak-finance/orderly-utils'),jsxRuntime=require('react/jsx-runtime');var St=Object.create;var it=Object.defineProperty;var It=Object.getOwnPropertyDescriptor;var Bt=Object.getOwnPropertyNames;var Vt=Object.getPrototypeOf,Kt=Object.prototype.hasOwnProperty;var H=(t,o)=>()=>(o||t((o={exports:{}}).exports,o),o.exports);var zt=(t,o,e,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of Bt(o))!Kt.call(t,r)&&r!==e&&it(t,r,{get:()=>o[r],enumerable:!(a=It(o,r))||a.enumerable});return t};var $t=(t,o,e)=>(e=t!=null?St(Vt(t)):{},zt(!t||!t.__esModule?it(e,"default",{value:t,enumerable:true}):e,t));var wt=H(ot=>{Object.defineProperty(ot,"__esModule",{value:true});Object.defineProperty(ot,"default",{enumerable:true,get:function(){return ha}});function Tt(t,o){return {handler:t,config:o}}Tt.withOptions=function(t,o=()=>({})){let e=function(a){return {__options:a,handler:t(a),config:o(a)}};return e.__isOptionsFunction=true,e.__pluginFunction=t,e.__configFunction=o,e};var ha=Tt;});var Lt=H(rt=>{Object.defineProperty(rt,"__esModule",{value:true});Object.defineProperty(rt,"default",{enumerable:true,get:function(){return ba}});var ya=Ca(wt());function Ca(t){return t&&t.__esModule?t:{default:t}}var ba=ya.default;});var Nt=H((_n,Dt)=>{var at=Lt();Dt.exports=(at.__esModule?at:{default:at}).default;});var D=t=>{let o=Math.abs(t),e=o===0?0:o<=10?2:o<=100?1:0,a=orderlyUtils.numberToHumanStyle(o,e);return t<0?`-${a}`:a};var k=t=>{let{label:o,value:e,prefix:a,unit:r="USDC",coloring:i=false,dp:n,rm:l}=t;return jsxRuntime.jsxs(orderlyUi.Box,{intensity:600,p:3,r:"md",children:[jsxRuntime.jsxs(orderlyUi.Flex,{direction:"row",className:t.titleClassName,children:[a,jsxRuntime.jsx(orderlyUi.Text.numeral,{unit:r,as:"div",size:"sm",coloring:i,showIdentifier:i,unitClassName:"oui-text-base-contrast-54 oui-ml-1",weight:"semibold",rm:l,dp:n,children:e})]}),jsxRuntime.jsx(orderlyUi.Text,{size:"2xs",intensity:54,weight:"semibold",children:o})]})};var ct=()=>{let t=document.documentElement,o=getComputedStyle(t);return {primary:S(o.getPropertyValue("--oui-color-primary")),primaryLight:S(o.getPropertyValue("--oui-color-primary-light")),secondary:S(o.getPropertyValue("--oui-color-secondary")),success:S(o.getPropertyValue("--oui-color-success")),warning:S(o.getPropertyValue("--oui-color-warning")),danger:S(o.getPropertyValue("--oui-color-danger")),info:S(o.getPropertyValue("--oui-color-info")),loss:S(o.getPropertyValue("--oui-color-trading-loss")),profit:S(o.getPropertyValue("--oui-color-trading-profit"))}},S=t=>`rgb(${t.split(" ").join(",")})`;var p=t=>react.useMemo(()=>{let e=ct();return {profit:t?.profit||e.profit,loss:t?.loss||e.loss,primary:e.primary,primaryLight:e.primaryLight}},[t]);var oe=t=>{let{fill:o,x:e,y:a,width:r,height:i}=t,n=Math.abs(i);return jsxRuntime.jsx("rect",{rx:2,x:e,y:i>0?a:a+i,width:r,height:n,stroke:"none",fill:o})},re=t=>{let{x:o,y:e,stroke:a,payload:r,index:i,width:n,containerWidth:l}=t,{t:s}=orderlyI18n.useTranslation(),h=i===0?48:l>0?l-10:n+r.offset;return jsxRuntime.jsx("g",{transform:`translate(${h},${e-6})`,children:jsxRuntime.jsx("text",{x:0,y:0,dy:16,textAnchor:i===0?"start":"end",fontSize:10,fill:"rgba(255,255,255,0.54)",children:i===0?r.value:s("chart.now")})})},ae=t=>{let{width:o,height:e,stroke:a,fill:r}=t;return jsxRuntime.jsx(recharts.Cross,{x:t.x+t.width/2,top:t.top,height:e,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},ie=t=>{let{active:o,payload:e,label:a}=t,r=react.useRef(new Date().toISOString().split("T")[0]),{t:i}=orderlyI18n.useTranslation();return o&&e&&e.length?jsxRuntime.jsx(k,{label:a===r.current?i("chart.now"):a,value:e[0].value,coloring:true}):null},ne=t=>{let{invisible:o,data:e,responsiveContainerProps:a}=t,r=p(t.colors),i=react.useRef(0);return jsxRuntime.jsx(recharts.ResponsiveContainer,{className:orderlyUi.cn(o&&"chart-invisible"),onResize:n=>{i.current=n;},...a,children:jsxRuntime.jsxs(recharts.BarChart,{data:e,margin:{left:-10,top:10,right:10,bottom:30},children:[!o&&jsxRuntime.jsx(recharts.Tooltip,{cursor:jsxRuntime.jsx(ae,{}),content:jsxRuntime.jsx(ie,{})}),jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.ReferenceLine,{y:0,stroke:"rgba(0,0,0,0.04)"}),!o&&jsxRuntime.jsx(recharts.Bar,{dataKey:"pnl",shape:jsxRuntime.jsx(oe,{}),children:e.map((n,l)=>jsxRuntime.jsx(recharts.Cell,{fill:n.pnl>0?r.profit:r.loss},`cell-${l}`))}),jsxRuntime.jsx(recharts.YAxis,{tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickFormatter:n=>D(n),tickLine:false,axisLine:false,dataKey:"pnl"}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",tickLine:false,interval:e.length-2,height:1,tick:jsxRuntime.jsx(re,{containerWidth:i.current}),stroke:"#FFFFFF",strokeOpacity:.04})]})})};var I=t=>{let{x:o,y:e,stroke:a,payload:r,index:i}=t,{t:n}=orderlyI18n.useTranslation();return jsxRuntime.jsx("g",{transform:`translate(${o},${e-6})`,children:jsxRuntime.jsx("text",{x:0,y:0,dy:16,textAnchor:"end",fontSize:10,fill:"rgba(255,255,255,0.54)",children:i===0?r.value:n("chart.now")})})};var xe=t=>{let{active:o,payload:e,label:a}=t,r=react.useRef(new Date().toISOString().split("T")[0]),{t:i}=orderlyI18n.useTranslation();return o&&e&&e.length?jsxRuntime.jsx(k,{label:a===r.current?i("chart.now"):a,value:e[0].value,coloring:true}):null},ve=t=>{let o=[];return t?.reduce((e,a)=>(e+=a.pnl,o.push({...a,pnl:e,_pnl:a.pnl}),e),0),o},Fe=t=>{let{responsiveContainerProps:o}=t,e=p(t.colors),{isMobile:a}=orderlyUi.useScreen(),r=react.useMemo(()=>ve(t.data),[t.data]),i=jsxRuntime.jsxs(recharts.LineChart,{data:r,margin:{top:20,right:10,left:-10,bottom:0},children:[jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsxRuntime.jsx(I,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.YAxis,{dataKey:"pnl",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:D}),!t.invisible&&jsxRuntime.jsx(recharts.Tooltip,{cursor:{strokeDasharray:"3 2",strokeOpacity:.16},content:jsxRuntime.jsx(xe,{})}),!t.invisible&&jsxRuntime.jsx(recharts.Line,{type:"natural",dataKey:"pnl",stroke:e.primary,strokeWidth:a?1.5:2,dot:false,isAnimationActive:false})]});return jsxRuntime.jsx(recharts.ResponsiveContainer,{className:t.invisible?"chart-invisible":void 0,...o,children:i})};var Be=t=>{let{active:o,payload:e,label:a}=t,r=react.useRef(new Date().toISOString().split("T")[0]),{t:i}=orderlyI18n.useTranslation();return o&&e&&e.length?jsxRuntime.jsx(k,{label:a===r.current?i("chart.now"):a,value:e[0].value,coloring:true}):null},Ve=t=>{let o=[];return t?.reduce((e,a)=>(e+=a.pnl,o.push({...a,pnl:e,_pnl:a.pnl}),e),0),o},Ke=t=>{let{responsiveContainerProps:o}=t,e=p(t.colors),{isMobile:a}=orderlyUi.useScreen(),r=react.useId(),i=react.useMemo(()=>Ve(t.data),[t.data]),n=jsxRuntime.jsxs(recharts.AreaChart,{data:i,margin:{top:20,right:10,left:-10,bottom:0},children:[jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsxRuntime.jsx(I,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.YAxis,{dataKey:"pnl",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:D}),!t.invisible&&jsxRuntime.jsx(recharts.Tooltip,{cursor:{strokeDasharray:"3 2",strokeOpacity:.16},content:jsxRuntime.jsx(Be,{})}),!t.invisible&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsxs("linearGradient",{id:r,x1:"0",y1:"0",x2:"0",y2:"1",children:[jsxRuntime.jsx("stop",{stopColor:"#608CFF",offset:"0%",stopOpacity:.5}),jsxRuntime.jsx("stop",{stopColor:"#608CFF",offset:"100%",stopOpacity:0})]})}),jsxRuntime.jsx(recharts.Area,{type:"natural",dataKey:"pnl",stroke:e.primary,strokeWidth:a?1.5:2,dot:false,isAnimationActive:false,fill:`url(#${r})`})]})]});return jsxRuntime.jsx(recharts.ResponsiveContainer,{className:t.invisible?"chart-invisible":void 0,...o,children:n})};var V=({title:t="No Data Available",description:o="No data to display for the selected period",height:e="300px",className:a})=>jsxRuntime.jsx(orderlyUi.Box,{className:orderlyUi.cn("oui-w-full oui-flex oui-items-center oui-justify-center oui-bg-base-8",a),style:{height:e},children:jsxRuntime.jsxs(orderlyUi.Flex,{direction:"column",itemAlign:"center",gap:3,className:"oui-text-center",children:[jsxRuntime.jsx(orderlyUi.BarChartIcon,{}),jsxRuntime.jsx(orderlyUi.Text,{as:"div",size:"sm",weight:"semibold",className:"oui-text-base-contrast-100",children:t}),jsxRuntime.jsx(orderlyUi.Text,{as:"div",size:"xs",className:"oui-text-base-contrast-54",children:o})]})});var ao=t=>{let{fill:o,x:e,y:a,width:r,height:i}=t,n=Math.abs(i);return jsxRuntime.jsx("rect",{rx:2,x:e,y:i>0?a:a+i,width:r,height:n,stroke:"none",fill:o})},io=t=>{let{width:o,height:e}=t;return jsxRuntime.jsx(recharts.Cross,{x:t.x+t.width/2,top:t.top,height:e,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},ft=t=>`${t>0?"+":""}${t.toFixed(2)}`,ht=(t,o)=>t===0?"inherit":t>0?o.profit:o.loss,no=t=>{let{active:o,payload:e,label:a}=t,r=p();if(o&&e&&e.length>=1){let n=e.find(u=>u.dataKey==="pnl")?.value??0,s=e.find(u=>u.dataKey==="cumulativePnL")?.value??0,h=a,R=ht(n,r);ht(s,r);return jsxRuntime.jsxs(orderlyUi.Box,{intensity:600,p:3,r:"md",className:"oui-flex oui-flex-col oui-gap-2",children:[jsxRuntime.jsxs("div",{className:"oui-text-xs oui-font-semibold",children:[h,":"," ",jsxRuntime.jsxs("span",{style:{color:R},children:[ft(n)," USDC"]})]}),jsxRuntime.jsxs("div",{className:"oui-text-xs oui-flex oui-gap-2",children:[jsxRuntime.jsx("span",{className:"oui-text-base-contrast-54",children:"Cumulative:"}),jsxRuntime.jsxs("span",{className:"oui-font-semibold",children:[ft(s)," USDC"]})]})]})}return null},so=(t,o,e=false)=>{if(t<=12&&!e)return 0;let a;t>500||t>200?a=6:t>100?a=7:t>50?a=8:a=12,e&&(a=Math.ceil(a/2));let r=Math.ceil(t/a);if(o==="15m")return r>=96?Math.ceil(r/56)*56:r>=48?Math.ceil(r/28)*28:r>=24?Math.ceil(r/16)*16:Math.max(8,Math.ceil(r/4)*4);if(o==="1h")return r>=48?Math.ceil(r/28)*28:r>=24?Math.ceil(r/12)*12:Math.max(4,Math.ceil(r/4)*4);if(o==="1d"){if(r>=14)return Math.ceil(r/14)*14;if(r>=3)return Math.ceil(r/7)*7}return r},lo=t=>{let o=0;return t.map(e=>(o+=e.pnl,{...e,cumulativePnL:o}))},co=t=>{let{data:o,aggregationWindow:e="1d",isMobile:a=false,invisible:r,responsiveContainerProps:i,className:n}=t,l=p(t.colors),s=react.useMemo(()=>lo(o),[o]),h=react.useMemo(()=>so(s.length,e,a),[s.length,e,a]),R=react.useMemo(()=>{if(s.length===0)return [0,1];let c=s.map($=>$.pnl),u=s.map($=>$.cumulativePnL),v=Math.min(...c,...u,0),N=Math.max(...c,...u,0),F=N-v;if(F===0)return [0,1];let A=F*.1,T=v-A,w=N+A,O=Math.pow(10,Math.floor(Math.log10(F))),L=Math.ceil((w-T)/5/O)*O,z=Math.floor(T/L)*L,Y=Math.ceil(w/L)*L;return [z,Y]},[s]);return r||s.length===0?jsxRuntime.jsx(V,{title:"No P&L Data",description:"No profit and loss data available for the selected period",height:"100%",className:n}):jsxRuntime.jsx(orderlyUi.Box,{className:orderlyUi.cn("oui-w-full oui-h-full",n),children:jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:"100%",...i,children:jsxRuntime.jsxs(recharts.ComposedChart,{data:s,margin:{left:45,top:10,right:50,bottom:20},syncId:"symbol-performance",children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsxs("linearGradient",{id:"cumulativeGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[jsxRuntime.jsx("stop",{offset:"5%",stopColor:"#608CFF",stopOpacity:.4}),jsxRuntime.jsx("stop",{offset:"95%",stopColor:"#608CFF",stopOpacity:0})]})}),jsxRuntime.jsx(recharts.Tooltip,{cursor:jsxRuntime.jsx(io,{}),content:jsxRuntime.jsx(no,{})}),jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.ReferenceLine,{y:0,stroke:"rgba(255,255,255,0.3)",strokeWidth:2,strokeDasharray:"4 4"}),jsxRuntime.jsx(recharts.YAxis,{domain:R,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:c=>mo(c),width:45}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",tickLine:false,interval:h,minTickGap:30,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.Bar,{dataKey:"pnl",shape:jsxRuntime.jsx(ao,{}),minPointSize:1,isAnimationActive:false,children:s.map((c,u)=>jsxRuntime.jsx(recharts.Cell,{fill:c.pnl===0?"rgba(255,255,255,0.2)":c.pnl>0?l.profit:l.loss},`cell-${u}`))}),jsxRuntime.jsx(recharts.Area,{type:"natural",dataKey:"cumulativePnL",fill:"url(#cumulativeGradient)",stroke:"none",isAnimationActive:false}),jsxRuntime.jsx(recharts.Line,{type:"natural",dataKey:"cumulativePnL",stroke:l.primary,strokeWidth:2,dot:false,isAnimationActive:false,strokeLinecap:"round",strokeLinejoin:"round"})]})})})};function mo(t){let o=["","K","M","B","T"],e=0,a=Math.abs(t);for(;a>=1e3&&e<o.length-1;)a/=1e3,e++;let r=t<0?"-":"",i=a<=10?1:0,n=a.toFixed(i);return `${r}${n}${o[e]}`}var ko=t=>{let{fill:o,x:e,y:a,width:r,height:i}=t,n=Math.abs(i);return jsxRuntime.jsx("rect",{rx:2,x:e,y:i>0?a:a+i,width:r,height:n,stroke:"none",fill:o})},Po=t=>{let{width:o,height:e}=t;return jsxRuntime.jsx(recharts.Cross,{x:t.x+t.width/2,top:t.top,height:e,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},Ct=t=>`${t>0?"+":""}${t}`,Mo=t=>{let{active:o,payload:e,label:a}=t;if(o&&e&&e.length>=1){let i=e.find(h=>h.dataKey==="volume")?.value??0,l=e.find(h=>h.dataKey==="cumulativeVolume")?.value??0;return jsxRuntime.jsxs(orderlyUi.Box,{intensity:600,p:3,r:"md",className:"oui-flex oui-flex-col oui-gap-2",children:[jsxRuntime.jsxs("div",{className:"oui-text-xs oui-font-semibold",children:[a,": ",Ct(i)," USDC"]}),jsxRuntime.jsxs("div",{className:"oui-text-xs oui-flex oui-gap-2",children:[jsxRuntime.jsx("span",{className:"oui-text-base-contrast-54",children:"Cumulative:"}),jsxRuntime.jsxs("span",{className:"oui-font-semibold",children:[Ct(l)," USDC"]})]})]})}return null},Ro=(t,o,e=false)=>{if(t<=12&&!e)return 0;let a;t>500||t>200?a=6:t>100?a=7:t>50?a=8:a=12,e&&(a=Math.ceil(a/2));let r=Math.ceil(t/a);if(o==="15m")return r>=96?Math.ceil(r/56)*56:r>=48?Math.ceil(r/28)*28:r>=24?Math.ceil(r/16)*16:Math.max(8,Math.ceil(r/4)*4);if(o==="1h")return r>=48?Math.ceil(r/28)*28:r>=24?Math.ceil(r/12)*12:Math.max(4,Math.ceil(r/4)*4);if(o==="1d"){if(r>=14)return Math.ceil(r/14)*14;if(r>=3)return Math.ceil(r/7)*7}return r},Ao=t=>{let o=0;return t.map(e=>(o+=e.volume,{...e,cumulativeVolume:o}))},To=t=>{let{data:o,aggregationWindow:e="1d",isMobile:a=false,invisible:r,responsiveContainerProps:i,className:n}=t,l=p(t.colors?{profit:t.colors.fill,loss:t.colors.fill}:void 0),s=react.useMemo(()=>Ao(o),[o]),h=react.useMemo(()=>Ro(s.length,e,a),[s.length,e,a]),R=react.useMemo(()=>{if(s.length===0)return [0,1];let c=s.map(O=>O.volume),u=Math.max(...c,0),v=u;if(v===0)return [0,1];let N=v*.1,F=u+N,A=Math.pow(10,Math.floor(Math.log10(v))),T=Math.ceil(F/5/A)*A;return [0,Math.ceil(F/T)*T]},[s]);return r||s.length===0?jsxRuntime.jsx(V,{title:"No Volume Data",description:"No trading volume data available for the selected period",height:"100%",className:n}):jsxRuntime.jsx(orderlyUi.Box,{className:orderlyUi.cn("oui-w-full oui-h-full",n),children:jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:"100%",...i,children:jsxRuntime.jsxs(recharts.ComposedChart,{data:s,margin:{left:45,top:10,right:50,bottom:20},syncId:"symbol-performance",children:[jsxRuntime.jsx(recharts.Tooltip,{cursor:jsxRuntime.jsx(Po,{}),content:jsxRuntime.jsx(Mo,{})}),jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.ReferenceLine,{y:0,stroke:"rgba(0,0,0,0.04)"}),jsxRuntime.jsx(recharts.YAxis,{domain:R,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:c=>wo(c),width:45}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",tickLine:false,interval:h,minTickGap:30,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.Bar,{dataKey:"volume",shape:jsxRuntime.jsx(ko,{}),minPointSize:1,isAnimationActive:false,children:s.map((c,u)=>jsxRuntime.jsx(recharts.Cell,{fill:c.volume===0?"rgba(255,255,255,0.2)":l.profit,opacity:.8},`cell-${u}`))})]})})})};function wo(t){let o=["","K","M","B","T"],e=0,a=Math.abs(t);for(;a>=1e3&&e<o.length-1;)a/=1e3,e++;let r=t<0?"-":"",i=a<=10?1:0,n=a.toFixed(i);return `${r}${n}${o[e]}`}var Eo=t=>{let{fill:o,x:e,y:a,width:r,height:i}=t,n=Math.abs(i);return jsxRuntime.jsx("rect",{rx:2,x:e,y:i>0?a:a+i,width:r,height:n,stroke:"none",fill:o})},Uo=t=>{let{width:o,height:e}=t;return jsxRuntime.jsx(recharts.Cross,{x:t.x+t.width/2,top:t.top,height:e,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},gt=t=>`${t>0?"+":""}${t.toFixed(2)}`,Wo=t=>{let{active:o,payload:e,label:a}=t;if(o&&e&&e.length>=1){let i=e.find(h=>h.dataKey==="fees")?.value??0,l=e.find(h=>h.dataKey==="cumulativeFees")?.value??0;return jsxRuntime.jsxs(orderlyUi.Box,{intensity:600,p:3,r:"md",className:"oui-flex oui-flex-col oui-gap-2",children:[jsxRuntime.jsxs("div",{className:"oui-text-xs oui-font-semibold",children:[a,": ",gt(i)," USDC"]}),jsxRuntime.jsxs("div",{className:"oui-text-xs oui-flex oui-gap-2",children:[jsxRuntime.jsx("span",{className:"oui-text-base-contrast-54",children:"Cumulative:"}),jsxRuntime.jsxs("span",{className:"oui-font-semibold",children:[gt(l)," USDC"]})]})]})}return null},Xo=(t,o,e=false)=>{if(t<=12&&!e)return 0;let a;t>500||t>200?a=6:t>100?a=7:t>50?a=8:a=12,e&&(a=Math.ceil(a/2));let r=Math.ceil(t/a);if(o==="15m")return r>=96?Math.ceil(r/56)*56:r>=48?Math.ceil(r/28)*28:r>=24?Math.ceil(r/16)*16:Math.max(8,Math.ceil(r/4)*4);if(o==="1h")return r>=48?Math.ceil(r/28)*28:r>=24?Math.ceil(r/12)*12:Math.max(4,Math.ceil(r/4)*4);if(o==="1d"){if(r>=14)return Math.ceil(r/14)*14;if(r>=3)return Math.ceil(r/7)*7}return r},Yo=t=>{let o=0;return t.map(e=>(o+=e.fees,{...e,cumulativeFees:o}))},Ho=t=>{let{data:o,aggregationWindow:e="1d",isMobile:a=false,invisible:r,responsiveContainerProps:i,className:n}=t,l=p(t.colors?{profit:t.colors.fill,loss:t.colors.fill}:void 0),s=react.useMemo(()=>Yo(o),[o]),h=react.useMemo(()=>Xo(s.length,e,a),[s.length,e,a]),R=react.useMemo(()=>{if(s.length===0)return [0,1];let c=s.map($=>$.fees),u=s.map($=>$.cumulativeFees),v=Math.min(...c,...u,0),N=Math.max(...c,...u,0),F=N-v;if(F===0)return [0,1];let A=F*.1,T=v-A,w=N+A,O=Math.pow(10,Math.floor(Math.log10(F))),L=Math.ceil((w-T)/5/O)*O,z=Math.floor(T/L)*L,Y=Math.ceil(w/L)*L;return [z,Y]},[s]);return r||s.length===0?jsxRuntime.jsx(V,{title:"No Fees Data",description:"No fees data available for the selected period",height:"100%",className:n}):jsxRuntime.jsx(orderlyUi.Box,{className:orderlyUi.cn("oui-w-full oui-h-full",n),children:jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:"100%",...i,children:jsxRuntime.jsxs(recharts.ComposedChart,{data:s,margin:{left:45,top:10,right:50,bottom:20},syncId:"symbol-performance",children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsxs("linearGradient",{id:"feesGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[jsxRuntime.jsx("stop",{offset:"5%",stopColor:"#FF6B6B",stopOpacity:.4}),jsxRuntime.jsx("stop",{offset:"95%",stopColor:"#FF6B6B",stopOpacity:0})]})}),jsxRuntime.jsx(recharts.Tooltip,{cursor:jsxRuntime.jsx(Uo,{}),content:jsxRuntime.jsx(Wo,{})}),jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.ReferenceLine,{y:0,stroke:"rgba(0,0,0,0.04)"}),jsxRuntime.jsx(recharts.YAxis,{domain:R,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:c=>qo(c),width:45}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",tickLine:false,interval:h,minTickGap:30,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.Bar,{dataKey:"fees",shape:jsxRuntime.jsx(Eo,{}),minPointSize:1,isAnimationActive:false,children:s.map((c,u)=>jsxRuntime.jsx(recharts.Cell,{fill:c.fees===0?"rgba(255,255,255,0.2)":l.loss,opacity:.8},`cell-${u}`))}),jsxRuntime.jsx(recharts.Area,{type:"natural",dataKey:"cumulativeFees",fill:"url(#feesGradient)",stroke:"none",isAnimationActive:false}),jsxRuntime.jsx(recharts.Line,{type:"natural",dataKey:"cumulativeFees",stroke:l.loss,strokeWidth:2,dot:false,isAnimationActive:false,strokeLinecap:"round",strokeLinejoin:"round"})]})})})};function qo(t){let o=["","K","M","B","T"],e=0,a=Math.abs(t);for(;a>=1e3&&e<o.length-1;)a/=1e3,e++;let r=t<0?"-":"",i=a<=10?1:0,n=a.toFixed(i);return `${r}${n}${o[e]}`}var nr=t=>{let{width:o,height:e}=t;return jsxRuntime.jsx(recharts.Cross,{x:t.x+t.width/2,top:t.top,height:e,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},sr=t=>{let{active:o,payload:e,label:a}=t;if(o&&e&&e.length>=1){let r=e[0].payload;return r.close!==null&&r.close!==void 0?jsxRuntime.jsxs(orderlyUi.Box,{intensity:600,p:3,r:"md",className:"oui-flex oui-flex-col oui-gap-2",children:[jsxRuntime.jsxs("div",{className:"oui-text-xs oui-flex oui-gap-2",children:[jsxRuntime.jsx("span",{className:"oui-text-base-contrast-54",children:"Open:"}),jsxRuntime.jsx("span",{className:"oui-font-semibold",children:r.open?.toFixed(2)??"--"})]}),jsxRuntime.jsxs("div",{className:"oui-text-xs oui-flex oui-gap-2",children:[jsxRuntime.jsx("span",{className:"oui-text-base-contrast-54",children:"High:"}),jsxRuntime.jsx("span",{className:"oui-font-semibold",children:r.high?.toFixed(2)??"--"})]}),jsxRuntime.jsxs("div",{className:"oui-text-xs oui-flex oui-gap-2",children:[jsxRuntime.jsx("span",{className:"oui-text-base-contrast-54",children:"Low:"}),jsxRuntime.jsx("span",{className:"oui-font-semibold",children:r.low?.toFixed(2)??"--"})]}),jsxRuntime.jsxs("div",{className:"oui-text-xs oui-flex oui-gap-2",children:[jsxRuntime.jsx("span",{className:"oui-text-base-contrast-54",children:"Close:"}),jsxRuntime.jsx("span",{className:"oui-font-semibold",children:r.close.toFixed(2)})]}),jsxRuntime.jsxs("div",{className:"oui-text-xs oui-flex oui-gap-2 oui-mt-1 oui-pt-2 oui-border-t oui-border-base-contrast-16",children:[jsxRuntime.jsx("span",{className:"oui-text-base-contrast-54",children:"Time:"}),jsxRuntime.jsx("span",{className:"oui-font-semibold",children:a})]})]}):jsxRuntime.jsxs(orderlyUi.Box,{intensity:600,p:3,r:"md",className:"oui-flex oui-flex-col oui-gap-2",children:[jsxRuntime.jsx("div",{className:"oui-text-xs oui-text-base-contrast-54",children:"Price data unavailable"}),jsxRuntime.jsxs("div",{className:"oui-text-xs oui-flex oui-gap-2 oui-mt-1 oui-pt-2 oui-border-t oui-border-base-contrast-16",children:[jsxRuntime.jsx("span",{className:"oui-text-base-contrast-54",children:"Time:"}),jsxRuntime.jsx("span",{className:"oui-font-semibold",children:a})]})]})}return null},lr=(t,o,e=false)=>{if(t<=12&&!e)return 0;let a;t>500||t>200?a=6:t>100?a=7:t>50?a=8:a=12,e&&(a=Math.ceil(a/2));let r=Math.ceil(t/a);if(o==="15m")return r>=96?Math.ceil(r/56)*56:r>=48?Math.ceil(r/28)*28:r>=24?Math.ceil(r/16)*16:Math.max(8,Math.ceil(r/4)*4);if(o==="1h")return r>=48?Math.ceil(r/28)*28:r>=24?Math.ceil(r/12)*12:Math.max(4,Math.ceil(r/4)*4);if(o==="1d"){if(r>=14)return Math.ceil(r/14)*14;if(r>=3)return Math.ceil(r/7)*7}return r};function cr(t){return t.toFixed(2)}var mr=t=>{let {data:o,aggregationWindow:e="1d",isMobile:a=false,invisible:r,responsiveContainerProps:i,className:n}=t;p();let s=react.useMemo(()=>lr(o.length,e,a),[o.length,e,a]),h=react.useMemo(()=>{if(o.length===0)return [0,1];let R=o.map(z=>z.close).filter(z=>z!=null);if(R.length===0)return [0,1];let c=Math.min(...R),u=Math.max(...R),v=u-c;if(v===0)return [c-1,u+1];let N=v*.1,F=c-N,A=u+N,T=Math.pow(10,Math.floor(Math.log10(v))),w=Math.ceil((A-F)/5/T)*T,O=Math.floor(F/w)*w,L=Math.ceil(A/w)*w;return [O,L]},[o]);return r||o.length===0?jsxRuntime.jsx(V,{title:"No Price Data",description:"No price data available for the selected period",height:"100%",className:n}):jsxRuntime.jsx(orderlyUi.Box,{className:orderlyUi.cn("oui-w-full oui-h-full",n),children:jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:"100%",...i,children:jsxRuntime.jsxs(recharts.ComposedChart,{data:o,margin:{left:45,top:10,right:50,bottom:20},syncId:"symbol-performance",children:[jsxRuntime.jsx(recharts.Tooltip,{cursor:jsxRuntime.jsx(nr,{}),content:jsxRuntime.jsx(sr,{})}),jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.ReferenceLine,{y:0,stroke:"rgba(0,0,0,0.04)"}),jsxRuntime.jsx(recharts.YAxis,{domain:h,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:cr,width:50}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",tickLine:false,interval:s,minTickGap:50,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.Line,{type:"natural",dataKey:"close",stroke:"#00B49E",strokeWidth:2,dot:false,isAnimationActive:false,strokeLinecap:"round",strokeLinejoin:"round"})]})})})};var vr=t=>{let{active:o,payload:e,label:a}=t,r=react.useRef(new Date().toISOString().split("T")[0]),{t:i}=orderlyI18n.useTranslation();return o&&e&&e.length?jsxRuntime.jsx(k,{label:a===r.current?i("chart.now"):a,value:e[0].value}):null},Fr=t=>{let{responsiveContainerProps:o}=t,e=p(t.colors),a=react.useId(),{isMobile:r}=orderlyUi.useScreen(),i=r?jsxRuntime.jsxs(recharts.AreaChart,{width:530,height:180,data:t.data,margin:{top:20,right:10,left:-20,bottom:-10},children:[jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsxRuntime.jsx(I,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.YAxis,{dataKey:"account_value",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:n=>D(n)}),!t.invisible&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsxs("linearGradient",{id:a,x1:"0",y1:"0",x2:"0",y2:"1",children:[jsxRuntime.jsx("stop",{stopColor:"#00B49E",offset:"0%",stopOpacity:.5}),jsxRuntime.jsx("stop",{stopColor:"#00B49E",offset:"100%",stopOpacity:0})]})}),jsxRuntime.jsx(recharts.Area,{type:"natural",dataKey:"account_value",stroke:e.profit,strokeWidth:r?1.5:2,dot:false,isAnimationActive:false,fill:`url(#${a})`})]})]}):jsxRuntime.jsxs(recharts.LineChart,{width:530,height:180,data:t.data,margin:{top:20,right:10,left:-20,bottom:-10},children:[jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsxRuntime.jsx(I,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.YAxis,{dataKey:"account_value",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:D}),!t.invisible&&jsxRuntime.jsx(recharts.Tooltip,{cursor:{strokeDasharray:"3 2",strokeOpacity:.16},content:jsxRuntime.jsx(vr,{})}),!t.invisible&&jsxRuntime.jsx(recharts.Line,{type:"natural",dataKey:"account_value",stroke:e.profit,strokeWidth:r?1.5:2,dot:false,isAnimationActive:false})]});return jsxRuntime.jsx(recharts.ResponsiveContainer,{className:t.invisible?"chart-invisible":void 0,...o,children:i})};var Ir=t=>{let{active:o,payload:e,label:a}=t,r=react.useRef(new Date().toISOString().split("T")[0]),{t:i}=orderlyI18n.useTranslation();return o&&e&&e.length?jsxRuntime.jsx(k,{label:a===r.current?i("chart.now"):a,value:e[0].value}):null},Br=t=>{let{responsiveContainerProps:o}=t,e=p(t.colors),a=react.useId(),{isMobile:r}=orderlyUi.useScreen(),i=jsxRuntime.jsxs(recharts.AreaChart,{width:530,height:180,data:t.data,margin:{top:20,right:10,left:-20,bottom:-10},children:[jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",interval:t.data.length-2,tick:jsxRuntime.jsx(I,{}),stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.YAxis,{dataKey:"account_value",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,tickFormatter:D}),!t.invisible&&jsxRuntime.jsx(recharts.Tooltip,{cursor:{strokeDasharray:"3 2",strokeOpacity:.16},content:jsxRuntime.jsx(Ir,{})}),!t.invisible&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsxs("linearGradient",{id:a,x1:"0",y1:"0",x2:"0",y2:"1",children:[jsxRuntime.jsx("stop",{stopColor:"#00B49E",offset:"0%",stopOpacity:.5}),jsxRuntime.jsx("stop",{stopColor:"#00B49E",offset:"100%",stopOpacity:0})]})}),jsxRuntime.jsx(recharts.Area,{type:"natural",dataKey:"account_value",stroke:e.profit,strokeWidth:r?1.5:2,dot:false,isAnimationActive:false,fill:`url(#${a})`})]})]});return jsxRuntime.jsx(recharts.ResponsiveContainer,{className:t.invisible?"chart-invisible":void 0,...o,children:i})};var Qr=t=>{let{fill:o,x:e,y:a,width:r,height:i,opacity:n}=t,l=Math.abs(i);return jsxRuntime.jsx("rect",{rx:2,x:e,y:i>0?a:a+i,width:r,height:l,stroke:"none",fill:o,opacity:n})},Jr=t=>{let{width:o,height:e,payload:a,stroke:r,fill:i}=t;return a?.[0]?.value===0?null:jsxRuntime.jsx(recharts.Cross,{x:t.x+t.width/2,top:t.top,height:e,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},Zr=t=>{let{active:o,payload:e,label:a,tooltip:r}=t;return e?.[0]?.value===0?null:o&&e&&e.length?jsxRuntime.jsx(k,{label:a,value:e[0].value,titleClassName:"oui-gap-4",rm:r?.rm,dp:r?.dp}):null},jr=t=>{let o=p(t.colors?.fill?{profit:t.colors?.fill,loss:t.colors?.fill}:void 0),e=t.data?.reduce((i,n)=>i+n.volume,0)===0,a=t.data?.reduce((i,n)=>i>n.volume?i:n.volume,0),r=a<=10?2:a<=100?1:0;return jsxRuntime.jsx(orderlyUi.Box,{className:orderlyUi.cn(t.className),children:jsxRuntime.jsx(recharts.ResponsiveContainer,{children:jsxRuntime.jsxs(recharts.BarChart,{data:t.data,margin:{left:-0,top:6,right:0,bottom:20},children:[jsxRuntime.jsx(recharts.Tooltip,{cursor:jsxRuntime.jsx(Jr,{}),content:jsxRuntime.jsx(Zr,{tooltip:t.tooltip})}),jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.08,repeatCount:6}),jsxRuntime.jsx(recharts.ReferenceLine,{y:0,stroke:"#000"}),jsxRuntime.jsx(recharts.Bar,{dataKey:"volume",shape:jsxRuntime.jsx(Qr,{}),minPointSize:1,children:t.data.map((i,n)=>jsxRuntime.jsx(recharts.Cell,{fill:i.volume>0?o.profit:o.loss,opacity:i.opacity},`cell-${n}`))}),jsxRuntime.jsx(recharts.YAxis,{tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,dataKey:"volume",tickFormatter:(i,n)=>e?`${n*100}`:ta(i,r),width:45}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",tickLine:false,interval:t.data.length-2,height:1,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},stroke:"rgb(229, 231, 235)",strokeOpacity:.2})]})})})};function ta(t,o=0){let e=["","K","M","B","T"],a=0;for(;t>=1e3&&a<e.length-1;)t/=1e3,a++;return `${ea(t,o)}${e[a]}`}function ea(t,o){let e=t.toString(),a=e.indexOf(".");if(a===-1||o===0)return e.split(".")[0];let r=a+o+1;return e.slice(0,r)}var pa=t=>{let{width:o,height:e}=t;return jsxRuntime.jsx(recharts.Cross,{x:t.x+t.width/2,top:t.top,height:e,width:1,stroke:"rgba(255,255,255,0.16)",strokeDasharray:"3 2",fill:"none"})},da=t=>{let{active:o,payload:e,label:a}=t;return o&&e&&e.length>0?jsxRuntime.jsxs(orderlyUi.Box,{intensity:600,p:3,r:"md",className:"oui-flex oui-flex-col oui-gap-2",children:[jsxRuntime.jsx("div",{className:"oui-text-xs oui-font-semibold",children:a}),e.map((r,i)=>jsxRuntime.jsxs("div",{className:"oui-text-xs oui-flex oui-gap-2",children:[jsxRuntime.jsxs("span",{style:{color:r.color},className:"oui-font-semibold",children:[r.name,":"]}),jsxRuntime.jsx("span",{children:r.value?.toFixed(2)||0})]},i))]}):null},fa=({volumeData:t,feesData:o,priceData:e,aggregationWindow:a,includeFees:r,className:i})=>{let n=react.useMemo(()=>{let l=new Map;return t.forEach(s=>{l.set(s.date,{...l.get(s.date),date:s.date,volume:s.volume});}),o.forEach(s=>{l.set(s.date,{...l.get(s.date),date:s.date,fees:s.fees});}),e.forEach(s=>{l.set(s.date,{...l.get(s.date),date:s.date,open:s.open,high:s.high,low:s.low,close:s.close});}),Array.from(l.values())},[t,o,e]);return n.length===0?jsxRuntime.jsx(orderlyUi.Box,{className:orderlyUi.cn("oui-w-full oui-h-full",i),children:jsxRuntime.jsx("div",{className:"oui-text-center oui-text-base-contrast-54 oui-py-10",children:"No data available"})}):jsxRuntime.jsx(orderlyUi.Box,{className:orderlyUi.cn("oui-w-full oui-h-full",i),children:jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:"100%",children:jsxRuntime.jsxs(recharts.ComposedChart,{data:n,margin:{left:0,top:10,right:10,bottom:20},children:[jsxRuntime.jsx(recharts.CartesianGrid,{vertical:false,stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"date",tickLine:false,tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},stroke:"#FFFFFF",strokeOpacity:.04}),jsxRuntime.jsx(recharts.YAxis,{yAxisId:"left",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,width:45,label:{value:"Volume / Fees",angle:-90,position:"insideLeft"}}),jsxRuntime.jsx(recharts.YAxis,{yAxisId:"right",orientation:"right",tick:{fontSize:10,fill:"rgba(255,255,255,0.54)"},tickLine:false,axisLine:false,width:50,label:{value:"Price",angle:90,position:"insideRight"}}),jsxRuntime.jsx(recharts.Tooltip,{cursor:jsxRuntime.jsx(pa,{}),content:jsxRuntime.jsx(da,{})}),jsxRuntime.jsx(recharts.ReferenceLine,{y:0,stroke:"rgba(0,0,0,0.04)"}),jsxRuntime.jsx(recharts.Bar,{yAxisId:"left",dataKey:"volume",fill:"rgba(0, 180, 158, 0.6)",name:"Volume"}),jsxRuntime.jsx(recharts.Bar,{yAxisId:"left",dataKey:"fees",fill:"rgba(255, 107, 107, 0.6)",name:"Fees"}),jsxRuntime.jsx(recharts.Line,{yAxisId:"right",type:"natural",dataKey:"close",stroke:"#00B49E",strokeWidth:2,dot:false,isAnimationActive:false,name:"Price",strokeLinecap:"round",strokeLinejoin:"round"})]})})})};var Ot=$t(Nt()),ga=()=>(0, Ot.default)(function({addComponents:t,addBase:o}){t({".xAxis":{".recharts-cartesian-axis-tick:first-child text":{"text-anchor":"start"},".recharts-cartesian-axis-tick:last-child text":{"text-anchor":"end"}}},{respectPrefix:false});});Object.defineProperty(exports,"Area",{enumerable:true,get:function(){return recharts.Area}});Object.defineProperty(exports,"AreaChart",{enumerable:true,get:function(){return recharts.AreaChart}});Object.defineProperty(exports,"Bar",{enumerable:true,get:function(){return recharts.Bar}});Object.defineProperty(exports,"BarChart",{enumerable:true,get:function(){return recharts.BarChart}});Object.defineProperty(exports,"Cell",{enumerable:true,get:function(){return recharts.Cell}});Object.defineProperty(exports,"Line",{enumerable:true,get:function(){return recharts.Line}});Object.defineProperty(exports,"LineChart",{enumerable:true,get:function(){return recharts.LineChart}});exports.AssetAreaChart=Br;exports.AssetLineChart=Fr;exports.ChartEmptyState=V;exports.CombinedFeesChart=Ho;exports.CombinedPnLChart=co;exports.CombinedPriceChart=mr;exports.CombinedVolumeChart=To;exports.PnLBarChart=ne;exports.PnlAreaChart=Ke;exports.PnlLineChart=Fe;exports.UnifiedSymbolPerformanceChart=fa;exports.VolBarChart=jr;exports.chartPlugin=ga;//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|