Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inconsistent spacing in stdlog #1080

Closed
wants to merge 2 commits into from
Closed

Conversation

oorzkws
Copy link

@oorzkws oorzkws commented Mar 5, 2021

It is currently "BUY{SPACE}{SPACE}" but "SELL{SPACE}". If you have a reason for this feel free to reject, it's just making log monitoring a pain for me currently.

It is currently "BUY{SPACE}{SPACE}" but "SELL{SPACE}". If you have a reason for this feel free to reject, it's just making log monitoring a pain for me currently.
@coveralls
Copy link

coveralls commented Mar 5, 2021

Coverage Status

Coverage remained the same at 37.924% when pulling a0e1c61 on oorzkws:patch-1 into 24baa03 on ctubio:master.

@ctubio
Copy link
Owner

ctubio commented Mar 5, 2021

im sorry that is to keep logs aligned vertically, note BUY has 3 chars and SELL 4, so we need a extra space to align prices and else data in the log line

@ctubio ctubio closed this Mar 5, 2021
@ctubio
Copy link
Owner

ctubio commented Mar 5, 2021

i know it doesnt helps but this is how we usualy parse logs:

auto parseTrade = [](string line)->tribeca::LastOrder {
stringstream ss(line);
string _, pingpong, side;
tribeca::LastOrder order;
ss >> _ >> _ >> _ >> _ >> pingpong >> _ >> side >> order.filled >> _ >> _ >> _ >> order.price;
order.side = (side == "BUY" ? Side::Bid : Side::Ask);
order.isPong = (pingpong == "PONG");
return order;
};
vector<tribeca::LastOrder> loglines({
parseTrade("03/30 07:10:34.800532 GW COINBASE PING TRADE BUY 0.03538069 BTC at price 141.31 EUR (value 4.99 EUR)."),
parseTrade("03/30 07:12:10.769009 GW COINBASE PONG TRADE SELL 0.03241380 BTC at price 141.40 EUR (value 4.58 EUR)."),
parseTrade("03/30 07:12:10.786990 GW COINBASE PONG TRADE SELL 0.00295204 BTC at price 141.40 EUR (value 0.41 EUR)."),
parseTrade("03/30 07:25:49.333540 GW COINBASE PING TRADE BUY 0.03528853 BTC at price 141.60 EUR (value 4.99 EUR)."),
parseTrade("03/30 07:25:50.787607 GW COINBASE PONG TRADE SELL 0.03528853 BTC at price 141.66 EUR (value 4.99 EUR)."),
parseTrade("03/30 07:38:07.369008 GW COINBASE PING TRADE BUY 0.03528867 BTC at price 141.66 EUR (value 4.99 EUR)."),
parseTrade("03/30 07:38:34.268582 GW COINBASE PONG TRADE SELL 0.03529119 BTC at price 141.68 EUR (value 5.00 EUR)."),
parseTrade("03/30 07:43:02.229028 GW COINBASE PING TRADE BUY 0.03528870 BTC at price 141.63 EUR (value 4.99 EUR)."),
parseTrade("03/30 07:45:22.735730 GW COINBASE PING TRADE SELL 0.03530102 BTC at price 141.55 EUR (value 4.99 EUR)."),
parseTrade("03/30 08:14:52.978466 GW COINBASE PING TRADE BUY 0.03512242 BTC at price 142.28 EUR (value 4.99 EUR)."),
parseTrade("03/30 08:15:13.002363 GW COINBASE PING TRADE BUY 0.03515685 BTC at price 142.22 EUR (value 5.00 EUR).")
});

otherwise maybe you can work with string length (cos data is always in the same position) instead of space separations?

@ctubio
Copy link
Owner

ctubio commented Mar 5, 2021

another easy solution could be to replace somehow BUY/SELL by BID/ASK (cos same length so everybody happy), but im not english expert :P

@oorzkws
Copy link
Author

oorzkws commented Mar 5, 2021

Ah, I see. That makes sense. I'll switch to per-word and just dropping spaces, then.

Thanks for the explanation ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants