-
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
fix(makerbot): allow more than one prices url in makerbot #2027
Conversation
@@ -113,7 +112,7 @@ impl From<std::string::String> for OrderProcessingError { | |||
#[derive(Deserialize)] | |||
pub struct StartSimpleMakerBotRequest { | |||
cfg: SimpleMakerBotRegistry, | |||
price_url: Option<String>, |
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 we please leave the singular price_url
for backwards compatibility in the short term? e.g. translate it into a list with single item?
During netid migration it would be optimal to avoid any maker config issues until transition is complete.
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.
No error is thrown if using the old param, looks like it uses the defaults. I'll can mark it as deprecated in docs, could we also add a log message in the bot update loop when it is used to warn users of the deprecation?
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 we also add a log message in the bot update loop when it is used to warn users of the deprecation?
Mmm, I guess to do that I have to keep price_url
in addition to price_urls
to check if it's used or not. If used, what would you like the behaviour to be of the 2 below options:
1 - Translate it into a list with single item and log a warning message.
2 - Use default list and log warning message.
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 third option is to revert price_urls
to price_url
and make it accept either a list or a string, but it won't be very good in my opinion since we need to inform users about the change.
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 third option is to revert price_urls to price_url and make it accept either a list or a string, but it won't be very good in my opinion since we need to inform users about the change.
I would support both at the same time with an enum.
e.g.,:
enum PriceSourceType {
#[serde(rename = "price_url")]
Singular(String),
#[serde(rename = "price_urls")]
Multiple(Vec<String>),
}
impl PriceSourceType {
/// Always use this to get the data
fn get_urls(&self) -> Vec<String> {
match self {
// TODO: deprecate price_url soon and inform the users
PriceSourceType::Singular(t) => vec![t.clone()],
PriceSourceType::Multiple(t) => t.clone(),
}
}
}
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
Thanks for the quick PR! |
Yep, it's sequential. I will also add a rotation logic (if the first one on the list fails we move it to the back of the list for subsequent requests). |
Done |
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.
LGTM
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.
Great work! just couple notes
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.
very minor
let cfg = running_state.trading_bot_cfg.clone(); | ||
let price_urls = &mut running_state.price_urls; | ||
let rates_registry = match fetch_price_tickers(price_urls).await { | ||
Ok(model) => model, |
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.
let cfg = running_state.trading_bot_cfg.clone();
let rates_registry = match fetch_price_tickers(&mut running_state.price_urls).await {
Ok(model) => model,
Err(err) => {
let nb_orders = cancel_pending_orders(ctx, &cfg).await;
error!("error fetching price: {err:?} - cancel {nb_orders} orders");
return;
},
};
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
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.
🚀
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!
- Confirmed backwards compatibility if using
price_url
- Confirmed price url list progression if a failing url is detected.
- Confirmed error message in logs when progressing to next url after one fails.
* evm-hd-wallet: (27 commits) Fix todo comments Fix HDAddressOps::Address trait bounds fix(indexeddb): fix IDB cursor.continue_() call after drop (KomodoPlatform#2028) security bump for `h2` (KomodoPlatform#2062) fix(makerbot): allow more than one prices url in makerbot (KomodoPlatform#2027) fix(wasm worker env): refactor direct usage of `window` (KomodoPlatform#1953) feat(nft): nft abi in withdraw_nft RPC, clear_nft_db RPC (KomodoPlatform#2039) refactor(utxo): refactor utxo output script creation (KomodoPlatform#1960) feat(ETH): balance event streaming for ETH (KomodoPlatform#2041) chore(release): bump mm2 version to 2.1.0-beta (KomodoPlatform#2044) feat(trezor): add segwit support for withdraw with trezor (KomodoPlatform#1984) chore(config): remove vscode launchjson (KomodoPlatform#2040) feat(trading-proto-upgrade): wasm DB, kickstart, refund states, v2 RPCs (KomodoPlatform#2015) feat(UTXO): balance event streaming for Electrum clients (KomodoPlatform#2013) feat(tx): add new sign_raw_transaction rpc for UTXO and EVM coins (KomodoPlatform#1930) fix(p2p): handle encode_and_sign errors (KomodoPlatform#2038) chore(release): add changelog entries for v2.0.0-beta (KomodoPlatform#2037) chore(network): write network information to stdout (KomodoPlatform#2034) fix(price_endpoints): add cached url (KomodoPlatform#2032) deps(network): sync with upstream yamux (KomodoPlatform#2030) ...
* dev: feat(zcoin): ARRR WASM implementation (KomodoPlatform#1957) feat(trading-proto-upgrade): locked amounts, kmd burn and other impl (KomodoPlatform#2046) fix(indexeddb): set stop on success cursor condition (KomodoPlatform#2067) feat(config): add `max_concurrent_connections` to mm2 config (KomodoPlatform#2063) feat(stats_swaps): add gui/mm_version in stats db (KomodoPlatform#2061) fix(indexeddb): fix IDB cursor.continue_() call after drop (KomodoPlatform#2028) security bump for `h2` (KomodoPlatform#2062) fix(makerbot): allow more than one prices url in makerbot (KomodoPlatform#2027) fix(wasm worker env): refactor direct usage of `window` (KomodoPlatform#1953) feat(nft): nft abi in withdraw_nft RPC, clear_nft_db RPC (KomodoPlatform#2039) refactor(utxo): refactor utxo output script creation (KomodoPlatform#1960) feat(ETH): balance event streaming for ETH (KomodoPlatform#2041) chore(release): bump mm2 version to 2.1.0-beta (KomodoPlatform#2044) feat(trezor): add segwit support for withdraw with trezor (KomodoPlatform#1984)
fixes #2016