Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simulator #995

Merged
merged 139 commits into from
Feb 8, 2024
Merged

Simulator #995

merged 139 commits into from
Feb 8, 2024

Conversation

pingustar
Copy link
Collaborator

@pingustar pingustar commented Jan 18, 2024

#1002

comment from @GrandSchtroumpf

I found this snippet that used D3 to animate an SVG, capture all frame to draw it on a canvas and use Media Recording API to export the result as an WebM video.
https://gist.github.com/miklobit/f777577d54b97f0dd234442ad9de8f60

Maybe you can use Region Capture to get the SVG stream directly
https://developer.chrome.com/docs/web-platform/region-capture?hl=en#region-capture

Copy link

cloudflare-workers-and-pages bot commented Jan 18, 2024

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3963657
Status: ✅  Deploy successful!
Preview URL: https://747c1eaa.carbon-app-csq.pages.dev
Branch Preview URL: https://d3charts.carbon-app-csq.pages.dev

View logs

@pingustar pingustar changed the title D3charts DRAFT: Simulator Jan 22, 2024
@Costa769
Copy link
Collaborator

Added the simulator task #1002

@zavelevsky
Copy link
Collaborator

@pingustar I see many chart related components under /lib and I'm not sure why they are there and not alongside the usual components

@ashachaf
Copy link
Collaborator

ashachaf commented Feb 8, 2024

  • prevent simulation with 0 budget
    IF user tried to create simulation with 0 budget for both orders, trigger an error message.
    error: "Please add Sell and/or Buy budgets"

  • create strategy CTA
    expected: to see the same input values from the simulation in the create strategy page.
    actual: the create strategy opens up with no pre populated values

  • slightly overlapping ranges handling
    currently: if the buy/sell ranges slightly overlap, the simulation returns an error
    expected: run the simulation regularly

  • disclaimer popup - enhancement
    currently: we show the popup on every time you open the simulation page
    updated: show the popup on the first visit in a session. where session can be set by time (15minutes for example) or until the user refresh/revisit the app.

@pingustar pingustar marked this pull request as ready for review February 8, 2024 11:28
@pingustar pingustar changed the title DRAFT: Simulator Simulator Feb 8, 2024
@pingustar pingustar self-assigned this Feb 8, 2024
@pingustar pingustar added the epic label Feb 8, 2024
return;
}

wait(3000).then(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am guessing this is the part that waits 3 seconds to start the animation - but an anonymous arrow function with an hardcoded number isn't a good way to help me understand it. I'd suggest a named function and a named constant for both

export const SimulatorPage = () => {
const { simDisclaimerLastSeen, setSimDisclaimerLastSeen } = useStore();
const [timeRange] = useState({
start: dayjs().unix() - 60 * 60 * 24 * 30 * 12,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dayjs().subtract(1, 'year').unix()

useEffect(() => {
if (
!!simDisclaimerLastSeen &&
simDisclaimerLastSeen > dayjs().unix() - 15 * 60 * 1000
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you are making a mistake - daysjs unix is in seconds. I assume you want 15 minutes. not 15,000 :)
Please do this:
dayjs().subtract(15, 'minute').unix()

? 'Please add Sell and/or Buy budgets'
: null;

useEffect(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be generalized to a useDisclaimer custom hook which removes all this logic from the page

@pingustar pingustar merged commit 2929aef into main Feb 8, 2024
1 check passed
@pingustar pingustar deleted the d3charts branch February 8, 2024 17:36
@pingustar pingustar mentioned this pull request Feb 19, 2024
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simulator
6 participants