Back to Community
Global Equity - NoDataForSid: No minute data for sid

Trying to run an Algorithm using HK-listed stock (sid: 1184398205540173) but shows error: "No minute data for sid 1184398205540173"

My strategy does not require minute-by-minute trading but only rebalancing daily (on open or close). The strategy may not make sense but I just want to test whether I can backtest with Global Equity. Could this error be resolved?

Thank you.

Code below:



"""
This is a template algorithm on Quantopian for you to adapt and fill in.  
"""
import quantopian.algorithm as algo  
from quantopian.pipeline import Pipeline  
#from quantopian.pipeline.data.builtin import USEquityPricing  
#from quantopian.pipeline.filters import QTradableStocksUS  
from quantopian.pipeline.data import EquityPricing  
from quantopian.pipeline.domain import HK_EQUITIES



def initialize(context):  
    """  
    Called once at the start of the algorithm.  
    """  
    context.asset = sid(1184398205540173) #2800.HK  
    context.pred_market = 'bull'  
    context.counter = 0  
    context.last_value = 0  
    # Rebalance every day, 1 hour after market open.  
    algo.schedule_function(  
        rebalance,  
        algo.date_rules.every_day(),  
        algo.time_rules.market_open(),  
    )

    # Record tracking variables at the end of each day.  
    algo.schedule_function(  
        record_vars,  
        algo.date_rules.every_day(),  
        algo.time_rules.market_close(),  
    )

    # Create our dynamic stock selector.  
    algo.attach_pipeline(make_pipeline(), 'pipeline')  

def make_pipeline():  
    """  
    A function to create our dynamic stock selector (pipeline). Documentation  
    on pipeline can be found here:  
    https://www.quantopian.com/help#pipeline-title  
    """

    # Base universe set to the QTradableStocksUS  
    #base_universe = QTradableStocksUS()  
    last_px = EquityPricing.close.latest

    pipe = Pipeline(  
        columns={  
            'px': last_px  
        },  
        screen=EquityPricing.close.latest.notnull()  
    )  
    return pipe


def before_trading_start(context, data):  
    """  
    Called every day before market open.  
    """  
    context.output = algo.pipeline_output('pipeline')

    #print(context.last_value)  
    #print(context.counter)

def rebalance(context, data):  
    """  
    Execute orders according to our schedule_function() timing.  
    """  
    if context.pred_market == 'bull':  
        context.pred_market = 'bear'


    if context.pred_market == 'bull':  
        order_target_percent(context.asset, 1)  
    else:  
        order_target_percent(context.asset, 0)  

def record_vars(context, data):  
    """  
    Plot variables at the end of each day.  
    """  
    longs = 0  
    for position in context.portfolio.positions.values():  
        if position.amount > 0:  
            longs += 1

    # Record our variables.  
    record(leverage=context.account.leverage, long_count=longs)

Clone Algorithm
0
Loading...
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
"""
This is a template algorithm on Quantopian for you to adapt and fill in.
"""
import quantopian.algorithm as algo
from quantopian.pipeline import Pipeline
#from quantopian.pipeline.data.builtin import USEquityPricing
#from quantopian.pipeline.filters import QTradableStocksUS
from quantopian.pipeline.data import EquityPricing  
from quantopian.pipeline.domain import HK_EQUITIES



def initialize(context):
    """
    Called once at the start of the algorithm.
    """
    
    context.asset = sid(1184398205540173) #2800.HK
    context.pred_market = 'bull'
    context.counter = 0
    context.last_value = 0
    
    # Rebalance every day, 1 hour after market open.
    algo.schedule_function(
        rebalance,
        algo.date_rules.every_day(),
        algo.time_rules.market_open(),
    )

    # Record tracking variables at the end of each day.
    algo.schedule_function(
        record_vars,
        algo.date_rules.every_day(),
        algo.time_rules.market_close(),
    )

    # Create our dynamic stock selector.
    algo.attach_pipeline(make_pipeline(), 'pipeline')
    
  
def make_pipeline():
    """
    A function to create our dynamic stock selector (pipeline). Documentation
    on pipeline can be found here:
    https://www.quantopian.com/help#pipeline-title
    """

    # Base universe set to the QTradableStocksUS
    #base_universe = QTradableStocksUS()
    
    last_px = EquityPricing.close.latest

    pipe = Pipeline(
        columns={
            'px': last_px
        },
        screen=EquityPricing.close.latest.notnull()
    )
    return pipe


def before_trading_start(context, data):
    """
    Called every day before market open.
    """
    context.output = algo.pipeline_output('pipeline')

    
    #print(context.last_value)
    #print(context.counter)

def rebalance(context, data):
    """
    Execute orders according to our schedule_function() timing.
    """
    if context.pred_market == 'bull':
        context.pred_market = 'bear'


    if context.pred_market == 'bull':
        order_target_percent(context.asset, 1)
    else:
        order_target_percent(context.asset, 0)
    
    
    
def record_vars(context, data):
    """
    Plot variables at the end of each day.
    """
    longs = 0
    for position in context.portfolio.positions.values():
        if position.amount > 0:
            longs += 1

    # Record our variables.
    record(leverage=context.account.leverage, long_count=longs)
There was a runtime error.