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

[WIP] Historical price and difficulty fetching and saving #16

Merged
merged 30 commits into from
May 27, 2022

Conversation

endorxmr
Copy link
Contributor

@endorxmr endorxmr commented May 7, 2022

No description provided.

a = POW_Coin(coin.XMR)
b = a.profitability(fiat.USD, 20000, 200, 0.1)
print(b)
print(b)
Copy link
Owner

Choose a reason for hiding this comment

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

Please use asserts for testing.

This assuming that there was no connection problem.

endorxmr added 16 commits May 23, 2022 20:11
Also reorder the requirements alphabetically
Accessing by height works fine.
Accessing by timestamp is still not available, need to figure out how to get the index from the timestamp.
Should I use a double index?
TODO: handle KeyboardCancellation to save partial data
target_height subestimation idea:
loop: fetch blocks; check if the timestamp is in there: if yes, break; if not, fetch again until it is found
Line 191 requires two values being returned, even in the case the fetching is successful
mj-xmr
mj-xmr previously approved these changes May 25, 2022
@endorxmr endorxmr marked this pull request as ready for review May 25, 2022 14:32
@mj-xmr mj-xmr dismissed their stale review May 25, 2022 15:22

still failing

src/kraken.py Show resolved Hide resolved
Copy link
Owner

@mj-xmr mj-xmr left a comment

Choose a reason for hiding this comment

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

the default test() calls must use subsample of data, because they're meant to be executed quickly.

endorxmr added 5 commits May 26, 2022 17:36
The delta_height was always the same, because it did not consider the last known timestamp of the last block fetched in the previous iteration of the loop.

Note that the v1 part (blocktime 60s) does not have this issue, because it always calculates delta_height from the last known timestamp.

When falling in the second case (timestamp > xmr_blocktime_120), the first iteration must calculate the delta from the fork timestamp, while subsequent iterations must calculate.
results = []
try:
print(f"Downloading headers from {start_height} to {end_height}")
while (end_height - start_height >= batch_size):
Copy link
Owner

Choose a reason for hiding this comment

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

This loop has to have any kind of max_iterations fuse, where the max_iterations can be a very large number.

@mj-xmr mj-xmr merged commit 7717da7 into mj-xmr:master May 27, 2022
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