|
|
@ -165,7 +165,7 @@ async fn _main() -> AppResult<()> { |
|
|
|
&config.poloniex_rest_url, |
|
|
|
&config.poloniex_rest_url, |
|
|
|
&config.poloniex_ws_url, |
|
|
|
&config.poloniex_ws_url, |
|
|
|
)); |
|
|
|
)); |
|
|
|
let repo = Arc::new(SqliteRepo::new(&config.database_url).await?); |
|
|
|
let repo = Arc::new(SqliteRepo::new_migrate(&config.database_url).await?); |
|
|
|
let base_start_time = NaiveDate::from_ymd_opt(2024, 12, 1) |
|
|
|
let base_start_time = NaiveDate::from_ymd_opt(2024, 12, 1) |
|
|
|
.unwrap() |
|
|
|
.unwrap() |
|
|
|
.and_hms_opt(0, 0, 0) |
|
|
|
.and_hms_opt(0, 0, 0) |
|
|
@ -221,9 +221,14 @@ async fn _main() -> AppResult<()> { |
|
|
|
let mut trades = poloniex_client.recent_trades_stream(&config.pairs).await?; |
|
|
|
let mut trades = poloniex_client.recent_trades_stream(&config.pairs).await?; |
|
|
|
|
|
|
|
|
|
|
|
while let Some(t) = trades.next().await { |
|
|
|
while let Some(t) = trades.next().await { |
|
|
|
println!("{t:?}"); |
|
|
|
let trade = match t { |
|
|
|
|
|
|
|
Ok(t) => t, |
|
|
|
let Ok(trade) = t else { break }; |
|
|
|
Err(e) => { |
|
|
|
|
|
|
|
println!("trade stream error: {e:?}"); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
println!("inserting {trade:?}"); |
|
|
|
|
|
|
|
|
|
|
|
for interval in &config.intervals { |
|
|
|
for interval in &config.intervals { |
|
|
|
tokio::spawn({ |
|
|
|
tokio::spawn({ |
|
|
|