-
Notifications
You must be signed in to change notification settings - Fork 72
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
Collector metadata #1184
Open
valouvaliavlo
wants to merge
1
commit into
Drakkar-Software:master
Choose a base branch
from
valouvaliavlo:collector-metadata
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Collector metadata #1184
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -21,6 +21,7 @@ | |||||
|
||||||
import octobot_commons.databases as databases | ||||||
import octobot_commons.symbols as commons_symbols | ||||||
import octobot_backtesting.data as data | ||||||
import octobot_backtesting.enums as enums | ||||||
import octobot_backtesting.errors as errors | ||||||
import octobot_trading.enums as trading_enums | ||||||
|
@@ -53,6 +54,8 @@ async def data_collector(exchange_name, tentacles_setup_config, symbols, time_fr | |||||
os.remove(collector_instance.file_path) | ||||||
if collector_instance.temp_file_path and os.path.isfile(collector_instance.temp_file_path): | ||||||
os.remove(collector_instance.temp_file_path) | ||||||
if collector_instance.metadata_file_path and os.path.isfile(collector_instance.metadata_file_path): | ||||||
os.remove(collector_instance.metadata_file_path) | ||||||
|
||||||
|
||||||
@contextlib.asynccontextmanager | ||||||
|
@@ -78,9 +81,11 @@ async def test_collect_valid_data(): | |||||
assert collector.exchange_manager is None | ||||||
assert isinstance(collector.exchange, tentacles_exchanges.Binance) | ||||||
assert collector.file_path is not None | ||||||
assert collector.metadata_file_path is not None | ||||||
assert collector.temp_file_path is not None | ||||||
assert not os.path.isfile(collector.temp_file_path) | ||||||
assert os.path.isfile(collector.file_path) | ||||||
assert os.path.isfile(collector.metadata_file_path) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||||||
async with collector_database(collector) as database: | ||||||
ohlcv = await database.select(enums.ExchangeDataTables.OHLCV) | ||||||
# use > to take into account new possible candles since collect max time is not specified | ||||||
|
@@ -101,7 +106,10 @@ async def test_collect_invalid_data(): | |||||
assert collector.exchange_manager is None | ||||||
assert collector.exchange is not None | ||||||
assert collector.file_path is not None | ||||||
assert collector.metadata_file_path is not None | ||||||
assert collector.temp_file_path is not None | ||||||
assert not os.path.isfile(collector.file_path) | ||||||
assert not os.path.isfile(collector.metadata_file_path) | ||||||
assert not os.path.isfile(collector.temp_file_path) | ||||||
|
||||||
|
||||||
|
@@ -116,8 +124,10 @@ async def test_collect_valid_date_range(): | |||||
assert collector.exchange_manager is None | ||||||
assert isinstance(collector.exchange, tentacles_exchanges.Binance) | ||||||
assert collector.file_path is not None | ||||||
assert collector.metadata_file_path is not None | ||||||
assert collector.temp_file_path is not None | ||||||
assert os.path.isfile(collector.file_path) | ||||||
assert os.path.isfile(collector.metadata_file_path) | ||||||
assert not os.path.isfile(collector.temp_file_path) | ||||||
async with collector_database(collector) as database: | ||||||
ohlcv = await database.select(enums.ExchangeDataTables.OHLCV) | ||||||
|
@@ -146,8 +156,10 @@ async def test_collect_invalid_date_range(): | |||||
assert collector.exchange_manager is None | ||||||
assert isinstance(collector.exchange, tentacles_exchanges.Binance) | ||||||
assert collector.file_path is not None | ||||||
assert collector.metadata_file_path is not None | ||||||
assert collector.temp_file_path is not None | ||||||
assert not os.path.isfile(collector.file_path) | ||||||
assert not os.path.isfile(collector.metadata_file_path) | ||||||
assert not os.path.isfile(collector.temp_file_path) | ||||||
|
||||||
|
||||||
|
@@ -164,16 +176,19 @@ async def test_collect_multi_pair(): | |||||
assert collector.exchange_manager is None | ||||||
assert isinstance(collector.exchange, tentacles_exchanges.Binance) | ||||||
assert collector.file_path is not None | ||||||
assert collector.metadata_file_path is not None | ||||||
assert collector.temp_file_path is not None | ||||||
assert not os.path.isfile(collector.temp_file_path) | ||||||
assert os.path.isfile(collector.metadata_file_path) | ||||||
assert os.path.isfile(collector.file_path) | ||||||
async with collector_database(collector) as database: | ||||||
ohlcv = await database.select(enums.ExchangeDataTables.OHLCV) | ||||||
# use > to take into account new possible candles since collect max time is not specified | ||||||
assert len(ohlcv) > 19316 | ||||||
h_ohlcv = await database.select(enums.ExchangeDataTables.OHLCV, time_frame="4h") | ||||||
assert len(h_ohlcv) == len(symbols) * BINANCE_MAX_CANDLES_COUNT | ||||||
symbols_description = json.loads((await database.select(enums.DataTables.DESCRIPTION))[0][3]) | ||||||
symbols_description = data.get_metadata_description(collector.metadata_file_path)\ | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
[enums.DataFormatKeys.SYMBOLS.value] | ||||||
assert all(symbol in symbols_description for symbol in symbols) | ||||||
eth_btc_ohlcv = await database.select(enums.ExchangeDataTables.OHLCV, symbol="ETH/BTC") | ||||||
assert len(eth_btc_ohlcv) > 6760 | ||||||
|
@@ -200,4 +215,5 @@ async def stop_soon(): | |||||
assert collector.finished | ||||||
assert collector.exchange_manager is None | ||||||
assert not os.path.isfile(collector.temp_file_path) | ||||||
assert not os.path.isfile(collector.metadata_file_path) | ||||||
assert not os.path.isfile(collector.file_path) |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we also move this line in
bot_snapshot_with_history_collector.py
please ?