def test_getall_type(self):
        ASSET_STOCK = "stock"
        ASSET_INDEX = "index"
        ASSET_SPOT = "spot"
        ASSET_DELIVERY = "delivery"
        ASSET_PERPETUAL = "perpetual"
        ASSET_OPTION = "option"
        ASSET_ETF = "etf"

        timeframes = {
            '1m': '1m',
            '5m': '5m',
            '30m': '30m',
            '1h': '1h',
            '4h': '4h',
            '1d': '1d',
            '1w': '1w',
            '1M': '1M',
        }

        assets = [ASSET_STOCK, ASSET_INDEX, ASSET_SPOT, ASSET_DELIVERY, ASSET_PERPETUAL, ASSET_OPTION, ASSET_ETF]
        timeframes = timeframes.keys()
        numbers = []
        for a in assets:
            for t in timeframes:
                pair = "{}_{}".format(a, t)
                code = "BTC/USDT"
                exchange = "okex"
                ret = mh.bar(code, exchange=exchange, asset=a, freq=t)
                print(ret)
                numbers.append(pair)
        print(numbers)
        print("len pair: {}".format(len(numbers)))
 def test_get_spot(self):
     a = "spot"
     code = "ETH/USDT"
     exchange = "binance"  # sz
     t = "1d"
     ret = mh.bar(code, exchange=exchange, asset=a, freq=t, limit=500)
     print(ret)
 def test_get_c_bar(self):
     print("message hub test")
     code = "BTC"
     exchange = "okex"
     asset = "spot"
     ret = mh.bar(code, exchange=exchange, asset=asset)
     print("============")
     print(ret)
 def test_get_f_bar(self):
     print("message hub test")
     code = "btcusdt"
     exchange = "binance"
     asset = "perpetual"
     freq = "5m"
     ma = [7, 25, 99]
     ret = mh.bar(code, exchange=exchange, freq=freq, asset=asset, ma=ma)
     print("============")
     if ret is not None:
         print(ret.head(5))
         df = ret.head(5)
         df.to_csv('btcusdt.csv', index=None)
 def test_get_f_bar_ts(self):
     print("message hub test")
     code = "btcusdt"
     exchange = "binance"
     asset = "perpetual"
     freq = "1d"
     ma = [7, 25, 99]
     start = '20200201'
     end = '20200802'
     ret = mh.bar(code, exchange=exchange, freq=freq, asset=asset, ma=ma, start_date=start, end_date=end)
     print("============")
     print(ret.head(5))
     # df = ret.head(5)
     ret.to_csv('btcusdt_start_end.csv', index=None)
 def test_get_bar(self):
     print("message hub test")
     code = "600123"
     ret = mh.bar(code)
     print("============")
     print(ret)