Code Monkey home page Code Monkey logo

pancakeswapbot's Introduction

[๐Ÿ”ฅ UPDATE V2] PancakeSwap Prediction Bot

โš ๏ธ Beware of forks. I do not give any guarantee that the fork may turn out to be a scam.

๐Ÿ’ฅ Disclaimer

I'm coding this stuff on a pure open source, every time the bot wins, it donates a small portion of your winnings to a developer account so we can continue improving this bot.

0xC3c531bE09102E84D4273984E29e827D71e28Ae8

As you receive the program as open source feel free to update the bot strategy to increase the win-rate or even changing the formula of the donation to what you consider rasonable.

All investment strategies and investments involve risk of loss. Nothing contained in this program, scripts, code or repository should be construed as investment advice. Any reference to an investment's past or potential performance is not, and should not be construed as, a recommendation or as a guarantee of any specific outcome or profit. By using this program you accept all liabilities, and that no claims can be made against the developers or others connected with the program.

Info

This is a PancakeSwap Prediction game bot, it includes backtesting code so you can try new strategies changing the env variables on a risk free environment.

It works with PancakePredictionV2 (https://pancakeswap.finance/prediction)

๐Ÿ’ก How to use

1. Provide your private key to .env PRIVATE_KEY field
2. Install dependencies `npm i`
4. Start the app with `npm run start`
5. Enjoy winning!

๐ŸฆŠ How to Export Private Key from MetaMask

Open your account
Click on three points at top-right corner
Account details
Export Private Key

๐Ÿ’ก BackTesting with PancakeSwap data

1. Update initialEpoch with the current epoch in pancake -5 (example: current epoch 25890 -> 25885)
2. Update finalEpoch with the current epoch in pancake -500 (example: current epoch 25890 -> 25390)
3. Install dependencies `npm i`
4. Run `npm run download_data` **not needed as this code contains history.json file
5. Run `npm run backtest` 
6. Open file chart.png

alt PancakeSwap Prediction Bot-Winner alt PancakeSwap Prediction Bot-Winner Screenshot alt Candle Genie Bot-Winner Screenshot

Strategy

The bot strategy can be found in src/bot.ts. It bets on the biggest of the bull or bear payout.

const bet = roundBullAmount < roundBearAmount ? 'bull' : 'bear';

To increase the bet amount the bot uses this strategy (check the .env to modify the multiplier and the initial bet amount)

https://en.wikipedia.org/wiki/Martingale_(probability_theory)

pancakeswapbot's People

Contributors

bsc-predict avatar diego-tobalina 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pancakeswapbot's Issues

Gas estimate problem

Hi there, thank you very much for this bot. I have been having lots of fun with it. However, sometimes it would get stuck with 'cannot estimate gas; transaction may fail or may require manual gas limit'.

Sometimes this happens in a timem where the bot is recovering from loss, and then it need to start from the beginning bet gain. Is there a way to resolve this?

Thanks

Transaction Fail

Hi there, sometimes I get the error below and it resets the whole bot, if you have 2-3 consecutive lost bets it will reset it back to the start, you'll be losing money.

Why would that happen?

Thank you!

1|ts-node  | Tx Started
1|ts-node  | Tx Error, calling reduceWaitingTimeByOneBlocks(waitingTime) Error: transaction failed (transactionHash="0xf6867c02184e5da80bfce0b63a99ec76d8bf51cab77a996ac42377ff7cf23e54", transaction={"nonce":1435,"gasPrice":{"type":"BigNumber","hex":"0x012a05f200"},"gasLimit":{"type":"BigNumber","hex":"0x01cd17"},"to":"0x18B2A687610328590Bc8F2e5fEdDe3b582A49cdA","value":{"type":"BigNumber","hex":"0x011c37937e080000"},"data":"0xaa6b873a0000000000000000000000000000000000000000000000000000000000007539","chainId":56,"v":148,"r":"0x13b9040f2407bab5df6b64562907774597b77ee38095e648b589a5a0481cf24d","s":"0x362069f6ec2834f1b2abcb2d2f55db7b0e1b4c817e8963c8185a01f901ccded8","from":"0xbA85c23C2C1A1aABDd86D0AAAA544C933FFeDa35","hash":"0xf6867c02184e5da80bfce0b63a99ec76d8bf51cab77a996ac42377ff7cf23e54","type":null,"confirmations":0}, receipt={"to":"0x18B2A687610328590Bc8F2e5fEdDe3b582A49cdA","from":"0xbA85c23C2C1A1aABDd86D0AAAA544C933FFeDa35","contractAddress":null,"transactionIndex":194,"gasUsed":{"type":"BigNumber","hex":"0x7475"},"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","blockHash":"0x02b12189416b117c8dc865e4d7913f9d973ee6bdb2b342ee23641e8736fe6ec5","transactionHash":"0xf6867c02184e5da80bfce0b63a99ec76d8bf51cab77a996ac42377ff7cf23e54","logs":[],"blockNumber":13700008,"confirmations":1,"cumulativeGasUsed":{"type":"BigNumber","hex":"0x01cf6ca3"},"status":0,"type":0,"byzantium":true}, code=CALL_EXCEPTION, version=providers/5.5.0)
1|ts-node  |     at Logger.makeError (/root/PSP/PancakeSwapBot/node_modules/@ethersproject/logger/src.ts/index.ts:225:28)
1|ts-node  |     at Logger.throwError (/root/PSP/PancakeSwapBot/node_modules/@ethersproject/logger/src.ts/index.ts:237:20)
1|ts-node  |     at JsonRpcProvider.<anonymous> (/root/PSP/PancakeSwapBot/node_modules/@ethersproject/providers/src.ts/base-provider.ts:1314:24)
1|ts-node  |     at step (/root/PSP/PancakeSwapBot/node_modules/@ethersproject/providers/lib/base-provider.js:48:23)
1|ts-node  |     at Object.next (/root/PSP/PancakeSwapBot/node_modules/@ethersproject/providers/lib/base-provider.js:29:53)
1|ts-node  |     at fulfilled (/root/PSP/PancakeSwapBot/node_modules/@ethersproject/providers/lib/base-provider.js:20:58) {
1|ts-node  |   reason: 'transaction failed',
1|ts-node  |   code: 'CALL_EXCEPTION',
1|ts-node  |   transactionHash: '0xf6867c02184e5da80bfce0b63a99ec76d8bf51cab77a996ac42377ff7cf23e54',
1|ts-node  |   transaction: {
1|ts-node  |     nonce: 1435,
1|ts-node  |     gasPrice: BigNumber { _hex: '0x012a05f200', _isBigNumber: true },
1|ts-node  |     gasLimit: BigNumber { _hex: '0x01cd17', _isBigNumber: true },
1|ts-node  |     to: '0x18B2A687610328590Bc8F2e5fEdDe3b582A49cdA',
1|ts-node  |     value: BigNumber { _hex: '0x011c37937e080000', _isBigNumber: true },
1|ts-node  |     data: '0xaa6b873a0000000000000000000000000000000000000000000000000000000000007539',
1|ts-node  |     chainId: 56,
1|ts-node  |     v: 148,
1|ts-node  |     r: '0x13b9040f2407bab5df6b64562907774597b77ee38095e648b589a5a0481cf24d',
1|ts-node  |     s: '0x362069f6ec2834f1b2abcb2d2f55db7b0e1b4c817e8963c8185a01f901ccded8',
1|ts-node  |     from: '0xbA85c23C2C1A1aABDd86D0AAAA544C933FFeDa35',
1|ts-node  |     hash: '0xf6867c02184e5da80bfce0b63a99ec76d8bf51cab77a996ac42377ff7cf23e54',
1|ts-node  |     type: null,
1|ts-node  |     confirmations: 0,
1|ts-node  |     wait: [Function (anonymous)]
1|ts-node  |   },
1|ts-node  |   receipt: {
1|ts-node  |     to: '0x18B2A687610328590Bc8F2e5fEdDe3b582A49cdA',
1|ts-node  |     from: '0xbA85c23C2C1A1aABDd86D0AAAA544C933FFeDa35',
1|ts-node  |     contractAddress: null,
1|ts-node  |     transactionIndex: 194,
1|ts-node  |     gasUsed: BigNumber { _hex: '0x7475', _isBigNumber: true },
1|ts-node  |     logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
1|ts-node  |     blockHash: '0x02b12189416b117c8dc865e4d7913f9d973ee6bdb2b342ee23641e8736fe6ec5',
1|ts-node  |     transactionHash: '0xf6867c02184e5da80bfce0b63a99ec76d8bf51cab77a996ac42377ff7cf23e54',
1|ts-node  |     logs: [],
1|ts-node  |     blockNumber: 13700008,
1|ts-node  |     confirmations: 1,
1|ts-node  |     cumulativeGasUsed: BigNumber { _hex: '0x01cf6ca3', _isBigNumber: true },
1|ts-node  |     status: 0,
1|ts-node  |     type: 0,
1|ts-node  |     byzantium: true
1|ts-node  |   }
1|ts-node  | }

Doesn't claim the rewards

I'm not sure how it suppose to work but I'll explain my situation.

It wins one round, then it waits one.
When the next round starts, it shows this in the console.

Claimable epochs empty: []
Tx Success

But it doesn't claim it for some reason.
If I check the pancakeswap interface, the reward is still there, waiting to be claimed.
Could you please explain to me why is that happening?

Thank you!

Your strategy just bets the on the bigger payout

Your strategy is very simple and you should state it outright. It bets on the higher payout at the time the bet is made. Your backtest is also inaccurate since it uses the final payout as the bet, but this is not known the time the bet is made.

You should make the strategy explicit in the README as it's simple to understand.

const bet = roundBullAmount < roundBearAmount ? 'bull' : 'bear';

https://github.com/xBidi/PancakeSwapBot/blob/main/src/bot.ts#L73

how start?

root@Ubuntu-2004-focal-64-minimal ~/PancakeSwapBot # npm start

[email protected] start
ts-node src/bot.ts

Bot started at 9:05
/root/PancakeSwapBot/node_modules/@ethersproject/logger/src.ts/index.ts:225
const error: any = new Error(message);
^
Error: call revert exception (method="currentEpoch()", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.5.0)
at Logger.makeError (/root/PancakeSwapBot/node_modules/@ethersproject/logger/src.ts/index.ts:225:28)
at Logger.throwError (/root/PancakeSwapBot/node_modules/@ethersproject/logger/src.ts/index.ts:237:20)
at Interface.decodeFunctionResult (/root/PancakeSwapBot/node_modules/@ethersproject/abi/src.ts/interface.ts:425:23)
at Contract. (/root/PancakeSwapBot/node_modules/@ethersproject/contracts/src.ts/index.ts:392:44)
at step (/root/PancakeSwapBot/node_modules/@ethersproject/contracts/lib/index.js:48:23)
at Object.next (/root/PancakeSwapBot/node_modules/@ethersproject/contracts/lib/index.js:29:53)
at fulfilled (/root/PancakeSwapBot/node_modules/@ethersproject/contracts/lib/index.js:20:58)
at processTicksAndRejections (node:internal/process/task_queues:95:5) {
reason: null,
code: 'CALL_EXCEPTION',
method: 'currentEpoch()',
errorArgs: null,
errorName: null,
errorSignature: null,
address: '0x6e17072D6B2524aBB63134c632144F59Ca0aebbF',
args: [],
transaction: {
data: '0x76671808',
to: '0x6e17072D6B2524aBB63134c632144F59Ca0aebbF',
from: '0x6e17072D6B2524aBB63134c632144F59Ca0aebbF'
}
}

something wrong

Started epoch 57619, waiting
Waiting time ended
Bet selected: bear
The round 57618 is not ended, cant bet without knowing the last result
C:\Users\PancakeSwapBot\node_modules@ethersproject\logger\src.ts\index.ts:225
const error: any = new Error(message);
^
Error: missing revert data in call exception (error={"reason":"missing response","code":"SERVER_ERROR","requestBody":"{"method":"eth_call","params":[{"from":"0xde9bf5fd7e9fb1f6277f5c9d2b0e1ecb48e01af5","to":"0x18b2a687610328590bc8f2e5fedde3b582a49cda","data":"0x76671808"},"latest"],"id":120,"jsonrpc":"2.0"}","requestMethod":"POST","serverError":{"code":"ECONNRESET","path":null,"host":"bsc-dataseed.binance.org","port":443},"url":"https://bsc-dataseed.binance.org/"}, data="0x", code=CALL_EXCEPTION, version=providers/5.5.0)
at Logger.makeError (C:\Users\PancakeSwapBot\node_modules@ethersproject\logger\src.ts\index.ts:225:28)
at Logger.throwError (C:\Users\PancakeSwapBot\node_modules@ethersproject\logger\src.ts\index.ts:237:20)
at checkError (C:\Users\PancakeSwapBot\node_modules@ethersproject\providers\src.ts\json-rpc-provider.ts:34:16)
at JsonRpcProvider. (C:\Users\PancakeSwapBot\node_modules@ethersproject\providers\src.ts\json-rpc-provider.ts:562:20)
at step (C:\Users\PancakeSwapBot\node_modules@ethersproject\providers\lib\json-rpc-provider.js:48:23)
at Object.throw (C:\Users\PancakeSwapBot\node_modules@ethersproject\providers\lib\json-rpc-provider.js:29:53)
at rejected (C:\Users\PancakeSwapBot\node_modules@ethersproject\providers\lib\json-rpc-provider.js:21:65)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
reason: 'missing revert data in call exception',
code: 'CALL_EXCEPTION',
error: Error: missing response (requestBody="{"method":"eth_call","params":[{"from":"0xde9bf5fd7e9fb1f6277f5c9d2b0e1ecb48e01af5","to":"0x18b2a687610328590bc8f2e5fedde3b582a49cda","data":"0x76671808"},"latest"],"id":120,"jsonrpc":"2.0"}", requestMethod="POST", serverError={"code":"ECONNRESET","path":null,"host":"bsc-dataseed.binance.org","port":443}, url="https://bsc-dataseed.binance.org/", code=SERVER_ERROR, version=web/5.5.0)
at Logger.makeError (C:\Users\PancakeSwapBot\node_modules@ethersproject\logger\src.ts\index.ts:225:28)
at Logger.throwError (C:\Users\PancakeSwapBot\node_modules@ethersproject\logger\src.ts\index.ts:237:20)
at C:\Users\PancakeSwapBot\node_modules@ethersproject\web\src.ts\index.ts:234:28
at step (C:\Users\PancakeSwapBot\node_modules@ethersproject\web\lib\index.js:33:23)
at Object.throw (C:\Users\PancakeSwapBot\node_modules@ethersproject\web\lib\index.js:14:53)
at rejected (C:\Users\PancakeSwapBot\node_modules@ethersproject\web\lib\index.js:6:65)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
reason: 'missing response',
code: 'SERVER_ERROR',
requestBody: '{"method":"eth_call","params":[{"from":"0xde9bf5fd7e9fb1f6277f5c9d2b0e1ecb48e01af5","to":"0x18b2a687610328590bc8f2e5fedde3b582a49cda","data":"0x76671808"},"latest"],"id":120,"jsonrpc":"2.0"}',
requestMethod: 'POST',
serverError: Error: Client network socket disconnected before secure TLS connection was established
at connResetException (node:internal/errors:692:14)
at TLSSocket.onConnectEnd (node:_tls_wrap:1587:19)
at TLSSocket.emit (node:events:539:35)
at TLSSocket.emit (node:domain:475:12)
at endReadableNT (node:internal/streams/readable:1345:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'ECONNRESET',
path: null,
host: 'bsc-dataseed.binance.org',
port: 443,
localAddress: undefined
},
url: 'https://bsc-dataseed.binance.org/'
},
data: '0x'
}

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.