Last active
November 14, 2024 12:25
-
-
Save oliver-zehentleitner/d55aa1ee03b7959e285c467e07eab2a4 to your computer and use it in GitHub Desktop.
Connect to Binance REST API using a SOCKS5 Proxy in Python with UNICORN Binance REST API. - How To: https://medium.lucit.tech/how-to-connect-to-binance-com-rest-api-using-python-via-a-socks5-proxy-638dbbecacfd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from unicorn_binance_rest_api import BinanceRestApiManager | |
| import logging | |
| import os | |
| socks5_proxy = "1.2.3.4:1080" | |
| socks5_ssl_verification = True | |
| if __name__ == "__main__": | |
| logging.getLogger("unicorn_binance_rest_api") | |
| logging.basicConfig(level=logging.INFO, | |
| filename=os.path.basename(__file__) + '.log', | |
| format="{asctime} [{levelname:8}] {process} {thread} {module}: {message}", | |
| style="{") | |
| ubra = BinanceRestApiManager(exchange="binance.com", | |
| socks5_proxy_server=socks5_proxy, | |
| socks5_proxy_ssl_verification=socks5_ssl_verification) | |
| klines_1m = ubra.get_historical_klines("BTCUSDT", ubra.KLINE_INTERVAL_1MINUTE, "1 day ago UTC") | |
| print(f"klines_1m:\r\n{klines_1m}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment