Giter Site home page Giter Site logo

cyberpunkmetalhead / binance-trading-bot-new-coins Goto Github PK

View Code? Open in Web Editor NEW
1.5K 1.5K 269.0 14 KB

This Binance trading bot detects new coins as soon as they are listed on the Binance exchange and automatically places sell and buy orders. It comes with trailing stop loss and other features. If you like this project please consider donating via Brave.

License: MIT License

Python 100.00%

binance-trading-bot-new-coins's People

Contributors

altchater avatar cinderblockgames avatar cyberpunkmetalhead avatar stevenhgs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

binance-trading-bot-new-coins's Issues

connection aborted error

Testing your code on Mac OS. I've started getting this error since yesterday. It was fine before...

('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer'))

Feedback on ILV/BNB listing

I was running in TEST mode and only got sold.json written, no order.json.

If I read it correctly, the bot sold 0.144 ILV at a price of 1.616? My buy limit was at 0.24 BNB so it should have bought way more. But maybe I am interpreting things wrong?

{
    "ILVBNB": {
        "symbol": "ILVBNB",
        "price": "1.61600000",
        "volume": 0.144,
        "time": 1632290402.621374,
        "profit": -0.07399999999999984,
        "relative_profit": -4.379
    }
}

Will run the next one in PROD mode with a small amount so that the orders and sells are actually logged.

Ran execpt block for lot_size. "TypeError: argument of type 'int' is not iterable"

New coins detected: [{'symbol': 'TRIBEBTC', 'price': '0.00002194'}, {'symbol': 'TRIBEBNB', 'price': '0.00220000'}, {'symbol': 'TRIBEBUSD', 'price': '1.09470000'}, {'symbol': 'TRIBEUSDT', 'price': '1.07700000'}]
New coin detected, but TRIBEBTC is currently in portfolio, or pairing is not USDT
New coin detected, but TRIBEBNB is currently in portfolio, or pairing is not USDT
New coin detected, but TRIBEBUSD is currently in portfolio, or pairing is not USDT
Preparing to buy TRIBEUSDT
ran exept block for lot_size
Traceback (most recent call last):
File "main.py", line 194, in
main()
File "main.py", line 153, in main
volume = convert_volume(coin, qty, price)
File "/binance/trade_client.py", line 29, in convert_volume
if coin not in lot_size:
TypeError: argument of type 'int' is not iterable

Scrapper

I make a new coin bot that uses a scrapper to gather the new coins if you want to check out it I made a comment in the discussion thread, but i notice your filter on some keywords I think you're missing some like Cross, Perpetual

QUESTION : SELL and BUY swapped?

Probably a stupid question but in the first commit the BUY block was in the end and now they are swapped.
Did the logic changed and the comments are old or am I missing something?

facing issues not working please check it there might be some issues with the import module

amanjyosMacBook:binance-trading-bot-new-coins amanjyotsingh$ python main.py
File "main.py", line 157
print(f'updated tp: {round(new_tp, 3)} and sl: {round(new_sl, 3)}')
^
SyntaxError: invalid syntax
amanjyosMacBook:binance-trading-bot-new-coins amanjyotsingh$ python3 main.py
Traceback (most recent call last):
File "/Users/amanjyotsingh/binance_api/binance-trading-bot-new-coins/main.py", line 4, in
from new_listings_scraper import *
File "/Users/amanjyotsingh/binance_api/binance-trading-bot-new-coins/new_listings_scraper.py", line 5, in
from chromedriver_py import binary_path
ModuleNotFoundError: No module named 'chromedriver_py'

No sell order created on GNO listing

Hey, buy order created this morning for GNO but no subsequent sell order was triggered. Unfortunately I don’t have any logs as I was running it in the background. Did anyone else experience this?

.

p

some insights on the recent GNOUSDT listing

hey man,
awesome stuff you're doing <3

about an hour ago GNO was listed on binance and the bot gave the following logs (I used the most recent config with RUN_EVERY: 0.025):

New coins detected: [{'symbol': 'GNOUSDT', 'price': '399.00000000'}, {'symbol': 'GNOBUSD', 'price': '408.00000000'}, {'symbol': 'GNOBNB', 'price': '0.61580000'}, {'symbol': 'GNOBTC', 'price': '0.00606900'}]
Preparing to buy GNOUSDT
3
APIError(code=-2010): Account has insufficient balance for requested action.

