Hi All,
I am new here and I am also new in coding, please if you answer try to make it simple. :)
I have a code that needs to check what happened at last 25 days closing prices for a certain set of stocks;
Now I see this is almost impossible to achieve in IDE, at least until last time this question was asked in the forum.
Here are my 2 questions:
is it possible to put in a list the stocks I am selecting with the lines below and build a data frame?
something like: stocks = data.history(ticker,"close",25,"1d")
where ticker is the list of stocks with below selection:
base_universe = Q1500US()
dollar_volume = AverageDollarVolume(window_length =30)
high_dollar_volume = dollar_volume.percentile_between(95,100)
top_five_base_energy = base_universe & high_dollar_volume
so ticker will come from
top_five_base_energy
or
SMA = SimpleMovingAverage(inputs=[USEquityPricing.close], window_length = 20, mask=top_five_base_energy)
In case it is not possible:
question Number 2:
If I make the following calls:
SMA_1 = SimpleMovingAverage(inputs=[USEquityPricing.close], window_length = 1, mask=top_five_base_energy)
SMA_2 = SimpleMovingAverage(inputs=[USEquityPricing.close], window_length = 2, mask=top_five_base_energy)
would it be possible to put the results in a concatenated data frame?
clearly SMA_2*2 - SMA_1 = price (t-2) and so on
I would use this as a workaround, I just need the last 25 days' prices.
Also 3rd and last question:
if try to use the following:
for m in range(1,3,1):
"SMA_{}".format(m) = SimpleMovingAverage(inputs=[USEquityPricing.close], window_length = m, mask=top_five_base_energy)
I get an error: SyntaxError: can't assign to function call
why ?
Thanks for any help
Rhino