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

simple market maker bot #1066

Merged
merged 84 commits into from
Oct 13, 2021
Merged

simple market maker bot #1066

merged 84 commits into from
Oct 13, 2021

Conversation

Milerius
Copy link

No description provided.

…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.
- 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.
@Milerius Milerius marked this pull request as ready for review September 14, 2021 10:13
Copy link
Member

@artemii235 artemii235 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have several changes requests and few questions 🙂

mm2src/rpc/dispatcher/dispatcher_v2.rs Outdated Show resolved Hide resolved
mm2src/lp_ordermatch.rs Outdated Show resolved Hide resolved
mm2src/lp_bot_tests.rs Outdated Show resolved Hide resolved
mm2src/lp_bot.rs Outdated Show resolved Hide resolved
mm2src/lp_bot.rs Outdated Show resolved Hide resolved
mm2src/lp_bot/simple_market_maker.rs Outdated Show resolved Hide resolved
mm2src/lp_bot/simple_market_maker.rs Outdated Show resolved Hide resolved

pub async fn lp_bot_loop(ctx: MmArc) {
info!("lp_bot_loop successfully started");
loop {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like a good chance to start more extensive usage of the State machine pattern implemented by @sergeyboyko0791 🙂 Please check https://github.com/KomodoPlatform/atomicDEX-API/blob/mm2.1/mm2src/common/patterns/state_machine.rs. We plan to refactor some code parts to it in the future too.

mm2src/lp_bot.rs Outdated Show resolved Hide resolved
mm2src/lp_bot.rs Outdated Show resolved Hide resolved
… code review

- Change `StartSimpleMakerBotAnswer` to `StartSimpleMakerBotRes`
- Change `StopSimpleMakerBotAnswer` to `StopSimpleMakerBotRes`
- Remove spurious usage of `return`
- Sort alphabetically the dispatcher_v2 commands
Copy link
Member

@artemii235 artemii235 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few more changes requests and a couple of questions 🙂

mm2src/lp_ordermatch/lp_bot.rs Outdated Show resolved Hide resolved
mm2src/lp_ordermatch/lp_bot.rs Outdated Show resolved Hide resolved
mm2src/lp_ordermatch/lp_bot.rs Outdated Show resolved Hide resolved
mm2src/lp_ordermatch.rs Outdated Show resolved Hide resolved
mm2src/lp_ordermatch/simple_market_maker.rs Outdated Show resolved Hide resolved
Copy link
Member

@artemii235 artemii235 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have few more changes requests and questions 🙂

mm2src/lp_ordermatch.rs Outdated Show resolved Hide resolved
mm2src/lp_ordermatch/lp_bot.rs Outdated Show resolved Hide resolved
mm2src/lp_ordermatch/simple_market_maker.rs Outdated Show resolved Hide resolved
mm2src/lp_ordermatch/simple_market_maker.rs Outdated Show resolved Hide resolved
mm2src/lp_ordermatch/simple_market_maker.rs Outdated Show resolved Hide resolved
mm2src/lp_ordermatch/simple_market_maker.rs Outdated Show resolved Hide resolved
mm2src/lp_ordermatch/simple_market_maker.rs Outdated Show resolved Hide resolved
mm2src/lp_ordermatch/simple_market_maker.rs Outdated Show resolved Hide resolved
mm2src/lp_ordermatch/simple_market_maker.rs Outdated Show resolved Hide resolved
Copy link
Member

@artemii235 artemii235 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more review iteration 🙂

mm2src/coins/lp_coins.rs Outdated Show resolved Hide resolved
mm2src/lp_ordermatch/lp_bot.rs Outdated Show resolved Hide resolved
mm2src/lp_ordermatch/simple_market_maker.rs Outdated Show resolved Hide resolved
mm2src/lp_ordermatch/simple_market_maker.rs Outdated Show resolved Hide resolved
mm2src/lp_ordermatch/simple_market_maker.rs Outdated Show resolved Hide resolved
mm2src/lp_ordermatch/simple_market_maker.rs Outdated Show resolved Hide resolved
mm2src/lp_ordermatch/simple_market_maker.rs Show resolved Hide resolved
mm2src/lp_swap.rs Outdated Show resolved Hide resolved
Copy link
Member

@artemii235 artemii235 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved 🙂 @Milerius Thanks for your patience and good work on fixing all the remarks 👍

@artemii235 artemii235 merged commit aa21c18 into dev Oct 13, 2021
@artemii235 artemii235 deleted the simple_market_maker_bot branch October 13, 2021 07:32
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.

2 participants