happydasch / btoandav20

Support for Oanda-V20 API in backtrader
Apache License 2.0
131 stars 52 forks source link

Need your help or explain because backtrader stops after receiving new data at new minute #72

Closed huuquynh closed 3 years ago

huuquynh commented 3 years ago

Dear happydasch!

I'm so sorry when posting this issue on this git (my pattern data store to follow)! It is completely not an issue from your code. The logic and the code runs smooth... I'm following and writing my own live data store. And I think, also double check, the data store runs so well.

This issue could be from the backtrader at all. But I could not post the topic on community, I could not login because forget the password and could not reset password on community too, maybe the backtrader's hosting issue on email or forum's system.

Let me explain the issue where I stuck at:

I tried to log any point on data store to understood the logic or process queue message, and find the point it stops. But no way to stop in the data store. So only from backtrader, but with live process, it will run until it gets breaked or killed. So please take a quick look and do you have any similar experience like this?

Thank you very much for your time!

Best regards, huuquynh

from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

from utils import send_telegram_message

import backtrader as bt
import signal 
from btplotting import BacktraderPlotting
from btplotting.tabs import MetadataTab

from feeds.vndvn30data import VndVN30Data
import datetime as dt 

from log import get_logger
logger = get_logger(__name__)

class sigStrategy(bt.Strategy):

    def __init__(self):
        self.count = 0
        signal.signal(signal.SIGINT, self.sigstop)

    def notify_store(self, msg, *args, **kwargs):
        '''Receives a notification from a store provider'''
        logger.info(f'STORE NOTIF: {msg}')

    def notify_data(self, data, status, *args, **kwargs):
        '''Receives a notification from data'''
        moment = dt.datetime.now()
        logger.info(f'{moment} {data._name} - DATA NOTIF: {data._getstatusname(status)}')

    def next(self):
        for d in self.datas:
            txt = []
            txt.append(f'{data._name}')
            txt.append(d.datetime.datetime().isoformat())
            txt.append(f'{d.close[0]}')
            txt.append(f'{d.volume[0]}')
            #print(','.join(txt))
            logger.info(','.join(txt))

    def sigstop(self, a ,b):
        send_telegram_message('Grateful Stoped Backtrader', True)
        self.env.runstop()

if __name__ == '__main__':

    #Create an instance of cerebro
    cerebro = bt.Cerebro()

    #Add our strategy
    cerebro.addstrategy(sigStrategy)

    beginday = dt.date.today() - dt.timedelta(days=1)
    fromtime = dt.datetime(beginday.year, beginday.month, beginday.day, 9, 0, 0)
    totime = dt.datetime.now()

    data = VndVN30Data(dataname='VN30', name='VN30-Ticks-Live', timeframe=bt.TimeFrame.Ticks, compression=1, 
                        historical=False, backfill_start=False, backfill=True, fromdate=fromtime, todate=totime)

    cerebro.adddata(data)

    #data1 = cerebro.resampledata(data, name='VN30-M1-Live', timeframe=bt.TimeFrame.Minutes, compression=1)
    #data1.plotinfo.plotmaster = data

    #data2 = cerebro.resampledata(data, name='VN30-M3-Live', timeframe=bt.TimeFrame.Minutes, compression=3)
    #data2.plotinfo.plotmaster = data

    # Run over everything
    cerebro.run()

    p = BacktraderPlotting(style='bar', use_default_tabs=False, tabs=[MetadataTab])

    cerebro.plot(p)

I tried many cases: live tick data, resampledata to 1M, 3M, or 5M, or both tick data and resample to different minute timeframe. But backtrader always stop after new minute is counted.

Tick:

2021-03-01 10:40:28,537 __main__:INFO:2021-03-01 10:40:28.537963 VN30-Ticks-Live - DATA NOTIF: DELAYED
2021-03-01 10:40:28,538 stores.vndvn30store:INFO:CREATING NEW CONNECTION...
2021-03-01 10:40:28,825 stores.vndvn30store:INFO:New Session : f178ff6b-98f2-4e09-b396-536b2c35c8b0
2021-03-01 10:40:29,474 stores.vndvn30store:INFO:Login Session : 'ok'
2021-03-01 10:40:29,789 stores.vndvn30store:INFO:Confirm Session : /socket.io
2021-03-01 10:40:30,100 stores.vndvn30store:INFO:SAY HELLO AND SUBSCRIBE TOKEN VN30
2021-03-01 10:40:30,173 stores.vndvn30store:INFO:BEGIN
2021-03-01 10:40:32,283 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 10:40:00'), 'Open': 1189.5, 'High': 1189.5, 'Low': 1189.5, 'Close': 1189.5, 'Volume': 121700}
2021-03-01 10:40:32,283 feeds.vndvn30data:INFO:KEEP LIVE MESSAGE WAIT FOR BACKFILL RUNS FIRST {'datetime': Timestamp('2021-03-01 10:40:00'), 'Open': 1189.5, 'High': 1189.5, 'Low': 1189.5, 'Close': 1189.5, 'Volume': 121700}
2021-03-01 10:40:32,284 feeds.vndvn30data:INFO:BACKFILL RUNS
2021-03-01 10:40:32,284 stores.vndvn30store:INFO:LOAD HISTORY BACKFILL by LOCAL TICK DATA 2021-02-28 09:00:00 - 2021-03-01 10:40:00
2021-03-01 10:40:32,432 feeds.vndvn30data:INFO:LOAD HISTORY BACK: {'datetime': Timestamp('2021-03-01 09:15:00'), 'Open': 1173.7, 'High': 1173.7, 'Low': 1173.7, 'Close': 1173.7, 'Volume': 46100}
2021-03-01 10:40:32,433 __main__:INFO:VN30-Ticks-Live,2021-03-01T09:15:00,1173.7,46100.0
....
2021-03-01 10:40:32,780 feeds.vndvn30data:INFO:LOAD HISTORY BACK: {'datetime': Timestamp('2021-03-01 10:40:00'), 'Open': 1189.5, 'High': 1189.5, 'Low': 1189.5, 'Close': 1189.5, 'Volume': 121700}
2021-03-01 10:40:32,781 __main__:INFO:VN30-Ticks-Live,2021-03-01T10:40:00,1189.5,121700.0
2021-03-01 10:40:32,781 feeds.vndvn30data:INFO:LOAD HISTORY BACK: {}
2021-03-01 10:40:32,781 feeds.vndvn30data:INFO:BACK TO LIVE
2021-03-01 10:40:32,781 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 10:40:00'), 'Open': 1189.5, 'High': 1189.5, 'Low': 1189.5, 'Close': 1189.5, 'Volume': 121700}
2021-03-01 10:40:32,781 __main__:INFO:2021-03-01 10:40:32.781432 VN30-Ticks-Live - DATA NOTIF: LIVE
2021-03-01 10:40:32,781 __main__:INFO:VN30-Ticks-Live,2021-03-01T10:40:00,1189.5,121700.0
2021-03-01 10:40:37,963 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 10:40:00'), 'Open': 1189.5, 'High': 1189.5, 'Low': 1189.5, 'Close': 1189.5, 'Volume': 20300}
2021-03-01 10:40:37,964 __main__:INFO:VN30-Ticks-Live,2021-03-01T10:40:00,1189.5,20300.0
2021-03-01 10:40:47,937 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 10:40:00'), 'Open': 1189.5, 'High': 1189.5, 'Low': 1189.5, 'Close': 1189.5, 'Volume': 900}
2021-03-01 10:40:47,938 __main__:INFO:VN30-Ticks-Live,2021-03-01T10:40:00,1189.5,900.0
2021-03-01 10:40:53,360 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 10:40:00'), 'Open': 1189.4, 'High': 1189.4, 'Low': 1189.4, 'Close': 1189.4, 'Volume': 29800}
2021-03-01 10:40:53,361 __main__:INFO:VN30-Ticks-Live,2021-03-01T10:40:00,1189.4,29800.0
2021-03-01 10:40:57,855 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 10:40:00'), 'Open': 1189.3, 'High': 1189.3, 'Low': 1189.3, 'Close': 1189.3, 'Volume': 296100}
2021-03-01 10:40:57,856 __main__:INFO:VN30-Ticks-Live,2021-03-01T10:40:00,1189.3,296100.0
2021-03-01 10:41:02,906 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 10:40:00'), 'Open': 1189.3, 'High': 1189.3, 'Low': 1189.3, 'Close': 1189.3, 'Volume': 128800}
2021-03-01 10:41:02,906 __main__:INFO:VN30-Ticks-Live,2021-03-01T10:40:00,1189.3,128800.0
2021-03-01 10:41:07,265 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 10:40:00'), 'Open': 1189.3, 'High': 1189.3, 'Low': 1189.3, 'Close': 1189.3, 'Volume': 19700}
2021-03-01 10:41:07,266 __main__:INFO:VN30-Ticks-Live,2021-03-01T10:40:00,1189.3,19700.0
2021-03-01 10:41:12,959 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 10:40:00'), 'Open': 1189.3, 'High': 1189.3, 'Low': 1189.3, 'Close': 1189.3, 'Volume': 100600}
2021-03-01 10:41:12,960 __main__:INFO:VN30-Ticks-Live,2021-03-01T10:40:00,1189.3,100600.0
2021-03-01 10:41:23,130 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 10:41:00'), 'Open': 1189.3, 'High': 1189.3, 'Low': 1189.3, 'Close': 1189.3, 'Volume': 6600}
2021-03-01 10:41:23,131 feeds.vndvn30data:INFO:WHY STOP HERE?

