Skip to content

Commit

Permalink
update market price to simulation
Browse files Browse the repository at this point in the history
  • Loading branch information
GrandSchtroumpf committed Dec 16, 2024
1 parent 27bb2d7 commit 0620c1c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/pages/simulator/overlapping/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,15 @@ export const SimulatorInputOverlappingPage = () => {
if (isPending || isError || noBudget) return;
const start = state.start ?? defaultStart();
const end = state.end ?? defaultEnd();
const marketPrice = (() => {
if (!state.start) return data[0].open;
return data.find((d) => d.date.toString() === state.start)?.open;
})();

const { buyPriceMarginal, sellPriceMarginal } = calculateOverlappingPrices(
formatNumber(state.buy.min),
formatNumber(state.sell.max),
data[0].open.toString(),
marketPrice!.toString(),
state.spread
);

Expand Down

0 comments on commit 0620c1c

Please sign in to comment.