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

#153 - [trader] Optimize main loop by waiting till soonest epoch #155

Merged
merged 4 commits into from
Sep 8, 2023

Conversation

trizin
Copy link
Contributor

@trizin trizin commented Sep 8, 2023

Fixes #153

Changes proposed in this PR:

  • Optimize main loop by waiting till soonest epoch

Logs (ran on testnet):

Getting feed for 0x8db30338c5f09381cd2644bf7b4b8ea578e248a9
XRP/USDT at address 0x8db30338c5f09381cd2644bf7b4b8ea578e248a9 is at epoch 5647243. s_per_epoch: 300, s_remaining_in_epoch: 200
      Done feed: already traded this epoch
-- Soonest epoch is in 199 seconds, waiting... --
XRP/USDT at address 0x8db30338c5f09381cd2644bf7b4b8ea578e248a9 is at epoch 5647244. s_per_epoch: 300, s_remaining_in_epoch: 300
Reading contract values...
     Could not get aggpredval, trying again in a second
XRP/USDT at address 0x8db30338c5f09381cd2644bf7b4b8ea578e248a9 is at epoch 5647244. s_per_epoch: 300, s_remaining_in_epoch: 300
Reading contract values...
 Got 0.007 and 0.007
Got (0.007, 0.007).
 XRP/USDT (contract 0x8db30338c5f09381cd2644bf7b4b8ea578e248a9) has a new prediction: 0.007 / 0.007.  Let's buy or sell
Saving 5647244 0x8db30338c5f09381cd2644bf7b4b8ea578e248a9
-- Soonest epoch is in 299 seconds, waiting... --

@trizin trizin linked an issue Sep 8, 2023 that may be closed by this pull request
2 tasks
@trizin trizin marked this pull request as ready for review September 8, 2023 11:50
@trizin trizin changed the title [trader] Optimize main loop by waiting till soonest epoch #153 - [trader] Optimize main loop by waiting till soonest epoch Sep 8, 2023
@trizin trizin self-assigned this Sep 8, 2023
@trizin trizin requested a review from trentmc September 8, 2023 12:01
Copy link
Member

@trentmc trentmc left a comment

Choose a reason for hiding this comment

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

Small thing to fix. Once that's done, go ahead and merge. (Therefore approving now)


def _process_block_at_feed(self, addr: str, timestamp: int, tries: int = 0):
def _process_block_at_feed(self, addr: str, timestamp: int, tries: int = 0) -> int:
Copy link
Member

Choose a reason for hiding this comment

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

If this method is returning values, there should be a docstring of what it's returning.

@trizin trizin merged commit e0591e0 into main Sep 8, 2023
5 checks passed
@trizin trizin deleted the issue153-trader-optimize-main-loop branch September 8, 2023 14:52
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.

[trader] Optimize main loop
2 participants