def init():
    # init db and indexes
    # trades
    config.mongo_db.trades.ensure_index(
        [("base_asset", pymongo.ASCENDING),
         ("quote_asset", pymongo.ASCENDING),
         ("block_time", pymongo.DESCENDING)
         ])
    config.mongo_db.trades.ensure_index(  # tasks.py and elsewhere (for singlular block_index index access)
        [("block_index", pymongo.ASCENDING),
         ("base_asset", pymongo.ASCENDING),
         ("quote_asset", pymongo.ASCENDING)
         ])
    # asset_market_info
    config.mongo_db.asset_market_info.ensure_index('asset', unique=True)
    # asset_marketcap_history
    config.mongo_db.asset_marketcap_history.ensure_index('block_index')
    config.mongo_db.asset_marketcap_history.ensure_index(  # tasks.py
        [
            ("market_cap_as", pymongo.ASCENDING),
            ("asset", pymongo.ASCENDING),
            ("block_index", pymongo.DESCENDING)
        ])
    config.mongo_db.asset_marketcap_history.ensure_index(  # api.py
        [
            ("market_cap_as", pymongo.ASCENDING),
            ("block_time", pymongo.DESCENDING)
        ])
    # asset_pair_market_info
    config.mongo_db.asset_pair_market_info.ensure_index(  # event.py, api.py
        [("base_asset", pymongo.ASCENDING),
         ("quote_asset", pymongo.ASCENDING)
         ], unique=True)
    config.mongo_db.asset_pair_market_info.ensure_index('last_updated')