Polymarket Stop Loss, Order Book, Order Flow, Order Types & Maker vs Taker
501 segments
All right. So in this video I will be
talking about everything related to
orders on poly market. So I will be
talking about the order book and I will
be talking about the spread. I will be
talking about what is a tick size. I
will also be talking about stop- losses,
take profits. I'll be talking about what
is a mega, what is a taker and generally
just digging deep into that. So I hope
you will stick around. This is really
important information. And I've really
been researching this for a while now.
And now I'm going to do a brain dump on
you so you get a better understanding of
this. And this will actually enable you
to perform better with your trading. But
because it's important to understand
what happens when you place a trade, how
can you handle your trades? How can you
monitor your trades? How can you limit
risk exposure by implementing uh stop-
losses and take profits? Because as you
probably know, Poly Market does not
support stop- losses. So, it's something
we have to implement in our bot by
ourself. And I have an implementation of
that that I will show you how it works.
It might not be perfect yet, but as we
go along, I will improve it and make it
very robust when Raven is ready to
launch. So, let's get started. To
understand stop-losses and take profit,
we need to understand the order book.
So, I have uh this market here. The US
government shutdown Saturday and we have
the order book. Okay. So the order book
represents basically everybody all the
traders that are placing trades. This is
what you see here is resting orders on
the order book. The ask side is people
that are willing to sell which is
indicated by red and the bit side is
people willing to buy. So that's on the
buying side. And then you have a spread
which is the difference between the asks
and the bits.
And this also ties in a little bit with
what we talked about in the previous
video about what is a maker and what is
a taker. So I will be explaining that as
well because if you remember we have the
mega rebates program. So you are
actually able to earn money by becoming
a maker. And if you are what we define
as a taker you actually pay money you
pay trading fees. And this is
specifically for the 15minute crypto
markets because these are going crazy.
But we might actually have these fees
coming onto other markets that are very
liquid. So it's important to understand
well what is a mega and what is a taker.
So I'm going to try my best to explain
what that is. There's some confusion
about what is a mega and what is a
taker. Some people think that the megas
is someone that sells and the tears is
someone that buys because that's kind of
what your intuition would say, but
that's actually not what what it is. So
a mega or taker is defined as who
provides and who takes liquidity. To
provide liquidity to a market, you would
have to place what we call a resting
order on the order book. So if you let's
say you place a let's say you want to
sell but you want to sell as a mega
what you would have to do is you would
have to place a order to sell your
shares
at 45 not crossing
the bit not crossing a spread. So you
can actually place you can see there's a
spread now of 1 cent.
So if you play if you place a sell
order, let's say 45.5,
you did not cross the spread over to the
bit side, meaning that it's actually a
maker order. However, if you place a
order of let's say 44 to sell at 44,
that would be a taker. You are removing
liquidity because you have resting
orders that has provided liquid
liquidity
and um and it would actually be
taken right away by the people that are
buying. So the spread is the difference
between the best asks and the best bits.
So there's also something called a tick
size. So the tick size is basically how
you know how much you can increment your
prices with. Let's say you have a tick
size of 0.1. That means you can place um
you know orders at 45.1, 45.2 and so on
and so forth. So let's say the tick
price is 0.1. Then you could place a
mega order on the ask side at 45.9 and
it would it will still be a mega order.
And the same goes for the bit side.
Let's say that you want to buy as a
taker. That means you would have to take
liquidity from the ask side. You would
have to place a buy order at 45. So that
means place a order at the best ask then
you would be almost guaranteed that your
order would be filled right away unless
the market moves away from you which
actually happened for me a few times and
I'm I'm going to show you exactly what
happened there. So in that case you
would become at a at taker. If you want
to be a mega as a buyer you would have
to place your buyer orders within the
spread not crossing over to ask. You
could do it at 44. You could do it at
45, 44.5, 44.6 and so on depending on
the tick size. The text size we can get
from the API, but I'm not going to show
this in this video. So if we look at
this examples of a buyer limit buy below
best ask, it rests on the order book and
then it becomes a mega. If you do a
limit buy at or above the best ask, it
then fails and you become a taker. And
if you do it on the cell examples, a
limit cell above best bit, then it rests
and you are maker limit cell at or below
best bit, it fills and then you are
taker. I hope that makes sense. It all
depends on if you are crossing the
spread over to the other side. That's
what defines if you're mega or a taker.
And this is kind of I mean it's not this
is very important when you are
implementing your stop-loss and take
profit which is very relevant when doing
trading bots. So when implementing a
stop-loss we also want to understand the
different order types. So if we look at
poly markets documentation there's
different order types. You have an order
type called fill or kill order which is
a market order to buy in dollars or sell
in shares.
shares that must be executed immediately
in its entirety otherwise the entire
order will be cancelled. Now we have to
keep in mind here poly market doesn't
have market orders. So the definition
here of a market order is what we also
could call a taker order. So it's a
order you place on the best bit or as
depending on if you are a seller or
buyer. So if you want to do a market
order as a buyer, then you would have to
look at the order book. You would have
to say, okay, as a buyer, I need to
cross the spread over to the ask side.
What is the best ask? It's 46.
So if you place a order to buy at 46,
you could be almost guaranteed that they
fill if there's enough liquidity. So in
this case, let's say that I place an
order to buy at 46,
let's say 6,000 shares. The order would
be cancelled if it's a fill or kill
because it has to be executed first of
all immediately and also in its entirety
otherwise the entire order will be
cancelled. So if there's not enough
liquidity, if it's if there's not enough
shares, it's going to be cancelled. But
there's another one that we call or that
they call fill and kill order which is a
similar order. It's a market order to
buy in dollars or sell in shares that
will be executed
immediately for as many shares as are
available.
Any portion not filled at once is
canled.
So I actually haven't tried this one uh
myself. I have tried to fill or kill but
the way I understand this one is that
let's say that you place a buy order
at let's say now it's 6,000 let's say
you place it at 7,000
at 46 then you would get these 6 thou 6
6,100
but then the remaining shares you will
not get
and the same goes if you are selling
let's say that you are selling
um and there was Now there's 300,
there's 500. Let's say there's 500
liquidity and you sell a,000. You're
trying to sell a,000 at at 45. Then you
would sell the 561, but the remaining
400 something you would not sell. So
this is a very big distinction between
these two and it's important to
understand if you're going to implement,
you know, stop losses because let's say
that you place a stop-loss. Let's say
you place a a limit order to sell right
away because your position has moved
against you, but it's actually not
filled.
You know, what are you going to do? You
have to have some kind of monitoring in
place. And I'm also going to explain how
I have implemented that into Raven.
You also have good till cancelled. So a
good to can good till order is a limit
order that is active until it's
fulfillled.
So it kind of you know it's pretty
typical. you place an order. Let's say
you place an order here at 45 or 44.
It's going to just going to stay there
until it's filled and not do anything.
And then we have the good till date.
Order is a type of order that is active
until it's until it's specified date UTC
seconds timestamp
unless it has been fulfilled or
cancelled.
There's a security threshold of 1
minute. If the order needs to expire in
90 seconds, the correct expiration value
is now plus 1 minute plus 30 seconds. I
don't really understand what they mean
about this. So, there's a security
threshold of 1 minute. If the order
needs to expire in 90 seconds, the
correct expiration value is now plus 1
minute
plus 30 seconds. If you if you know what
they mean about this, leave a comment
down below because I don't really
understand what they mean here, but
that's okay. But I mean, it it kind of
makes sense. They're good till date. So,
you want to place a limit order. You
only want to have that, let's say, in 2
minutes or 3 minutes. After that, it's
going to expire. So, when you place an
order, it goes through different order
life cycle on Poly Market. You have
different statuses. And this is taken
from the documentation. But however
there's actually more statuses than this
that I have experienced when doing uh
trades but I'm going to go through
these. So we have the status that's
called match. So you place an order on
poly market you know it might be resting
on the order book. So nothing really
happens before something happens sort of
saying so when it's matched it means
that a trade has been matched and sent
to the executor service by the operator.
The executor service submits the trade
as a transaction to the exchange
contract. So you have to understand Poly
Market runs on blockchain. So first of
all you place an order through their
API. It's it goes to their centralized
servers on AWS. Now they're looking for,
you know, traders, sellers or buyers on
the order book. When they find someone
matching your order,
they going it's then matched, right? And
then it's going to be sent to be mined
onto the blockchain. Okay. And this is
when the next status happens. So the
status is mined. So the trade is
observed to be mined onto the chain. No
finality threshold established.
So it is going to be mined on the
blockchain. Okay. But before that
actually happens, it's sort of not
final. Something can still happen. It
can still be cancelled. How that's going
to hap happen, I'm not really sure, but
it can. And then we have the confirmed
status. This is where the order is
terminal. So the trade has achieved
strong probabilistic finality and was
successful. So you know on the
blockchain when you put a transaction on
the blockchain there's certain
confirmations that need to happen on the
blockchain before it's final. And this
is kind of what they wait for. And when
you have a certain amount of
confirmations well then they know that
it's confirmed. It have a strong
probabilistic finality and then it's
done. Okay. So this is what you need to
look for. There's also retrying and
failed and this kind of you know that
makes sense. So if you place let's say
you make a system in your trading bot to
place a stop-loss you have to monitor
your your positions to check if it's
actually confirmed or not. And u and
this is very important. It's something
that I have been working on implementing
into Raven. So the flow that I have been
working on is when we do the placement
and this is actually a different status
that they don't have in uh in this
overview here. So the placement is
basically just you place an order on the
on the order book and that's it. It's
now it's waiting to get matched. So the
placement when that happens I listen for
the user events. when we get the
placement, that's when uh we place the
order into what I call the pending order
tracker. Okay? And the pending order
tracker then just monitors for these
statuses over here that I just showed
you. And then when we get the matched,
that's when we take the order from the
pending order tracker over to the
position track. And now we actually have
a live position that we need to monitor.
And this is also where I implement the
stop loss. So with the the position
tracker uh tracks the position but it
also tracks the stop-loss. Okay. And it
tracks the the the order life cycle from
match to update mind confirmed and so
on.
And um so when it's confirmed you know
then we actually have an order live and
we need to monitor it. We need to track
it and that's when the stop loss is
actually activated. So I will just
quickly brief you on the position
monitor. We have different methods. So
for example, when we have the position
monitor, we have a start,
we have a start monitoring method that
basically just starts the the monitor,
right? And then we have a handle price
change. So the position monitor is
subscribing to certain events from the
event bus. Okay, so that's the events we
get from the user events. You can see
how it takes a processed event. If you
don't know what I'm talking about now,
watch some of my previous videos because
I've explained this in previous videos
and kind of explain the architecture of
this trading bot. And then you can see
here we have the check position P&L and
this again it just checks what is the
P&L of the position and we need this to
take profit. We need this to stop the
loss, stop loss, right? And then we
basically just checks this and uh we
have then a um a generate a generate
exit action over here. So we just check
if we have a stop loss and if that is
within the threshold that we are looking
for. We generate the exit action. Okay.
And that's then going to be published to
our executing layer. Currently I have
hardcoded the filler kill order type but
I will be changing this in Raven. So you
can choose how you want the bot to
behave, you know, fine grain things,
experiment and and stuff like that. But
for now, what I've done is to use the
fill or kill. And um I will show you
what happens in
here. So you can see here, this is a
real trade I did. So I've been doing
real trades, you know, not actually to
try to make money, but just to see
how the stop-loss works that I've
implemented.
So what I do is I did a mega order
first. Doesn't really matter if it's a
mega or take in this case. So I buy five
at 0.55.
And then the position monitor monitors
the position and looks for the P&L. If
the P&L is less than the threshold, I
think this it was 10% in this case, it's
uh going to execute a sell order. And I
did the fill or kill. And uh what
actually happened was it got killed
because you can see here from the time
the order is placed
on poly market the market already moved
against it and this is the risk that we
need to uh think about. So it was
actually killed even though I placed the
order on the best bit. So placing it on
the best bit should have made it a
market order but since you know the
market move you can see how rapidly it
moved down in this case. I think at the
time there was just no um orders at that
time and then was simply just killed and
then my system then it didn't the system
then keeps monitoring if the if the
order go through or not and in this case
it was killed so it placed another one.
So it it did a filler kill number two
here at uh 0.4378 4378 and then it was
actually filled but but uh I think um
here it was like 10% already and then it
when it was uh when it was finally
filled the second time you know it was
like down 20% or something. Um so yeah
that was uh not the best trade. Um but
you know we live and we learn and so I'm
I'm I'm tweaking this as I go along. And
of course in Raven which is you know the
the framework that I'm working on we
will be able to set the uh the you know
the different metrics do you want to
fill or kill and so on and so forth. So
yeah if you haven't seen already you
probably have maybe I'm building Raven
which is kind of still the project name
which is what I'm building here in
public. It's not just a trading bot I
built for myself, but it's actually a no
code strategy builder for prediction
markets. It's something that I'm
planning to release. And it's a, as I
said, it's a no code strategy build. You
can see how you can create these
different nodes and construct your own
strategy. So instead of spending, you
know, too long time on trying to build
a, you know, a Python bot from the
ground up, you will actually soon be
able to use this framework to build and
test uh your own strategies. Very easy,
very efficient. And uh now you can join
the weight list. So I'm still building
this. I'm building this in public on my
YouTube channel. So you can click here,
join the weight list, and then down here
you can provide your email. And if you
do that then you will actually be one of
the first in line to get access because
I will not be releasing this like you
know in a grand way. I'm just going to
be doing it um you know gradually first
take like you know maybe 10 people then
20 people then maybe 100 people and so
on so forth. So if you're on the early
access you will be getting access
earlier than everybody else. We also
have uh Poly Traders which is a free
discord community for prediction
markets. We have different channels such
as you know bot development. We have
strategy and data. We have predictions
crypto bite coding and we have a forum
where people there posting insights. So
it's a great way to uh meet other you
know traders, other builders, other
programmers and so on. And there's a lot
of nice alpha and insights in here. So I
really highly highly suggest you to join
it and it's free to join. Of course,
it's a free and open community for
everybody that's interested in
prediction markets, poly market,
calcium, and so on so forth. So, I've
made sure to leave links down below in
here in the description. You can find
the link to the weight list, and you can
find link to Discord. So, with that
said, I think it's all for now. I hope
it made sense. And if you have any
questions or if I said anything that was
not correct, please, you know, leave
your comment down below and uh let's
have a discussion. So, until next time,
see you and have a good one.
Ask follow-up questions or revisit key timestamps.
This video provides a comprehensive overview of orders on Poly Market, focusing on the order book, spread, tick size, stop-losses, and take-profits. It explains the concepts of 'maker' and 'taker' orders, clarifying that they are defined by providing or taking liquidity, respectively, rather than simply buying or selling. The video details different order types available on Poly Market, including Fill or Kill, Fill and Kill, Good Till Cancelled, and Good Till Date, and discusses their implications, particularly for implementing stop-loss orders, which are not natively supported by Poly Market and must be managed through bots. It also outlines the order lifecycle statuses on the blockchain (Matched, Mined, Confirmed) and the internal tracking system (Placement, Pending Order Tracker, Position Tracker) used in the Raven trading bot. Finally, it touches upon the development of the Raven no-code strategy builder and invites viewers to join the waitlist and the Poly Traders Discord community.
Videos recently processed by our community