looking at the very 1st minute of the price, I suppose that means the bot noticed the coin rather late, i.e at a price of 399 although it was listed at 295 – correct?:
image

PS.: I "missed out" on purpose as I was just testing without any balance, so it's all fine with the APIError in line 4.

cheers

Test Net run issue

Hi,

Thanks for sharing the codes. I am trying to run the codes on Binance test net but I am getting below error:

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.binance.binance_tld', port=443): Max retries exceeded with url: /api/v3/ping (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f12e8610760>: Failed to establish a new connection: [Errno -2] Name or service not known'))

Could you please assist ? Thanks

Connection reset by peer

I continue to get an "Connection reset by peer" issue, sometimes no more than a few minutes after I start the script. Anyone else experiencing this? It's not my network that's an issue. I've tried on multiple OVH servers (Australia, Canada), I've tried on my local network. All the same.

urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "main.py", line 64, in add_updated_all_coins_to_queue
    all_coins_updated = get_all_coins()
  File "main.py", line 22, in get_all_coins
    return client.get_all_tickers()
  File "/usr/local/lib/python3.6/dist-packages/binance/client.py", line 571, in get_all_tickers
    return self._get('ticker/price', version=self.PRIVATE_API_VERSION)
  File "/usr/local/lib/python3.6/dist-packages/binance/client.py", line 371, in _get
    return self._request_api('get', path, signed, version, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/binance/client.py", line 334, in _request_api
    return self._request(method, uri, signed, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/binance/client.py", line 314, in _request
    self.response = getattr(self.session, method)(uri, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 555, in get
    return self.request('GET', url, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

Discussion around the Binance API having issues with dropping clients here - https://www.reddit.com/r/binance/comments/lzz831/requestsexceptionsconnectionerror_connection/, but nothing of use.

OSError: [Errno 8] Exec format error: '.... chromedriver_py/chromedriver_linux64'

I'm getting the following error when running the latest version on my Raspberry Pi. Not sure what's wrong with chromedriver. I've installed it, as well as selenium.

Traceback (most recent call last):
File "/root/new-coin-bot/main.py", line 4, in
from new_listings_scraper import *
File "/root/new-coin-bot/new_listings_scraper.py", line 15, in
driver = webdriver.Chrome(executable_path=binary_path, options=chrome_options)
File "/usr/local/lib/python3.9/dist-packages/selenium/webdriver/chrome/webdriver.py", line 73, in init
self.service.start()
File "/usr/local/lib/python3.9/dist-packages/selenium/webdriver/common/service.py", line 72, in start
self.process = subprocess.Popen(cmd, env=self.env,
File "/usr/lib/python3.9/subprocess.py", line 951, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.9/subprocess.py", line 1823, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/usr/local/lib/python3.9/dist-packages/chromedriver_py/chromedriver_linux64'

Error: `string indices must be integers`

I got the following error during the new listing of the GNO coin last night

New coins detected: ['symbol', 'price', 'symbol', 'price', 'symbol', 'price', 'symbol', 'price']
string indices must be integers

Any idea in which part of the script this might have occurred?

FYI: My currency was BNB with a 0.xxxx value. Are only integers allow here?

Eorror running the script

I'm having issues running the script at all. I get the FileNotFoundError: [Errno 2] No such file or directory: '/auth/auth.yml'

I'm executing via windows console just referencing the main.py:
C:\Users\usr1\Downloads\binance-trading-bot-new-coins-main\binance-trading-bot-new-coins-main/main.py

Also, I can't see what to enter on the line in auth.yml binance_tld: "BINANCE_TLD"

Cascading crash caused by API timeout

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 421, in _make_request
six.raise_from(e, None)
File "", line 3, in raise_from
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 416, in _make_request
httplib_response = conn.getresponse()
File "/usr/lib/python3.8/http/client.py", line 1344, in getresponse
response.begin()
File "/usr/lib/python3.8/http/client.py", line 307, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.8/http/client.py", line 268, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/lib/python3.8/socket.py", line 669, in readinto
return self._sock.recv_into(b)
File "/usr/lib/python3/dist-packages/urllib3/contrib/pyopenssl.py", line 326, in recv_into
raise timeout("The read operation timed out")
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 439, in send
resp = conn.urlopen(
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 719, in urlopen
retries = retries.increment(
File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 400, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/lib/python3/dist-packages/six.py", line 703, in reraise
raise value
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 665, in urlopen
httplib_response = self._make_request(
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 423, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 330, in _raise_timeout
raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.binance.com', port=443): Read timed out. (read timeout=10)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "main.py", line 194, in
main()
File "main.py", line 137, in main
new_coins, all_coins_recheck = get_new_coins(all_coins)
File "main.py", line 27, in get_new_coins
all_coins_recheck = get_all_coins()
File "main.py", line 20, in get_all_coins
return client.get_all_tickers()
File "/home//.local/lib/python3.8/site-packages/binance/client.py", line 437, in get_all_tickers
return self._get('ticker/price', version=self.PRIVATE_API_VERSION)
File "/home/
/.local/lib/python3.8/site-packages/binance/client.py", line 237, in _get
return self._request_api('get', path, signed, version, kwargs)
File "/home/
/.local/lib/python3.8/site-packages/binance/client.py", line 202, in _request_api
return self._request(method, uri, signed, kwargs)
File "/home/
/.local/lib/python3.8/site-packages/binance/client.py", line 196, in _request
self.response = getattr(self.session, method)(uri, **kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 546, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 529, in send
raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='api.binance.com', port=443): Read timed out. (read timeout=10)

Trailing stop loss on spot trade?

Forgive me if I'm wrong here. I'm seeing a few issues mentioning the sell order not executing. Could this be because you are setting a trailing stop-loss order on a spot trade?

Natively Binance only allows for TSL on futures. On spot trades, you can set limit or stop-loss orders but not of the trailing type.

Also just confirming that the json files are created when the script finds a new coin and executes. I don't see the json files but do see the references within the executed functions.

Where did the frequency function go? Looks like we have no control of the API call frequency anymore.

Thanks

recent XEC/USDT trade feedback

Hi, I'm new here. Just made my GitHub account for this. I really liked your project and would love to contribute with some feedback to it.

My bot is live with real currency. No test mode.
It didn't worked properly with the GNO, because of a too low buying amount - 10$, upped it to 12$
So here is my experience with the latest XEC/USDT:

Over the recent days I got "connection aborted" issues and changed the (RUN_EVERY:) from 0.025 to 0.04 and then again to 0.05
Other configurations are SL: 8 TP: 3
Today the bot managed to buy XEC rather later at 0.00027900. It was listed at 0.00022961.
I got some 'volume' spam in terminal and decided to sell it manually at 0.00025740

What is that 'volume' thing spam? I got it, it's the unfinished order. Deleted it.

list index out of range

I am getting this error for some reason:

user@instance-3:~/binance-trading-bot-new-coins$ python3 main.py
working...
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.9/threading.py", line 892, in run
    self._target(*self._args, **self._kwargs)
  File "/home/tkcartofficial/binance-trading-bot-new-coins/new_listings_scraper.py", line 70, in search_and_update
    latest_coin = get_last_coin()
  File "/home/tkcartofficial/binance-trading-bot-new-coins/new_listings_scraper.py", line 34, in get_last_coin
    uppers = ''.join(item[1] for item in enum if item[1].isupper() and (enum[enum.index(item)+1][1].isupper() or enum[enum.index(item)+1][1]==' ' or enum[enum.index(item)+1][1]==')') )
  File "/home/tkcartofficial/binance-trading-bot-new-coins/new_listings_scraper.py", line 34, in <genexpr>
    uppers = ''.join(item[1] for item in enum if item[1].isupper() and (enum[enum.index(item)+1][1].isupper() or enum[enum.index(item)+1][1]==' ' or enum[enum.index(item)+1][1]==')') )
IndexError: list index out of range

Error on buy order

The script found the new coin but returned this error - trying a real purchase not a test:
New coins detected: [{'symbol': 'ILVUSDT', 'price': '587.00000000'}, {'symbol': 'ILVBUSD', 'price': '598.00000000'}, {'symbol': 'ILVBNB', 'price': '1.74000000'}, {'symbol': 'ILVBTC', 'price': '0.01580000'}]
Preparing to buy ILVUSDT
3
APIError(code=-1021): Timestamp for this request is outside of the recvWindow.
New coin detected, but ILVBUSD is currently in portfolio, or USDT does not match
New coin detected, but ILVBNB is currently in portfolio, or USDT does not match
New coin detected, but ILVBTC is currently in portfolio, or USDT does not match

APIError(code=-1121): Invalid symbol.

Hi!

I got this error when trying to buy the new coin listed.
"New coins detected: [{'symbol': 'GALAUSDT', 'price': '0.05380000'}, {'symbol': 'GALABUSD', 'price': '0.05300000'}, {'symbol': 'GALABNB', 'price': '0.00013000'}, {'symbol': 'GALABTC', 'price': '0.00000123'}]
Preparing to buy GALAUSDT
Traceback (most recent call last):
File "D:\BinanceBot\auth\main.py", line 188, in
main()
File "D:\BinanceBot\auth\main.py", line 148, in main
price = get_price(coin['symbol'], pairing)
File "D:\BinanceBot\auth\main.py", line 33, in get_price
return client.get_ticker(symbol=coin+pairing)['lastPrice']
File "C:\Python39\lib\site-packages\binance\client.py", line 1185, in get_ticker
return self._get('ticker/24hr', data=params, version=self.PRIVATE_API_VERSION)
File "C:\Python39\lib\site-packages\binance\client.py", line 371, in _get
return self._request_api('get', path, signed, version, **kwargs)
File "C:\Python39\lib\site-packages\binance\client.py", line 334, in _request_api
return self._request(method, uri, signed, **kwargs)
File "C:\Python39\lib\site-packages\binance\client.py", line 315, in _request
return self._handle_response(self.response)
File "C:\Python39\lib\site-packages\binance\client.py", line 324, in _handle_response
raise BinanceAPIException(response, response.status_code, response.text)
binance.exceptions.BinanceAPIException: APIError(code=-1121): Invalid symbol."

Do you know why this happened and how to solve it?

main.zip

GALAUSDT listing 13/09 feedback

Anyone have any joy with this using the latest margin script? Looks like mine traded -6.146 (good) in test mode.

@CyberPunkMetalHead can you confirm which wallet the USDT needs to be in on our binance accounts, is it ok in the spot wallet or should we move to a specific margin wallet to execute the trades now?

Killed my account

Hello,

Just want you to know that your bot, in less than an hour, emptied all my account (25k usd) by burning fees in thousands of trades.
Thank you

Not sure if the bot is working properly.

I had to make some changes to a couple bits of code since it kept throwing errors and now I have it running but I am not sure if it"s working properly.
Currently all I see is the image below being returned constantly, with varying values for 'time to get updated list of coins:' and 'current amount of threads:'.
Cryptobotproblem

Please let me know if I have to make any changes :)

Update code?

Was wondering if anyone has the new code which sells high, and then buys low?

running getting this issus on rpi4

python3 main.py
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 159, in _new _conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 57, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/usr/lib/python3.7/socket.py", line 748, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 343, in _make_request
self._validate_conn(conn)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 841, in _validate_conn
conn.connect()
File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 301, in conn ect
conn = self._new_conn()
File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 168, in _new _conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnecti on object at 0xb555db10>: Failed to establish a new connection: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 398, in incr ement
raise MaxRetryError(pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.binance.binance
tld', port=443): Max retries exceeded with url: /api/v3/ping (Caused by NewConne ctionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xb555db10>: F ailed to establish a new connection: [Errno -2] Name or service not known'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "main.py", line 1, in
from trade_client import *
File "/home/pi/bot/trade_client.py", line 3, in
client = load_binance_creds('auth/auth.yml')
File "/home/pi/bot/auth/binance_auth.py", line 11, in load_binance_creds
return Client(api_key = auth['binance_api'], api_secret = auth['binance_secr et'], tld = "com" if 'binance_tld' not in auth else auth['binance_tld'])
File "/home/pi/.local/lib/python3.7/site-packages/binance/client.py", line 300 , in init
self.ping()
File "/home/pi/.local/lib/python3.7/site-packages/binance/client.py", line 526 , in ping
return self._get('ping', version=self.PRIVATE_API_VERSION)
File "/home/pi/.local/lib/python3.7/site-packages/binance/client.py", line 371 , in _get
return self._request_api('get', path, signed, version, **kwargs)
File "/home/pi/.local/lib/python3.7/site-packages/binance/client.py", line 334 , in _request_api
return self._request(method, uri, signed, **kwargs)
File "/home/pi/.local/lib/python3.7/site-packages/binance/client.py", line 314 , in _request
self.response = getattr(self.session, method)(uri, **kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 546, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in reque st
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.binance.binan ce_tld', port=443): Max retries exceeded with url: /api/v3/ping (Caused by NewCo nnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xb555db10> : Failed to establish a new connection: [Errno -2] Name or service not known'))

Possible too frequent polling of the API

I now get this error using a unique API key:

HTTPSConnectionPool(host='api.binance.com', port=443): Read timed out. (read timeout=10)
HTTPSConnectionPool(host='api.binance.com', port=443): Read timed out. (read timeout=10)
HTTPSConnectionPool(host='api.binance.com', port=443): Read timed out. (read timeout=10)
HTTPSConnectionPool(host='api.binance.com', port=443): Read timed out. (read timeout=10)
HTTPSConnectionPool(host='api.binance.com', port=443): Read timed out. (read timeout=10)
HTTPSConnectionPool(host='api.binance.com', port=443): Read timed out. (read timeout=10)
HTTPSConnectionPool(host='api.binance.com', port=443): Read timed out. (read timeout=10)
HTTPSConnectionPool(host='api.binance.com', port=443): Read timed out. (read timeout=10)

It resolves upon app restart.

Thus if this is a temporary block of the API key due to too frequent polling I suggest either/both of these:

  1. Restart the app once this error shows up
  2. Poll less frequently - what is the safe polling frequency if the default 0.025 is the culprit

Feature Request - Order Max instead of Qty of Coins

Since you don't know the coin list price, it is hard to estimate how many coins to buy per the config. One thing I do know is what I am willing to wager. Why not add a flag to set an order maximum? That way I could say buy $100 regardless of the quantity being bought.

calling yaml.load() without Loader=... is deprecated

Hi Andrei,

Thanks a lot for your code and videos :)

when i executed the main.py i got below error. could you please help me here.

I downloaded the file from --> https://github.com/CyberPunkMetalHead/binance-trading-bot-new-coins

Hope this the latest code.

After download i only changed binance_tld: to "COM"

Error as below:

C:\Anaconda\envs\api_test\lib\site-packages\dateparser\conf.py:45: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
cls.yaml_data = load_yaml(data).pop('settings', {})
C:\Anaconda\envs\api_test\lib\site-packages\dateparser\languages\loader.py:38: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
data = load_yaml(data)
Traceback (most recent call last):
File "main.py", line 4, in
from new_listings_scraper import *
File "C:\ADM\Test_binance\binance-trading-bot-new-coins-main\binance-trading-bot-new-coins-main\new_listings_scraper.py", line 10, in
from send_notification import *
File "C:\ADM\Test_binance\binance-trading-bot-new-coins-main\binance-trading-bot-new-coins-main\send_notification.py", line 4, in
config = load_config('config.yml')
File "C:\ADM\Test_binance\binance-trading-bot-new-coins-main\binance-trading-bot-new-coins-main\load_config.py", line 5, in load_config
return yaml.load(file, Loader=yaml.FullLoader)
File "C:\Anaconda\envs\api_test\lib\site-packages\yaml_init
.py", line 114, in load
return loader.get_single_data()
File "C:\Anaconda\envs\api_test\lib\site-packages\yaml\constructor.py", line 49, in get_single_data
node = self.get_single_node()
File "C:\Anaconda\envs\api_test\lib\site-packages\yaml\composer.py", line 36, in get_single_node
document = self.compose_document()
File "C:\Anaconda\envs\api_test\lib\site-packages\yaml\composer.py", line 55, in compose_document
node = self.compose_node(None, None)
File "C:\Anaconda\envs\api_test\lib\site-packages\yaml\composer.py", line 84, in compose_node
node = self.compose_mapping_node(anchor)
File "C:\Anaconda\envs\api_test\lib\site-packages\yaml\composer.py", line 127, in compose_mapping_node
while not self.check_event(MappingEndEvent):
File "C:\Anaconda\envs\api_test\lib\site-packages\yaml\parser.py", line 98, in check_event
self.current_event = self.state()
File "C:\Anaconda\envs\api_test\lib\site-packages\yaml\parser.py", line 439, in parse_block_mapping_key
"expected , but found %r" % token.id, token.start_mark)
yaml.parser.ParserError: while parsing a block mapping
in "config.yml", line 2, column 3
expected , but found ''
in "config.yml", line 18, column 22

No such file or directory: 'auth/auth.yml'

root@DietPi-Pi-119:~# python3 ~/new-coin-bot/main.py Traceback (most recent call last): File "/root/new-coin-bot/main.py", line 1, in <module> from trade_client import * File "/root/new-coin-bot/trade_client.py", line 3, in <module> client = load_binance_creds('auth/auth.yml') File "/root/new-coin-bot/auth/binance_auth.py", line 8, in load_binance_creds with open(file) as file: FileNotFoundError: [Errno 2] No such file or directory: 'auth/auth.yml'

So, there is actually a file there. If I execute: nano ~/new-coin-bot/auth/auth.yml I get the contents of that file.
What's happening here, why doesn't it see the auth file?

Not a valid margin pair (FIDA Listing)

New coins detected: [{'symbol': 'FIDABTC', 'price': '0.00013610'}]
New coin detected, but FIDABTC is currently in portfolio, or USDT does not match
New coins detected: [{'symbol': 'FIDAUSDT', 'price': '6.68000000'}, {'symbol': 'FIDABUSD', 'price': '6.78000000'}, {'symbol': 'FIDABNB', 'price': '0.01866000'}]
Preparing to buy FIDAUSDT
1
APIError(code=-3028): Not a valid margin pair.

ModuleNotFoundError

Hi, so I'm new to python, and i am getting ModuleNotFoundError for the from trade_client import * . I have been googling for a couple hours and have not been able to fix it. Would appreciate any help. Thanks

pycharm64_2021-09-04_21-46-44

pycharm64_2021-09-04_21-45-04

several error logs of the last few days

hey, just FYI:

config.yml:
RUN_EVERY: 0.3 (I understood this doesn't matter anymore?)
TEST: True

log #1:

working...
HTTPSConnectionPool(host='api.binance.com', port=443): Max retries exceeded with url: /api/v3/ticker/price (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001A023CD9C10>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))
HTTPSConnectionPool(host='api.binance.com', port=443): Max retries exceeded with url: /api/v3/ticker/price (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001A023CD9D90>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))
HTTPSConnectionPool(host='api.binance.com', port=443): Max retries exceeded with url: /api/v3/ticker/price (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001A023CD9C10>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))
HTTPSConnectionPool(host='api.binance.com', port=443): Max retries exceeded with url: /api/v3/ticker/price (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001A023CD9D90>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))
...

log #2:

working...
HTTPSConnectionPool(host='api.binance.com', port=443): Read timed out. (read timeout=10)
HTTPSConnectionPool(host='api.binance.com', port=443): Max retries exceeded with url: /api/v3/ticker/price (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001E9D7DC9520>, 'Connection to api.binance.com timed out. (connect timeout=10)'))
HTTPSConnectionPool(host='api.binance.com', port=443): Max retries exceeded with url: /api/v3/ticker/price (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x000001E9D7DC68B0>, 'Connection to api.binance.com timed out. (connect timeout=10)'))
...

