Skip to content

bsc-predict/bsc-predict-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PancakeSwap Prediction Market Starter Bot

This is a starter bot for BSCPredict or its official UI interface PancakeSwap Prediction Markets.

PRODUCT IS AS-IS. USE AT YOUR OWN DISCRETION

STRATEGIES PROVIDED ARE ONLY FOR DEMONSTRATION PURPOSES AND WILL LOSE MONEY

Quick Start

  1. Setup your virtual environment python3 -m venv venv && source venv/bin/activate && pip install -r requirements

  2. Copy over .env.sample to .env and update it with your account and secret key 1

  3. See strategies/SimpleBot.py for a simple "follow" strategy that copies over the last available winner. Edit the logic 2

  4. Run the bot python main.py --strategy SimpleBot --size 0.001 3

  5. Press CTRL+C to cancel

1. See Security section 2. The SimpleBot strategy is merely for demonstration purposes. Don't run this strategy as it is surely to lose money 3. This will run the bot and bet 0.001 ETH per bet

Background

Prediction markets are 5-minute binary options on the BNB-BUSD price hosted on the Binance Smart Chain. Users can predict whether they think the price of BNB will go up or down in 5 minute intervals. Contract can be found here. See documentation here.

Adding new strategies

See SimpleBot as an example of a strategy. You can copy this, alter it and run it with its new class name.

A strategy is defined by a class that extends BaseClass with a single function implementation of get_bet(self, upcoming: Round) -> Optional[Bet]. The function should return either a None or a Bet dataclass that's defined as follows.

class Direction(Enum):
  BULL = 0
  BEAR = 1

@dataclass
class Bet:
  """ Class for specifying a bet """
  direction: Direction
  amount_eth: int
  epoch: int

For instance, if you want to create a strategy that always bets BULL:

class Bot(BaseBot):
  def get_bet(self, upcoming: Round) -> Optional[Bet]:
    return Bet(direction=Direction.BULL, amount_eth=self.bet_size_eth, epoch=upcoming.epoch)    

Additional Configuration

Config.py has additional configuration, none of which is crucial to your both.

Security

NEVER SHARE YOUR PRIVATE KEYS TO ANYONE. If anyone has access to your private key, they can (and will) steal all your funds and you won't be able to do anything about it.

In order for the bot to work you have to input your private key. See metamask help for exporting your private keys.

Account and the corresponding private key need to be updated in .env file. NEVER CHECK THIS FILE INTO VERSION CONTROL OR SHARE IT WITH ANYONE

The BaseBot class that your strategy inherits from is initialized with your private key, and private key is passed to functions claim and make_bet in contract/utils.py

Review the BaseBot function carefully so you understand whats happening to your private key.

Useful Links

Releases

No releases published

Packages

No packages published

Languages