Skip to content

Commit

Permalink
0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
yutiansut committed Dec 4, 2019
1 parent 90a4088 commit a25b73a
Show file tree
Hide file tree
Showing 16 changed files with 291 additions and 211 deletions.
5 changes: 0 additions & 5 deletions .idea/codeStyles/codeStyleConfig.xml

This file was deleted.

4 changes: 2 additions & 2 deletions .idea/misc.xml

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

2 changes: 1 addition & 1 deletion .idea/modules.xml

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

7 changes: 3 additions & 4 deletions qatrader-rs.iml → .idea/qatrader-rs.iml

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

2 changes: 1 addition & 1 deletion .idea/vcs.xml

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

6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ license = "MIT"

[dependencies]
mongodb = "0.3.11" # mongodb
lapin = "^0.28" # rabbitmq
futures = "^0.1"
failure = "^0.1"
itertools = "^0.8.0"
lapin-futures = "^0.18"
log = "^0.4"
chrono = { version = "0.4", features = ["serde"] } # datetime
env_logger = "^0.7"
Expand All @@ -35,6 +38,5 @@ actix-web-actors = "1.0.0"
actix-files = "0.1.1"
awc = "0.2.8"
json = "*"
futures = "0.1"
bytes = "0.4"
tokio = "*"
1 change: 0 additions & 1 deletion src/eventmq.rs

This file was deleted.

81 changes: 0 additions & 81 deletions src/eventmq/mqbase.rs

This file was deleted.

22 changes: 17 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pub mod qamongo;
pub mod eventmq;
pub mod qawebsockets;
pub mod qaeventmq;

//pub mod qawebsockets;
// use tokio::net::TcpListener;
// use tokio::prelude::*;

Expand Down Expand Up @@ -50,12 +51,23 @@ use ndarray::array;
// use ndarray::{ArrayD, ArrayViewD, ArrayViewMutD};



fn main() {
qamongo::action::query_account("192.168.2.24".to_string(), "288870".to_string());
//eventmq::mqbase::connect_mq("192.168.2.24".to_string(), "test".to_string(), "test".to_string(), "thisisQUANTAXIS".to_string());

qamongo::query_account("192.168.2.24".to_string(), "288870".to_string());
//qaeventmq::connect_mq("192.168.2.24".to_string(), "test".to_string(), "test".to_string(), "thisisQUANTAXIS".to_string());
// let mq = qaeventmq::Eventmq{
// addr: "192.168.2.118:5672".to_string(),
// username: "admin".to_string(),
// password: "admin".to_string(),
// vhost: "/".to_string(),
// exchange: "realtime_1min_IF1912".to_string()
// };

// mq.subscriber_fanout();
qaeventmq::subscriber();
// qawebsockets::websocketclient::wsmain(
// "ws:https://101.132.37.31:7988".to_string());

test_ndarray();
test_datetime();
test_timeseries();
Expand Down
37 changes: 36 additions & 1 deletion src/qaasync.rs
Original file line number Diff line number Diff line change
@@ -1 +1,36 @@
pub mod qaasynctest;

use tokio::net::TcpListener;
use tokio::prelude::*;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let addr = "127.0.0.1:8080".parse()?;
let mut listener = TcpListener::bind(&addr).unwrap();

loop {
let (mut socket, _) = listener.accept().await?;

tokio::spawn(async move {
let mut buf = [0; 1024];

// In a loop, read data from the socket and write the data back.
loop {
let n = match socket.read(&mut buf).await {
// socket closed
Ok(n) if n == 0 => return,
Ok(n) => n,
Err(e) => {
println!("failed to read from socket; err = {:?}", e);
return;
}
};

// Write the data back
if let Err(e) = socket.write_all(&buf[0..n]).await {
println!("failed to write to socket; err = {:?}", e);
return;
}
}
});
}
}
36 changes: 0 additions & 36 deletions src/qaasync/qaasynctest.rs

This file was deleted.

Loading

0 comments on commit a25b73a

Please sign in to comment.