HomeVideos

Building a Polymarket trading bot

Now Playing

Building a Polymarket trading bot

Transcript

232 segments

0:00

So, the kind of newest trend I suppose

0:03

or maybe it's not a trend right now, but

0:04

something that's been going on for a

0:06

while is uh doing the poly market

0:08

trading bots and um well, I've been kind

0:12

of looking into it and you can see the

0:14

leaderboards on Poly Market, let's just

0:17

say

0:19

uh monthly, you can see, you know, some

0:23

of the the traders their profit like

0:26

some people are making more than a

0:28

million per month. Like if we scroll

0:30

down here, this is top 20. Let's just do

0:33

page two.

0:36

We have a monthly top 36 sensei.

0:45

Um he might have been quite lucky here.

0:48

You know, some of these traders, they

0:50

are um they are not bots, but they are

0:54

just traders.

0:56

See this one here? This one looks like

0:59

like just a regular trader maybe. And

1:02

then we have someone like this.

1:05

One month they have a profit of

1:06

$500,000. This is an account I saw

1:09

shared on uh on Twitter. You can also

1:11

see how many views it has here. And this

1:13

for sure is is is a trading bot.

1:17

And uh it trades the um you know only

1:20

crypto 15 minutes minute market. So, we

1:23

have these uh Bitcoin up and down

1:26

15minut market and uh let me just

1:28

refresh the page here

1:31

and this one there's like 1 minute left

1:32

and then it goes to the next one and you

1:34

basically just try to predict will

1:36

Bitcoin go up or down within the next 15

1:39

minutes and uh there's a few bots here

1:42

now that trades this and I know now that

1:44

the poly market they added a fee so it

1:48

makes the bots less viable but there's

1:50

still a lot of different markets on on

1:52

Poly market and I have been working a

1:55

little bit on a on a bot now that it's

1:58

far from finished but I'll just

2:00

demonstrate how it works. I can do the

2:03

market uh sl which is this part up here

2:06

in the URL and put it into my tool and

2:10

um let me just refresh it for a moment

2:14

here.

2:16

Then I can start monitoring and now it's

2:19

just going to stream in the the data

2:22

here when the when the market starts. So

2:24

now this market here will start in it

2:26

actually started

2:31

you can see here now that it we get data

2:34

in here on the on the console and then

2:36

what I've done in this this bot is that

2:38

I have I I have a method to record the

2:41

data. So this is all data that we are

2:43

streaming in from Poly Market. They have

2:46

a they have an open websocket that you

2:48

can connect to and get the data and then

2:50

I I store the data to a CSV file here.

2:53

You can see here that if I just go down

2:55

that it's going to stream the data. So

2:58

that means that I can in the future just

3:01

basically re um rerun a market again and

3:05

again if I want to try out different

3:06

strategies for a certain market. Yeah,

3:09

you can make a strategy fit exactly that

3:12

market and then maybe the next market is

3:13

not going to work. Um, and that's fine,

3:16

but but this allows me to get down a lot

3:18

of data and and write different uh

3:20

strategies.

3:22

And there's several different strategies

3:25

that you can uh you can run on on Poly

3:28

Market that I have been looking into.

3:30

So, the two strategies that I'm looking

3:33

into right now, basically just trying to

3:35

copy this guy here. So what he does is

3:39

on poly market you have a uh price you

3:43

know up and down

3:46

and uh now the market is very efficient.

3:49

So this will happen in a very rare case

3:52

where the the total price of a pair is

3:57

below one US dollar. So in a in a

4:01

completely efficient market, the the

4:03

price of of the prediction if it's going

4:06

to go up or down should always be $1.

4:08

But sometimes it's not. Sometimes the

4:11

price will actually be 99 cents or 98

4:13

cents for the for for something that's

4:16

actually worth $1 because let's say you

4:18

buy both sides of the trade um and you

4:23

just hold both of the tokens to the to

4:26

the when the market resolves then well

4:28

then you get $1. But think about if you

4:31

can actually buy both sides and it only

4:34

cost you 99 cents then actually you make

4:36

1% on that trade. But the caveat here is

4:39

that now they introduced uh fees

4:42

specifically on the 15minute

4:45

uh markets here. So so it's probably not

4:47

viable exactly. But I thought to myself,

4:50

let's just try this out um to simply

4:54

just copy this guy here and uh let's see

4:57

one day. I mean he's still making look

5:00

at this. He's made $83,000

5:04

the past 24 hours.

5:08

83,000

5:10

and I mean it's it's just mindboggling.

5:14

So you can see here how he he takes both

5:16

positions, right? So here he has the

5:19

Solan up and down January 8 245 to 3:00

5:23

a.m. This is uh he have about a,000

5:26

shares at up and then he have uh about

5:31

more than a,000 shares down.

5:35

He pays 66

5:37

cents

5:39

for up and then 44 cents for down which

5:42

is actually $1. We want to see both

5:46

sides. This is so see how many he does

5:48

does all the time. So he did 83,000 for

5:52

one day but if you look at his activity

5:55

each of the trades is like $1 like

5:58

170.44

6:01

like one and a half share and it's on

6:03

the same market. it just keeps adding to

6:07

his uh positions depending on some kind

6:11

of of criterias that he have is in uh is

6:15

in his um strategy. Right.

6:18

So let's take a look at some of these uh

6:21

bitcoin up and down gener 83 to 315.

6:26

So that's $100

6:28

down 70

6:30

and um

6:35

and then up here is

6:39

29.

6:41

So I know that these don't add up, but

6:45

it might

6:47

well I guess it actually does, right? So

6:50

he did um

6:52

he he bought

6:54

these tokens

6:57

150 uh 130 130

7:02

157 shares at 70 cents each one minute

7:07

ago and then since then he has added to

7:10

a position

7:12

right 10 shares 29 so that's that's

7:15

basically 1% gain 1% gain here and this

7:20

this is uh 28.

7:23

So that's actually a 2% gain, right?

7:25

Because what what is he paying here in

7:27

total? So that's 70 plus uh 28 and it's

7:30

only five shares and then 28 29 29 29 29

7:34

29. So he basically just he puts a

7:36

position

7:39

and then

7:41

he adds shares.

7:44

He's basically just scalping like 1%.

7:48

Um,

7:52

so how that's kind of tied in with the

7:54

fees, I'm not sure about. I'm not

7:55

exactly sure how much the fees is

7:57

because the fees fee structure also

7:59

depends on the price of the um of the

8:02

token. So if you if you buy a token

8:04

where the price is like 50 cents, it's

8:07

more compared to like the edges of the

8:09

market. like if you have 90 cents and 10

8:11

cents then the fees will be less. So

8:15

here he buys kind of at the edges of the

8:17

market. I don't know if that's something

8:19

he does consistently. If you just only

8:21

look at these two trades, you have no

8:23

risk, right? Because if he buy both and

8:26

hold to expiration, he will get $1

8:30

worth,

8:32

right? For sure like per per um per of

8:35

the shares. But he only paid 49 plus 31.

8:41

So that's uh five, six, seven, eight. So

8:43

that's 80 cents. So actually just of

8:45

these two trades, it's like 20%. That's

8:48

the 20% um return just there.

8:54

It just seems like he adds small amounts

8:56

to the position

8:58

whenever his algorithm

9:00

determines that it is a good trade in

9:03

one way or the other. But basically he

9:05

does a almost zerorisk strategy

9:10

somehow by trying to to to buy both

9:14

sides of the trade. So he's like risk

9:17

neutral but try to get a discount on it.

9:20

So if you buy both sides the value

9:22

should be $1,

9:25

but he tries to get it to a discount in

9:27

in his trading strategy. So, um, so

9:30

basically this is what I'm trying to to

9:32

uh to make. And and look at this. Like

9:35

his position value right now is only

9:37

31,000

9:39

and his whole profit loss is more than

9:41

600,000. Like he's just printing. This

9:43

is basically just printing money.

9:47

That's crazy. Yeah. Anyway, so this is

9:50

basically what I'm working on. And uh

9:52

right now I have uh what I showed you uh

9:55

the ability to record

9:57

these trades and then I have um

10:01

different strategies.

10:03

So I have my default strategies which is

10:05

basically uh what we're looking for when

10:08

we have a pair price that's less than a

10:10

certain amount then we want to put a

10:11

trade. Um but but but now when I've been

10:15

testing the few like hours and days, um

10:18

it's very rare that the price of a pair

10:21

at the same time

10:24

is is is lower than one $1. And if it

10:27

is, it's only like very milliseconds.

10:29

And and from what I can see how he does

10:32

it, it's not exactly where he finds a

10:35

specific time where both pairs line up

10:38

exactly where it's it's a good price,

10:40

but he kind of adds on to it. So he kind

10:42

of balances his accounts uh somehow all

10:45

the time, right? So I think that's what

10:47

I'm going to try to mimic. Um and then

10:50

um uh yeah, try to keep you posted like

10:54

um and and see how it goes. So that's uh

10:56

all for today. Have a good one.

Interactive Summary

Ask follow-up questions or revisit key timestamps.

The video introduces the growing trend of Poly Market trading bots, highlighting that some top traders are achieving profits exceeding $1 million monthly. The speaker is actively developing their own trading bot, demonstrating its capability to stream real-time market data from Poly Market's open websocket and record it into CSV files for strategy development and testing. The primary strategy being explored is inspired by a successful bot that exploits market inefficiencies: it identifies and capitalizes on situations where buying both the "up" and "down" predictions for a market costs less than one dollar in total, thereby securing a risk-free profit through arbitrage. This successful bot, through numerous small, scalping trades, has generated hundreds of thousands in profit. However, the speaker notes challenges such as newly implemented fees and the extreme rarity and fleeting nature of these arbitrage opportunities, leading them to consider adapting their strategy to mimic the successful bot's method of continuously balancing and adding to positions over time.

Suggested questions

5 ready-made prompts