CyberPunkMetalHead / Binance-News-Sentiment-Bot

This is a fully functioning Binance trading bot that takes into account the news sentiment for the top 100 crypto feeds. If you like this project consider donating though the Brave browser to allow me to continuously improve the script.
MIT License
1.57k stars 290 forks source link

Error while placing order in Testnet #49

Closed AlphaNumeric99 closed 3 years ago

AlphaNumeric99 commented 3 years ago
Press Ctrl-Q to stop the script
Kraken Daily Market Report for April 25 2021
OKEx Insights + Catallact : Bitcoin Market Witness the Growth of Retail Participation as Institutional Investors Continue to Lead
Bitcoin Banned in Turkey | This Week in Crypto – Apr 26, 2021
Mercurial on crypto: Will India’s latest stance lead to positive regulation?
OneLedger Announces “Gem Hunt” Mining and Validator Competition
AMA with Harsh Rajat and Richa Joshi (EPNS): Summary
Blockchain Object Storage Company Filebase Raises $2M, Aims to Incorporate Filecoin and Arweave Networks
Why Are Athletes Demanding To Be Paid In Bitcoin?
Could not parse http://Bitcoinist.com/feed error is: unbound prefix: line 57, column 2
Unmarshal's MARSH token lists on AscendEX
A Glimpse Into The Future Of Bitcoin At $200,000
Giant American Wine Seller Now Accepts Bitcoin, Dogecoin, and Ethereum
Verifying your 2FA disable requests and other security tips from CEX.IO
Embrace the Explosion of Colors in the Festive Hot Fiesta Slot
Could not parse https://www.mycryptopedia.com/feed/ error is: mismatched tag: line 135, column 2
Ampleforth.org Airdrop Review: The FORTH token has arrived
Stellar Lumen (XLM) Price Primed For A Fresh Rally Above $0.45
XRP Price Analysis: XRP Continues To Fall As Price is Stuck In Descending Channel
Turkey’s Central Bank: Crypto Regulation Will Come In Two Weeks
Dogecoin [DOGE] Struggles Near Support Despite An Uptick of 5%
Solana Hits All-Time High Amid Market Calm
Bit-flash.biz Review: PAYING or SCAM?
Could not parse https://botsfolio.com/crypto_news/feed error is: 'NoneType' object has no attribute 'text'
Nem szeretnek adót fizetni a multik – több milliárd dollár kötött ki adóparadicsomokban
Satoshi Nakamoto Identity Case Takes a New Turn
Could not parse http://bitcoinmxn.com/feed error is: 'NoneType' object has no attribute 'text'
Crypto News Cast For April 25th 2021 ?
XRP Ripple Returns – Long ETH and XRP
OKEx Insights + Catallact : Bitcoin Market Witness the Growth of Retail Participation as Institutional Investors Continue to Lead
Bitmain Teasing With the Upcoming AntMiner E9 Ethereum Miner
Top 5 Peterborough United F.C. Forums, Discussions and Message Boards You Must Follow in 2021
Neo Price Analysis: NEO Breaks Downtrend as Bulls Target $100
Could not parse https://coinpress.io/feed/ error is: 'charmap' codec can't decode byte 0x9d in position 22517: character maps to <undefined>
More Projects joining Polygon (MATIC) amidst rising Layer-2 adoption
Apple, MicroStrategy and Microsoft Stock Tokens Are Coming To Binance
Could not parse http://www.investorideas.com/rss/feeds/iimain.xml error is: time data 'Fri, 23 Apr 2021 14:10:00 EST' does not match format '%a, %d %b %Y %H:%M:%S %z'
How to Buy Real Estate with Cryptocurrency?
Traceback (most recent call last):
  File "D:/FinanceRepos/Binance-News-Sentiment-Bot/news-analysis.py", line 473, in <module>
    buy(compiled_sentiment, headlines_analysed)
  File "D:/FinanceRepos/Binance-News-Sentiment-Bot/news-analysis.py", line 368, in buy
    test_order = client.create_test_order(symbol=coin + PAIRING, side='BUY', type='MARKET',
  File "D:\Anaconda3\envs\pyt12\lib\site-packages\binance\client.py", line 1633, in create_test_order
Time it took to parse feeds:  24.928550800000004

BUY CHECKS:
Sentiment not positive enough for XRP, or not enough headlines analysed or already bought: -0.125, 2
preparing to buy 0.001876 BTC with USDT at 53294.93000000
    return self._post('order/test', True, data=params)
  File "D:\Anaconda3\envs\pyt12\lib\site-packages\binance\client.py", line 295, in _post
    return self._request_api('post', path, signed, version, **kwargs)
  File "D:\Anaconda3\envs\pyt12\lib\site-packages\binance\client.py", line 242, in _request_api
    return self._request(method, uri, signed, **kwargs)
  File "D:\Anaconda3\envs\pyt12\lib\site-packages\binance\client.py", line 220, in _request
    kwargs['data']['signature'] = self._generate_signature(kwargs['data'])
  File "D:\Anaconda3\envs\pyt12\lib\site-packages\binance\client.py", line 175, in _generate_signature
    m = hmac.new(self.API_SECRET.encode('utf-8'), query_string.encode('utf-8'), hashlib.sha256)
AttributeError: 'NoneType' object has no attribute 'encode'

Got this error, i have the API keys as mentioned in the blog, can you tell me what might be the issue here?

Rybens92 commented 3 years ago

I have exactly the same error when API keys aren't provided to the program correctly.

How do you provide the keys? (but obviously don't share them if you want show example)

Also do you use correct ones? API keys for testnet and live are seperate, you can get them in 2 different places

AlphaNumeric99 commented 3 years ago

I only have the test keys not live keys. Let me see if environment variables are the issue here

AlphaNumeric99 commented 3 years ago

Ok so if i put the keys directly not using the os.getenv it seems to work, maybe some issue from environment setup from my side.

Rybens92 commented 3 years ago

If that would help anyone using Windows, this is a bat file I am using:

SET "binance_api_stalkbot_testnet=key" SET "binance_secret_stalkbot_testnet=key"

SET "binance_api_stalkbot_live=key" SET "binance_secret_stalkbot_live=key"

python news-analysis.py

Just replace "key" word with your API keys and save it in bot's folder