Resampledata: 1M

2021-03-01 11:07:12,064 __main__:INFO:2021-03-01 11:07:12.064878 VN30-Ticks-Live - DATA NOTIF: DELAYED
2021-03-01 11:07:12,065 stores.vndvn30store:INFO:CREATING NEW CONNECTION...
2021-03-01 11:07:13,025 stores.vndvn30store:INFO:New Session : 8901ab71-9961-4c79-8def-2c2ef8735984
2021-03-01 11:07:13,281 stores.vndvn30store:INFO:Login Session : 'ok'
2021-03-01 11:07:13,575 stores.vndvn30store:INFO:Confirm Session : /socket.io
2021-03-01 11:07:13,701 stores.vndvn30store:INFO:SAY HELLO AND SUBSCRIBE TOKEN VN30
2021-03-01 11:07:13,916 stores.vndvn30store:INFO:BEGIN
2021-03-01 11:07:18,212 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:07:00'), 'Open': 1187.5, 'High': 1187.5, 'Low': 1187.5, 'Close': 1187.5, 'Volume': 322500}
2021-03-01 11:07:18,213 feeds.vndvn30data:INFO:KEEP LIVE MESSAGE WAIT FOR BACKFILL RUNS FIRST {'datetime': Timestamp('2021-03-01 11:07:00'), 'Open': 1187.5, 'High': 1187.5, 'Low': 1187.5, 'Close': 1187.5, 'Volume': 322500}
2021-03-01 11:07:18,213 feeds.vndvn30data:INFO:BACKFILL RUNS
2021-03-01 11:07:18,213 stores.vndvn30store:INFO:LOAD HISTORY BACKFILL by FETCH ONLINE DATA 1614477600 - 1614571620 - 4 - 1
2021-03-01 11:07:23,788 feeds.vndvn30data:INFO:LOAD HISTORY BACK: {'datetime': Timestamp('2021-03-01 09:16:00'), 'Open': 1183.65, 'High': 1185.03, 'Low': 1183.65, 'Close': 1185.03, 'Volume': 1152700}
2021-03-01 11:07:23,789 __main__:INFO:VN30-Ticks-Live,2021-03-01T09:16:00,1185.03,1152700.0
...
2021-03-01 11:07:23,829 feeds.vndvn30data:INFO:LOAD HISTORY BACK: {'datetime': Timestamp('2021-03-01 11:07:00'), 'Open': 1187.54, 'High': 1187.54, 'Low': 1187.54, 'Close': 1187.54, 'Volume': 322500}
2021-03-01 11:07:23,829 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:07:00,1187.54,322500.0
2021-03-01 11:07:23,829 feeds.vndvn30data:INFO:LOAD HISTORY BACK: {}
2021-03-01 11:07:23,829 feeds.vndvn30data:INFO:BACK TO LIVE
2021-03-01 11:07:23,829 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:07:00'), 'Open': 1187.5, 'High': 1187.5, 'Low': 1187.5, 'Close': 1187.5, 'Volume': 322500}
2021-03-01 11:07:23,829 __main__:INFO:2021-03-01 11:07:23.829615 VN30-Ticks-Live - DATA NOTIF: LIVE
2021-03-01 11:07:23,829 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:07:00,1187.5,322500.0
2021-03-01 11:07:23,829 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:07:00'), 'Open': 1187.5, 'High': 1187.5, 'Low': 1187.5, 'Close': 1187.5, 'Volume': 10400}
2021-03-01 11:07:23,830 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:07:00,1187.5,10400.0
2021-03-01 11:07:28,647 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:07:00'), 'Open': 1187.3, 'High': 1187.3, 'Low': 1187.3, 'Close': 1187.3, 'Volume': 39800}
2021-03-01 11:07:28,648 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:07:00,1187.3,39800.0
2021-03-01 11:07:33,148 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:07:00'), 'Open': 1187.4, 'High': 1187.4, 'Low': 1187.4, 'Close': 1187.4, 'Volume': 182100}
2021-03-01 11:07:33,149 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:07:00,1187.4,182100.0
2021-03-01 11:07:38,024 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:07:00'), 'Open': 1187.4, 'High': 1187.4, 'Low': 1187.4, 'Close': 1187.4, 'Volume': 11000}
2021-03-01 11:07:38,024 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:07:00,1187.4,11000.0
2021-03-01 11:07:43,490 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:07:00'), 'Open': 1187.3, 'High': 1187.3, 'Low': 1187.3, 'Close': 1187.3, 'Volume': 218700}
2021-03-01 11:07:43,491 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:07:00,1187.3,218700.0
2021-03-01 11:07:48,414 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:07:00'), 'Open': 1187.3, 'High': 1187.3, 'Low': 1187.3, 'Close': 1187.3, 'Volume': 99500}
2021-03-01 11:07:48,415 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:07:00,1187.3,99500.0
2021-03-01 11:07:52,892 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:07:00'), 'Open': 1187.2, 'High': 1187.2, 'Low': 1187.2, 'Close': 1187.2, 'Volume': 213100}
2021-03-01 11:07:52,893 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:07:00,1187.2,213100.0
2021-03-01 11:07:58,474 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:07:00'), 'Open': 1187.4, 'High': 1187.4, 'Low': 1187.4, 'Close': 1187.4, 'Volume': 73600}
2021-03-01 11:07:58,474 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:07:00,1187.4,73600.0
2021-03-01 11:08:03,571 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:07:00'), 'Open': 1187.4, 'High': 1187.4, 'Low': 1187.4, 'Close': 1187.4, 'Volume': 316400}
2021-03-01 11:08:03,571 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:07:00,1187.4,316400.0
2021-03-01 11:08:09,151 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:07:00'), 'Open': 1187.5, 'High': 1187.5, 'Low': 1187.5, 'Close': 1187.5, 'Volume': 31600}
2021-03-01 11:08:09,152 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:07:00,1187.5,31600.0
2021-03-01 11:08:13,181 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:07:00'), 'Open': 1187.5, 'High': 1187.5, 'Low': 1187.5, 'Close': 1187.5, 'Volume': 163500}
2021-03-01 11:08:13,182 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:07:00,1187.5,163500.0
2021-03-01 11:08:18,241 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:08:00'), 'Open': 1187.2, 'High': 1187.2, 'Low': 1187.2, 'Close': 1187.2, 'Volume': 43800}
2021-03-01 11:08:18,241 feeds.vndvn30data:INFO:WHY STOP HERE?

