-
Notifications
You must be signed in to change notification settings - Fork 19
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
Improve caching #102
Merged
btschwertfeger
merged 4 commits into
master
from
100-create-krakenspotmarketget_asset_pair-to-use-caching
May 20, 2023
Merged
Improve caching #102
btschwertfeger
merged 4 commits into
master
from
100-create-krakenspotmarketget_asset_pair-to-use-caching
May 20, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
btschwertfeger
added
enhancement
New feature or request
Could
Something that could be cool bit is not really important
Spot
Topic related to Spot trading
labels
May 20, 2023
This was
linked to
issues
May 20, 2023
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #102 +/- ##
==========================================
+ Coverage 86.71% 87.02% +0.30%
==========================================
Files 18 17 -1
Lines 1453 1472 +19
==========================================
+ Hits 1260 1281 +21
+ Misses 193 191 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
|
btschwertfeger
changed the title
Improve caching + add
Improve caching
May 20, 2023
kraken.spot.Market.get_asset
and kraken.spot.Market.get_asset_pair
This was
unlinked from
issues
May 20, 2023
This was referenced May 20, 2023
btschwertfeger
deleted the
100-create-krakenspotmarketget_asset_pair-to-use-caching
branch
May 20, 2023 15:11
btschwertfeger
added a commit
that referenced
this pull request
Mar 12, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Could
Something that could be cool bit is not really important
enhancement
New feature or request
Spot
Topic related to Spot trading
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
As described in Create
kraken.spot.Market.get_asset_pair
to use caching #100 and Createkraken.spot.Market.get_asset
to use caching #101 - creating functions that only accept hashable parameters allow to use the@lru_cache
decorator of the functools package which improves the execution time significantly.That seemed to be the right way - but then I realized creating a decorator that casts the unhashable lists into a string before the caching function is called might be the better way. For this reason no new market functions were added. Just a decorator that ensures that the critical parameters will be a string when the lru_cache decorator is called.
The
truncate
function moved fromkraken.spot.Utils
tokraken.spot.Trade
to benefit from caching.A
defined
function was added to simplify allx is not None
comparisons of the python-kraken-sdk.