log #3:

working...
HTTPSConnectionPool(host='api.binance.com', port=443): Read timed out. (read timeout=10)
APIError(code=0): Invalid JSON error message from Binance: <html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->

HTTPSConnectionPool(host='api.binance.com', port=443): Read timed out. (read timeout=10)
HTTPSConnectionPool(host='api.binance.com', port=443): Read timed out. (read timeout=10)
...

Connection reset by peer

When running the program for a while, me and a friend of mine keeps getting ConnectionResetError(54, 'Connection reset by peer') error. Apparently, this is because the Client times out after a while.

Unexpected messages when running main.py

This is the status that was printed in the terminal and I am not sure it is entirely sensible. The account where the API key lives did not and does not hold any balance in the coins named below:

New coins detected: [{‘symbol’: ‘FORUSDT’, ‘price’: ‘0.12880000’}, {‘symbol’: ‘REQUSDT’, ‘price’: ‘0.40160000’}, {‘symbol’: ‘GHSTUSDT’, ‘price’: ‘2.35000000’}, {‘symbol’: ‘TRURUB’, ‘price’: ‘50.00000000’}, {‘symbol’: ‘FISBRL’, ‘price’: ‘11.93000000’}] New coin[‘symbol’] detected, but FORUSDT is currently in portfolio New coin[‘symbol’] detected, but REQUSDT is currently in portfolio New coin[‘symbol’] detected, but GHSTUSDT is currently in portfolio New coin[‘symbol’] detected, but TRURUB is currently in portfolio New coin[‘symbol’] detected, but FISBRL is currently in portfolio

