PyAlgoEngine 0.8.0.post2__tar.gz → 0.8.0.post3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/PKG-INFO +1 -1
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/PyAlgoEngine.egg-info/PKG-INFO +1 -1
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/__init__.py +1 -1
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/backtest/replay.py +103 -90
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/LICENSE +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/PyAlgoEngine.egg-info/SOURCES.txt +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/PyAlgoEngine.egg-info/dependency_links.txt +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/PyAlgoEngine.egg-info/requires.txt +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/PyAlgoEngine.egg-info/top_level.txt +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/README.md +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/apps/__init__.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/apps/backtest/__init__.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/apps/backtest/doc_server.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/apps/backtest/tester.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/apps/backtest/web_app.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/apps/bokeh_server.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/apps/demo/__init__.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/apps/demo/test.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/apps/sim_input/__init__.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/apps/sim_input/client.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/apps/sim_input/sim_keyboard.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/apps/sim_input/sim_mouse.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/apps/sim_input/window.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/backtest/__init__.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/backtest/__main__.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/backtest/metrics.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/backtest/sim_match.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/base/__init__.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/base/candlestick.pyi +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/base/console_utils.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/base/finance_decimal.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/base/market_data.pyi +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/base/market_data_buffer.pyi +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/base/market_utils_nt.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/base/market_utils_posix.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/base/technical_analysis.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/base/telemetrics.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/base/tick.pyi +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/base/trade_utils.pyi +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/base/trade_utils_native.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/base/transaction.pyi +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/engine/__init__.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/engine/algo_engine.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/engine/event_engine.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/engine/market_engine.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/engine/trade_engine.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/monitor/__init__.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/monitor/advanced_data_interface.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/profile/__init__.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/profile/cn.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/strategy/__init__.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/strategy/strategy_engine.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/utils/__init__.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/utils/commit_regularizer.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/utils/data_utils.py +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/setup.cfg +0 -0
- {pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/setup.py +0 -0
|
@@ -405,99 +405,96 @@ class ProgressReplay(SimpleReplay):
|
|
|
405
405
|
'config': pbar_config,
|
|
406
406
|
}
|
|
407
407
|
self._pbar = None
|
|
408
|
-
self.add_bod(self._update_pbar_prefix, priority=0)
|
|
409
408
|
|
|
410
|
-
def
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
409
|
+
def _init_pbar_tqdm(self):
|
|
410
|
+
from tqdm.auto import tqdm
|
|
411
|
+
from tqdm.std import tqdm as tqdm_std
|
|
412
|
+
from tqdm.contrib.logging import _TqdmLoggingHandler, _get_first_found_console_logging_handler, _is_console_logging_handler
|
|
413
|
+
|
|
414
|
+
tqdm_config = {
|
|
415
|
+
'total': 1,
|
|
416
|
+
'unit_scale': True,
|
|
417
|
+
'unit': 'percent',
|
|
418
|
+
'mininterval': 0.1,
|
|
419
|
+
'miniters': 0.001,
|
|
420
|
+
**self.pbar_config['config'],
|
|
421
|
+
}
|
|
422
|
+
self._pbar = tqdm(**tqdm_config)
|
|
423
|
+
|
|
424
|
+
self.pbar_config['loggers'] = loggers = [LOGGER.root] + [_ for _ in LOGGER.root.manager.loggerDict.values() if isinstance(_, logging.Logger) and _.handlers]
|
|
425
|
+
self.pbar_config['original_handlers_list'] = [logger.handlers for logger in loggers]
|
|
426
|
+
for logger in loggers:
|
|
427
|
+
tqdm_handler = _TqdmLoggingHandler(tqdm_std)
|
|
428
|
+
orig_handler = _get_first_found_console_logging_handler(logger.handlers)
|
|
429
|
+
if orig_handler is not None:
|
|
430
|
+
tqdm_handler.setFormatter(orig_handler.formatter)
|
|
431
|
+
tqdm_handler.stream = orig_handler.stream
|
|
432
|
+
logger.handlers = [handler for handler in logger.handlers if not _is_console_logging_handler(handler)] + [tqdm_handler]
|
|
433
|
+
|
|
434
|
+
self.add_bod(self._init_pbar_tqdm_secondary, priority=0)
|
|
435
|
+
self.add_eod(self._close_pbar_tqdm_secondary, priority=0)
|
|
436
|
+
self.add_bod(self._update_tqdm_prefix, priority=0)
|
|
437
|
+
self._update_pbar_progress = self._update_tqdm_progress
|
|
438
|
+
|
|
439
|
+
def _init_pbar_tqdm_secondary(self, market_date):
|
|
440
|
+
from tqdm.auto import tqdm
|
|
441
|
+
|
|
442
|
+
tqdm_secondary_config = {
|
|
443
|
+
'total': 1,
|
|
444
|
+
'unit_scale': True,
|
|
445
|
+
'unit': 'percent',
|
|
446
|
+
'mininterval': 0.1,
|
|
447
|
+
'miniters': 0.001,
|
|
448
|
+
**self.pbar_config['config'],
|
|
449
|
+
}
|
|
450
|
+
self._pbar_secondary = tqdm(**tqdm_secondary_config)
|
|
451
|
+
prompt = f'Progress Total ({self._idx_date + 1} / {len(self._calendar)})'
|
|
452
|
+
prompt_secondary = f'Progress [{market_date:%Y-%m-%d}]'
|
|
453
|
+
prompt_length = max(len(prompt), len(prompt_secondary))
|
|
454
|
+
self._pbar_secondary.n = 0
|
|
455
|
+
self._pbar_secondary.set_description(prompt_secondary.ljust(prompt_length))
|
|
456
|
+
self._pbar_secondary.refresh()
|
|
457
|
+
|
|
458
|
+
def _close_pbar_tqdm_secondary(self, market_date: datetime.date):
|
|
459
|
+
self._pbar_secondary.n = 1
|
|
460
|
+
# self._pbar_secondary.refresh()
|
|
461
|
+
self._pbar_secondary.close()
|
|
462
|
+
self._pbar_secondary = None
|
|
463
|
+
|
|
464
|
+
def _init_pbar_native(self):
|
|
465
|
+
from ..base import Progress
|
|
450
466
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
467
|
+
progress_config = dict(
|
|
468
|
+
tasks=1,
|
|
469
|
+
tick_size=0.001,
|
|
470
|
+
**self.pbar_config['config'],
|
|
471
|
+
)
|
|
456
472
|
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
raise NotImplementedError(f'Invalid pbar backend {pbar_backend}')
|
|
473
|
+
self.add_bod(self._update_native_prefix, priority=0)
|
|
474
|
+
self._pbar = Progress(**progress_config)
|
|
475
|
+
self._update_pbar_progress = self._update_native_progress
|
|
461
476
|
|
|
462
|
-
def
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
prompt = f'Progress Total ({self._idx_date + 1} / {len(self._calendar)})'
|
|
467
|
-
prompt_secondary = f'Progress [{market_date:%Y-%m-%d}]'
|
|
468
|
-
prompt_length = max(len(prompt), len(prompt_secondary))
|
|
469
|
-
self._pbar.set_description(prompt.ljust(prompt_length))
|
|
470
|
-
self._pbar.refresh()
|
|
471
|
-
self._pbar_secondary.n = 0
|
|
472
|
-
self._pbar_secondary.set_description(prompt_secondary.ljust(prompt_length))
|
|
473
|
-
self._pbar_secondary.refresh()
|
|
474
|
-
case 'native':
|
|
475
|
-
self._pbar.prompt = f'Replay {market_date:%Y-%m-%d} ({self._idx_date + 1} / {len(self._calendar)}):'
|
|
476
|
-
self._pbar.output()
|
|
477
|
-
case _:
|
|
478
|
-
raise NotImplementedError(f'Invalid pbar backend {pbar_backend}')
|
|
477
|
+
def _update_tqdm_prefix(self, market_date: datetime.date):
|
|
478
|
+
prompt = f'Progress Total ({self._idx_date + 1} / {len(self._calendar)})'
|
|
479
|
+
self._pbar.set_description(prompt)
|
|
480
|
+
self._pbar.refresh()
|
|
479
481
|
|
|
480
|
-
def
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
case 'native':
|
|
497
|
-
self._pbar.done_tasks = 1
|
|
498
|
-
self._pbar.output()
|
|
499
|
-
case _:
|
|
500
|
-
raise NotImplementedError(f'Invalid pbar backend {pbar_backend}')
|
|
482
|
+
def _update_native_prefix(self, market_date: datetime.date):
|
|
483
|
+
self._pbar.prompt = f'Replay {market_date:%Y-%m-%d} ({self._idx_date + 1} / {len(self._calendar)}):'
|
|
484
|
+
self._pbar.output()
|
|
485
|
+
|
|
486
|
+
def _close_pbar_tqdm(self):
|
|
487
|
+
for logger, original_handlers in zip(self.pbar_config['loggers'], self.pbar_config['original_handlers_list']):
|
|
488
|
+
logger.handlers = original_handlers
|
|
489
|
+
|
|
490
|
+
self._pbar.n = 1
|
|
491
|
+
# self._pbar.refresh()
|
|
492
|
+
self._pbar.close()
|
|
493
|
+
self._pbar = None
|
|
494
|
+
|
|
495
|
+
def _close_pbar_native(self):
|
|
496
|
+
self._pbar.done_tasks = 1
|
|
497
|
+
self._pbar.output()
|
|
501
498
|
|
|
502
499
|
def _update_tqdm_progress(self):
|
|
503
500
|
self._pbar.n = self.progress
|
|
@@ -515,7 +512,16 @@ class ProgressReplay(SimpleReplay):
|
|
|
515
512
|
self._pbar.output()
|
|
516
513
|
|
|
517
514
|
def __iter__(self):
|
|
518
|
-
self.
|
|
515
|
+
pbar_backend = self.pbar_config['backend']
|
|
516
|
+
|
|
517
|
+
match pbar_backend:
|
|
518
|
+
case 'tqdm':
|
|
519
|
+
self._init_pbar_tqdm()
|
|
520
|
+
case 'native':
|
|
521
|
+
self._init_pbar_native()
|
|
522
|
+
case _:
|
|
523
|
+
raise NotImplementedError(f'Invalid pbar backend {pbar_backend}')
|
|
524
|
+
|
|
519
525
|
return super().__iter__()
|
|
520
526
|
|
|
521
527
|
def __next__(self) -> MarketData:
|
|
@@ -526,7 +532,14 @@ class ProgressReplay(SimpleReplay):
|
|
|
526
532
|
return result
|
|
527
533
|
except StopIteration:
|
|
528
534
|
if self._pbar is not None:
|
|
529
|
-
self.
|
|
535
|
+
pbar_backend = self.pbar_config['backend']
|
|
536
|
+
match pbar_backend:
|
|
537
|
+
case 'tqdm':
|
|
538
|
+
self._close_pbar_tqdm()
|
|
539
|
+
case 'native':
|
|
540
|
+
self._close_pbar_native()
|
|
541
|
+
case _:
|
|
542
|
+
raise NotImplementedError(f'Invalid pbar backend {pbar_backend}')
|
|
530
543
|
raise
|
|
531
544
|
|
|
532
545
|
|
|
File without changes
|
|
File without changes
|
{pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/PyAlgoEngine.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/apps/backtest/doc_server.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/apps/sim_input/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/apps/sim_input/sim_keyboard.py
RENAMED
|
File without changes
|
{pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/apps/sim_input/sim_mouse.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/base/market_data_buffer.pyi
RENAMED
|
File without changes
|
|
File without changes
|
{pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/base/market_utils_posix.py
RENAMED
|
File without changes
|
{pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/base/technical_analysis.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/base/trade_utils_native.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/monitor/advanced_data_interface.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/strategy/strategy_engine.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyalgoengine-0.8.0.post2 → pyalgoengine-0.8.0.post3}/algo_engine/utils/commit_regularizer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|