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

[Enhancement] Sync pairs in multiple instances of Gunthy GUI #21

Open
caogeoge opened this issue Sep 23, 2017 · 3 comments
Open

[Enhancement] Sync pairs in multiple instances of Gunthy GUI #21

caogeoge opened this issue Sep 23, 2017 · 3 comments

Comments

@caogeoge
Copy link

caogeoge commented Sep 23, 2017

Hi Sjakil,

So I have a suggestion for sync-ing pairs in multiple instances of Gunthy GUI. As discussed, let's say I run 2 instances of GunBot & Gunthy GUI with the following structure:


/home/geogecao/GunBot
\_ GunBot
    \_ gunthy-gui-linux-x64 (binary)
    \_ gunthy-linx64 (binary)
    \_ config.js (file)
    \_ gui-bots.json (file)
\_ GunBot_1
    \_ gunthy-gui-linux-x64 (symlink to ~/GunBot/GunBot/gunthy-gui-linux-x64)
    \_ gunthy-linx64 (symlink to ~/GunBot/GunBot/gunthy-linx64)
    \_ config.js (file)
    \_ gui-bots.json (file)
\_ GunBot_2
    \_ gunthy-gui-linux-x64 (symlink to ~/GunBot/GunBot/gunthy-gui-linux-x64)
    \_ gunthy-linx64 (symlink to ~/GunBot/GunBot/gunthy-linx64)
    \_ config.js (file)
    \_ gui-bots.json (file)

Let's say I run GunBot_1 with 5 pairs and GunBot_2 with another 5 pairs. In total I have 10 pairs in both Bots. Let's say the exchange (Bittrex for example) has 200 pairs in circulation.

At the moment when I click on "Add Pairs" in GunBot_1, it would show 200 - 5 = 195 pairs that I can add to it. These 195 pairs contain (duplicate) 5 pairs that are already added in GunBot_2. Similarly, when I click on "Add Pairs" in GunBot_2, it would show 200 - 5 = 195 pairs that I can add to it (of course, these 195 pairs include the 5 pairs I already added in GunBot_1).

In other words, currently "Add Pairs" in Gunthy GUI is not sync-ing the pairs between different instances of GunBot.

To implement this functionality would be (I think) not a huge task. Let's look at the current gui-bots.json structure:


[
	{
		"gunbotVersion": "3.3.3+",
		"exchange": "bittrex",
		"pair": "BTC-1ST",
		"config": {
			"strategy": "stepgain",
			"override": {}
		}
	},
	{
		"gunbotVersion": "3.3.3+",
		"exchange": "bittrex",
		"pair": "BTC-2GIVE",
		"config": {
			"strategy": "stepgain",
			"override": {}
		}
	},
]

We can change this to smt that looks like this:


[
    {
        "name": "GunBot_1",
        "pairs": [
            {
                "gunbotVersion": "3.3.3+",
                "exchange": "bittrex",
                "pair": "BTC-1ST",
                "config": {
                    "strategy": "stepgain",
                    "override": {}
                }
            },
            {
                "gunbotVersion": "3.3.3+",
                "exchange": "bittrex",
                "pair": "BTC-2GIVE",
                "config": {
                    "strategy": "stepgain",
                    "override": {}
                }
            }
        ]
    },
    {
        "name": "GunBot_2",
        "pairs": [
            {
                "gunbotVersion": "3.3.3+",
                "exchange": "bittrex",
                "pair": "BTC-ADT",
                "config": {
                    "strategy": "stepgain",
                    "override": {}
                }
            },
            {
                "gunbotVersion": "3.3.3+",
                "exchange": "bittrex",
                "pair": "BTC-ADX",
                "config": {
                    "strategy": "stepgain",
                    "override": {}
                }
            }
        ]
    }
]

So instead of having gui-bots.json for each instance of Gunthy GUI, we would have a central gui-bots.json that can be "symlink-ed" to by multiple instances of Gunthy GUI. Here I added the attribute "name" that is already used in gui-config.json as an unique identifier for each GunBot instance. Then the "pairs" attribute lists all the pairs that are added to that single GunBot.

In the code, when "Add Pairs" is clicked (regardless of in single-instance GunBot or an instance of multiple-instance GunBot), it reads & parses this gui-bots.json file and adds all pairs of all Gunbot_X instances and show the pairs that have not yet been added.

My guess is you also use gui-bots.json for displaying the correct GunBot Log windows of each pairs and that's why I added that "name" attribute that you can use to still be able to query the specific pairs that the GunBot instance is having. But if not (you also have the list of pairs in the "pairs" table in your gui-db.sqlite), then this "name" attribute is not necessary. I don't know if gui-bots.json & gui-db.sqlite are related (I guess they are) and if so we can use this "name" attribute to serve both purposes of Log windows displaying & sync-ing pairs between different instance of GunBot.

In effect, the directory/file structure of multiple-instance GunBot would now look like this:


/home/geogecao/GunBot
\_ GunBot
    \_ gunthy-gui-linux-x64 (binary)
    \_ gunthy-linx64 (binary)
    \_ config.js (file)
    \_ gui-bots.json (file)
\_ GunBot_1
    \_ gunthy-gui-linux-x64 (symlink to ~/GunBot/GunBot/gunthy-gui-linux-x64)
    \_ gunthy-linx64 (symlink to ~/GunBot/GunBot/gunthy-linx64)
    \_ config.js (file)
    \_ gui-bots.json (symlink to ~/GunBot/GunBot/gui-bots.json)
\_ GunBot_2
    \_ gunthy-gui-linux-x64 (symlink to ~/GunBot/GunBot/gunthy-gui-linux-x64)
    \_ gunthy-linx64 (symlink to ~/GunBot/GunBot/gunthy-linx64)
    \_ config.js (file)
    \_ gui-bots.json (symlink to ~/GunBot/GunBot/gui-bots.json)

Thank you Sjakil for Gunthy GUI

@caogeoge
Copy link
Author

caogeoge commented Sep 23, 2017

I hope this feature would be available soon since many of us using GunBot are running multiple instances. If you have 100 pairs in a single GunBot instance, that would mean 100 seconds for each pair to be cycled. But if you divide it up to 10 instances, it would take 10 seconds for cycling. As you know, GunBot right now is having problem with cycling pairs properly. I mean 10 seconds for cycling for each bot (this is like multi-threaded code) would make the Bot much faster in making decision to buy/sell at the exact timing. My 2 cents.

@caogeoge
Copy link
Author

This is just my suggestion. You probably already have a better way than this to implement the feature. Here I would just want to make clear how I (and many others) run multiple instances of GunBot.

@Sjakil
Copy link
Owner

Sjakil commented Oct 20, 2017

Hi caogeoge!

I hope the recent update to version 1.0 is satisfactory to your needs. It allows you to configure a maximum amount of pairs for each instance and then takes care of the rest.

Please let me know!

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

No branches or pull requests

2 participants