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

Multiple accounts in a single instance. #32

Open
bitcoiniodev opened this issue Jun 24, 2018 · 8 comments
Open

Multiple accounts in a single instance. #32

bitcoiniodev opened this issue Jun 24, 2018 · 8 comments
Labels
enhancement New feature or request

Comments

@bitcoiniodev
Copy link

bitcoiniodev commented Jun 24, 2018

Hello Andre

The buydip strategy is rather greedy on traffic. When I need to run two bots with the same strategy what should be the steps to prevent double data loading from exchange? Could there be easy fix or complete rewrite needed?

@supershwa
Copy link
Collaborator

Hi Mike,

If you're running two bots and want to divide the traffic, you could try this:

  • Make a duplicate copy of the buydip strategy and add it to the index.js file in the strategies folder. Let's say you use "buydip1" and "buydip2" and have corresponding .js files, "buydip1.js" and "buydip2.js".
  • In the index.js file, make sure you set up "buydip1" and "buydip2" objects (just copy/paste the original buydip object).
  • Now, you will need to split up the workload between buydip1 and buydip2 strategies by assigning tokens using the targetTokens parameter, like this:
buydip1: {
    name: "Buy Dip 1",
    paperTrading: true,
    buyAmountMarket: 0.018,
    profitTarget: 1.4,
    maxLoss: 0.8,
    maxTradingPairs: 50,
    targetMarket: "BTC",
    targetTokens: ["ETH","LTC","VEN","TRX","BNB","XLM","NEO","ETC"] // half of the token list here
},
buydip2: {
    name: "Buy Dip 2",
    paperTrading: true,
    buyAmountMarket: 0.018,
    profitTarget: 1.4,
    maxLoss: 0.8,
    maxTradingPairs: 50,
    targetMarket: "BTC",
    targetTokens: ["EOS","BCC","ICX","ONT","IOTA","ADA","XMR","NANO"] // 2nd half of the token list here
}

This way, your "buydip1" strategy will cover the first half of the list of tokens you would like it to use, and the "buydip2" strategy would be the 2nd half of the list.

This would probably be the easiest way to accomplish your goal, and would require a little bit of time dedicated to creating the lists, but it should do what you need it to.

Hope it helps!

-supershwa

@andresilvasantos
Copy link
Owner

Hello Mike,

The buydip strategy is rather greedy on traffic.

Yes, the strategies that have lots of valid pairs will have high traffic consumption.
We still need to rewrite that part of the code - we open a websocket that requests a 500 candlestick data each second for each pair, instead of requesting the 500 candlestick data for the first time and open a websocket that gives us the next candlestick when it is ready. I was kinda lazy that day 😄

When I need to run two bots with the same strategy what should be the steps to prevent double data loading from exchange?

There is no double data loading right now, as we only update a pair if it is really outdated.


You can always do as @supershwa wrote, but I can't understand what would be the point to have the same strategies duplicated.

@bitcoiniodev
Copy link
Author

bitcoiniodev commented Jun 25, 2018

If the bots are working on different accounts but use the same strategy - that is the case when we need to share the candles but need 2 bots

@andresilvasantos
Copy link
Owner

For that scenario it won't be possible to share the candles, so you'll be downloading the same data twice. You can only have one account for each instance of BitProphet. That's an issue that would be cool to address in a near future.

@bitcoiniodev
Copy link
Author

- we open a websocket that requests a 500 candlestick data each second for each pair - you meant that even when strategy needs 5 minute candles they are loaded every second?

@andresilvasantos
Copy link
Owner

Sorry, what I said was wrong.

We don't load the data every second. With the websocket connection, the data is sent and loaded when there are changes to the price. So, if you request the 1h, 5m and 1m charts, as soon as the price changes, all three will receive new data (500 candlestick for each every time). The correct approach here, is to keep a single websocket open (1 candlestick of data for each update) and to update all three with the new data.

@andresilvasantos andresilvasantos changed the title Traffic consumption Traffic consumption - multiple accounts in a single instance. Jun 26, 2018
@andresilvasantos andresilvasantos added the enhancement New feature or request label Jun 26, 2018
@andresilvasantos andresilvasantos changed the title Traffic consumption - multiple accounts in a single instance. Multiple accounts in a single instance. Jun 26, 2018
@bitcoiniodev
Copy link
Author

Last night I succeeded to be "IP banned" by binance while running several other bots plus one bitprophet. Other bots worked fine during 2 month but now "1200 requests per minute" message arrived and my vds IP was blocked for short period (binance kindly sends timestamp "until" ). Also about 1TB of traffic eaten during two days )))

@andresilvasantos
Copy link
Owner

I'm running BitProphet 24/7 since March now.
I never looked at the bandwidth, but that's an issue we need to take care of.
I never got my IP banned, so, those 1200 req / min, are being probably used mostly by the other bots. The requests that count for that sum, are being done for each token for validation. If the token is not valid, it will be done again, but 15 minutes later. Other than that, those requests are being used for certain issued commands when the user interacts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants