update market data as first action.
This commit is contained in:
parent
beb0991af2
commit
1e6caf51e0
|
|
@ -166,7 +166,6 @@ class HugeVolumeMain:
|
||||||
for symbol in self.market_data_main.symbols:
|
for symbol in self.market_data_main.symbols:
|
||||||
for bar in self.market_data_main.bars:
|
for bar in self.market_data_main.bars:
|
||||||
try:
|
try:
|
||||||
self.market_data_main.update_data(symbol, bar)
|
|
||||||
self.update_volume_spike(symbol, bar, window_size)
|
self.update_volume_spike(symbol, bar, window_size)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(
|
logger.error(
|
||||||
|
|
@ -666,6 +665,15 @@ def batch_update_volume_spike(threshold: float = 2.0, is_us_stock: bool = False)
|
||||||
):
|
):
|
||||||
window_sizes = [50, 80, 100, 120]
|
window_sizes = [50, 80, 100, 120]
|
||||||
huge_volume_main = HugeVolumeMain(threshold, is_us_stock, is_binance=False)
|
huge_volume_main = HugeVolumeMain(threshold, is_us_stock, is_binance=False)
|
||||||
|
|
||||||
|
for symbol in huge_volume_main.market_data_main.symbols:
|
||||||
|
for bar in huge_volume_main.market_data_main.bars:
|
||||||
|
try:
|
||||||
|
huge_volume_main.market_data_main.update_data(symbol, bar)
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning(
|
||||||
|
f"更新交易数据失败: {symbol} {bar}: {e}"
|
||||||
|
)
|
||||||
for window_size in window_sizes:
|
for window_size in window_sizes:
|
||||||
huge_volume_main.batch_update_volume_spike(window_size=window_size)
|
huge_volume_main.batch_update_volume_spike(window_size=window_size)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -117,8 +117,8 @@ class MarketDataMain:
|
||||||
if bar == "1m":
|
if bar == "1m":
|
||||||
if isinstance(start, str):
|
if isinstance(start, str):
|
||||||
start_time_ts = transform_date_time_to_timestamp(start)
|
start_time_ts = transform_date_time_to_timestamp(start)
|
||||||
# start为end_time_ts的前十五天
|
|
||||||
if end_time_ts - start_time_ts > 86400000 * 15:
|
if end_time_ts - start_time_ts > 86400000 * 15:
|
||||||
|
# start为end_time_ts的前十五天
|
||||||
start_time_ts = end_time_ts - 86400000 * 15
|
start_time_ts = end_time_ts - 86400000 * 15
|
||||||
start = timestamp_to_datetime(start_time_ts)
|
start = timestamp_to_datetime(start_time_ts)
|
||||||
elif isinstance(start, int):
|
elif isinstance(start, int):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue