Skip to content

Commit

Permalink
#update
Browse files Browse the repository at this point in the history
  • Loading branch information
yutiansut committed Feb 7, 2022
1 parent 76a4a11 commit 98de529
Show file tree
Hide file tree
Showing 14 changed files with 211 additions and 28 deletions.
187 changes: 187 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions qapro-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ features = [
"string_encoding",
"product",
"ndarray",
"parquet"
]

[dependencies.clickhouse-rs]
Expand Down
8 changes: 4 additions & 4 deletions qapro-rs/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ async fn main() {
// 初始化 Monitor管理
let morm_addr = MonitorManager::new(count).await.start();

let mut cash_map: HashMap<String, f64> =
let cash_map: HashMap<String, f64> =
serde_json::from_str(&format!(r#"{}"#, CONFIG.accsetup.cash_map)).unwrap();
let backtest_start = get_n_day_before_date9(20);
let _backtest_start = get_n_day_before_date9(20);

let mut all_hisdata: HashMap<String, Vec<QAKlineBase>> = HashMap::new();
for code in codes.iter() {
Expand Down Expand Up @@ -130,6 +130,6 @@ async fn main() {
println!("all histdata is cleaned");
// system.run();

let (tx, rx) = futures::channel::oneshot::channel::<()>();
rx.await;
let (_tx, rx) = futures::channel::oneshot::channel::<()>();
rx.await.unwrap();
}
2 changes: 1 addition & 1 deletion qapro-rs/src/parsers/lang.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::str::FromStr;
use parse_display::{Display, FromStr};


use polars::prelude::CsvReader;


use polars::prelude::*;

Expand Down
2 changes: 1 addition & 1 deletion qapro-rs/src/parsers/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl fmt::Display for Array {
for atom in self.data.iter() {
writeln!(f, " {},", atom);
}
writeln!(f, ">>");
writeln!(f, ">>")?;
Ok(())
}
}
1 change: 0 additions & 1 deletion qapro-rs/src/parsers/sql/env.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::collections::VecDeque;

use indexmap::IndexMap as Map;

Expand Down
10 changes: 5 additions & 5 deletions qapro-rs/src/qaconnector/mongo/mongoclient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl QAMongoClient {

pub async fn save_account(&self, mut account: QA_Account) {
// 实时切片
let mut slice: QIFI = account.get_qifi_slice();
let slice: QIFI = account.get_qifi_slice();
self.save_qifi_slice(slice).await;
}

Expand All @@ -109,10 +109,10 @@ impl QAMongoClient {
doc! {"account_cookie": slice.account_cookie},
v,
UpdateOptions::builder().upsert(Option::from(true)).build(),
);
).unwrap();
}

pub async fn save_his_qifi_slice(&self, mut slice: QIFI) {
pub async fn save_his_qifi_slice(&self, slice: QIFI) {
let coll = self
.client
.database(CONFIG.account.db.as_str())
Expand All @@ -123,7 +123,7 @@ impl QAMongoClient {
doc! {"account_cookie": slice.account_cookie,"trading_day":trading_day},
v,
UpdateOptions::builder().upsert(Option::from(true)).build(),
);
).unwrap();
}

pub async fn save_accounthis(&self, mut account: QA_Account) {
Expand All @@ -139,6 +139,6 @@ impl QAMongoClient {
doc! {"account_cookie": slice.account_cookie,"trading_day":trading_day},
v,
UpdateOptions::builder().upsert(Option::from(true)).build(),
);
).unwrap();
}
}
2 changes: 1 addition & 1 deletion qapro-rs/src/qadata/resample.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::qaprotocol::mifi::qafastkline::QAKlineBase;
use crate::qaprotocol::qifi::account::QIFI;
use chrono::format::ParseError;
use chrono::{DateTime, FixedOffset, NaiveDate, NaiveDateTime, NaiveTime, TimeZone, Utc};
use serde::{Deserialize, Serialize};
use serde::Serialize;

#[derive(Debug, Clone)]
pub struct QARealtimeResampler {
Expand Down
Loading

0 comments on commit 98de529

Please sign in to comment.