Resampledata 5M

2021-03-01 11:10:05,522 __main__:INFO:2021-03-01 11:10:05.522312 VN30-Ticks-Live - DATA NOTIF: DELAYED
2021-03-01 11:10:05,522 stores.vndvn30store:INFO:CREATING NEW CONNECTION...
2021-03-01 11:10:05,889 stores.vndvn30store:INFO:New Session : 7f1396aa-c450-4b90-a9c8-92177a1c62c9
2021-03-01 11:10:06,200 stores.vndvn30store:INFO:Login Session : 'ok'
2021-03-01 11:10:06,504 stores.vndvn30store:INFO:Confirm Session : /socket.io
2021-03-01 11:10:06,662 stores.vndvn30store:INFO:SAY HELLO AND SUBSCRIBE TOKEN VN30
2021-03-01 11:10:06,849 stores.vndvn30store:INFO:BEGIN
2021-03-01 11:10:08,280 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:09:00'), 'Open': 1186.0, 'High': 1186.0, 'Low': 1186.0, 'Close': 1186.0, 'Volume': 1800}
2021-03-01 11:10:08,280 feeds.vndvn30data:INFO:KEEP LIVE MESSAGE WAIT FOR BACKFILL RUNS FIRST {'datetime': Timestamp('2021-03-01 11:09:00'), 'Open': 1186.0, 'High': 1186.0, 'Low': 1186.0, 'Close': 1186.0, 'Volume': 1800}
2021-03-01 11:10:08,280 feeds.vndvn30data:INFO:BACKFILL RUNS
2021-03-01 11:10:08,281 stores.vndvn30store:INFO:LOAD HISTORY BACKFILL by FETCH ONLINE DATA 1614477600 - 1614571740 - 4 - 5
2021-03-01 11:10:08,735 feeds.vndvn30data:INFO:LOAD HISTORY BACK: {'datetime': Timestamp('2021-03-01 09:16:00'), 'Open': 1183.65, 'High': 1186.34, 'Low': 1183.65, 'Close': 1186.34, 'Volume': 3140000}
2021-03-01 11:10:08,736 __main__:INFO:VN30-Ticks-Live,2021-03-01T09:16:00,1186.34,3140000.0
.....
2021-03-01 11:10:08,747 feeds.vndvn30data:INFO:LOAD HISTORY BACK: {'datetime': Timestamp('2021-03-01 11:05:00'), 'Open': 1187.88, 'High': 1188.43, 'Low': 1185.87, 'Close': 1185.98, 'Volume': 5198000}
2021-03-01 11:10:08,747 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:05:00,1185.98,5198000.0
2021-03-01 11:10:08,747 feeds.vndvn30data:INFO:LOAD HISTORY BACK: {}
2021-03-01 11:10:08,747 feeds.vndvn30data:INFO:BACK TO LIVE
2021-03-01 11:10:08,747 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:09:00'), 'Open': 1186.0, 'High': 1186.0, 'Low': 1186.0, 'Close': 1186.0, 'Volume': 1800}
2021-03-01 11:10:08,748 __main__:INFO:2021-03-01 11:10:08.748057 VN30-Ticks-Live - DATA NOTIF: LIVE
2021-03-01 11:10:08,748 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:09:00,1186.0,1800.0
2021-03-01 11:10:13,630 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:09:00'), 'Open': 1186.2, 'High': 1186.2, 'Low': 1186.2, 'Close': 1186.2, 'Volume': 420000}
2021-03-01 11:10:13,630 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:09:00,1186.2,420000.0
2021-03-01 11:10:18,450 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:10:00'), 'Open': 1186.3, 'High': 1186.3, 'Low': 1186.3, 'Close': 1186.3, 'Volume': 62200}
2021-03-01 11:10:18,451 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:10:00,1186.3,62200.0
2021-03-01 11:10:23,179 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:10:00'), 'Open': 1186.2, 'High': 1186.2, 'Low': 1186.2, 'Close': 1186.2, 'Volume': 72900}
2021-03-01 11:10:23,180 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:10:00,1186.2,72900.0
2021-03-01 11:10:28,473 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:10:00'), 'Open': 1186.1, 'High': 1186.1, 'Low': 1186.1, 'Close': 1186.1, 'Volume': 22800}
2021-03-01 11:10:28,474 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:10:00,1186.1,22800.0
2021-03-01 11:10:33,108 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:10:00'), 'Open': 1186.1, 'High': 1186.1, 'Low': 1186.1, 'Close': 1186.1, 'Volume': 167000}
2021-03-01 11:10:33,109 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:10:00,1186.1,167000.0
2021-03-01 11:10:38,187 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:10:00'), 'Open': 1186.2, 'High': 1186.2, 'Low': 1186.2, 'Close': 1186.2, 'Volume': 160500}
2021-03-01 11:10:38,188 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:10:00,1186.2,160500.0
2021-03-01 11:10:43,454 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:10:00'), 'Open': 1186.2, 'High': 1186.2, 'Low': 1186.2, 'Close': 1186.2, 'Volume': 57900}
2021-03-01 11:10:43,455 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:10:00,1186.2,57900.0
2021-03-01 11:10:48,586 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:10:00'), 'Open': 1186.3, 'High': 1186.3, 'Low': 1186.3, 'Close': 1186.3, 'Volume': 79300}
2021-03-01 11:10:48,587 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:10:00,1186.3,79300.0
2021-03-01 11:10:52,981 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:10:00'), 'Open': 1186.3, 'High': 1186.3, 'Low': 1186.3, 'Close': 1186.3, 'Volume': 19400}
2021-03-01 11:10:52,982 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:10:00,1186.3,19400.0
2021-03-01 11:10:58,027 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:10:00'), 'Open': 1186.3, 'High': 1186.3, 'Low': 1186.3, 'Close': 1186.3, 'Volume': 127600}
2021-03-01 11:10:58,028 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:10:00,1186.3,127600.0
2021-03-01 11:11:03,644 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:10:00'), 'Open': 1185.9, 'High': 1185.9, 'Low': 1185.9, 'Close': 1185.9, 'Volume': 204600}
2021-03-01 11:11:03,645 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:10:00,1185.9,204600.0
2021-03-01 11:11:08,606 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:10:00'), 'Open': 1185.8, 'High': 1185.8, 'Low': 1185.8, 'Close': 1185.8, 'Volume': 60300}
2021-03-01 11:11:08,607 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:10:00,1185.8,60300.0
2021-03-01 11:11:13,259 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:10:00'), 'Open': 1185.7, 'High': 1185.7, 'Low': 1185.7, 'Close': 1185.7, 'Volume': 90700}
2021-03-01 11:11:13,260 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:10:00,1185.7,90700.0
2021-03-01 11:11:18,508 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:11:00'), 'Open': 1186.0, 'High': 1186.0, 'Low': 1186.0, 'Close': 1186.0, 'Volume': 26100}
2021-03-01 11:11:18,509 feeds.vndvn30data:INFO:WHY STOP HERE?

