JeeZues / TradeBot

GNU General Public License v3.0
4 stars 4 forks source link

Alternate Pair Order based on number of signals from 3Commas #1

Closed derrey closed 3 years ago

derrey commented 3 years ago

Is it posable for you to pull, evaluate, and use the data from 3C on all the signals from BPT's history to sort the pairs that should be opened next? This shows the last 1000 trades from - BlockParty - Futures Sniper - Futures Signals on 3Commas. (Although 24hrs delayed) https://3commas.io/public/api/ver1/marketplace/195/signals?limit=1000 Using the 3C API - https://github.com/3commas-io/3commas-official-api-docs/blob/master/marketplace_api.md GET /ver1/marketplace/{item_id}/signals The marketplace id for BlockParty = 195 You can pull all the past signals and figure out what ones are getting the most. I don't think that the other info from 3C is very valuable as they show losses so they don't take into consideration the strategy of DCA.

JeeZues commented 3 years ago

Hi @derrey,

Currently the code supports (by default) starting bots in the order of what made you the most profit or randomly. I was considering allowing the user to load a hardcoded list of start priority but never got to it. I this the above might be used to generate such a list in, maybe, a standalone script. That said, I have a feeling historic data in this case might not be a very good indicator of future performance. We are simply relying to a small volatility of price and most move with BTC anyways. Feel free to create a pull request against the code or suggest a new script to generate such a list :)

derrey commented 3 years ago

Thanks for your reply. I think that if you had the hardcoded list, that would work. I think that using some historical data may help with knowing what coins are getting the most requests at the moment so that you can open and close more deals based on those coins.

derrey commented 3 years ago

One thing that I forgot to mention is that When you have a lot of bots running it is easier to change the pairs of existing bots... when you do that your other option of taking the ones with the most profit never let the new pairs get a chance to open. That is the main reason I think it is important to have some other method of sorting the next open. I have some bot ID's that have been running for a long time with good and bad pairs... but have a lot of profit.. so they always open.

JeeZues commented 3 years ago

Hi @derrey, I added 2 new arguments to the script based on your suggestion.You can now specify your top pairs to start in a specific order, e.g. --my_top_pairs SRM HNT FTM AAVE

You can also rely on the number of signals the bot is getting using the following argument flag: --signal_top_pairs

The 2nd option is what you are looking for. You can prefix your own top list as well. Hopefully this does what you are looking for.

If you have sometime I would appreciate if you run with those new option(s) and see if they are performing as expected before letting me know so I can release the code to others and close this issue.

Thanks again for the great suggestion and keep them coming :) JZ

derrey commented 3 years ago

Hi @JeeZues , Thanks for working on the items. I will test them out. One thing that I noticed is that when pulling the records from the 3C API you are only pulling the last 1000 signals. That will not cover much. You should loop through that a few times using the offset parameter as I don't think that the 1000 records will be for the last day. I think from my last few test with that data, each day had over 3000+ signals. Do you think this will have any performance issues when the script is updating the bots every 10 sec or so? Maybe have them cached locally and only pull once an hour rather than every cycle ... i.e. 10 sec. Also, if it was cached you can use the same cache for multiple scripts... i.e. If you have 20 futures accounts running and have each pulling the 3C data for each every 10 sec... that would be a lot.

derrey commented 3 years ago

@JeeZues , maybe have the code for pulling the 3C data pulled out into a separate script that runs every 15 Min and creates the json file of all the pars sorted by highest signals in the last 24hrs? Then all the scripts can pull the same data and not slow down the system.

JeeZues commented 3 years ago

Hey @derrey, As always, thanks for the feedback. I didn't know how much data would be enough to give a good idea of top pairs. I'll modify it to pull few more pages. We can adjust it after the logic is there. Currently this data is only pooled once the script is started. I have a feeling we will eventually get banned if we keep on pushing the APIs. and I think 10 seconds is too frequent :) Adding a separate script is a good idea, but asking people to run separate scripts will result in confusion, not everyone knows what they are doing like you... I think I will cache the data and refresh it every hour inside the script. It's kind of a hack but the whole thing kind is!

JeeZues commented 3 years ago

https://github.com/JeeZues/TradeBot/commit/22bce029cfe2d2e16f7d56f3291c597b2ce12543 we now pull 5000 signal records every 1 hour.

derrey commented 3 years ago

--my_top_pairs SRM HNT FTM AAVE

You can also rely on the number of signals the bot is getting using the following argument flag: --signal_top_pairs

are the 2 options exclusive or can they be used together? I am just testing 50 pairs now.

JeeZues commented 3 years ago

--my_top_pairs SRM HNT FTM AAVE You can also rely on the number of signals the bot is getting using the following argument flag: --signal_top_pairs

are the 2 options exclusive or can they be used together? I am just testing 50 pairs now. They can be used together. "my_top_pairs" take priority To see the list that is generated use the --debug argument

derrey commented 3 years ago

@JeeZues things are looking good with the last update. Once question is how you pick the bots to turn off. I would have thought that it would turn off in reverse order based on the same formulas.. but it looks a bit different than expected. I was expecting something other than USDT_BEL to be shut off as it was selected in the batch just before. They all ran within 2-3 mins.

Last ones to load: image Ones disabled next run: image

derrey commented 3 years ago

2nd disable: image

1st enable: image

2nd enable: image

JeeZues commented 3 years ago

I think the stopping currently has no specific order... I'll take a look at the code in a bit to see if it is an easy change...

JeeZues commented 3 years ago

Now stopping in reverse order. I reduced the refresh of the list to every 3 hours, shouldn't change much and reduces the load.

derrey commented 3 years ago

Now stopping in reverse order. I reduced the refresh of the list to every 3 hours, shouldn't change much and reduces the load.

Ok. I have 2 accounts running both with 50 pairs. 2 servers running - 1 primary and 1 backup. I do notice a much longer load time between runs. Did you change something at the load section? Did you notice it as well? I have not been able to test the pairs loading from the 3C.... but will keep an eye on it. Did you have an issue with performance when loading the 3C data and set to 3hrs?

I have tested the load and unload of the bots. That seems to work well now.

image

image

JeeZues commented 3 years ago

Load time is longer on the first run since it's caching the signals from 3C. I think it took around 20 second extra bit after that it seemed normal. Till it has to load then again in 3h. I do need to look at which functions are taking long and try to optimize them but I think most of the time is waiting for APIs...

derrey commented 3 years ago

I think that the new changes work very well with the open and close. I will close this case for now. Thanks again for such quick and great work. :)