Coder Social home page Coder Social logo

yaqub0r / limitswap Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cryptognome/limitswap

6.0 6.0 4.0 986 KB

LimitSwap is fully functional DeFi Trading Bot. No fees. You just need to hold LIMIT Utility token in your wallet to use.

Home Page: https://www.limitswap.com/

Python 99.79% Dockerfile 0.21%

limitswap's People

Contributors

cryptognome avatar gradyd avatar nathan31337 avatar prt1999 avatar tsarbuig avatar vlameiras avatar yaqub0r avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

limitswap's Issues

SELL is not triggered anymore

SELL is not triggered anymore

image

On pancake :

  {

    "ENABLED": "true",

    "SYMBOL": "CAKE",
    "ADDRESS": "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", 
    "BUYAMOUNTINBASE": "0.0005",
    "BUYPRICEINBASE":  "0",
    "SELLPRICEINBASE": "5",
    "STOPLOSSPRICEINBASE": "0",

    "SLIPPAGE": "49",

    "MAXTOKENS": "20",
    "MOONBAG": "0",

    "RUGDOC_CHECK": "false",
    "BUYAFTER_XXX_SECONDS": "0",    
    "MAX_FAILED_TRANSACTIONS_IN_A_ROW": "2",    
    
    "LIQUIDITYCHECK": "false",
    "LIQUIDITYAMOUNT": "1.5",
    "LIQUIDITYINNATIVETOKEN": "true",
    "USECUSTOMBASEPAIR": "false",
    "BASESYMBOL": "WETH",
    "BASEADDRESS": "0xc778417e063141139fce010982780140aa0cd5ab",

    "SELLAMOUNTINTOKENS": "0.0005",
    "HASFEES": "false",
    "GAS": "6",
    "BOOSTPERCENT": "30",
    "GASLIMIT": "1000000",
    "GASPRIORITY_FOR_ETH_ONLY": "2.5"

  }
]```

error when not enough liquidity

on ETH Rinkeby

[
  {

    "ENABLED": "true",

    "SYMBOL": "UNI",
    "ADDRESS": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", 
    "BUYAMOUNTINBASE": "0.0005",
    "BUYPRICEINBASE":  "10",
    "SELLPRICEINBASE": "0.5",
    "STOPLOSSPRICEINBASE": "0",

    "SLIPPAGE": "49",

    "MAXTOKENS": "20",
    "MOONBAG": "0",

    "RUGDOC_CHECK": "false",
    "BUYAFTER_XXX_SECONDS": "0",    
    "MAX_FAILED_TRANSACTIONS_IN_A_ROW": "2",    
    
    "LIQUIDITYCHECK": "false",
    "LIQUIDITYAMOUNT": "1.5",
    "LIQUIDITYINNATIVETOKEN": "true",
    "USECUSTOMBASEPAIR": "true",
    "BASESYMBOL": "WETH",
    "BASEADDRESS": "0xc778417e063141139fce010982780140aa0cd5ab",

    "SELLAMOUNTINTOKENS": "0.0005",
    "HASFEES": "false",
    "GAS": "6",
    "BOOSTPERCENT": "30",
    "GASLIMIT": "1000000",
    "GASPRIORITY_FOR_ETH_ONLY": "2.5"

  }
]

ERROR: 2021-12-17 09:58:05,710 execution reverted: UniswapV2Library: INSUFFICIENT_LIQUIDITY
Traceback (most recent call last):
  File "/Users/ceciliavaury/Downloads/LimitSwap-last/LimitSwapyak.py", line 2369, in run
    quote = check_price(inToken, outToken, token['SYMBOL'], token['BASESYMBOL'],
  File "/Users/ceciliavaury/Downloads/LimitSwap-last/LimitSwapyak.py", line 1288, in check_price
    price_check = routerContract.functions.getAmountsOut(1 * DECIMALS, [inToken, weth, outToken]).call()[-1]
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/web3/contract.py", line 959, in call
    return call_contract_function(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/web3/contract.py", line 1503, in call_contract_function
    return_data = web3.eth.call(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/web3/module.py", line 57, in caller
    result = w3.manager.request_blocking(method_str,
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/web3/manager.py", line 187, in request_blocking
    return self.formatted_response(response,
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/web3/manager.py", line 167, in formatted_response
    apply_error_formatters(error_formatters, response)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/web3/manager.py", line 67, in apply_error_formatters
    formatted_resp = pipe(response, error_formatters)
  File "cytoolz/functoolz.pyx", line 667, in cytoolz.functoolz.pipe
  File "cytoolz/functoolz.pyx", line 642, in cytoolz.functoolz.c_pipe
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/web3/_utils/method_formatters.py", line 569, in raise_solidity_error_on_revert

idea : make the bot buys after price has moved, to handle "Open Trading" function

nowadays, lots of token launches work this way :

  • team adds liquidity
  • but trading in enabled a little moment after, with Open Trading function

So our bot tries to buy, and order fails.
The difficulty is that there are many ways to do so.

--> a user gave me this idea : make the bot buys after price has moved

we could :

  • store the initial price after liquidity is added
  • and make the bot buys after price has moved (down of up)

We could create a new parameter for that : "WAIT_FOR_PRICE_MOVEMENT"

checksum on addresses

liquidity check does a checksum on the address. We should do this when loading tokens and store that information.

idea: token.json

add a shortcut key to learn the new settings in tokens.json so it will only change focus when the shortcut is triggered

Bot slowing down when no token available

2021-12-20 23:12:15.919345 Checking Approval Status 0x0000000000000000000000000000000000000
2021-12-20 23:12:16.083242 ---------------------------------------------------------------------------
2021-12-20 23:12:16.083286 You need to APPROVE this token before selling it : LimitSwap will do it now
2021-12-20 23:12:16.083311 ---------------------------------------------------------------------------
2021-12-20 23:12:16.083338 Approving 0x0000000000000000000000000000000000000
Estimating Gas Cost Using Web3
Current Gas Price = 6.0
2021-12-20 23:12:17.020403 Transaction Hash = 0x0000000000000000000000000000000000000
2021-12-20 23:12:17.021661 Checking for transaction confirmation (waiting 60 seconds)...
2021-12-20 23:12:24.210646 Transaction was successful with a status code of 1
2021-12-20 23:12:24.210684 ---------------------------------------------------------
2021-12-20 23:12:24.210698 Token is now approved : LimitSwap can sell this token True
2021-12-20 23:12:24.210710 ---------------------------------------------------------
2021-12-20 23:12:24.210747 ENTER: calculate_gas()
2021-12-20 23:12:24.210765 EXIT: calculate_gas()
2021-12-20 23:12:24.374769 ENTER: check_balance()
2021-12-20 23:12:24.703731 Current Wallet Balance is: 24246.1042588 RAINM/WBNB
2021-12-20 23:12:24.703791 EXIT: check_balance()
2021-12-20 23:12:26.001818 Transaction Hash = 0x0000000000000000000000000000000000000
2021-12-20 23:12:26.002979 Checking for transaction confirmation (waiting 60 seconds)..
2021-12-20 23:12:31.196335 Transaction was rejected by contract with a status code of 0
2021-12-20 23:12:31.196530 ----------------------------------
2021-12-20 23:12:31.196558 SUCCESS : your Tx is confirmed
2021-12-20 23:12:31.196573 ----------------------------------
2021-12-20 23:12:31.196587 We have sold our position in RAINM/WBNB DISABLING this token.
2021-12-20 23:12:31.196604 ENTER: check_balance()
2021-12-20 23:12:31.525273 Current Wallet Balance is: 24246.1042588 RAINM/WBNB
2021-12-20 23:12:31.525332 EXIT: check_balance()
2021-12-20 23:12:31.525409 Bot is moving way too fast for a public node. Slowing down to approximately 10 queries per second.
2021-12-20 23:12:32.156555 Bot is still moving too fast for a public node. Slowing down a bit more.
2021-12-20 23:12:32.332330 Bot is still moving too fast for a public node. Slowing down a bit more.
2021-12-20 23:12:32.533309 Bot is still moving too fast for a public node. Slowing down a bit more.
2021-12-20 23:12:32.709064 Bot is still moving too fast for a public node. Slowing down a bit more.
2021-12-20 23:12:32.884784 Bot is still moving too fast for a public node. Slowing down a bit more.
2021-12-20 23:12:33.085664 Bot is still moving too fast for a public node. Slowing down a bit more.
2021-12-20 23:12:33.261414 Bot is still moving too fast for a public node. Slowing down a bit more.
2021-12-20 23:12:33.437199 Bot is still moving too fast for a public node. Slowing down a bit more.
2021-12-20 23:12:33.638043 Bot is still moving too fast for a public node. Slowing down a bit more.
2021-12-20 23:12:33.813791 Bot is still moving too fast for a public node. Slowing down a bit more.
2021-12-20 23:12:33.989567 Bot is still moving too fast for a public node. Slowing down a bit more.
2021-12-20 23:12:34.190426 Bot is still moving too fast for a public node. Slowing down a bit more.
2021-12-20 23:12:34.366225 Bot is still moving too fast for a public node. Slowing down a bit more.
2021-12-20 23:12:34.542088 Bot is still moving too fast for a public node. Slowing down a bit more.
2021-12-20 23:12:34.742915 Bot is still moving too fast for a public node. Slowing down a bit more.
2021-12-20 23:12:34.918692 Bot is still moving too fast for a public node. Slowing down a bit more.
2021-12-20 23:12:35.094445 Bot is still moving too fast for a public node. Slowing down a bit more.
2021-12-20 23:12:35.295304 Bot is still moving too fast for a public node. Slowing down a bit more.
2021-12-20 23:12:35.471098 Bot is still moving too fast for a public node. Slowing down a bit more.
2021-12-20 23:12:35.646861 Bot is still moving too fast for a public node. Slowing down a bit more.
2021-12-20 23:12:35.847706 Bot is still moving too fast for a public node. Slowing down a bit more.
2021-12-20 23:12:36.023426 Bot is still moving too fast for a public node. Slowing down a bit more.
2021-12-20 23:12:36.199167 Bot is still moving too fast for a public node. Slowing down a bit more.
2021-12-20 23:12:36.400060 Bot is still moving too fast for a public node. Slowing down a bit more.

Error with "SELLAMOUNTINTOKENS": "ALL",

I have this error

ERROR: 2021-12-20 02:35:25,334 expected string or bytes-like object
Traceback (most recent call last):
  File "/Users/admin/Downloads/LimitSwap-last/LimitSwap.py", line 2580, in run
    tokens = load_tokens_file(command_line_args.tokens, True)
  File "/Users/admin/Downloads/LimitSwap-last/LimitSwap.py", line 569, in load_tokens_file
    elif re.search(r'^\d+$', token[key]):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/re.py", line 200, in search
    return _compile(pattern, flags).search(string)
TypeError: expected string or bytes-like object
ERROR: 2021-12-20 02:35:25,336 expected string or bytes-like object
Traceback (most recent call last):
  File "/Users/admin/Downloads/LimitSwap-last/LimitSwap.py", line 2580, in run
    tokens = load_tokens_file(command_line_args.tokens, True)
  File "/Users/admin/Downloads/LimitSwap-last/LimitSwap.py", line 569, in load_tokens_file
    elif re.search(r'^\d+$', token[key]):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/re.py", line 200, in search
    return _compile(pattern, flags).search(string)
TypeError: expected string or bytes-like object

with :

[
{

    "ENABLED": "true",

    "SYMBOL": "CAKE",
    "ADDRESS": "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", 
    "BUYAMOUNTINBASE": "0.000005",
    "BUYPRICEINBASE":  "0",
    "SELLPRICEINBASE": "550",
    "STOPLOSSPRICEINBASE": "0",

    "SLIPPAGE": "49",

    "MAXTOKENS": "0.0001",
    "MOONBAG": "0",

    "RUGDOC_CHECK": "true",
    "BUYAFTER_XXX_SECONDS": "20",    
    "MAX_FAILED_TRANSACTIONS_IN_A_ROW": "2",    
    
    "LIQUIDITYCHECK": "false",
    "LIQUIDITYAMOUNT": "1.5",
    "LIQUIDITYINNATIVETOKEN": "true",
    "USECUSTOMBASEPAIR": "false",
    "BASESYMBOL": "BUSD",
    "BASEADDRESS": "0xe9e7cea3dedca5984780bafc599bd69add087d56",

    "SELLAMOUNTINTOKENS": "0.0005",
    "HASFEES": "false",
    "GAS": "BOOST",
    "BOOSTPERCENT": "30",
    "GASLIMIT": "1000000",
    "GASPRIORITY_FOR_ETH_ONLY": "2.5"

  }
]

typos

ERROR TRASACTION FAILURE -- >please write ERROR TRANSACTION FAILURE

SLIPPAGE too lo --> SLIPPAGE too low

Remove "Not Listed For Trade Yet......" from error logs

We need the bot NOT TO WRITE in error logs lines like :

INFO: 2021-12-20 15:55:23,921 WND Not Listed For Trade Yet... waiting for liquidity to be added on exchange

otherwise the error logs will be full of this

I checked at the code but I'm not sure what is the best way to remove this...

Error when you update tokens.json in real-time

when you update tokens.json in real time, it fails :

image

With this error :

line 2603, in run
    raise Exception("tokens.json has been changed, reinitializing tokens.")
Exception: tokens.json has been changed, reinitializing tokens.
ERROR: 2021-12-20 10:41:36,420 tokens.json has been changed, reinitializing tokens.

I tried to understand why, but I'm not sure how to reinitialize tokens...

mistake in my PREAPPROVE symbol

I made a mistake in my preapprove, it's "BASESYMBOL" instead of "SYMBOL" here :

(2 lines before the end)

def preapprove(tokens):
    # We ask the bot to check if your allowance is > to your balance. Use a 10000000000000000 multiplier for decimals.

    # First in all the tokens of the tokens.json
    for token in tokens:

        balance = Web3.fromWei(check_balance(token['ADDRESS'], token['SYMBOL']), 'ether')
        check_approval(token, token['ADDRESS'], balance * 10000000000000000)

        # then of the base pair
        if token['USECUSTOMBASEPAIR'].lower() == 'false':
            balanceweth = Web3.fromWei(client.eth.getBalance(settings['WALLETADDRESS']), 'ether')
            check_approval(token, weth, balanceweth * 10000000000000000)
        else:
            balancebase = Web3.fromWei(check_balance(token['BASEADDRESS'], token['BASESYMBOL']), 'ether')
            check_approval(token, token['BASEADDRESS'], balancebase * 10000000000000000)

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.