Live tick without backfill

2021-03-01 11:12:28,512 stores.vndvn30store:INFO:CREATING NEW CONNECTION...
2021-03-01 11:12:28,846 stores.vndvn30store:INFO:New Session : eed58ce9-e5c4-4ae6-b068-96b05b5fdb8c
2021-03-01 11:12:29,359 stores.vndvn30store:INFO:Login Session : 'ok'
2021-03-01 11:12:29,705 stores.vndvn30store:INFO:Confirm Session : /socket.io
2021-03-01 11:12:29,886 stores.vndvn30store:INFO:SAY HELLO AND SUBSCRIBE TOKEN VN30
2021-03-01 11:12:30,087 stores.vndvn30store:INFO:BEGIN
2021-03-01 11:12:33,184 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:12:00'), 'Open': 1184.9, 'High': 1184.9, 'Low': 1184.9, 'Close': 1184.9, 'Volume': 52300}
2021-03-01 11:12:33,184 __main__:INFO:2021-03-01 11:12:33.184817 VN30-Ticks-Live - DATA NOTIF: LIVE
2021-03-01 11:12:33,185 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:12:00,1184.9,52300.0
2021-03-01 11:12:38,681 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:12:00'), 'Open': 1184.8, 'High': 1184.8, 'Low': 1184.8, 'Close': 1184.8, 'Volume': 85200}
2021-03-01 11:12:38,682 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:12:00,1184.8,85200.0
2021-03-01 11:12:43,138 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:12:00'), 'Open': 1184.4, 'High': 1184.4, 'Low': 1184.4, 'Close': 1184.4, 'Volume': 117000}
2021-03-01 11:12:43,139 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:12:00,1184.4,117000.0
2021-03-01 11:12:48,299 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:12:00'), 'Open': 1184.8, 'High': 1184.8, 'Low': 1184.8, 'Close': 1184.8, 'Volume': 65400}
2021-03-01 11:12:48,300 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:12:00,1184.8,65400.0
2021-03-01 11:12:53,306 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:12:00'), 'Open': 1185.0, 'High': 1185.0, 'Low': 1185.0, 'Close': 1185.0, 'Volume': 124300}
2021-03-01 11:12:53,307 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:12:00,1185.0,124300.0
2021-03-01 11:12:58,609 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:12:00'), 'Open': 1185.1, 'High': 1185.1, 'Low': 1185.1, 'Close': 1185.1, 'Volume': 5600}
2021-03-01 11:12:58,611 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:12:00,1185.1,5600.0
2021-03-01 11:13:03,081 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:12:00'), 'Open': 1185.1, 'High': 1185.1, 'Low': 1185.1, 'Close': 1185.1, 'Volume': 35800}
2021-03-01 11:13:03,082 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:12:00,1185.1,35800.0
2021-03-01 11:13:08,517 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:12:00'), 'Open': 1185.2, 'High': 1185.2, 'Low': 1185.2, 'Close': 1185.2, 'Volume': 45700}
2021-03-01 11:13:08,517 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:12:00,1185.2,45700.0
2021-03-01 11:13:15,354 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:12:00'), 'Open': 1185.2, 'High': 1185.2, 'Low': 1185.2, 'Close': 1185.2, 'Volume': 121900}
2021-03-01 11:13:15,354 __main__:INFO:VN30-Ticks-Live,2021-03-01T11:12:00,1185.2,121900.0
2021-03-01 11:13:19,225 feeds.vndvn30data:INFO:_load BEGIN: {'datetime': Timestamp('2021-03-01 11:13:00'), 'Open': 1185.2, 'High': 1185.2, 'Low': 1185.2, 'Close': 1185.2, 'Volume': 12800}
2021-03-01 11:13:19,226 feeds.vndvn30data:INFO:WHY STOP HERE?
huuquynh commented 3 years ago

BTW, I do not implement Broker class. Just only Data and Store.

And in Store class I removed BrokerCls, removed @classmethod def getbroker(cls, *args, **kwargs):, class variable self.broker, and any code snippet about self.broker.

Is this the main reason? I will try with it on tomorrow.

happydasch commented 3 years ago

I am not really sure how to help you with that. Can you provide some code which shows the issue? You can add zip files here.

huuquynh commented 3 years ago

Please make a try from 9:15-11:30 & 13:00-14:45 (GMT+7) on weekdays!

Thank you very much!

huuquynh commented 3 years ago

So strange man!

If change from Data Feed to Data Store's getdata(), it runs normally. Do you have any idea about this issue?

Thank you in advanced!