Exemplo n.º 1
0
def get_historicals(ticker, intervalArg, spanArg, boundsArg):
    history = r.get_stock_historicals(ticker,interval=intervalArg,span=spanArg,bounds=boundsArg)

    #If it's not a stock ticker, try it as a crypto ticker
    if(history is None or None in history):
        history = r.get_crypto_historicals(ticker,interval=intervalArg,span=spanArg,bounds=boundsArg)

    return history
Exemplo n.º 2
0
 def test_crypto_historicals(self):
     crypto = r.get_crypto_historicals(self.bitcoin,
                                       'day',
                                       'week',
                                       '24_7',
                                       info=None)
     assert (len(crypto) == 7)
     first_point = crypto[0]
     # check keys
     assert ('begins_at' in first_point)
     assert ('open_price' in first_point)
     assert ('close_price' in first_point)
     assert ('high_price' in first_point)
     assert ('low_price' in first_point)
     assert ('volume' in first_point)
     assert ('session' in first_point)
     assert ('interpolated' in first_point)
     #
     crypto = r.get_crypto_historicals(self.bitcoin,
                                       'hour',
                                       'day',
                                       'regular',
                                       info=None)
     assert (len(crypto) <= 6)  # 6 regular hours in a day
     crypto = r.get_crypto_historicals(self.bitcoin,
                                       'hour',
                                       'day',
                                       'trading',
                                       info=None)
     assert (len(crypto) <= 9)  # 9 trading hours in a day
     crypto = r.get_crypto_historicals(self.bitcoin,
                                       'hour',
                                       'day',
                                       'extended',
                                       info=None)
     assert (len(crypto) <= 16)  # 16 extended hours in a day
     crypto = r.get_crypto_historicals(self.bitcoin,
                                       'hour',
                                       'day',
                                       '24_7',
                                       info=None)
     assert (len(crypto) <= 24)  # 24 24_7 hours in a day
Exemplo n.º 3
0
def getCryptoHistorical(ticker, interval, length):
    return r.get_crypto_historicals(symbol=ticker,
                                    interval=interval,
                                    span=length,
                                    bounds="24_7")