Source: Is the sample BitMEX market maker bot profitable? : BitMEX (reddit.com)
Posted by
Is the sample BitMEX market maker bot profitable?
I've been running the sample market maker all day today and a bit of last night on the testnet. So far its made a 10% profit. Of course now I'm getting excited so I'm wondering where the pitfalls of this bot is? my friend says it can make some money but has no risk management, although today has been a pretty volatile day and its still made money so where does this bot fall down?
54 Comments
Award
Share
Unsave
Hide
Report
81% Upvoted
This thread is archived
New comments cannot be posted and votes cannot be cast
SORT BY
NEW
level 1
·3y
I updated my fork of the sample market maker with the following suggestions:
THEORY and PRACTICE of Market-Making
I recommend this article if you are not familiar with market-making and its pitfalls. Reading that will make my discussion eaiser to follow.
Daily range
The most important idea for you to grasp now about market-making is that you are setting up a grid of buy and sell orders and you make money on the daily fluctuation of the market.
As you can see from this picture having a grid of buy and sell orders allows you to profit from the daily fluctuations of bitcoin regardless of whether the price is going up or down.
The caveat is: you need to need to be 100% certain that your buy/sell grid covers the range of fluctuation AND that you have enough capital in your account to make the buys/sells throughout an entire day of fluctuation. Check our TOTAL capital versus AVAILABLE credit after setting up your buy/sell grid and make sure that only 50% of your capital is expended in opening up these limit orders.
An important concept is daily price range. You must know the daily price range of Bitcoin and be certain that your buy/sell grid covers it. For instance, here you can see that I have a wide range of orders on the book and the daily range of Bitcoin is 4 times or more smaller than my grid.
Reading an article like this Bloomberg one will help you understand what range your grid should be prepared to cover on a daily basis.
For me, all I do is look at the UPside and DOWNside contracts at Bitmex to get an idea of the range that Bitcoin will trade in - this is because these future contracts are designed to not pay back and the prices of these contracts are calculated to make sure that Bitcoin does not rise or fall to those values within a week.
For instance, at this moment, Bitcoin is trading at $7639.00 and the UP contract strike is $8250 and the DOWN contract strike is $6750. So as long as my grid covers that price range, I am good to go for a week.
Are you bullish on Bitcoin?
If you are bullish on Bitcoin and don't want to get caught with sell orders when BTC skyrockets to the moon without notice, then you may want to only offer buy-side market-making instead of two-way market making.
The way to do this is to enable CHECK_POSITION_LIMITS and then set MIN_POSITION to -1 so that you never hold more than 1 short contract. Set the MAX_POSITION to a number that you feel comfortable with. e.g., if your initial buy contract is for 500 contracts and your orders are spaced 1% apart and you want to be able to buy all the way down to BTC dropping 20% in value, then you need 20 * 500 as your MAX_POSITION and no more.
CHECK_POSITION_LIMITS should be True by default
You do not want to wake (as I have) and find that a 0.6BTC account has been drained because there was no limit on total amount of contracts you could have open.
1
Give Award
Share
ReportSave
level 2
OP·3y
so following these guidelines will reduce the risk of using the market maker?
The main issue is getting stuck into a position when the market moves and starts trading in a new range. Then you get stuck in a position that you can never recover from.
e.g. say we rise from $7600 to $8200. Now you have a short position that you can only recover from if the market goes back down to $7600 which there is no guarantee of. If it goes higher it gets worse.
1
Give Award
Share
ReportSave
level 3
·3y
Instead of such a move liquidating your entire account, you could close that position for a loss.
And studying recent maximum price range prepares you for this.. You would open more sell orders in the higher range.
Finally when something goes higher, there is always a pullback and correction. Some forks of sample market maker do martingale style increase in contract size.
Also since your fear is Bitcoin going to the moon, just be a buy side market maker Instead of trading both sides.
1
Give Award
Share
ReportSave
level 4
OP·3y
I would prefer to seek a risk management technique which is implemented in the bot rather than intervening manually. Also I would like to design it such that it would not take such heavy losses.
Bitcoin going to the moon is on a longer timescale than what a bot needs to know. Bitcoin can dump just as hard as it can moonshot. I have lost money in both scenarios using the market maker. I find that I make small gains while price is stable but when a volatile move occurs I take a heavy loss the wipes out my gains.
How often does your bot make trades? I thought the initial configuration for the bot was pointless since you could just place buy and sell orders above and below price yourself. I started working on the bot with its initial buy and sell orders at the bid and ask price respectively. That way it executes multiple trades a minute and takes advantage of the maker rebate fee. I found it more profitable but still needs risk management.
1
Give Award
Share
ReportSave
level 5
·3y
I have lost money in both scenarios using the market maker.
I lost money in a drop, but I analyzed why. And is it because I was trading too many contracts. That over-margined me. I needed to limit the total number of contracts and I needed to make sure that my grid was wide enough to accomodate the daily range of Bitcoin.
How often does your bot make trades?
110 made in the last 24 hours.
I started working on the bot with its initial buy and sell orders at the bid and ask price respectively.
That's what i wanted so I set the difference between bid/ask very small but then after an order filled, the new orders would also fill immediately. But I definitely like your idea of being right at the bid/ask.
1
Give Award
Share
ReportSave
level 6
OP·3y
I lost money in a drop, but I analyzed why. And is it because I was trading too many contracts. That over-margined me. I needed to limit the total number of contracts and I needed to make sure that my grid was wide enough to accomodate the daily range of Bitcoin.
Yeah that was my problem too.
110 made in the last 24 hours.
That's 4-5 trades an hour, which you could just do yourself manually. I have essentially been doing that myself over the last two weeks in my own trading strategy, very similar to the sample market maker, so you don't really need a bot to implement it, and I prefer to manage my position myself and use my judgement to e.g. only have buy side orders to go long if we are in a bullish trend, vice versa for bearish.
That's what i wanted so I set the difference between bid/ask very small but then after an order filled, the new orders would also fill immediately. But I definitely like your idea of being right at the bid/ask.
This is what you want the bot for, to execute more trades than a human can. You can bet your ass people have flocked to BitMEX to make markets and just earn money with the maker rebate. I'm sure HFT guys are drooling at the prospect of an exchange that pays you to place orders, and I'm sure they've come up with risk free ways to constantly get that maker rebate, making several trades a minute.
tbh leaving the sample market maker as it is and just tweaking the variables, I'm sure you could find a profitable setup, but I doubt it will stay profitable for long as the market conditions constantly change. Now is the best time to market make as we consolidation further in a tightening range and volume drops off, but once we break this consolidation patter volatility will spike and the sample market maker will no longer be profitable.
1
Give Award
Share
ReportSave
level 7
·3y
Hey, EnterShikariZzz, just a quick heads-up:
accomodate is actually spelled accommodate. You can remember it by two cs, two ms.
Have a nice day!
The parent commenter can reply with 'delete' to delete this comment.
1
Give Award
Share
ReportSave
level 8
OP·3y
fuck off
1
Give Award
Share
ReportSave
level 6
·3y
Hey, metaperl, just a quick heads-up:
accomodate is actually spelled accommodate. You can remember it by two cs, two ms.
Have a nice day!
The parent commenter can reply with 'delete' to delete this comment.
1
Give Award
Share
ReportSave
level 1
·3y·edited 3y
Is there some way to use talib to write an indicator based strategy for this bot? Just to be more clear, I'd like to write something like "open short when RSI>70" and "open long when RSI<30"... Is this possible using a custom strategy for this bot?
1
Give Award
Share
ReportSave
level 2
OP·3y
I wanted to try this myself but never had the time. I'm sure it is though, give it a go and let me know.
My friend started with the sample bot and kept editing it until he had re-written most of the codebase. He now has a profitable trading bot.
1
Give Award
Share
ReportSave
level 3
·3y
Maybe you can help me setting the bot to run. I created a fresh new debian install just for that. Followed the (minimal) instructions to install and configure but when I try to run marketmaker XBTUSD I get a lot of errors:
*marketmaker "XBTUSD" Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.5/bin/marketmaker", line 9, in <module> load_entry_point('bitmex-market- maker==1.3', 'console_scripts', 'marketmaker')() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site- packages/bitmex_market_maker-1.3-py3.5.egg/market_maker/__init__.py", line 21, in run from market_maker import market_maker File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/bitmex_market_maker-1.3-py3.5.egg/market_maker/market_maker.py", line 11, in <module> from market_maker import bitmex File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/bitmex_market_maker-1.3-py3.5.egg/market_maker/bitmex.py", line 12, in <module> from market_maker.ws.ws_thread import BitMEXWebsocket File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/bitmex_market_maker-1.3-py3.5.egg/market_maker/ws/ws_thread.py", line 10, in <module> from market_maker.settings import settings File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/bitmex_market_maker-1.3-py3.5.egg/market_maker/settings.py", line 25, in <module> userSettings = import_path(os.path.join('.', 'settings')) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/bitmex_market_maker-1.3-py3.5.egg/market_maker/settings.py", line 19, in import_path module = importlib.import_module(filename, path) File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 981, in _gcd_import File "<frozen importlib._bootstrap>", line 931, in _sanity_check SystemError: Parent module '.' not loaded, cannot perform relative import
1
Give Award
Share
ReportSave
level 4
OP·3y
looks like its getting confused about the directory. I remember the intructions were a bit off. I think maybe if you change 'settings' to 'settings.py' in "import_path(os.path.join('.', 'settings'))" or maybe '_settings_base.py' since that's the name of the actual settings file you put your API keys into
1
Give Award
Share
ReportSave
level 5
·3y
Thank you. Tested both names but no success at all. Did you have installed in a python venv?
1
Give Award
Share
ReportSave
level 6
·3y
Are you still having problems getting the bot to work?
1
Give Award
Share
ReportSave
level 6
OP·3y
nah was just using mine through git bash.
I was def able to fix it keep plowing away at it
maybe try just _settings_base or check that its looking in the right directory
1
Give Award
Share
ReportSave
level 3
·3y
Your friends cares to share the code? Except his custom profitable strategies, obviously.
1
Give Award
Share
ReportSave
level 4
OP·3y
you must be joking haha he has patented that shit and started a company with it
1
Give Award
Share
ReportSave
level 5
·3y
your friend rewrote an existing bot and it was so profitable he was able to start a company?
also patented it? what?? lol
1
Give Award
Share
ReportSave
level 6
OP·3y
tbh I would be suprised if he had any of BitMEX's original code now, he told me he pretty much re-wrote it.
but yeah I think its more or less profitable so he's trying to get investors to give him their money to play with. Think his biggest one was willing to invest 50mil
1
Give Award
Share
ReportSave
level 7
·3y
I assumed you couldn't patent an algo, am I wrong?
That's a nice story though, my algos would get destroyed trying to use that much capital lol
1
Give Award
Share
ReportSave
level 8
OP·3y
dunno he did something with loads of lawyers anyway, was saying all the legal stuff was very stressful.
He's also a hardcore hodler. Held IOTA and SNT from the ICO onwards, don't think he ever sold some. Turned like 3000 into over 60,000 or something with IOTA. Also bought ETH at $10 and XRP at $0.005. Think his only sell was 2 bitcoins at $7k in Oct and 1 bitcoin at $17k in Dec. Overall turned a little less than €2,500 into over €100k
1
Give Award
Share
ReportSave
level 9
·3y
Meh I had pretty similar results and I only got into crypto a 8 months ago
1
Give Award
Share
ReportSave
level 10
OP·3y
srs? damn you played that well.
I invested a lot more and didn't get nearly as much, got in 9 months ago
1
Give Award
Share
ReportSave
level 8
·3y
You're not wrong, Walter, you're just an asshole.
0
Give Award
Share
ReportSave
level 9
·3y
Bad bot
1
Give Award
Share
ReportSave
level 10
·3y
Thank you, phachen, for voting on BigLebowskiBot.
This bot wants to find the best and worst bots on Reddit. You can view results here.
Even if I don't reply to your comment, I'm still listening for votes. Check the webpage to see if your vote registered!
1
Give Award
Share
ReportSave
level 1
·3y
Hey man could you share settings for this bot, or default is best?
1
Give Award
Share
ReportSave
level 2
OP·3y
default is best I'd say. Least risky.
If you reduce the min_spread variable it might make you more money but you'll more likely to lose it all faster.
Also the less liquid coins are more profitable but more risky
1
Give Award
Share
ReportSave
level 3
·3y
We had some serious drops in BTC recently, how does the market maker react? What are good settings to minimize the risk of price drops?
1
Give Award
Share
ReportSave
level 4
OP·3y
I haven't been running the market marker but I can only assume it would have lost a load of money
1
Give Award
Share
ReportSave
level 1
·3y
How has your guys' testing been going? I've been running it for a couple weeks with a nice profit. I agree it's a very simple algorithm with no safety measures. I'm more of a developer than a trader, so I'll have to consult some friends on the strategy that it's currently using.
1
Give Award
Share
ReportSave
level 2
OP·3y
have you been running it on the testnet or the real exchange?
I ran it on the testnet for a week and it turned 0.2 TBTC into 2 TBTC which is pretty incredible, but the testnet is quite different to the real exchange.
I've been running it on the mainnet for a couple of days now. I started with 0.01 BTC, it lost 0.001 BTC when the market went to one side, but it has since regained that loss and I'm now at 0.01022 BTC
The error handling is crap on the real exchange
1
Give Award
Share
ReportSave
level 3
·3y
Yea I'm testing on testnet. Figured the real thing would have different results. Have you made any changes to the strategy?
1
Give Award
Share
ReportSave
level 4
OP·3y
I just lowered the number of order pairs to 4 and reduce the amount the initial amount to 50 and the increments to 5.
This seems to just about work with 0.01 BTC on the mainnet.
The bot seems to make a slow and steady profit while the market moves sideways, but if there's a breakout or breakdown then the bot gets you in a huge long or short that it can't really recover from and it ends up losing you money, so I'd say for it to reliably make a profit one would need to turn it off before a breakout or breakdown, but if you knew when that would happen you wouldn't really need a bot to make money now would you
3
Give Award
Share
ReportSave
level 5
·3y
This has been my experience as well.
1
Give Award
Share
ReportSave
level 6
OP·3y
Have you made or lost any money so far?
I turned 0.01 TBTC into 0.015 TBTC running it trading XBTUSD contracts for about a week. Then started it trading XLMF18 contracts which had higher spreads and it increased my 0.015 TBTC into 0.02 TBTC in about two days, but then it got itself into a huge short and ran out of funds to keep the bot running so I got liquidated.
I was thinking of trying again but keeping it on XBTUSD because its the least volatile most of the time. There are definitely more profitable spreads on some altcoins but the volatility makes them riskier
2
Give Award
Share
ReportSave
level 7
·3y
I did test with minuscule amounts long ago. Running my own strategy now which is profitable and solid for months (and nothing to do with the market maker strategy). Be careful regardless, it's hard to keep the same performance with bigger amounts due to slippage.
1
Give Award
Share
ReportSave
level 8
OP·3y
Did you write that bot from scratch or from the sample market maker?
I've been wanting to implement an EMA cross strategy to see how it does but I've been busy with my M.Sc.
1
Give Award
Share
ReportSave
level 9
·3y
Save yourself the time, EMA cross doesn't work for a crypto bot lots of people tried already. Apparently none of the named TA stuff work, if you believe this guy's research: https://news.bitcoin.com/trading-tip-wall-meet-ta-gods/
1
Give Award
Share
ReportSave
level 10
OP·3y
interesting. I wouldn't really be able to think of any other strategies to implement with a bot without TA tbh. If you're not market making, and you're not using TA, then what are you doing?
1
Give Award
Share
ReportSave
level 5
·3y
bitmex market maker
that a good and complete answer :)
2
Give Award
Share
ReportSave
level 1
·3y
Where’d you find this bot? I’d like to give it a try, maybe we can compare results.
1
Give Award
Share
ReportSave
level 2
·3y
Short of I use the Bot to learn python, or learn python first? Minor coding experience here.
1
Give Award
Share
ReportSave
level 3
OP·3y
Use the bot to learn IMO
1
Give Award
Share
ReportSave
level 3
·3y
Same for me - interested to know
1
Give Award
Share
ReportSave
level 4
OP·3y
use the bot to learn IMO
1
Give Award
Share
ReportSave
level 2
OP·3y
It's on GitHub, just search bitmex market maker
1
Give Award
Share
ReportSave
'Finance' 카테고리의 다른 글
The Ultimate Guide For Grid Trading Bot 2021 | 8 Grid Bot (that Actually Work) (0) | 2021.07.13 |
---|---|
Huobi Global - Grid Trading Rankings (0) | 2021.07.13 |
(BitMEX) Algo Trading & Market Making (pdf) (0) | 2021.07.11 |
비트코인 MDD (0) | 2021.07.06 |
비트코인 전송 속도 (0) | 2021.07.05 |