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
-
Setup your virtual environment
python3 -m venv venv && source venv/bin/activate && pip install -r requirements
-
Copy over
.env.sample
to.env
and update it with your account and secret key 1 -
See
strategies/SimpleBot.py
for a simple "follow" strategy that copies over the last available winner. Edit the logic 2 -
Run the bot
python main.py --strategy SimpleBot --size 0.001
3 -
Press CTRL+C to cancel
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.
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)
Config.py
has additional configuration, none of which is crucial to your both.
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.