def createFlippedUpattern(vec, length, repeatitionAmount=1): up1 = np.linspace(0, 10, length/4).tolist() up2 = np.linspace(10, 40, length/4).tolist() down1 = np.linspace(40, 10, length/4).tolist() down2 = np.linspace(10, 0, length/4).tolist() pattern = up1 + up2 + down1 + down2 smoothedPattern = ma.movingAverage(pattern, length/5, 1.3) pattern = smoothedPattern pattern = [x-np.mean(pattern) for x in pattern] fac = np.sqrt(np.var(vec)/np.var(pattern)) m1 = np.mean(vec) pattern = [x*fac + m1 for x in pattern] #retVal = list(itertools.repeat(pattern, repeatitionAmount)) retVal = pattern*repeatitionAmount return retVal
def main(): arguments = parse_arguments() if arguments.test: Testing.Testing().run_tests() else: # process input file and store the events read events = utility.process_input_data(arguments.input_file) # create moving average class with event and window size moving_average = MovingAverage.MovingAverage(events, arguments.window) # perform moving average time calculation average_times = moving_average.moving_average() # for output in average_times: utility.log_average_time(arguments.input_file, arguments.print, average_times, arguments.output_file)
#opl.SellLimit(110.500, 109.000, 1) #opl.SellStop(101.000, 100.000, 1) """ timeGetPrice, ask, bid = opl.GetPrices() print(ask) print(bid) dataMng.setMarketPrice(ask, bid) """ #opl.SetStopLoss(213, 100.000) #opl.SetStopLoss(211, 100.000) #headers = {"Authorization" : "Bearer " + } ''' req=accounts.AccountSummary(accountID=account_id) res = api.request(req) print(json.dumps(res, indent=2)) marginAvailable = float(res["account"]["marginAvailable"]) marginUsed = float(res["account"]["marginUsed"]) print(marginAvailable) print(marginUsed) print(50 * marginUsed / marginAvailable) ''' #print(opl.GetMarginLevel()) print(np.mean(ma.getData(5), axis=0, keepdims=True)) #---End---#
def __init__(self, filesystem): threading.Thread.__init__(self) self.daemon = True self.filesystem = filesystem self.size_ma = MovingAverage.moving_average([5, 15, 30])