擅长:python、mysql、java
<pre><code>result = [590.0, 600.0, 590.0, 580.0, 570.0, 560.0, 570.0]
avrg = [580.0, 590.0, 593.33, 590.0, 580.0, 570.0, 566.67]
signal = []
for i in range(len(result)):
if (result[i] > avrg[i]):
signal.append('BUY')
else:
signal.append('SELL')
</code></pre>
<p>给予</p>
<pre><code>>>> signal
['BUY', 'BUY', 'SELL', 'SELL', 'SELL', 'SELL', 'BUY']
</code></pre>