def diverter(data, choice, filereports): q1 = data if (choice == "all"): aan.analyse(data, filereports) exit() else: an.analyse(data, choice, filereports) exit()
def diverter(data, choice): q1 = data if (choice == "all"): aan.analyse(data) else: an.analyse(data, choice) print(" Analyser ki vachindi")
y_profit = 1 n_ticks = i - list(self.data.index).index(open_date) thresh_profit = y_profit * self.period * price_in / (480 * 252) * n_ticks + price_in + price_in * 0.01 thresh_loss = -y_profit * self.period * price_in / (480 * 252) * n_ticks + price_in - price_in * 0.01 if self.data.iloc[i, 0] < thresh_loss or diff.iloc[-2] < 0 < diff.iloc[-1] or self.data.iloc[i, 0] > thresh_profit: self.sell() # Cover as soon as we achieve a sufficient year-based profit or after three days if we lose too much if type(self.position) is tuple and self.position[0] == -1: open_date = self.position[1] price_in = self.data.loc[open_date, 'close'] y_profit = 1 n_ticks = i - list(self.data.index).index(open_date) thresh_profit = -y_profit * self.period * price_in / (480 * 252) * n_ticks + price_in - price_in * 0.01 thresh_loss = y_profit * self.period * price_in / (480 * 252) * n_ticks + price_in + price_in * 0.01 if self.data.iloc[i, 0] > thresh_loss or diff.iloc[-2] > 0 > diff.iloc[-1] or self.data.iloc[i, 0] < thresh_profit: self.cover() return self.calls if __name__ == '__main__': ticker = 'IQ' data = pickle.load(open('Data/{}_5.pickle'.format(ticker), 'rb')) strat = Strat(data, 5) calls = strat.run() Analyser.analyse(ticker, 5, calls)