0

my question is so similar to this one with a different specs. Actually I wanna mimic what TradingView Ghost Feed does, but I didn't know how to do this. this is an answer from that link for that particular requirement that was defined:

def genMockDataFrame(days,startPrice,colName,startDate,seed=None): 
   
    periods = days*24
    np.random.seed(seed)
    steps = np.random.normal(loc=0, scale=0.0018, size=periods)
    steps[0]=0
    P = startPrice+np.cumsum(steps)
    P = [round(i,4) for i in P]

    fxDF = pd.DataFrame({ 
        'ticker':np.repeat( [colName], periods ),
        'date':np.tile( pd.date_range(startDate, periods=periods, freq='H'), 1 ),
        'price':(P)})
    fxDF.index = pd.to_datetime(fxDF.date)
    fxDF = fxDF.price.resample('D').ohlc()
    return fxDF

df = genMockDataFrame(100,1.1904,'eurusd','19/3/2020',seed=1)

So is it possible to have a control over the endPrice too? or where should be changed so the variance could be added to the soup? Many thanks

0 Answers0