|
@@ -197,7 +197,7 @@ def calculate_sigma_squared(prices, timestamps):
|
|
|
return 0.0
|
|
return 0.0
|
|
|
|
|
|
|
|
time_diff = int(int((timestamps[-1] - timestamps[0]).total_seconds() * 1000) / 100)
|
|
time_diff = int(int((timestamps[-1] - timestamps[0]).total_seconds() * 1000) / 100)
|
|
|
- price_diff_squared = [(prices[i] - prices[i - 1]) ** 2 for i in range(1, n)]
|
|
|
|
|
|
|
+ price_diff_squared = [(1 - prices[i] / prices[i - 1]) ** 2 for i in range(1, n)]
|
|
|
sigma_squared = np.sum(price_diff_squared) / time_diff
|
|
sigma_squared = np.sum(price_diff_squared) / time_diff
|
|
|
|
|
|
|
|
return sigma_squared
|
|
return sigma_squared
|
|
@@ -258,7 +258,7 @@ def process_depth_data():
|
|
|
sigma_squared = calculate_sigma_squared(S_values, order_book_timestamps)
|
|
sigma_squared = calculate_sigma_squared(S_values, order_book_timestamps)
|
|
|
|
|
|
|
|
# ========================== 计算 δ^a + δ^b ==========================
|
|
# ========================== 计算 δ^a + δ^b ==========================
|
|
|
- gamma = 0.5
|
|
|
|
|
|
|
+ gamma = 1
|
|
|
T_minus_t = 1.0
|
|
T_minus_t = 1.0
|
|
|
delta_sum = calculate_delta_sum(gamma, sigma_squared, T_minus_t, k_initial)
|
|
delta_sum = calculate_delta_sum(gamma, sigma_squared, T_minus_t, k_initial)
|
|
|
logger.info(f"δ^a + δ^b: {delta_sum}")
|
|
logger.info(f"δ^a + δ^b: {delta_sum}")
|