Browse Source

changes influx host, adds ticker, side to KrknTrade meas

master
Jonathan Strong 7 years ago
parent
commit
ab4788bf71
4 changed files with 16 additions and 3 deletions
  1. +1
    -0
      Cargo.toml
  2. +2
    -1
      src/influx.rs
  3. +12
    -2
      src/latency.rs
  4. +1
    -0
      src/lib.rs

+ 1
- 0
Cargo.toml View File

@@ -13,3 +13,4 @@ pub-sub = "2.0"
slog = "2.0.6"

windows = { path = "../windows" }
money = { path = "../money" }

+ 2
- 1
src/influx.rs View File

@@ -22,7 +22,8 @@ use warnings::Warning;
const WRITER_ADDR: &'static str = "ipc:///tmp/mm/influx";
//const WRITER_ADDR: &'static str = "tcp://127.0.0.1:17853";
const DB_NAME: &'static str = "mm";
const DB_HOST: &'static str = "http://localhost:8086/write";
//const DB_HOST: &'static str = "http://localhost:8086/write";
const DB_HOST: &'static str = "http://harrison.0ptimus.internal:8086/write";
const ZMQ_RCV_HWM: i32 = 0;
const ZMQ_SND_HWM: i32 = 0;



+ 12
- 2
src/latency.rs View File

@@ -11,6 +11,8 @@ use zmq;
use influent::measurement::{Measurement, Value};

use windows::{DurationWindow, Incremental};
use money::{Ticker, Side};

use influx;


@@ -109,7 +111,7 @@ pub enum ExperiencedLatency {

KrknHttpPrivate(Duration),

KrknTrade(Duration),
KrknTrade(Duration, Option<Ticker>, Option<Side>),

EventLoop(Duration),

@@ -350,13 +352,21 @@ impl LatencyManager<WTen> {
plnx_order.update(loop_time, d)
}

ExperiencedLatency::KrknTrade(d) => {
ExperiencedLatency::KrknTrade(d, ticker, side) => {
last.krkn = loop_time;
let n = DurationWindow::nanos(d);
krkn_trade_30.update(loop_time, d);
krkn_trade_300.update(loop_time, d);
let ticker_s = ticker.map(|t| t.to_string()).unwrap_or("".into());
let side_s = side.map(|s| s.to_string()).unwrap_or("".into());
let mut m = Measurement::new("krkn_trade_api");
m.add_field("nanos", Value::Integer(n as i64));
if ticker.is_some() {
m.add_tag("ticker", &ticker_s);
}
if side.is_some() {
m.add_tag("side", &side_s);
}
m.set_timestamp(now());
influx::serialize(&m, &mut buf);
socket.send_str(&buf, 0);


+ 1
- 0
src/lib.rs View File

@@ -4,6 +4,7 @@
#![feature(test)]

#[macro_use] extern crate slog;
#[macro_use] extern crate money;

extern crate test;
extern crate zmq;


Loading…
Cancel
Save