1inch.io Swap API using PYTHON on BSC (Binance Smart Chain)
This bot can be used to swap from One Crypto Asset to Another using 1inch Exchange and BSC (Binance Smart Chain Route)
Arbitrage Can be done using this api and further rules to set slippage and margin
Instead of using Private Key, a local mainnet can be attached to Metamask for Transaction Approval which can lead to lesser fees
Requirements
- pip install web3
- pip install --force-reinstall jsonschema==3.2.0
- pip install websocket-client
Paramters Explaination for swap
- fromTokenAddress : Contract Address of Token to swap FROM
- toTokenAddress : Contract Address of Token to swap TO
- withdrawAccount : Withdrawal Wallet Address
- destReceiver : Wallet address to receive the assets in ( Leave Blank if Withdraw Account is Same as Receiver )
- private_key : Private key of the Withdraw Wallet
- slippage : slippage % in int
- gasLimit : gas limit of to spend on transaction
- amount : Amount of asset to Swap
- gasPrice : Gas price to spend on transaction
Example Swap 1 BNB to USDT
- fromTokenAddress = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
- toTokenAddress = 0x55d398326f99059ff775485246999027b3197955
- withdrawAccount = "0xF15f243bb5xxxxxxxxxxxxxxxxxxxxxxxxxxx"
- destReceiver = 0xF15f243bb5xxxxxxxxxxxxxxxxxxxxxxxxxxx
- private_key = "18xxxxxxxb4325xxxxxxx8c9e4axxxxxxxc0b5c1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
- slippage = 5
- gasLimit = 10000000
- amount = 1
- gasPrice = 5000000000
Parameters of binance_price_tracker.py
- pair : Pair u want to track, example BNB to USDT so pair will be bnbusdt # List of pairs available on binance api documentation
For any queries email or raise a issue