{"id":6239,"date":"2021-01-05T15:08:14","date_gmt":"2021-01-05T15:08:14","guid":{"rendered":"http:\/\/algotrading101.com\/learn\/?p=6239"},"modified":"2023-04-03T21:12:45","modified_gmt":"2023-04-03T21:12:45","slug":"bitmex-api-introduction-guide","status":"publish","type":"post","link":"https:\/\/algotrading101.com\/learn\/bitmex-api-introduction-guide\/","title":{"rendered":"BitMex API Introduction Guide"},"content":{"rendered":"<div class=\"pvc_clear\"><\/div><p id=\"pvc_stats_6239\" class=\"pvc_stats total_only  \" data-element-id=\"6239\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p><div class=\"pvc_clear\"><\/div>\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"163\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/Naslovna-1024x163.jpg\" alt=\"BitMex API Guide\" class=\"wp-image-16264\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/Naslovna-1024x163.jpg 1024w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/Naslovna-300x48.jpg 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/Naslovna-768x122.jpg 768w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/Naslovna.jpg 1406w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Table of contents:<\/h3>\n\n\n\n<ol><li><a href=\"#what-is-the-bitmex-api\">What is the BitMex API?<\/a><\/li><li><a href=\"#what-is-bitmex\">What is BitMex?<\/a><\/li><li><a href=\"#bitmex-what-crypto-derivatives-available\">What Crypto Derivatives are available on BitMex?<\/a><\/li><li><a href=\"#bitmex-what-are-the-trading-fees\">What are the trading fees on BitMex?<\/a><\/li><li><a href=\"#why-should-i-use-the-bitmex-api\">Why should I use the BitMex API?<\/a><\/li><li><a href=\"#why-shouldnt-i-use-the-bitmex-api\">Why shouldn\u2019t I use the BitMex API?<\/a><\/li><li><a href=\"#is-bitmex-available-in-my-country\">Is BitMex Available in my Country?<\/a><\/li><li><a href=\"#what-are-the-alternatives-to-using-the-bitmex-api\">What are the alternatives to using the BitMex API?<\/a><\/li><li><a href=\"#what-are-the-available-libraries-for-the-bitmex-api\">What are the available libraries for the BitMex API?<\/a><\/li><li><a href=\"#what-is-the-bitmex-api-testnet\">What is the BitMex Testnet?<\/a><\/li><li><a href=\"#how-to-get-started-with-the-bitmex-api\">How to get started with the BitMex API?<\/a><\/li><li><a href=\"#how-do-i-execute-a-market-order-with-the-bitmex-api\">How do I execute a Market order with the BitMex API?<\/a><\/li><li><a href=\"#how-to-change-your-leverage-with-the-bitmex-api\">How to change your leverage with the BitMex API?<\/a><\/li><li><a href=\"#how-to-get-a-quote-with-the-bitmex-api\">How to get a quote with the BitMex API?<\/a><\/li><li><a href=\"#how-to-check-open-positions-with-the-bitmex-api\">How to check open positions with the BitMex API?<\/a><\/li><li><a href=\"#how-to-get-past-minute-data-with-the-bitmex-api\">How to get past-minute data with the BitMex API?<\/a><\/li><li><a href=\"#how-to-execute-a-trade-on-eth-when-btc-hits-a-certain-price-with-the-bitmex-api\">How to execute a trade on ETH when BTC hits a certain price with the BitMex API?<\/a><\/li><li><a href=\"#how-to-execute-an-eth-trade-when-btc-moves-5-in-the-last-5-minutes-with-the-bitmex-api\">How to execute an ETH trade when BTC moves 5% in the last 5 minutes with the BitMex API?<\/a><\/li><li><a href=\"#are-there-any-controversies-concerning-bitmex\">Are there any controversies concerning BitMex?<\/a><\/li><li><a href=\"#download-code\">Download Code Used<\/a><\/li><\/ol>\n\n\n\n<a name=\"what-is-the-bitmex-api\">\n\n\n\n<h2 class=\"wp-block-heading\">What is the BitMex API?<\/h2>\n\n\n\n<p>BitMex API is a method for us to trade cryptocurrencies on BitMex automatically via code.<\/p>\n\n\n\n<p>Link: <a href=\"https:\/\/www.bitmex.com\">https:\/\/www.bitmex.com<\/a><\/p>\n\n\n\n<a name=\"what-is-bitmex\">\n\n\n\n<h2 class=\"wp-block-heading\">What is BitMex?<\/h2>\n\n\n\n<p>The Bitcoin Mercantile Exchange (BitMex) is a trading platform that allows users to trade cryptocurrency derivative trading.<\/p>\n\n\n\n<p>With BitMex, traders trade contracts that can be more volatile than those of traditional trading. Their platform is primarily built around trading cryptocurrencies through derivative trading or more specialized approaches like margin trading.<\/p>\n\n\n\n<p>The volatility of BitMex is a double-edged sword which means that we can either generate mass profits with a small deposit, or lose much income in a quick manner.<\/p>\n\n\n\n<p>As of lately, BitMex has updated its policy and requires the customer to follow the KYC regulation.<\/p>\n\n\n\n<p>All currencies deposited on BitMex must be in Bitcoin, as the platform is specialized around it. When we deposit our Bitcoin, we can settle for contracts on various other currencies with it. <\/p>\n\n\n\n<p>Have in mind that BitMEX&nbsp;<strong>only<\/strong>&nbsp;<strong>handles Bitcoin<\/strong>. All profit and loss are in Bitcoin, even if you\u2019re buying and selling altcoin contracts. BitMEX does not handle fiat currency.<\/p>\n\n\n\n<p>The notable coins are the following:<\/p>\n\n\n\n<ul><li>Bitcoin<\/li><li>Bitcoin Cash<\/li><li>Dash<\/li><li>Ripple<\/li><li>Ethereum<\/li><li>Ethereum Classic<\/li><li>Tezos<\/li><li>Chainlink<\/li><li>Monero<\/li><li>Tron<\/li><li>Litecoin<\/li><li>Zcash<\/li><\/ul>\n\n\n\n<p>Have in mind that Ethereum and Bitcoin trades have futures and spot trading options, whilst others have only the future markets.<\/p>\n\n\n\n<a name=\"bitmex-what-crypto-derivatives-available\">\n\n\n\n<h2 class=\"wp-block-heading\">What Crypto Derivatives are available on BitMex?<\/h2>\n\n\n\n<p>When it comes to contracts that BitMex provides there are a few:<\/p>\n\n\n\n<ul><li><strong>Futures Contract<\/strong> \u2013 This can be viewed as an agreement to sell or buy a currency at a set price and time in the future.<\/li><\/ul>\n\n\n\n<ul><li><strong><strong>Perpetual<\/strong><\/strong> <strong>Contract<\/strong> \u2013 This one is similar to the previous one with the difference that it doesn\u2019t expire.<\/li><\/ul>\n\n\n\n<ul><li><strong>Upside Profit Contract<\/strong> \u2013 According to BitMex, this allows us to pay a premium on the trade date for which we\u2019re entitled to gain the difference between the underlying instrument settlement price and strike price on the maturity date, if positive. Otherwise, no payment is processed.<\/li><\/ul>\n\n\n\n<ul><li><strong>Downside Profit Contract \u2013 <\/strong>This is the opposite of the Upside Profit Contract and it allows us to take a part of a potential downside of a specified cryptocurrency.<\/li><\/ul>\n\n\n\n<a name=\"bitmex-what-are-the-trading-fees\">\n\n\n\n<h2 class=\"wp-block-heading\">What are the trading fees on BitMex?<\/h2>\n\n\n\n<p>When it comes to the fees BitMex applies to its users, they\u2019re not too harsh. For example, if the Taker Fee is 0.0750%, while the Maker Fee is -0.0250%, the maker makes a small pay back on trades.<\/p>\n\n\n\n<p>Takers are traders who buy at the ask price and sell at the bid price. <\/p>\n\n\n\n<p>Makers are traders who buy at the bid price and sell at the ask price.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"846\" height=\"775\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/Capture-6.jpg\" alt=\"\" class=\"wp-image-16265\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/Capture-6.jpg 846w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/Capture-6-300x275.jpg 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/Capture-6-768x704.jpg 768w\" sizes=\"(max-width: 846px) 100vw, 846px\" \/><\/figure>\n\n\n\n<p>Withdrawals and deposits are free of charge which makes BitMex a competitive provider when compared with others.<\/p>\n\n\n\n<p>The minimum amount that can be deposited into a BitMex trading account is 0.001 BTC, while there is no limit for the withdrawal amount. Fiat currencies aren\u2019t available for withdrawal and deposits.<\/p>\n\n\n\n<p>For a look into the full fee information, be sure to visit the following link: <a href=\"https:\/\/www.bitmex.com\/app\/fees\">https:\/\/www.bitmex.com\/app\/fees<\/a><\/p>\n\n\n\n<p>BitMex offers many order types like market orders, stop limit orders, take profit orders, stop limit orders, iceberg order, fill or kill, immediate or cancel, and more.<\/p>\n\n\n\n<p>For the most part, BitMex doesn\u2019t limit its user\u2019s access depending on his geographical location, rather it is limited by the local laws of the residential country of the said user.<\/p>\n\n\n\n<p>Following this, it is worthy to note that BitMex isn\u2019t allowed in several countries and one of them is the US that assumed some illegal activities coming from BitMex.<\/p>\n\n\n\n<p>If you want to learn how the BitMex indices are calculated, visit the following link: <a href=\"https:\/\/www.bitmex.com\/app\/indices\">https:\/\/www.bitmex.com\/app\/indices<\/a><\/p>\n\n\n\n<p>In my opinion, BitMex is most suitable for more experienced traders that have an understanding of the leverage function and the risks that go with it.<\/p>\n\n\n\n<a name=\"why-should-i-use-the-bitmex-api\">\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Why should I use the BitMex API?<\/strong><\/h2>\n\n\n\n<ul><li>Offers a wide range of cryptocurrencies for trading<\/li><li>Offers cryptocurrency derivatives<\/li><li>Offers valuable information on their website<\/li><li>Offers the leverage option (up to 100x)<\/li><li>The BitMex platform is customizable<\/li><li>No deposit and withdrawal fees<\/li><li>BitMex is transparent<\/li><li>High Liquidity<\/li><li>High Leverage<\/li><li>Good security<\/li><li>Has low fees<\/li><\/ul>\n\n\n\n<a name=\"why-shouldnt-i-use-the-bitmex-api\">\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Why shouldn\u2019t I use the BitMex API?<\/strong><\/h2>\n\n\n\n<ul><li>Only accepts Bitcoin for withdrawals and deposits<\/li><li>Not regulated in all countries (i.e. UK and US)<\/li><li>Doesn\u2019t offer fiat withdrawals or deposits<\/li><li>Withdrawals are fixed to a set time of day<\/li><li>Doesn\u2019t have a mobile application<\/li><li>Isn\u2019t suitable for beginners<\/li><\/ul>\n\n\n\n<a name=\"is-bitmex-available-in-my-country\">\n\n\n\n<h2 class=\"wp-block-heading\">Is BitMex Available in my Country?<\/h2>\n\n\n\n<p>As of 5th January 2021, BitMex is not available in the following areas:<\/p>\n\n\n\n<ul><li>United States of America<\/li><li>Province of Ontario in Canada<\/li><li>Province of Qu\u00e9bec in Canada <\/li><li>Hong Kong Special Administrative Region of the People\u2019s Republic of China, <\/li><li>Republic of Seychelles<\/li><li>Bermuda<\/li><li>Cuba<\/li><li>Crimea<\/li><li>Sevastopol<\/li><li>Iran<\/li><li>Syria<\/li><li>North Korea<\/li><li>Sudan<\/li><li>Any state, country or other jurisdiction that is embargoed by the United States of America.<\/li><\/ul>\n\n\n\n<p><a href=\"https:\/\/www.bitmex.com\/app\/terms#:~:text=You%20are%20not%20allowed%20to,Special%20Administrative%20Region%20of%20the\" target=\"_blank\" rel=\"noreferrer noopener\">Source<\/a><\/p>\n\n\n\n<a name=\"what-are-the-alternatives-to-using-the-bitmex-api\">\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What are the alternatives to using the BitMex API?<\/strong><\/h2>\n\n\n\n<p>BitMex can be replaced with other application that can be more suitable for you needs. Here is the list:<\/p>\n\n\n\n<ul><li>Deribit<\/li><li><a href=\"https:\/\/algotrading101.com\/learn\/coinbase-api-guide\/\">Coinbase<\/a><\/li><li>ByBit<\/li><li>Phemex<\/li><li>Binance<\/li><li>Bittrex<\/li><li>Kraken<\/li><li>Bittrex<\/li><li>Bitfinex<\/li><li>Poloniex<\/li><li>UPHOLD and more.<\/li><\/ul>\n\n\n\n<a name=\"what-are-the-available-libraries-for-the-bitmex-api\">\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What are the available libraries for the BitMex API?<\/strong><\/h2>\n\n\n\n<p>BitMex API uses a simple REST API that comes available in many languages like:<\/p>\n\n\n\n<ul><li>Python<\/li><li>C#<\/li><li>C++<\/li><li>Ruby<\/li><li>Scala<\/li><li>Java<\/li><li>PHP<\/li><li>JavaScript<\/li><li>Swift<\/li><li>NodeJS and more.<\/li><\/ul>\n\n\n\n<p>The full list can be obtained here: <a href=\"https:\/\/libraries.io\/github\/BitMEX\/api-connectors\">https:\/\/libraries.io\/github\/BitMEX\/api-connectors<\/a><\/p>\n\n\n\n<a name=\"how-to-get-started-with-the-bitmex-api\">\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to get started with the BitMex API?<\/strong><\/h2>\n\n\n\n<p>In order to get started with the BitMex API, we\u2019ll need to go to their website and register for an account. (<a href=\"https:\/\/www.bitmex.com\/\">https:\/\/www.bitmex.com\/<\/a>)<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"493\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/reg1-1024x493.jpg\" alt=\"\" class=\"wp-image-16266\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/reg1-1024x493.jpg 1024w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/reg1-300x145.jpg 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/reg1-768x370.jpg 768w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/reg1.jpg 1326w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>In the top right corner you\u2019ll see a green \u201cRegister\u201d button. Click it.<\/p>\n\n\n\n<p>After that, we\u2019ll input the required information (Email, Residence and Password) in the newly opened screen.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"671\" height=\"900\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/reg2.jpg\" alt=\"\" class=\"wp-image-16267\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/reg2.jpg 671w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/reg2-224x300.jpg 224w\" sizes=\"(max-width: 671px) 100vw, 671px\" \/><\/figure>\n\n\n\n<p>Now, the BitMex platform will send a confirmation email that we\u2019ll need to check in order to proceed to the platform. After the confirmation, we\u2019ll be led to a new screen.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"542\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/reg4-1024x542.jpg\" alt=\"\" class=\"wp-image-16268\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/reg4-1024x542.jpg 1024w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/reg4-300x159.jpg 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/reg4-768x406.jpg 768w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/reg4-1536x813.jpg 1536w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/reg4.jpg 1896w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Welcome to BitMex!<\/p>\n\n\n\n<p>Let\u2019s go ahead and setup an API Key. In the top toolbar click the \u201cAPI\u201d button. After that, click the API Key Management option under the API Keys section that is located on the left side of the screen.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"537\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/reg5-1024x537.jpg\" alt=\"\" class=\"wp-image-16269\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/reg5-1024x537.jpg 1024w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/reg5-300x157.jpg 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/reg5-768x403.jpg 768w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/reg5.jpg 1522w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Now, you\u2019ll be able to give a name to your API Key for an easier referencing later, create a CIDR block to restrict it to a single IP address, add permission like Order and Order Cancel, and allow withdrawals.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"480\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/reg6-1024x480.jpg\" alt=\"\" class=\"wp-image-16270\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/reg6-1024x480.jpg 1024w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/reg6-300x141.jpg 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/reg6-768x360.jpg 768w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/reg6.jpg 1503w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>After you\u2019re set, click the \u201cCreate API Key\u201d button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"330\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/regapi-1024x330.jpg\" alt=\"\" class=\"wp-image-16272\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/regapi-1024x330.jpg 1024w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/regapi-300x97.jpg 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/regapi-768x248.jpg 768w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/regapi.jpg 1271w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<a name=\"what-is-the-bitmex-api-testnet\">\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What is the BitMex Testnet?<\/strong><\/h2>\n\n\n\n<p>The BitMex API Testnet is an environment where we can test our programs and trading strategies. On the Testnet, all trading is free and is identical to the live trading market.<\/p>\n\n\n\n<p>The only \u201cannoying\u201d thing is that you\u2019ll need to go to the BitMex API Testnet and register on it. No matter if you already registered for the \u201creal\u201d one. <\/p>\n\n\n\n<p>The registration process is the same and the API Key registration is the same too.<\/p>\n\n\n\n<p> In order to differentiate the two BitMex environments, a logo variation was made. The regular BitMex API platform uses a red and blue logo while the BitMex API Testnet platform uses a green and blue logo.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2020\/11\/1-1024x576.png\" alt=\"\" class=\"wp-image-6168\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2020\/11\/1-1024x576.png 1024w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2020\/11\/1-300x169.png 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2020\/11\/1-768x432.png 768w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2020\/11\/1-1536x864.png 1536w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2020\/11\/1.png 1920w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<a name=\"how-do-i-execute-a-market-order-with-the-bitmex-api\">\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How do I execute a Market order with the BitMex API?<\/strong><\/h2>\n\n\n\n<p>For this article, we will use the Python programming language. Let\u2019s go ahead and install our BitMex client with the following code:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>pip install BitMex\npip install bitmex_websocket<\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex\"><\/figure>\n\n\n\n<p>Now, let\u2019s import the relevant libraries that we need:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>import bitmex\nimport time\nimport json\nimport requests<\/code><\/pre><\/div>\n\n\n\n<p>The next step is to add our API Key and API Secret and authenticate them so we can access the BitMex client.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>bitmex_api_key = \u201dYour API Key Here\u201d \nbitmex_api_secret = \u201dYour API Secret Here\u201d\nclient = bitmex.bitmex(api_key=bitmex_api_key_test, api_secret=bitmex_api_secret_test)<\/code><\/pre><\/div>\n\n\n\n<p>Take note that the BitMex API client automatically connects us to the Testnet version. In order to connect to the real trading one, we\u2019d need to write it as the following:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>client = bitmex.bitmex(test = False, api_key=bitmex_api_key_test, api_secret=bitmex_api_secret_test)<\/code><\/pre><\/div>\n\n\n\n<p>After this, we\u2019ll proceed to execute our market order. For this example we\u2019ll trade the XBTEUR asset using the long and short contracts for the current market price.<\/p>\n\n\n\n<p>We\u2019ll need to specify our symbol, order type, and values for the long and short positions.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>symbol = &#39;XBTUSD&#39;\nordType = &#39;Market&#39;\norderQty_Sell = -10 \norderQty_Buy = 10 <\/code><\/pre><\/div>\n\n\n\n<p>Now, let\u2019s make the order calls for both long and short orders.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>client.Order.Order_new(symbol=symbol, ordType=ordType, orderQty=orderQty_Sell).result() \n\nclient.Order.Order_new(symbol=symbol, ordType=ordType, orderQty=orderQty_Buy).result() <\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"887\" height=\"672\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/market-order.jpg\" alt=\"\" class=\"wp-image-16273\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/market-order.jpg 887w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/market-order-300x227.jpg 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/market-order-768x582.jpg 768w\" sizes=\"(max-width: 887px) 100vw, 887px\" \/><\/figure>\n\n\n\n<p>There is also another way to execute an order. For example if we want to buy 1000 XBTUSD contracts at $400, we\u2019ll write the following:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>client.Order.Order_new(symbol=&#39;XBTUSD&#39;, orderQty=1000, price=400).result()<\/code><\/pre><\/div>\n\n\n\n<p>In order to cancel all of our orders we can write the following:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>client.Order.Order_cancelAll().result()<\/code><\/pre><\/div>\n\n\n\n<a name=\"how-to-change-your-leverage-with-the-bitmex-api\">\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to change your leverage with the BitMex API?<\/strong><\/h2>\n\n\n\n<p>Leverages can be seen as borrowed funds that increase the returns from a specific investment or project. This means that they allow us to increase our buying power.<\/p>\n\n\n\n<p>In order to change the leverage used with the BitMex API write the following code:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>Leverage = 10\nsymbol = \u2018XBTEUR\u2019\n\nclient.Position.Position_updateLeverage (symbol = symbol, leverage = Leverage).result ()<\/code><\/pre><\/div>\n\n\n\n<a name=\"how-to-get-a-quote-with-the-bitmex-api\">\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to get a quote with the BitMex API?<\/strong><\/h2>\n\n\n\n<p>In order to get a quote from the BitMex API we\u2019ll need to import the required library and specify the quote we want to obtain:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>import bitmex\nclient = bitmex.bitmex()\nresult = client.Quote.Quote_get(symbol=&quot;XBTUSD&quot;, reverse=True, count=1).result()<\/code><\/pre><\/div>\n\n\n\n<p>Now, let\u2019s ask for the bid price, bid size and the ask price:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>result[0][0][&#39;bidSize&#39;]\n\nresult[0][0][&#39;bidSize&#39;]\n\nresult[0][0][&#39;askPrice&#39;]<\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"719\" height=\"426\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/quote.jpg\" alt=\"\" class=\"wp-image-16274\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/quote.jpg 719w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/quote-300x178.jpg 300w\" sizes=\"(max-width: 719px) 100vw, 719px\" \/><\/figure>\n\n\n\n<p>If you want to obtain all the quotes for today, you can write the following code:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>client.Quote.Quote_get(symbol=&quot;XBTUSD&quot;, endTime=datetime.datetime.utcnow()).result()<\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"520\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/quoteday-1024x520.jpg\" alt=\"\" class=\"wp-image-16275\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/quoteday-1024x520.jpg 1024w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/quoteday-300x152.jpg 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/quoteday-768x390.jpg 768w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/quoteday.jpg 1075w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<a name=\"how-to-check-open-positions-with-the-bitmex-api\">\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to check open positions with the BitMex API?<\/strong><\/h2>\n\n\n\n<p>In order to get the open position we\u2019ll need to add the following libraries:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>import bitmex\nimport json\nimport datetime<\/code><\/pre><\/div>\n\n\n\n<p>After that, let\u2019s start the client and get the position for the XBTUSD asset:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>client.Position.Position_get(filter=json.dumps({&#39;symbol&#39;: &#39;XBTUSD&#39;})).result()<\/code><\/pre><\/div>\n\n\n\n<a name=\"how-to-get-past-minute-data-with-the-bitmex-api\">\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to get past minute data with the BitMex API?<\/strong><\/h2>\n\n\n\n<p>In order to get the past minute data with the BitMex API we\u2019ll import the relevant libraries and authenticate our API Key:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>import bitmex\nimport requests\nimport json\nimport datetime\nimport pandas as pd\nbitmex_api_key = &#39;EeE092m3lwJism5mAFc4plfX&#39; \nbitmex_api_secret = &#39;kgRLOsB7QOfauIyyNj5VOvPQ8ueLCuWWxwXTAI4ABcqqEMqk&#39; \nclient = bitmex.bitmex(api_key=bitmex_api_key, api_secret=bitmex_api_secret)<\/code><\/pre><\/div>\n\n\n\n<p>After this, let\u2019s specify that we only want the past minute data and launch a call with the client:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>binSize=&#39;1m&#39;\npast_minute_data = \\\n    client.Trade.Trade_getBucketed(binSize=binSize, count=1, symbol=&#39;XBTUSD&#39;, reverse=True).result()[0][0]<\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"684\" height=\"502\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/pmd.jpg\" alt=\"\" class=\"wp-image-16276\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/pmd.jpg 684w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/pmd-300x220.jpg 300w\" sizes=\"(max-width: 684px) 100vw, 684px\" \/><\/figure>\n\n\n\n<p>If you want to obtain past data from more than 1 minute, I got you. Let\u2019s obtain data from the past 10 minutes with the following code:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>number_of_minutes_needed = 20\npast_minutes_data_list = []\npast_minutes_data = client.Trade.Trade_getBucketed(binSize=&#39;1m&#39;, count=number_of_minutes_needed, symbol=&#39;XBTUSD&#39;, reverse=True).result()[0]<\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"940\" height=\"550\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/pmdv.jpg\" alt=\"\" class=\"wp-image-16277\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/pmdv.jpg 940w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/pmdv-300x176.jpg 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2022\/07\/pmdv-768x449.jpg 768w\" sizes=\"(max-width: 940px) 100vw, 940px\" \/><\/figure>\n\n\n\n<a name=\"how-to-execute-a-trade-on-eth-when-btc-hits-a-certain-price-with-the-bitmex-api\">\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to execute a trade on ETH when BTC hits a certain price with the BitMex API?<\/strong><\/h2>\n\n\n\n<p>In this example, we will place a buy order on the Ethereum asset when the Bitcoin asset crosses above the 15076 price mark.<\/p>\n\n\n\n<p>Firstly, let\u2019s import the relevant libraries:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>import bitmex\nimport requests\nimport json\nimport datetime\nimport pandas as pd\nfrom time import sleep<\/code><\/pre><\/div>\n\n\n\n<p>After this, we will authenticate the API Key:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>bitmex_api_key = &#39;EeE092m3lwJism5mAFc4plfX&#39; \nbitmex_api_secret = &#39;kgRLOsB7QOfauIyyNj5VOvPQ8ueLCuWWxwXTAI4ABcqqEMqk&#39; \nclient = bitmex.bitmex(api_key=bitmex_api_key, api_secret=bitmex_api_secret)<\/code><\/pre><\/div>\n\n\n\n<p>Now, let\u2019s see our XBTUSD asset and how it is performing overall. Also let\u2019s clean up the results a bit.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>positions = client.Position.Position_get(filter=json.dumps({&quot;symbol&quot;: &#39;XBTUSD&#39;})).result()[0][0]\npositions[&#39;markPrice&#39;]<\/code><\/pre><\/div>\n\n\n\n<p>As we can see, our market price has already gone above the specified limit but what would we do if it was closer, for example, 15078.76?<\/p>\n\n\n\n<p>Firstly, we would want to specify the currency we want to trade (Etherium) and the quantity of our market order:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>symbol = &#39;ETHUSD&#39;\nordType = &#39;Market&#39;\norderQty_Buy = 100<\/code><\/pre><\/div>\n\n\n\n<p>The next step would be to create a loop that would fire every set of seconds (30) to check if the market price has gone above the specified level. If the price has gone above our level, we\u2019d want to buy our Ethereium.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>while True:\n    if processed_position[&#39;markPrice&#39;] &lt; 15000:\n       positions = client.Position.Position_get(filter=json.dumps({&quot;symbol&quot;: &#39;XBTUSD&#39;})).result()[0][0]\n       processed_position = {}\n       processed_position[&quot;markPrice&quot;] = positions[&quot;markPrice&quot;]\n    else:\n        if processed_position[&#39;markPrice&#39;] &gt; 15000:\n            try:\n                order = client.Order.Order_new(symbol=symbol, ordType=ordType, orderQty=orderQty_Buy).result()\n                print(order)\n                print (&#39;Order placed at {}&#39;.format(pd.Timestamp.now()))\n                break\n                \n            except Exception as e:\n                print(&quot;Error placing order:&quot;, e)\n            \n    sleep(30)<\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image alignwide size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1896\" height=\"789\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2020\/11\/orderPriceHit.png\" alt=\"\" class=\"wp-image-6180\" srcset=\"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2020\/11\/orderPriceHit.png 1896w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2020\/11\/orderPriceHit-300x125.png 300w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2020\/11\/orderPriceHit-1024x426.png 1024w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2020\/11\/orderPriceHit-768x320.png 768w, https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2020\/11\/orderPriceHit-1536x639.png 1536w\" sizes=\"(max-width: 1896px) 100vw, 1896px\" \/><\/figure>\n\n\n\n<a name=\"how-to-execute-an-eth-trade-when-btc-moves-5-in-the-last-5-minutes-with-the-bitmex-api\">\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to execute an ETH trade when BTC moves 5% in the last 5 minutes with the BitMex API?<\/strong><\/h2>\n\n\n\n<p>There are many ways to do this and this example will follow a simple, beginner-friendly, way to solve the problem.<\/p>\n\n\n\n<p>The first thing we want to do is import the required libraries:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>import bitmex\nimport requests\nimport json\nimport datetime\nfrom time import sleep<\/code><\/pre><\/div>\n\n\n\n<p>The next thing is to validate our API key:<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>bitmex_api_key = &#39;EeE092m3lwJism5mAFc4plfX&#39; \nbitmex_api_secret = &#39;kgRLOsB7QOfauIyyNj5VOvPQ8ueLCuWWxwXTAI4ABcqqEMqk&#39; \nclient = bitmex.bitmex(api_key=bitmex_api_key, api_secret=bitmex_api_secret)<\/code><\/pre><\/div>\n\n\n\n<p>Now we shall specify the currency we want to buy, here being Etherium, the order type, and the quantity of it.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>symbol = &#39;ETHUSD&#39;\nordType = &#39;Market&#39;\norderQty_Buy = 1000<\/code><\/pre><\/div>\n\n\n\n<p>Now, we need to make a logic by which the trade will occur. We want to make a loop that will start by obtaining the 5 minute candle with the opening price. <\/p>\n\n\n\n<p>After it was obtained, we want our loop to sleep 5 minutes so we can get the new 5 minute candle.<\/p>\n\n\n\n<p>The next step will be to calculate the percentage difference between the two obtained candles. If the percentage doesn\u2019t match our desired 5 percent, the loop will continue.<\/p>\n\n\n\n<p>On the other hand, if it does match our desired 5 percent we will place the order and break out of the loop. Sounds good? <\/p>\n\n\n\n<p>Before I show the code, another way to do this was to obtain new candles every minute or less, and the code would be similar. You\u2019d just need to change your candle size (binSize) and the sleep time.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>while True:\n    binSize=&#39;5m&#39;\n    start = \\\n    client.Trade.Trade_getBucketed(binSize=binSize, count=1, symbol=&#39;XBTUSD&#39;, partial =True, reverse=True).result()[0][0]\n    \n    print(start[&#39;open&#39;])\n    \n    sleep (300)\n    \n    end = \\\n    client.Trade.Trade_getBucketed(binSize=binSize, count=1, symbol=&#39;XBTUSD&#39;, partial =True, reverse=True).result()[0][0]\n    \n\n    print(end[&#39;open&#39;])\n    \n    percent = int(((end[&#39;open&#39;] - start[&#39;open&#39;]) * 100) \/ start[&#39;open&#39;]) \n        \n    if percent &gt; 5:\n        try:\n            order = client.Order.Order_new(symbol=symbol, ordType=ordType, orderQty=orderQty_Buy).result()\n            print(order)\n            print (&#39;Order placed at {}&#39;.format(pd.Timestamp.now()))\n            break\n\n        except Exception as e:\n            print(&quot;Error placing order:&quot;, e)\n    \n    else:\n        print (&#39;Did not move 5%&#39;)\n        sleep (0.1)\n        continue <\/code><\/pre><\/div>\n\n\n\n<a name=\"are-there-any-controversies-concerning-bitmex\">\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Are there any controversies concerning BitMex?<\/strong><\/h2>\n\n\n\n<p>Yes! In May 2020, BitMex got sued by the US for evading rules designed to stop money laundering.<\/p>\n\n\n\n<p>Accusations were made on the BitMex\u2019s parent company (HDR Global Trading) and the top executives (Arthur Hayes, Samuel Reed, Ben Delo).<\/p>\n\n\n\n<p>They were accused on several things and some of them are racketeering, operating a money transmitting business that\u2019s not licensed, money laundering and fraud.<\/p>\n\n\n\n<p>BitMex has disclosed in 2019 that almost 15% of its trading volume, which is worth around 138 billion dollars, was attributable to U.S. traders. <\/p>\n\n\n\n<p>This means that they processed $3 billion in money transfers on a daily basis without having a license!<\/p>\n\n\n\n<p>Arthur Hayes when asked why BitMex was opened in Seychelles said the following:<\/p>\n\n\n\n<p>\u201cSeychelles is cheaper to bribe than [the United States]\u2019 and when asked how much he had to pay Seychelles to register BitMEX there, he said \u2018a coconut.\u201d<\/p>\n\n\n\n<p>\u201cBut how was money laundering possible with BitMex?\u201d &#8211; one may ask.<\/p>\n\n\n\n<p>Well the Dolgov\u2019s lawsuit described an example of how it occurs:<\/p>\n\n\n\n<p>&#8220;A money launderer (Defendants) would open two exchange accounts \u2013 a helper account on one or more exchanges used by BitMEX to calculate its index price (Coinbase Pro, Kraken and BitStamp) and a winner account on BitMEX,&#8221; the lawsuit explains. <\/p>\n\n\n\n<p>&#8220;The money launderer (Defendants) would then enter into a large leveraged derivatives position on BitMEX and immediately execute market orders from the helper account with maximum slippage to move the index price in a favorable direction.&#8221;<\/p>\n\n\n\n<p>This article won\u2019t take a side on either of the perspectives as the main point of it was to inform you about BitMex and its API.<\/p>\n\n\n\n<a name=\"download-code\">\n\n\n\n<h2 class=\"wp-block-heading\">Download Code Used<\/h2>\n\n\n\n<p><a href=\"https:\/\/github.com\/Lucas170\/BitMex-API-Introduction-Guide\" target=\"_blank\" rel=\"noreferrer noopener\">Github Link<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_6239\" class=\"pvc_stats total_only  \" data-element-id=\"6239\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/algotrading101.com\/learn\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n<p>Table of contents: What is the BitMex API? What is BitMex? What Crypto Derivatives are available on BitMex? What are the trading fees on BitMex? Why should I use the BitMex API? Why shouldn\u2019t I use the BitMex API? Is BitMex Available in my Country? What are the alternatives to using the BitMex API? What [&hellip;]<\/p>\n","protected":false},"author":14,"featured_media":7108,"comment_status":"closed","ping_status":"open","sticky":true,"template":"","format":"standard","meta":{"_lmt_disableupdate":"no","_lmt_disable":"no","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[3,2],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>BitMex API Introduction Guide - AlgoTrading101 Blog<\/title>\n<meta name=\"description\" content=\"BitMex API is a method for us to trade cryptocurrencies on BitMex automatically via code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/algotrading101.com\/learn\/bitmex-api-introduction-guide\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"BitMex API Introduction Guide - AlgoTrading101 Blog\" \/>\n<meta property=\"og:description\" content=\"BitMex API is a method for us to trade cryptocurrencies on BitMex automatically via code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/algotrading101.com\/learn\/bitmex-api-introduction-guide\/\" \/>\n<meta property=\"og:site_name\" content=\"Quantitative Trading Ideas and Guides - AlgoTrading101 Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-01-05T15:08:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-04-03T21:12:45+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2021\/01\/Bitmex-API-Guide.png\" \/>\n\t<meta property=\"og:image:width\" content=\"700\" \/>\n\t<meta property=\"og:image:height\" content=\"400\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Igor Radovanovic\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Igor Radovanovic\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"16 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"BitMex API Introduction Guide - AlgoTrading101 Blog","description":"BitMex API is a method for us to trade cryptocurrencies on BitMex automatically via code.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/algotrading101.com\/learn\/bitmex-api-introduction-guide\/","og_locale":"en_US","og_type":"article","og_title":"BitMex API Introduction Guide - AlgoTrading101 Blog","og_description":"BitMex API is a method for us to trade cryptocurrencies on BitMex automatically via code.","og_url":"https:\/\/algotrading101.com\/learn\/bitmex-api-introduction-guide\/","og_site_name":"Quantitative Trading Ideas and Guides - AlgoTrading101 Blog","article_published_time":"2021-01-05T15:08:14+00:00","article_modified_time":"2023-04-03T21:12:45+00:00","og_image":[{"width":700,"height":400,"url":"http:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2021\/01\/Bitmex-API-Guide.png","type":"image\/png"}],"author":"Igor Radovanovic","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Igor Radovanovic","Est. reading time":"16 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/algotrading101.com\/learn\/bitmex-api-introduction-guide\/#article","isPartOf":{"@id":"https:\/\/algotrading101.com\/learn\/bitmex-api-introduction-guide\/"},"author":{"name":"Igor Radovanovic","@id":"https:\/\/algotrading101.com\/learn\/#\/schema\/person\/a7ae60c112a73b7c3fe14ac56726a0ae"},"headline":"BitMex API Introduction Guide","datePublished":"2021-01-05T15:08:14+00:00","dateModified":"2023-04-03T21:12:45+00:00","mainEntityOfPage":{"@id":"https:\/\/algotrading101.com\/learn\/bitmex-api-introduction-guide\/"},"wordCount":2486,"publisher":{"@id":"https:\/\/algotrading101.com\/learn\/#organization"},"articleSection":["Programming","Trading"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/algotrading101.com\/learn\/bitmex-api-introduction-guide\/","url":"https:\/\/algotrading101.com\/learn\/bitmex-api-introduction-guide\/","name":"BitMex API Introduction Guide - AlgoTrading101 Blog","isPartOf":{"@id":"https:\/\/algotrading101.com\/learn\/#website"},"datePublished":"2021-01-05T15:08:14+00:00","dateModified":"2023-04-03T21:12:45+00:00","description":"BitMex API is a method for us to trade cryptocurrencies on BitMex automatically via code.","breadcrumb":{"@id":"https:\/\/algotrading101.com\/learn\/bitmex-api-introduction-guide\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/algotrading101.com\/learn\/bitmex-api-introduction-guide\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/algotrading101.com\/learn\/bitmex-api-introduction-guide\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/algotrading101.com\/learn\/"},{"@type":"ListItem","position":2,"name":"BitMex API Introduction Guide"}]},{"@type":"WebSite","@id":"https:\/\/algotrading101.com\/learn\/#website","url":"https:\/\/algotrading101.com\/learn\/","name":"Quantitative Trading Ideas and Guides - AlgoTrading101 Blog","description":"Authentic Stories about Algorithmic trading, coding and life.","publisher":{"@id":"https:\/\/algotrading101.com\/learn\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/algotrading101.com\/learn\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/algotrading101.com\/learn\/#organization","name":"AlgoTrading101","url":"https:\/\/algotrading101.com\/learn\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/algotrading101.com\/learn\/#\/schema\/logo\/image\/","url":"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2020\/11\/AlgoTrading101-Lucas-Liew.jpg","contentUrl":"https:\/\/algotrading101.com\/learn\/wp-content\/uploads\/2020\/11\/AlgoTrading101-Lucas-Liew.jpg","width":1200,"height":627,"caption":"AlgoTrading101"},"image":{"@id":"https:\/\/algotrading101.com\/learn\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/algotrading101.com\/learn\/#\/schema\/person\/a7ae60c112a73b7c3fe14ac56726a0ae","name":"Igor Radovanovic","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/algotrading101.com\/learn\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d46175c509b3ee240a1e2bbe735a4d1e?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d46175c509b3ee240a1e2bbe735a4d1e?s=96&d=mm&r=g","caption":"Igor Radovanovic"},"sameAs":["https:\/\/igorradovanovic.com","https:\/\/www.linkedin.com\/in\/igor-radovanovic-profile"],"url":"https:\/\/algotrading101.com\/learn\/author\/igor\/"}]}},"modified_by":"Igor Radovanovic","_links":{"self":[{"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/posts\/6239"}],"collection":[{"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/comments?post=6239"}],"version-history":[{"count":16,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/posts\/6239\/revisions"}],"predecessor-version":[{"id":21162,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/posts\/6239\/revisions\/21162"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/media\/7108"}],"wp:attachment":[{"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/media?parent=6239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/categories?post=6239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/algotrading101.com\/learn\/wp-json\/wp\/v2\/tags?post=6239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}