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

[Community] handle candles history fetch #2449

Merged
merged 2 commits into from
Oct 24, 2023
Merged

[Community] handle candles history fetch #2449

merged 2 commits into from
Oct 24, 2023

Conversation

GuillaumeDSM
Copy link
Member

@GuillaumeDSM GuillaumeDSM commented Oct 22, 2023

@GuillaumeDSM GuillaumeDSM self-assigned this Oct 22, 2023
@GuillaumeDSM GuillaumeDSM requested a review from Herklos as a code owner October 22, 2023 17:09
@GuillaumeDSM GuillaumeDSM changed the title WIP [Community] handle candles history fetch [Community] handle candles history fetch Oct 23, 2023
Comment on lines 360 to 365
.eq(
"exchange_internal_name", exchange
).eq(
"symbol", symbol
).eq(
"time_frame", time_frame.value
Copy link
Member

Choose a reason for hiding this comment

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

You can use match instead of multiple eq

Copy link
Member Author

Choose a reason for hiding this comment

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

up, thanks !

total_candles = []
max_requests_count = 100
request_count = 0
while request_count < max_requests_count:
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to do multiple requests?

Copy link
Member Author

Choose a reason for hiding this comment

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

supabases has a max of rows returned by one query (1000 by default), here we want approx 18k rows for 15min over 6m

Copy link
Member

Choose a reason for hiding this comment

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

And why not increasing supabase's limit?

Copy link
Member Author

Choose a reason for hiding this comment

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

according to supabase this value should not be too high as it can take a lot of computing power from the db and be an attack vector. We can increase it though, this code will just adapt

Copy link
Member

Choose a reason for hiding this comment

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

Ok thanks for the explanation 👍

total_candles = []
max_requests_count = 100
request_count = 0
while request_count < max_requests_count:
Copy link
Member

@Herklos Herklos Oct 24, 2023

Choose a reason for hiding this comment

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

Should we catch if a request fails to not stop the whole loop or it's ok to raise?

Copy link
Member Author

Choose a reason for hiding this comment

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

we would need a retry mechanism. I havn't seen it happen yet, do you think we should add it ?

Copy link
Member

Choose a reason for hiding this comment

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

We can probably wait for it to happen a first time

@GuillaumeDSM GuillaumeDSM merged commit 4464a4f into dev Oct 24, 2023
14 checks passed
@GuillaumeDSM GuillaumeDSM deleted the candles_db branch October 24, 2023 21:33
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

Successfully merging this pull request may close these issues.

2 participants