Minseok Choi

Question about market data

Programming


Hello, I am now studying to be aware of Algogene's backtesting engine. 
I run this code and the result shows this result.
<CODE>
class AlgoEvent:
    def __init__(self):
        self.timer = datetime(1970, 1, 1)
        self.rsi_period = 14
        self.instrument = ""
        
    def start(self, mEvt):
        self.instrument = mEvt["subscribeList"][0]
        
        self.evt = AlgoAPI_Backtest.AlgoEvtHandler(self, mEvt)
        self.evt.start()
        
    def on_bulkdatafeed(self, isSync, bd, ab):
        pass

    def on_marketdatafeed(self, md, ab):
        if md.timestamp >= self.timer + timedelta(hours=24):
            #Update timeer
            self.timer = md.timestamp
            
            #get last 14 closing price
            res = self.evt.getHistoricalBar({"instrument":self.instrument}, self.rsi_period+1, "D")
            self.evt.consoleLog("historical bar = ", res)

<RESULT>
One of the results is:
('2019-01-01 00:00:00', {'t': '2019-01-01 00:00:00', 'o': 3591.4, 'h': 3960.6, 'l': 3576.0, 'c': 3835.4, 'b': 3810.4, 'a': 3860.4, 'm': 3835.4, 'v': 8452.0, 'instrument': 'BTCUSD', 'expiry': '', 'right': '', 'strike': 0, 'symbol': 'BTCUSD', 'bb': [], 'ab': []})])

So, it shows that the open price of BTCUSD was 3591.4 on 2019-01-01. However, I think the actual data is not equal to the result. In this engine, isn't it based on actual data? Or if there are errors in my code, please let me know.
Thank you in advance for your help and good luck with the competition!
 
William Cheung
Do you mean you think the open price on 2019-01-01 is not 3591.4? Can you provide more info the data source you are referencing? 

As crypto is a decentralized market, the market price can be different between different exchanges. 
I checked the result for Coinbase which is more or less the same. 

I guess algogene team is taking average from multiple exchanges. 
Good luck with the competition! 


img1