-
Notifications
You must be signed in to change notification settings - Fork 94
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
[r2r] enhanced logging in spv and rpc_client mods #1594
Conversation
Signed-off-by: borngraced <samiodev@icloud.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! I have only one minor suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fixes! Please consider my comments
@@ -518,7 +545,14 @@ async fn update_single_order( | |||
let resp = update_maker_order(ctx, req) | |||
.await | |||
.map_to_mm(OrderProcessingError::OrderUpdateError)?; | |||
info!("Successfully update order for {} - uuid: {}", key_trade_pair, resp.uuid); | |||
let (volume, _) = calculate_volume(ctx, &cfg, Some(&base_balance), &rates.base_price).await?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can reuse the volume
returning from prepare_order
function:
- let (min_vol, _, calculated_price, is_max, base_balance) = prepare_order(rates, &cfg, &key_trade_pair, ctx).await?;
+ let (min_vol, volume, calculated_price, is_max, base_balance) = prepare_order(rates, &cfg, &key_trade_pair, ctx).await?;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yh thanks
//async fn prepare_order(cfg) { | ||
// let mut is_max = cfg.max.unwrap_or(false); | ||
// let (vol, is_max) = calculate_volume(ctx, cfg, base_balance, price).await?; | ||
// let is_max = cfg.max.unwrap_or_default() | is_max; | ||
//} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be removed
@@ -491,21 +518,21 @@ async fn prepare_order( | |||
None => None, | |||
}; | |||
|
|||
Ok((min_vol, volume, calculated_price, is_max)) | |||
Ok((min_vol, volume, calculated_price, is_max, base_balance)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that after these changes:
- let (min_vol, _, calculated_price, is_max, base_balance) = prepare_order(rates, &cfg, &key_trade_pair, ctx).await?;
+ let (min_vol, volume, calculated_price, is_max, base_balance) = prepare_order(rates, &cfg, &key_trade_pair, ctx).await?;
the base_balance
is no longed required to be returned from prepare_order
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Signed-off-by: borngraced <samiodev@icloud.com>
Signed-off-by: borngraced <samiodev@icloud.com>
Signed-off-by: borngraced <samiodev@icloud.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks!
I see
and in "price": "0.002567964983164983164983164983164983164983164983164983164983164983164983164983164983164983164983164983", "price": "403.5584623598505072076882007474639615589962626801922050186865990389749065670048051254671649759743727", Seems volume not calculated, as logs show zero. Can we please extend the logs to 8 decimal places? |
Signed-off-by: borngraced <samiodev@icloud.com>
@smk762 this is ready for another round of test.. |
Thanks, I see extra decimals now
Volume still zero tho |
Signed-off-by: borngraced <samiodev@icloud.com>
@smk762, if PS. I handled this case to print "max volume" instead of |
Cheers, here's latest logs with config change to not be
Could we please likewise limit the volume to 8 decimal places? |
Signed-off-by: borngraced <samiodev@icloud.com>
all done now.. @smk762 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, log output is now nice and clean and informative
05 13:17:13, simple_market_maker:592] INFO Successfully placed order for LTC-KMD - uuid: a69504ed-7ae1-4ea2-9918-0a23c8de6750 - rate: (406.00490928 LTC-KMD) - volume: 0.06689858
05 13:17:15, simple_market_maker:586] INFO Successfully update order for KMD-LTC - uuid: 27997929-260b-4be4-b024-1aa8a39041be - rate: (0.00255249 KMD-LTC) - max volume
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more changes please
if is_max { | ||
info!( | ||
"Successfully update order for {key_trade_pair} - uuid: {} - rate: ({:.8} {key_trade_pair}) - max volume", | ||
resp.uuid, | ||
calculated_price.to_decimal() | ||
); | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please refactor this as
let vol_info = if is_max {
"max volume".to_string()
} else {
format!("volume: {:.8}", volume.to_decimal())
};
info!("Successfully update order for {key_trade_pair} - uuid: {} - rate: ({:.8} {key_trade_pair}) - {vol_info}", resp.uuid, calculated_price.to_decimal());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this really needed? done anyways
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think the changed version looks more clear and readable?
It also helped to to shorten by 4 lines
if is_max { | ||
info!( | ||
"Successfully update order for {key_trade_pair} - uuid: {} - rate: ({:.8} {key_trade_pair}) - max volume", | ||
resp.uuid, | ||
calculated_price.to_decimal() | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same here please
Signed-off-by: borngraced <samiodev@icloud.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! LGTM!
@shamardy could you please also take a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only one suggestion :)
Signed-off-by: borngraced <samiodev@icloud.com>
2b26226
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small change!
Signed-off-by: borngraced <samiodev@icloud.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fixes!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-approve
fixes: #1481
Signed-off-by: borngraced samiodev@icloud.com