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

Hi, would you like to add some examples for multiple-symbol-runs? #11

Open
narcissusdu opened this issue Sep 25, 2024 · 5 comments
Open

Comments

@narcissusdu
Copy link

narcissusdu commented Sep 25, 2024

We see ts_corr might be unable to work out the correlation for multiple-symbol scenarios.
Is that supported?

Thanks,

@narcissusdu
Copy link
Author

We see a similar issue closed. Do you have any furthur updates for that?
#2

@UePG-21
Copy link
Owner

UePG-21 commented Sep 26, 2024

This is originally designed for single symbol, but you may add other symbol data as raw factors.

@narcissusdu
Copy link
Author

narcissusdu commented Sep 27, 2024

Thanks for the reply!
We have tried that. It works good with simple calculations such as mul/div/abs.
The difficulty we found was that gplearn only supports functions for ndarrays. It erases the 2 index we added (symbol/date). Unless we convert the ndarry back to 2d array inside the function with some tricks, it won't get a meaningful corr.
Do you have any suggestions?

@uepgwang
Copy link

ts_corr should be able to take two 1d array and calculate correlation. I don't know why it doesn't work.

@narcissusdu
Copy link
Author

With ts_corr(x1, x2, d) we are tring to calculate the previouse d-days' ts_corr of 2 indicator-data within the same symbol.
In single symbol scenario it works perfectly. While in multiple-symbol scenario, ts_corr needs to use a subsequence of the 1d array which have the same symbol_index, to calculate the previous d-day corr. Or the corr could be calculated across different symbols and different days.

Given an 2-index dataframe with 2 symbols

day_index symbol_index open close
1 a open_1a close_1a
1 b open_1b close_1b
2 a open_2a close_2a
2 b open_2b close_2b
3 a open_3a close_3a
...

If a generation was created as ts_corr(open array, close array, 3) to such 2-index data, the calculation to the elements would have inconsistent meaning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants