Dear Python Users,
I have the code below. The problem is that two functions are interdependent and should be run simultaneously (line - 8 and 11). How can I run the re-construct the code? The Final output is the value of "call" the gives the minimum value of "diff"
I have the code below. The problem is that two functions are interdependent and should be run simultaneously (line - 8 and 11). How can I run the re-construct the code? The Final output is the value of "call" the gives the minimum value of "diff"
warrant_price = [] diff = [] def results(S0, K, T, r, sigma, k, N, M, Iteration): for i in range(1, Iteration): dilution = N/(N +k*M) Value_2 = 10000 Value_1= 10000 warrant = dilution*bsm_call_value(Value_2/N,100,1,0.1,0.2) warrant_price.append(warrant) Value_2 = Value_1 + warrant*M diff1 = Value_1 - Value_2 diff.append(diff1) print(results(100,100,1,0.1,0.2,1,100,10, 10)) call_df = pd.DataFrame({'warrant_price': warrant_price}) diff_df = pd.DataFrame({'diff': diff}) merged_df = call_df.join(diff_df) merged_df.loc[merged_df['diff'].idxmin()]