Add news data support
- Refactor everything in the process, oops Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
use crate::database;
|
||||
use clickhouse::Client;
|
||||
use tokio::join;
|
||||
|
||||
pub async fn cleanup(clickhouse_client: &Client) {
|
||||
let assets = database::assets::select(clickhouse_client).await;
|
||||
let symbols = assets
|
||||
.iter()
|
||||
.map(|asset| asset.symbol.clone())
|
||||
.collect::<Vec<_>>();
|
||||
let bars_future = database::bars::cleanup(clickhouse_client);
|
||||
let news_future = database::news::cleanup(clickhouse_client);
|
||||
let backfills_future = database::backfills::cleanup(clickhouse_client);
|
||||
|
||||
database::bars::delete_where_not_symbols(clickhouse_client, &symbols).await;
|
||||
database::backfills::delete_where_not_symbols(clickhouse_client, &symbols).await;
|
||||
join!(bars_future, news_future, backfills_future);
|
||||
}
|
||||
|
Reference in New Issue
Block a user