-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
1,327 additions
and
502 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
version: "2.1" | ||
services: | ||
|
||
redis: | ||
image: 'daocloud.io/quantaxis/qaredis:latest' | ||
ports: | ||
- "6379:6379" | ||
environment: | ||
- TZ=Asia/Shanghai | ||
command: ['redis-server'] | ||
restart: always | ||
networks: | ||
qanetwork_db: | ||
ipv4_address: 172.19.11.2 | ||
mgdb: | ||
image: daocloud.io/quantaxis/qamongo_single:latest | ||
ports: | ||
- "27017:27017" | ||
environment: | ||
- TZ=Asia/Shanghai | ||
- MONGO_INITDB_DATABASE=quantaxis | ||
volumes: | ||
- qamg:/data/db | ||
networks: | ||
qanetwork_db: | ||
ipv4_address: 172.19.11.3 | ||
restart: always | ||
|
||
qaclickhouse: | ||
image: daocloud.io/quantaxis/qa-clickhouse | ||
ports: | ||
- "9000:9000" | ||
- "8123:8123" | ||
- "9009:9009" | ||
environment: | ||
- TZ=Asia/Shanghai | ||
networks: | ||
qanetwork_db: | ||
ipv4_address: 172.19.11.4 | ||
|
||
qaeventmq: | ||
image: daocloud.io/quantaxis/qaeventmq:latest | ||
ports: | ||
- "15672:15672" | ||
- "5672:5672" | ||
- "4369:4369" | ||
environment: | ||
- TZ=Asia/Shanghai | ||
networks: | ||
qanetwork_db: | ||
ipv4_address: 172.19.11.5 | ||
restart: always | ||
|
||
|
||
volumes: | ||
qamg: | ||
external: | ||
name: qamg | ||
|
||
networks: | ||
qanetwork_db: | ||
ipam: | ||
config: | ||
- subnet: 172.19.11.0/24 | ||
gateway: 172.19.11.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use actix::Actor; | ||
use actix_cors::Cors; | ||
use actix_redis::RedisActor; | ||
use actix_rt::Arbiter; | ||
|
||
|
||
use actix_web::{middleware,http::header, web, App, HttpResponse, HttpServer}; | ||
use qapro_rs::qahandlers::websocket::websocket_router; | ||
use qapro_rs::qaenv::localenv::CONFIG; | ||
use qapro_rs::qahandlers::realtime::Realtime; | ||
|
||
|
||
use qapro_rs::qalog::log4::init_log4; | ||
|
||
use qapro_rs::qahandlers::wshandle::index; | ||
#[actix_rt::main] | ||
async fn main() -> std::io::Result<()> { | ||
init_log4("log/qarealtimepro_rs.log"); | ||
println!("{:#?}", &CONFIG.common.addr); | ||
let redis_addr = RedisActor::start(&CONFIG.redis.uri); | ||
let realtime_addr = Realtime::new(redis_addr.clone()).start(); | ||
|
||
HttpServer::new(move || { | ||
App::new() | ||
.data(realtime_addr.clone()) | ||
.route("/ws/", web::get().to(index)) | ||
//.service(web::scope("/ws").route("/", web::get().to(index))) | ||
.route("/ws2/",web::get().to(websocket_router)) | ||
|
||
}) | ||
.bind(&CONFIG.common.addr)? | ||
.run() | ||
.await | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use qapro_rs::qaconnector::clickhouse::ckclient; | ||
use qapro_rs::qaconnector::clickhouse::ckclient::DataConnector; | ||
use actix_web::{middleware, web, App, HttpResponse, HttpServer}; | ||
|
||
|
||
use actix::Actor; | ||
use actix_cors::Cors; | ||
use actix_redis::RedisActor; | ||
use actix_rt::Arbiter; | ||
|
||
use log4rs; | ||
|
||
#[actix_rt::main] | ||
async fn main() { | ||
let c = ckclient::QACKClient::init(); | ||
|
||
let codelist = ["600010.XSHG", "300002.XSHE"]; | ||
let hisdata = c | ||
.exectue(Vec::from(codelist), "2021-07-11", "2021-12-22", "1min") | ||
.await | ||
.unwrap(); | ||
println!("{:#?}", hisdata.to_kline()); | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use actix::{Actor, StreamHandler}; | ||
use actix_web::{web, App, Error, HttpRequest, HttpResponse, HttpServer}; | ||
use actix_web_actors::ws; | ||
|
||
/// Define HTTP actor | ||
struct MyWs; | ||
|
||
impl Actor for MyWs { | ||
type Context = ws::WebsocketContext<Self>; | ||
} | ||
|
||
/// Handler for ws::Message message | ||
impl StreamHandler<Result<ws::Message, ws::ProtocolError>> for MyWs { | ||
fn handle( | ||
&mut self, | ||
msg: Result<ws::Message, ws::ProtocolError>, | ||
ctx: &mut Self::Context, | ||
) { | ||
match msg { | ||
Ok(ws::Message::Ping(msg)) => ctx.pong(&msg), | ||
Ok(ws::Message::Text(text)) => ctx.text(text), | ||
Ok(ws::Message::Binary(bin)) => ctx.binary(bin), | ||
_ => (), | ||
} | ||
} | ||
} | ||
|
||
async fn index(req: HttpRequest, stream: web::Payload) -> Result<HttpResponse, Error> { | ||
let resp = ws::start(MyWs {}, &req, stream); | ||
println!("{:?}", resp); | ||
resp | ||
} | ||
|
||
#[actix_web::main] | ||
async fn main() -> std::io::Result<()> { | ||
HttpServer::new(|| App::new().route("/ws/", web::get().to(index))) | ||
.bind("127.0.0.1:8080")? | ||
.run() | ||
.await | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,5 @@ pub mod qalog; | |
pub mod qamacros; | ||
pub mod qapraser; | ||
|
||
pub mod qafactor; | ||
pub mod qahandlers; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
pub mod realtime; | ||
pub mod websocket; | ||
pub mod state; | ||
pub mod wshandle; |
Oops, something went wrong.