diff --git a/src/load_exchange_orders.rs b/src/load_exchange_orders.rs index 2292b50..963a4c4 100644 --- a/src/load_exchange_orders.rs +++ b/src/load_exchange_orders.rs @@ -86,11 +86,16 @@ pub async fn impl_batch_tx_insert(pool: &Graph, batch_txs: &[ExchangeOrder]) -> pub async fn load_from_json(path: &Path, pool: &Graph, batch_size: usize) -> Result<(u64, u64)> { let mut orders = extract_exchange_orders::read_orders_from_file(path)?; + info!("completed parsing orders"); + // add RMS stats to each order enrich_rms::include_rms_stats(&mut orders); + info!("completed rms statistics"); + // find likely shill bids enrich_rms::process_sell_order_shill(&mut orders); enrich_rms::process_buy_order_shill(&mut orders); + info!("completed shill bid calculation"); let mut balances = BalanceTracker::new(); balances.replay_transactions(&mut orders)?; diff --git a/src/neo4j_init.rs b/src/neo4j_init.rs index 6d19eb8..f53f7c9 100644 --- a/src/neo4j_init.rs +++ b/src/neo4j_init.rs @@ -35,6 +35,11 @@ pub static INDEX_SWAP_ID: &str = pub static INDEX_SWAP_TIME: &str = "CREATE INDEX swap_time IF NOT EXISTS FOR ()-[r:Swap]-() ON (r.filled_at)"; +pub static INDEX_EXCHANGE_LEDGER: &str = r#" + CREATE INDEX user_ledger IF NOT EXISTS FOR (ul:UserExchangeLedger) ON (ul.date) + CREATE INDEX link_ledger IF NOT EXISTS FOR ()-[r:DailyLedger]->() ON (r.date) + "#; + /// get the testing neo4j connection pub async fn get_neo4j_localhost_pool(port: u16) -> Result { let uri = format!("127.0.0.1:{port}"); @@ -67,6 +72,7 @@ pub async fn maybe_create_indexes(graph: &Graph) -> Result<()> { INDEX_TX_HASH, INDEX_TX_FUNCTION, INDEX_SWAP_ID, + INDEX_EXCHANGE_LEDGER, ]) .await?; txn.commit().await?; diff --git a/tests/test_enrich_exchange.rs b/tests/test_enrich_exchange.rs index 8772f19..2ca6ac8 100644 --- a/tests/test_enrich_exchange.rs +++ b/tests/test_enrich_exchange.rs @@ -176,7 +176,9 @@ async fn e2e_swap_data() -> Result<()> { } #[tokio::test] -async fn test_entry_point_exchange_load() -> Result<()>{ +async fn test_entry_point_exchange_load() -> Result<()> { + libra_forensic_db::log_setup(); + let c = start_neo4j_container(); let port = c.get_host_port_ipv4(7687); let graph = get_neo4j_localhost_pool(port).await?; @@ -184,6 +186,6 @@ async fn test_entry_point_exchange_load() -> Result<()>{ let path = env!("CARGO_MANIFEST_DIR"); let buf = PathBuf::from(path).join("tests/fixtures/savedOlOrders2.json"); - load_exchange_orders::load_from_json(&buf, &graph, 250).await?; + load_exchange_orders::load_from_json(&buf, &graph, 10).await?; Ok(()) }