NagarajuGunda / PyAlgoMate

114 stars 69 forks source link

Feed for flet UI is not resuming on failure #19

Closed AnveshMora closed 1 month ago

AnveshMora commented 2 months ago

During my testing for some reason my system went into sleep mode and when relogged into system.

Feed to Flet UI is broken and it is never resuming. I had restart the process altogether loosing my current positions.

AnveshMora commented 2 months ago

Below is the exception trace I've captured for recurrent feed breakage

[ERROR]|[2024-03-18 11:02:55,924]|[PID:19932::TID:22664]|[root::PyAlgoMate::runStrategy::102]|=> Error occurred while running strategy SuperTrend1. Exception:
Traceback (most recent call last):
  File "E:\github\PyAlgoMate\flet\PyAlgoMate.py", line 99, in runStrategy
    strategy.run()
  File "E:\github\PyAlgoMate\pyalgomate\core\strategy.py", line 513, in run
    self.__dispatcher.run()
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\dispatcher.py", line 109, in run
    eof, eventsDispatched = self.__dispatch()
                            ^^^^^^^^^^^^^^^^^
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\dispatcher.py", line 97, in __dispatch
    if self.__dispatchSubject(subject, smallestDateTime):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\dispatcher.py", line 75, in __dispatchSubject
    ret = subject.dispatch() is True
          ^^^^^^^^^^^^^^^^^^
  File "E:\github\PyAlgoMate\pyalgomate\brokers\zerodha\feed.py", line 216, in dispatch
    if super(ZerodhaLiveFeed, self).dispatch():
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\feed\__init__.py", line 108, in dispatch
    self.__event.emit(dateTime, values)
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\observer.py", line 69, in emit
    self.__applyChanges()
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\observer.py", line 44, in __applyChanges
    assert not self.__emitting
AssertionError
2024-03-18 11:02:55,924 root [ERROR] Error occurred while running strategy SuperTrend1. Exception:
Traceback (most recent call last):
  File "E:\github\PyAlgoMate\flet\PyAlgoMate.py", line 99, in runStrategy
    strategy.run()
  File "E:\github\PyAlgoMate\pyalgomate\core\strategy.py", line 513, in run
    self.__dispatcher.run()
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\dispatcher.py", line 109, in run
    eof, eventsDispatched = self.__dispatch()
                            ^^^^^^^^^^^^^^^^^
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\dispatcher.py", line 97, in __dispatch
    if self.__dispatchSubject(subject, smallestDateTime):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\dispatcher.py", line 75, in __dispatchSubject
    ret = subject.dispatch() is True
          ^^^^^^^^^^^^^^^^^^
  File "E:\github\PyAlgoMate\pyalgomate\brokers\zerodha\feed.py", line 216, in dispatch
    if super(ZerodhaLiveFeed, self).dispatch():
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\feed\__init__.py", line 108, in dispatch
    self.__event.emit(dateTime, values)
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\observer.py", line 69, in emit
    self.__applyChanges()
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\observer.py", line 44, in __applyChanges
    assert not self.__emitting
AssertionError
[ERROR]|[2024-03-18 11:02:55,947]|[PID:19932::TID:22664]|[root::PyAlgoMate::runStrategy::104]|=> Traceback (most recent call last):
  File "E:\github\PyAlgoMate\flet\PyAlgoMate.py", line 99, in runStrategy
    strategy.run()
  File "E:\github\PyAlgoMate\pyalgomate\core\strategy.py", line 513, in run
    self.__dispatcher.run()
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\dispatcher.py", line 109, in run
    eof, eventsDispatched = self.__dispatch()
                            ^^^^^^^^^^^^^^^^^
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\dispatcher.py", line 97, in __dispatch
    if self.__dispatchSubject(subject, smallestDateTime):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\dispatcher.py", line 75, in __dispatchSubject
    ret = subject.dispatch() is True
          ^^^^^^^^^^^^^^^^^^
  File "E:\github\PyAlgoMate\pyalgomate\brokers\zerodha\feed.py", line 216, in dispatch
    if super(ZerodhaLiveFeed, self).dispatch():
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\feed\__init__.py", line 108, in dispatch
    self.__event.emit(dateTime, values)
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\observer.py", line 69, in emit
    self.__applyChanges()
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\observer.py", line 44, in __applyChanges
    assert not self.__emitting
AssertionError
Traceback (most recent call last):
  File "E:\github\PyAlgoMate\flet\PyAlgoMate.py", line 99, in runStrategy
    strategy.run()
  File "E:\github\PyAlgoMate\pyalgomate\core\strategy.py", line 513, in run
    self.__dispatcher.run()
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\dispatcher.py", line 109, in run
    eof, eventsDispatched = self.__dispatch()
                            ^^^^^^^^^^^^^^^^^
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\dispatcher.py", line 97, in __dispatch
    if self.__dispatchSubject(subject, smallestDateTime):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\dispatcher.py", line 75, in __dispatchSubject
    ret = subject.dispatch() is True
          ^^^^^^^^^^^^^^^^^^
  File "E:\github\PyAlgoMate\pyalgomate\brokers\zerodha\feed.py", line 216, in dispatch
    if super(ZerodhaLiveFeed, self).dispatch():
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\feed\__init__.py", line 108, in dispatch
    self.__event.emit(dateTime, values)
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\observer.py", line 69, in emit
    self.__applyChanges()
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\observer.py", line 44, in __applyChanges
    assert not self.__emitting
AssertionError
2024-03-18 11:02:55,947 root [ERROR] Traceback (most recent call last):
  File "E:\github\PyAlgoMate\flet\PyAlgoMate.py", line 99, in runStrategy
    strategy.run()
  File "E:\github\PyAlgoMate\pyalgomate\core\strategy.py", line 513, in run
    self.__dispatcher.run()
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\dispatcher.py", line 109, in run
    eof, eventsDispatched = self.__dispatch()
                            ^^^^^^^^^^^^^^^^^
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\dispatcher.py", line 97, in __dispatch
    if self.__dispatchSubject(subject, smallestDateTime):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\dispatcher.py", line 75, in __dispatchSubject
    ret = subject.dispatch() is True
          ^^^^^^^^^^^^^^^^^^
  File "E:\github\PyAlgoMate\pyalgomate\brokers\zerodha\feed.py", line 216, in dispatch
    if super(ZerodhaLiveFeed, self).dispatch():
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\feed\__init__.py", line 108, in dispatch
    self.__event.emit(dateTime, values)
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\observer.py", line 69, in emit
    self.__applyChanges()
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\observer.py", line 44, in __applyChanges
    assert not self.__emitting
AssertionError
Traceback (most recent call last):
  File "E:\github\PyAlgoMate\flet\PyAlgoMate.py", line 99, in runStrategy
    strategy.run()
  File "E:\github\PyAlgoMate\pyalgomate\core\strategy.py", line 513, in run
    self.__dispatcher.run()
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\dispatcher.py", line 109, in run
    eof, eventsDispatched = self.__dispatch()
                            ^^^^^^^^^^^^^^^^^
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\dispatcher.py", line 97, in __dispatch
    if self.__dispatchSubject(subject, smallestDateTime):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\dispatcher.py", line 75, in __dispatchSubject
    ret = subject.dispatch() is True
          ^^^^^^^^^^^^^^^^^^
  File "E:\github\PyAlgoMate\pyalgomate\brokers\zerodha\feed.py", line 216, in dispatch
    if super(ZerodhaLiveFeed, self).dispatch():
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\feed\__init__.py", line 108, in dispatch
    self.__event.emit(dateTime, values)
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\observer.py", line 69, in emit
    self.__applyChanges()
  File "e:\github\PyAlgoMate\.venv\Lib\site-packages\pyalgotrade\observer.py", line 44, in __applyChanges
    assert not self.__emitting
AssertionError