It also appears that the variable symbol should have been populated.

IndentationError: expected an indented block

Traceback (most recent call last):
File "main.py", line 1, in
from trade_client import *
File "/home/nathan/binance/trade_client.py", line 4
"""Converts the volume given in QUANTITY from USDT to the each coin's volume"""
^
IndentationError: expected an indented block

issue when running main.py

getaddrinfo failed

I am quite new to python so please forgive what could be an easy fix. Based in Australia if that makes a difference.

From my research, getaddrinfo is an error that occurs when you try to make an API call but a connection cannot be made. There seem to be a few causes:

A) intermittent internet issues (I have none)
B) A proxy messing things up (which I do not use)
C) Hosts driver in system32 has a definition mismatch (nothing defined in there for me)

I have no idea why this issue is being cause but is there any chance someone could help me with a workaround for this?

Thanks

`"C:\Users\antho\Virtualenv Environment\Scripts\python.exe" C:/Users/antho/PycharmProjects/binance-trading-bot-new-coins-5/main.py
Traceback (most recent call last):
File "C:\Users\antho\Virtualenv Environment\lib\site-packages\urllib3\connection.py", line 169, in _new_conn
conn = connection.create_connection(
File "C:\Users\antho\Virtualenv Environment\lib\site-packages\urllib3\util\connection.py", line 73, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "C:\Users\antho\AppData\Local\Programs\Python\Python39\lib\socket.py", line 954, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\antho\Virtualenv Environment\lib\site-packages\urllib3\connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "C:\Users\antho\Virtualenv Environment\lib\site-packages\urllib3\connectionpool.py", line 382, in _make_request
self._validate_conn(conn)
File "C:\Users\antho\Virtualenv Environment\lib\site-packages\urllib3\connectionpool.py", line 1010, in _validate_conn
conn.connect()
File "C:\Users\antho\Virtualenv Environment\lib\site-packages\urllib3\connection.py", line 353, in connect
conn = self._new_conn()
File "C:\Users\antho\Virtualenv Environment\lib\site-packages\urllib3\connection.py", line 181, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x0000022EDC0479A0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\antho\Virtualenv Environment\lib\site-packages\requests\adapters.py", line 439, in send
resp = conn.urlopen(
File "C:\Users\antho\Virtualenv Environment\lib\site-packages\urllib3\connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "C:\Users\antho\Virtualenv Environment\lib\site-packages\urllib3\util\retry.py", line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.binance.binance_tld', port=443): Max retries exceeded with url: /api/v3/ping (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000022EDC0479A0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\antho\PycharmProjects\binance-trading-bot-new-coins-5\main.py", line 1, in
from trade_client import *
File "C:\Users\antho\PycharmProjects\binance-trading-bot-new-coins-5\trade_client.py", line 3, in
client = load_binance_creds('auth/auth.yml')
File "C:\Users\antho\PycharmProjects\binance-trading-bot-new-coins-5\auth\binance_auth.py", line 11, in load_binance_creds
return Client(api_key = auth['binance_api'], api_secret = auth['binance_secret'], tld = "com" if 'binance_tld' not in auth else auth['binance_tld'])
File "C:\Users\antho\Virtualenv Environment\lib\site-packages\binance\client.py", line 300, in init
self.ping()
File "C:\Users\antho\Virtualenv Environment\lib\site-packages\binance\client.py", line 526, in ping
return self._get('ping', version=self.PRIVATE_API_VERSION)
File "C:\Users\antho\Virtualenv Environment\lib\site-packages\binance\client.py", line 371, in _get
return self._request_api('get', path, signed, version, **kwargs)
File "C:\Users\antho\Virtualenv Environment\lib\site-packages\binance\client.py", line 334, in _request_api
return self._request(method, uri, signed, **kwargs)
File "C:\Users\antho\Virtualenv Environment\lib\site-packages\binance\client.py", line 314, in _request
self.response = getattr(self.session, method)(uri, **kwargs)
File "C:\Users\antho\Virtualenv Environment\lib\site-packages\requests\sessions.py", line 555, in get
return self.request('GET', url, **kwargs)
File "C:\Users\antho\Virtualenv Environment\lib\site-packages\requests\sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\antho\Virtualenv Environment\lib\site-packages\requests\sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "C:\Users\antho\Virtualenv Environment\lib\site-packages\requests\adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.binance.binance_tld', port=443): Max retries exceeded with url: /api/v3/ping (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000022EDC0479A0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

Process finished with exit code 1
`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.