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

Dependence of derive cols #232

Closed
mationai opened this issue Sep 16, 2021 · 3 comments · Fixed by #233
Closed

Dependence of derive cols #232

mationai opened this issue Sep 16, 2021 · 3 comments · Fixed by #233
Labels
bug Something isn't working question Further information is requested

Comments

@mationai
Copy link

Currently I have the following as separate derive since one depend on the other. I'm wondering if combining them under the same derive will work and if there are any speedups doing so.

      .derive({
        vol50: aq.rolling(d => op.round(op.average(d.vol)), [-50, 0]),
      })
      .derive({
        rvol: aq.escape(d => round(d.vol / d.vol50, 2)),
      })
@jheer jheer added the question Further information is requested label Sep 16, 2021
@jheer
Copy link
Member

jheer commented Sep 16, 2021

If one derive expression depends on another, they currently must be provided in sequential calls, as you've done here. Combining them into one derive will not work at this point in time.

@jheer jheer closed this as completed Sep 16, 2021
@mationai
Copy link
Author

mationai commented Sep 19, 2021

@jheer
It seems non-dependent derives still can not be in the same derive clause.

In the rolling average example in cookbook, if I add another rolling average in the same clause with different window, the result of the 2nd rolling average is just a copy of the first.

    .derive({
      ra4: aq.rolling(d => op.average(d.x), [-4, 0]),
      ra2: aq.rolling(d => op.average(d.x), [-2, 0]),
    })

@jheer jheer added the bug Something isn't working label Sep 20, 2021
@jheer
Copy link
Member

jheer commented Sep 20, 2021

Ooh, that is definitely a bug. Thank you for catching this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants