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

Single account multiple workers #441

Merged
merged 21 commits into from
Oct 18, 2019

Conversation

bitphage
Copy link
Collaborator

@bitphage bitphage commented Feb 3, 2019

Handle multiple workers on same account with Staggered Orders. The feature was funded by Cryptobridge.

@thehapax thehapax requested a review from joelvai February 6, 2019 18:58
@bitphage bitphage changed the base branch from master to devel February 12, 2019 14:25
@bitphage bitphage force-pushed the single-account-multiple-workers branch from 56ec150 to d1913cd Compare February 15, 2019 18:06
@joelvai
Copy link
Collaborator

joelvai commented Feb 22, 2019

To test this properly on GUI as well, you need to remove validation from worker_controller.py which doesn't allow creation of another worker with same account.

Add method for caclulating operational percent Method for caclulating
operational percent of asset balance available to the worker when
trading same assets on different markets on single account.

Add configuration settings for operational balances.
Small refactor to get unified names for properties and methods and to be
able use methods instead of properties when `refresh=False` kwarg is
needed.
This commit brings support for handling multiple workers on single
account with assets intersections into Staggered Orders strategy. See Codaone#434
for discussion.
@bitphage bitphage force-pushed the single-account-multiple-workers branch from d1913cd to 98af834 Compare February 23, 2019 09:24
@thehapax thehapax assigned PermieBTS and unassigned PermieBTS Feb 23, 2019
@thehapax
Copy link
Collaborator

@PermieBTS requesting additional end-users to test single-account-multiple workers to ensure no-err on funds.

@PermieBTS
Copy link
Collaborator

PermieBTS commented Feb 24, 2019

I'm looking into ways that our DEXBot community users can help us test.
The problem users give is that they would have to stop their main-workers which they want to run 24/7... in order to test a new feature/version.

So easy ways to run multiple DEXBot instances are needed.

On Linux, if one creates two users, then you can run DEXBot silently in the back ground and the other can run DEXBot too.

  1. Create a new user
  2. Install desired DEXBot version on that user
  3. Log in to DEXBot, configure settings, and run once.
  4. After this you can start and run this DEXBot worker in a terminal

su otheruser changes to other user
screen dexbot-cli run screen lets you detach change user without stopping the bot
ctrl+a and ctrl+d changes screen to control mode
ctrl+d is exit

To reattach and control the other bot again:
su otheruser
screen -r

====================
The DEXBot docker image can also be used to run two simultaneous versions of DEXBot

@bitphage
Copy link
Collaborator Author

You may ask cryptobridge team as this feature was implemented by their request and they are active users of it.

When using single account for multiple workers, add/remove of a worker
must not touch other workers orders.
@bitphage
Copy link
Collaborator Author

bitphage commented Mar 1, 2019

joelva2:43 PM
@vvk the multiple workers on one account breaks when closing the second one,

Traceback (most recent call last):
  File "/home/joel/projects/DEXBot/dexbot/views/errors.py", line 95, in func_wrapper
    return func(*args, **kwargs)
  File "/home/joel/projects/DEXBot/dexbot/views/worker_item.py", line 87, in pause_worker
    self.main_ctrl.pause_worker(self.worker_name)
  File "/home/joel/projects/DEXBot/dexbot/controllers/main_controller.py", line 58, in pause_worker
    self.worker_manager.stop(worker_name, pause=True)
  File "/home/joel/projects/DEXBot/dexbot/worker.py", line 198, in stop
    self.accounts.remove(account)
KeyError: 'test-account'

dexbot/strategies/base.py Outdated Show resolved Hide resolved
@PermieBTS
Copy link
Collaborator

Cryptokong is recieving training on how to test this strategy and recruit end-users to test this strategy

@bitphage
Copy link
Collaborator Author

@joelvai can you describe in more details of how you got error KeyError: 'test-account'? I'm unable to reproduce it.

@staccDOTsol staccDOTsol mentioned this pull request Mar 18, 2019
@joelvai
Copy link
Collaborator

joelvai commented Mar 22, 2019

@bitfag sorry for delayed answer.

  1. Create two workers that have same account
  2. Remove worker 1
  3. Remove worker 2

@PermieBTS
Copy link
Collaborator

Merging of this feature is delayed until unit tested

When removing a worker which uses account being in use by another worker
too, we must not remove account subscription. This is a fix for the
following condition discovered by @JoelvA:

1. Create two workers that have same account
2. Start both workers
3. Remove worker 1
4. Remove worker 2
To be consistent with param names, input field should be named as
`param_name_input`.
When creating or editing worker, param values should be saved to / taken from
config.
@bitphage
Copy link
Collaborator Author

bitphage commented May 5, 2019

To obtain win executable for testing, go to "continuous-integration/appveyor/pr" Details -> Artifacts -> download DEXBot-gui-win64.zip

@joelvai joelvai merged commit 92a1f5f into Codaone:devel Oct 18, 2019
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.

5 participants