Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(3)  |  Call(2)  |  Derive(0)  |  Import(1)
price must be a list 
FIXME we use list just in beginning, if the speed is OK

        def AverageFC(price,length):
    """price must be a list 
       FIXME we use list just in beginning, if the speed is OK
    """
    s = 0     
    ll = []
    
    if len(price)>length:

        s = sum(price[:length-1])
        n = 0
        for i in price[length-1:]:
            s = s+i
            ll.append(s/length)
            s = s-price[n]
            n = n+1
    else:
        ll.append(sum(price)/len(price))

    num = len(ll)
    if num < length:
            ll += [0]*(length-num)
    return ll
        


src/a/u/autotrader-HEAD/function/General.py   autotrader(Download)
import datetime
from math import sqrt
from AverageFC import Average
 
def General(dataset,length=300):
    if price and len(price) >= length and length>0:
        # Average return a list, just take first one
        av = Average(price,length)[0]
 
        for i in range(length):
    if price and len(price) >= length and length>0:
        # Average return a list, just take first one
        av = Average(price,length)[0]
        return av + stddev*StdDev(price,length)
    else: