-
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
Simple trading bot implementation #1065
Comments
…1065 - Add `start_simple_market_maker_bot` rpc call in dispatcher_v2.rs - Add `stop_simple_market_maker_bot` rpc call in dispatcher_v2.rs - Create a lp_bot.rs file and initiate the module in mm2.rs - Create a lp_bot_tests.rs file that contains unit test of the lp_bot module. - Add a context for the simple_trading_bot in mm_ctx.rs - Add a simple_market_maker.rs file that contains the simple trading bot logic. - Add the loop/logic for lp_price_service_loop (that fetch price every 20 seconds) - Add the loop of lp_bot_loop and an empty logic function - Add bot configuration data structure - Add price registry data structure Some notes: - There is too many logs right now in my implementation, I should reduce them.
MM2 design notes
|
I do think we can also add the fact that we need basic trading operations to be available in the
|
I've seen in https://github.com/KomodoPlatform/atomicDEX-API/blob/42d76e65f9fe5d7bbb0148ed69a2caad72113757/mm2src/lp_ordermatch.rs#L1321 that the My idea is to clone this hashmap since I need it only as a read-only operation and to avoid extra locking time. |
* feat(simple_trading_bot): draft for simple trading bot implementation #1065 - Add `start_simple_market_maker_bot` rpc call in dispatcher_v2.rs - Add `stop_simple_market_maker_bot` rpc call in dispatcher_v2.rs - Create a lp_bot.rs file and initiate the module in mm2.rs - Create a lp_bot_tests.rs file that contains unit test of the lp_bot module. - Add a context for the simple_trading_bot in mm_ctx.rs - Add a simple_market_maker.rs file that contains the simple trading bot logic. - Add the loop/logic for lp_price_service_loop (that fetch price every 20 seconds) - Add the loop of lp_bot_loop and an empty logic function - Add bot configuration data structure - Add price registry data structure Some notes: - There is too many logs right now in my implementation, I should reduce them. * feat(simple_trading_bot): remove spurious use of a non-public data structure. * feat(simple_trading_bot): remove unused HashSet inclusion * feat(simple_trading_bot): remove spurious usage of return. * enhancements(simple_trading_bot): fix needless_borrow warnings * enhancements(simple_trading_bot): rustfmt * enhancements(simple_trading_bot): rustfmt * feat(simple_trading_bot): add iteration through maker_orders - Add a function to clone maker_order as read-only ops - Add a loop that iterate through maker orders and call update_single_order if the combination is found in cfg - Add update_single_order without any concrete logic. * feat(simple_trading_bot): change price url to komodo.live * enhancements(simple_trading_bot): first iteration of fix based on the code review - Change `StartSimpleMakerBotAnswer` to `StartSimpleMakerBotRes` - Change `StopSimpleMakerBotAnswer` to `StopSimpleMakerBotRes` - Remove spurious usage of `return` - Sort alphabetically the dispatcher_v2 commands * enhancements(simple_trading_bot): confs can be negative, switching to u64 * enhancements(simple_trading_bot): use match expression when parsing network ops. * enhancements(simple_trading_bot): use an enum for the trading bot states * enhancements(simple_trading_bot): use mmnumber instead of string. * enhancements(simple_trading_bot): introducing TradingPair data structure * enhancements(simple_trading_bot): rename functor, make it more expressive * enhancements(simple_trading_bot): make lp_bot_tests a submodule of mm2_tests * enhancements(simple_trading_bot): make lp_bot a submodule of lp_ordermatch * enhancements(simple_trading_bot): don't use clone on a copiable data * feat(simple_trading_bot): add skeleton for creating orders * feat(simple_trading_bot): continue implementation of creating single order * feat(clippy): fix various clippy warnings * feat(clippy): fix various clippy warnings * feat(price): add calculated price * feat(simple_market_maker): add more checks and fix clippy warnings * feat(simple_market_maker): simplify coin_find_and_checks * feat(simple_market_maker): fix condition * feat(simple_market_maker): finalize the creation of the order. - Only max volume is supported for now - min_volume not supported yet * feat(simple_market_maker): finalize with volume and min_volume - finalize placing order with support of volume and min_volume * feat(simple_market_maker): add simple_market_maker_tests.rs - add unit tests for cex rates * fix(simple_market_maker): use the good TradingBotContext * feat(simple_market_maker): change approach for error checking - Now use MmError to provide more error checking - Start update_single_order function logic * enhancements(simple_market_maker): review fixing - Rename set_price_strong_type -> create_maker_order - use MmNumber without the full namespace * enhancements(market_maker_bot): use MmNumber instead of string * enhancements(market_maker_bot): use match expression instead of chained ifs * enhancements(market_maker_bot): fix code review comments - Simplify check prerequisites - use more match expression - cancel single order only called in the update function - remove non required arguments from checks_order_prerequisites * enhancements(market_maker_bot): fix code review comments - simplify the fetching of price. * enhancements(market_maker_bot): fix unit tests * feat(market_maker_bot): continue update maker order * feat(market_maker_bot): added first vwap version * feat(market_maker_bot): add unit tests for vwap * feat(market_maker_bot): more unit tests * feat(simple_market_maker): add last vwap unit tests - rename vwap functions. * feat(simple_market_maker): refactor some code * feat(simple_market_maker): continue refactor * feat(simple_market_maker): move price service * feat(simple_market_maker): continue refactoring * feat(market_maker): implement the cancelling of pending orders * feat(market_maker): fix unit tests * feat(market_maker): fix review comments - Rename MyRecentSwapsAnswer to MyRecentSwapsResponse - use ? for serde parsing error * feat(market_maker): fix review comments - use MmError::err instead of MmError::new - use display tags for error - replace spurious display tag by debug - use borrow whenever possible instead of clone * feat(simple_market_maker): use a proper error for balance * feat(simple_market_maker): use a lp_findpair like functions * feat(get_non_zero_balance): implement get_non_zero_balance in lp_coins * feat(simple_market_maker_bot): fix nonzerobalance - add multiple task spawning for creating order * feat(simple_market_maker_bot): add multiple spawn for order update * enhancement(review): simplify update/creation order - add a new log passthrough function that could be used * enhancement(review): simplify cex rates * enhancement(review): simplify mm error creation in cancel_order * enhancement(review): rename min_volume -> min_volume_percentage from the config * enhancement(review): refactor vwap calculation * feat(review): clippy warnings * feat(bot): cancel order only managed by the trading bot. * feat(simple_market_maker): fix review comments * feat(simple_market_maker): fix review comments * feat(simple_market_maker): change valid trades approach, remove useless async keyword * feat(simple_market_maker): continue review fixing * feat(simple_market_maker): continue review fixing * feat(simple_market_maker): clippy fix * feat(simple_market_maker_bot): use option for timestamp * feat(simple_market_maker_bot): simplify asynchrounous code * feat(bot): simplify order creation * feat(simple_market_maker): fix review iteration * feat(clippy): fix clippy warnings * feat(time): don't use unwrap for system time it can failed * feat(bot): add support for custom price url default to KMD one * feat(bot): add support for V2 endpoint and ticker groups
* feat(telegram): wip telegram send message * feat(telegram): add telegram simple notification client * feat(telegram): clippy warning * feat(message): add a message_service object that handle a collection of MessageServiceTraits * feat(ci): add telegram api key * feat(message): fix review * feat(message): use message service in simple_market_maker bot * feat(message): fix compilation and review * feat(simple_market_maker_bot): add swap notification * feat(style): clone macro at the beginning * feat(style): nest use statement * feat(simple_bot): more detailed errors for swap history * feat(lp_swap): log an error if the swap is not present in DB. - If you have a swap that is not present in DB the function was returning an error, it's too aggressive. `Error when querying swap history order cannot be created for: KMD/LTC` - Instead skip the erroneous swaps and continue the iteration * feat(simple_market_maker): add the possibility to control the loop refresh_rate - Useful for small coins that doesn't update often price and to avoid taker to dump on you - Add a default precision for notification, 8 should be enough for readable message. * feat(wasm): use now_float() instead of system function for time manipulation * feat(dispatcher): add a simple event dispatcher * feat(dispatcher): use dispatcher in lp_bot * feat(dispatcher): make wasm great again * feat(dispatcher): fix code review * feat(bot_cfg): add new options to prevent flash crash * feat(simple_market_maker_bot): use V2 API for price * feat(telegram): remove usage of unwrap_or for telegram send message - The operation in unwrap_or was evaluated even if the option was not None * feat(telegram): move trading bot cfg into running state * feat(telegram): better syntax for chat id * feat(telegram): cargo clippy * feat(dispatcher): use TypeId to avoid construction of type * feat(review): fix sergey review * feat(default): make the dispatcher default constructible without implying the events * feat(review): continue review fixing, extract more_code, introduce BotEvent * feat(bot): add stopped event * feat(bot): simplify on_trading_bot_event * feat(message_service): introduce message_service ctx in MmArc * feat(message_service): make init_message_service compile in wasm * feat(lp_bot): add min_volume_usd settings * feat(tests): add min_volume_usd to unit tests * feat(lp_bot): add nomics support * feat(lp_bot): simplify logging * feat(log): log the time used to process a whole tick of bot logic * feat(lp_bot): add max_volume_usd as balance_percentage alternative * feat(lp_bot): use volume settings based on review * feat(bot): use new volume approach in unit test * feat(lp_bot): fix unit tests * feat(lp_bot): fix minor changes review comment * feat(lp_bot): add forex endpoint
It's been working ok for me, and docs are up at |
@artemii235 we can probably close this issue |
Ok, thanks. |
It's the tracking issue for the built-in simple trading bot.
The text was updated successfully, but these errors were encountered: