XRP/BTC: +% ₮ 16 Robot-friendly API. Fees. Pay only % on every market trade and benefit from a % rebate on LP orders. Support. By your side 24 hours a day, our support team will assist you with any issue or question you may have. Api. Trading and algorithmic trading open source platform (stock markets, forex, bitcoins and options). - StockSharp. Market price active order: A traditional market price order which will be filled at the best available price. price is not required for this type of order. Limit price active order: You can set an execution price for your order. Only when the last traded price reaches the order price will the system will fill your order.
Btc markets api githubBTC Markets · GitHub
List withdrawals, in reverse chronological order, up to maximum of 10 withdrawals, starting after the withdrawal with ID of af3cda12e-cdf8fd99ab3b. List withdrawals, in reverse chronological order, up to a maximum of 10 withdrawals, ending before the withdrawal with ID of 0ddddeedb :. You can find sample request bodies for different types of orders in the examples in this section. Market Order : An order to buy or sell a specified quantity of an asset immediately at the best available price.
The market order will consume available orders on the book as it executes. Consequently, especially for large orders, the average price at which the order is filled will deviate from the last-traded price or current quote. Limit Order : An order to trade a specified quantity of an asset at a specified price. A buy order will only be filled at or below the limit price and a sell order will only be filled at or above the limit price.
Ceiling Order : A market or limit order that allows you to specify the amount of quote currency you want to spend or receive, if selling instead of the quantity of the market currency e. Good-Til-Cancelled Order : The order remains in force until it is explicitly cancelled either by the user or by Bittrex. Immediate-Or-Cancel Order : The order will be filled immediately as much as possible and then cancelled. Fill-or-Kill : The order will be filled immediately and completely, or it is cancelled without being filled at all.
Post Only : This option allows market makers to ensure that their orders are making it to the order book instead of matching with a pre-existing order. Note: If the order is not a maker order, you will return an error and the order will be cancelled.
Conditional Order : A directive for the system to place an order on your behalf when the price on the market moves past a given threshold. These are treated separately from orders. Refer to the Placing Conditional Orders section for more information. An optional UUID which is generated by the user to to keep a track of the order. If the outcome of placing an order is not known for example due to a client-side crash that occurred while placing the order , the same order can be safely placed again using the same UUID as the clientOrderId.
If the order was received and processed the first time, the API will return an error that includes the existing order's id instead of creating a second order. This protection is in place for 24 hours after an order is placed. Although clientOrderIds which are more than 24 hours old are no longer checked against new orders, they remain associated with their orders as metadata and may be retrieved by clients.
Conditional orders are placed using this API by specifying the market price trigger conditions and what action to take when the trigger is reached. When a trade occurs on the market that matches the trigger conditions, the actions are triggered such as placing an order. Conditional orders are not the same as orders.
They are stored separately from normal orders and do not appear on the order book. As such, there is a small delay between trading occurring on the market and corresponding conditional orders being triggered. Care must also be taken when working with conditional orders because balance is not reserved. If this occurs, placement of the order will fail. The trigger for a conditional order is made up of two parts: the operand and the trigger price or percentage.
Alternately, a trailingStopPercent may be specified. This will cause the triggerPrice to float a fixed percent off from the smallest or largest price seen since the conditional order was placed. The below table summarizes these options:. When the trigger condition is met, this will result in a new order being placed and, optionally, another order or conditional order being cancelled. The order to place is configured by populating orderToCreate with the same object you would post to create an order.
There are some limitations: post only orders, awards, and clientOrderId are not supported. For idempotency, instead specify a clientConditionalOrderId as a peer of orderToCreate in the request body. This will pair the newly placed or with its target. If either conditional order triggers, the other will be cancelled. If both are trigger simultaneously, only the first conditional order place will trigger and the other will be cancelled. Note that there is not currently a way to break up two conditional orders paired in the fashion.
To change the cancellation relationship, both conditional orders must be cancelled and placed again. You cannot link more than two orders in the fashion. Also note that if the orderToCancel is an order on the book and the conditional order triggers, the order on the book will be cancelled to free up funds prior to attempting to place the ordered triggered by the condition. This section describes some common use cases and provides instruction for how to meet them using the API:.
Stop Order : A market order triggered by price moving past a given threshold. Specify operand and triggerPrice as desired and define a market buy or sell order in orderToCreate. Stop Limit Order : A limit order triggered by price moving past a given threshold. Specify operand and triggerPrice as desired and define a limit buy or sell order in orderToCreate.
Stop Loss Order : A market sell order triggered by price falling to a given threshold. Take Profit Order : A limit sell order triggered by price rising to a given threshold. Trailing Stop Loss Order : A market sell order triggered when price falls more than a given amount below the highest price seen since the order was created.
One Cancels the Other Order OCO : A pair of orders where if one is triggered for a conditional order or executed for an order on book the other is automatically cancelled. When creating the second order in the pair, specify the id of the first order in orderToCancel. Note that currently one member of the OCO pair must be a conditional order. Note that more combinations are possible.
These examples are intended as a guide to some common use cases, not an exhaustive list of supported scenarios. The general flow of information to check is:.
This section lists some common error codes that are returned by the API, but is not an exhaustive list. If you have questions about an error code you are receiving, feel free to post an issue on GitHub. The v3 websocket is intended to allow a client to subscribe to a live stream of updates about things that are changing in the system instead of needing to poll the REST API looking for updates.
As such the messages sent from the socket include payloads that are formatted to match the corresponding data models from the v3 REST API. Like the existing v1 socket, the v3 socket is based on Microsoft ASP.
We are not using ASP. As such, any existing SignalR client implementation working with the v1 socket should be able to be modified to work with the new v3 socket. If working in the. Net environment, the Microsoft. Client NuGet package is the recommended basis for a client implementation.
The code snippets in the remainder of this section assume you are working in C using that library. Refer to the Example Socket Clients section for examples in other languages. This section includes simple examples of how to subscribe and receive messages in a few popular languages.
All of these examples follow the same basic pattern. They will connect to the socket server, authenticate if an API key and secret are provided, attempt to subscribe to a few streams, and finally print messages received on those streams to console. The hub name to use when creating the proxy is "c3". Once these objects are created, you can start the HubConnection to connect to the socket.
There are no streams of data sent automatically based solely on being connected. To get data, you must subscribe to one or more streams. The available streams are discussed in the Websocket Streams section of this site. Some streams contain private data and require that you be authenticated prior to subscribing.
In order to authenticate, invoke the Authenticate method on the hub as shown in the example. The authentication will need to be renewed periodically. Currently authentication lasts for 10 minutes. When authentication expires subscriptions to any private streams will be cancelled. One minute prior to authentication expiring, a reminder message will be sent notifying the client that it is time to reauthenticate.
To subscribe to one or more streams, simply invoke the Subscribe method with an array of streams to which you wish to subscribe. For a list of stream names, refer to the Websocket Streams section. The Subscribe method may be invoked as many times as desired if not all desired streams are known initially. The result of invoking the Subscribe method is a list of SocketResponse objects containing a Boolean value indicating if the subscription was successful and, in the case of failure, an error code.
Once you have subscribed to a stream, you will begin receiving messages as relevant activity occures in the system. The incoming messages must be decoded to do something with them. A basic example of this is shown below. The "balance" specified as a parameter is the name of the message to handle. This corresponds to the name of the stream. For a list of possible values and how they map to streams, refer to the Websocket Streams section. Messages sent on the v3 socket are gzipped and must be decompressed prior to being used.
The DataConverter. Decode method shown in the example is doing this decompression and then parsing the resulting json into an object. The schema for the BalanceDelta type can be found in the documentation for the Balance stream. It consists of an accountId field for identifying the account or subaccount the message relates to, the sequence number of the message used for synchronization, and the actualy delta which is an updated Balance object. For details about individual streams, refer to the Websocket Streams section of this page.
To ensure you have the most recent data, and have not missed anything, the recommended sequence of steps is to:. For applications that depend on keeping the stream of data as reliable as possible, creating multiple socket connections for redundancy is recommended. The sequence numbers published across all of the connections will be consistent with each other and can be used to determine which messages have been received.
Unsubscribing from streams follows the same pattern as subscribing to streams. Simply invoke the Unsubscribe method on the hub and provide the list of streams you wish to unsubscribe from. Subaccounts provide a way for partners to model their users without needing to create individual user accounts.
Each subaccount has its own deposit addresses, balances, desposits and withdrawals, orders, etc. Partners control all actions of their subaccounts via the v3 REST API and may use the v3 websocket to be notified of any updates to their balances, deposits, and orders. In order to work with subaccounts, you must be using an API key that has subaccount permissions. Partners who are part of this program can work with their Bittrex representative to get their API key enabled. To create a subaccount, POST to the subaccounts endpoint.
This will create a new subaccount and return its id. Once you have a subaccount id, you can transfer funds between it and your main master account using the transfers endpoint. In order to place orders, view history, or take other actions in the context of a subaccount using the REST API, add the Api-subaccount-ID header to the request and adjust your request signature as needed. To be notified of updates to subaccount data, use a websocket connection authenticated with a subaccount enabled API key and subscribe to the subaccount streams for the types of data you care about.
A single subscription will receive data from all subaccounts the API key is authorized to manage. Messaages will include an accountId field which can be used to associate them with the correct subaccount. For subaccount streams that include a sequence number for synchronizing with the server, the sequence number is independent for each subaccount. Retrieve information for the account associated with the request.
For now, it only echoes the subaccount if one was specified in the header, which can be used to verify that one is operating on the intended account.
More fields will be added later. Request provisioning of a deposit address for a currency for which no address has been requested or provisioned. Retrieve the status of the deposit address for a particular currency for which one has been requested or provisioned. List account balances across available currencies. Returns a Balance entry for each currency for which there is either a balance or an address.
Retrieve account balance for a specific currency. Request will always succeed when the currency exists, regardless of whether there is a balance or address. Create a new batch request. Currently batch requests are limited to placing and cancelling orders. The request model corresponds to the equivalent individual operations. Batch operations are executed sequentially in the order they are listed in the request. The response will return one result for each operation in the request in the same order.
The status and response payload are the same as the responses would be if individual API requests were made for each operation. List closed conditional orders. Pagination and the sort order of the results are in inverse order of the ClosedAt field.
The unique identifier of the item that the resulting query result should start after, in the sort order of the given endpoint. Used for traversing a paginated set in the forward direction. May only be specified if PreviousPageToken is not specified. The unique identifier of the item that the resulting query result should end before, in the sort order of the given endpoint.
Used for traversing a paginated set in the reverse direction. May only be specified if NextPageToken is not specified. In ISO format e. Precision beyond one second is not supported. Use pagination parameters for more precise filtering. Uses the same format as StartDate. Either, both, or neither of StartDate and EndDate can be set. The only constraint on the pair is that, if both are set, then EndDate cannot be before StartDate.
List open deposits. Results are sorted in inverse order of UpdatedAt, and are limited to the first List closed deposits. Pagination and the sort order of the results are in inverse order of the CompletedAt field. List historical executions for account. Pagination and the sort order of the results are in inverse order of the Executed field. Retrieve recent candles for a specific market and candle interval. Candles for intervals without any trading activity are omitted. This portion of the url may be omitted if trade based candles are desired e.
List closed orders. Retrieve executions for a specific order. Results are sorted in inverse order of execution time, and are limited to the first Also, there may be a delay before an executed trade is visible in this endpoint.
List subaccounts. Pagination and the sort order of the results are in inverse order of the CreatedAt field. Create a new subaccount. Retrieve details for a specified subaccount. List sent transfers. List received transfers. Retrieve information on the specified transfer. List open withdrawals. Results are sorted in inverse order of the CreatedAt field, and are limited to the first List closed withdrawals. Cancel a withdrawal. Authenticates the current connection using an API key. Note that after authenticating, the client must periodically renew its authentication.
Refer to the websocket authentication topic for additional information. Refer to the websocket authentication topic for an example. Determines if the current connection is authenticated. In the example, the client is not currently authenticated.
Subscribes to one or more data streams. Unsubscribes from one or more data streams. Sends a message at the start of each candle based on the subscribed interval and when trades have occurred on the market. Executions are immutable so any information received about a given execution from REST or the socket will be its final state. Sends an empty message on an interval currently 5 seconds. If you stop getting a heartbeat that means your connection is dead. If you are still getting a heartbeat but are not getting updates on active markets then that means your connection is alive but something else is wrong.
Provides regular updates of the current market summary data for all markets. Market summary data is different from candles in that it is a rolling hour number as opposed to data for a fixed interval like candles. Provides regular updates of the current market summary data for a given market.
This stream does not include a sequence number because each message received is a full snapshot of the current state. An update with quantity 0 means that there is no longer any liquidity available at that rate or that this rate is no longer within the subscribed depth. For example, if subscribed to a depth of 25, if an order is placed at a new rate somewhere in the middle of the top 25, the entry that was formerly the 25th, and is now 26th, will get an update with quantity 0.
For this reason, depth is included as part of the key defined above. The first 25 levels of the depth 25 and depth orderbooks will be identical, but updates for level 26 of the depth 25 order book always 0 must be kept separate from updates for the depth orderbook if you are subscribed to both. Note: You must get the orderbook snapshot from the same depth as you are subscribed to on the websocket.
Sequence numbers are not the same for different depths. Sends a message with the best bid price, best ask price, and last trade price for all markets as there are changes to the order book or trades.
Sends a message with the best bid and ask price for the given market as well as the last trade price whenever there is a relevant change to the order book or a trade. For example, at , the settlement is based on the fund rate generated at The fund rate generated at will be used at the next day.
Get wallet fund records. Bybit makes frequency limits based on the rolling time window per minute and UID, and each symbol is independent. Every request to the API returns the fields shown in the code panel:.
Please read Understanding Bybit's Liquidity System to understand how our system automatically allocates rate limits for users placing over orders per day. Please send your application email to api bybit. We will reply in working days. Orders Submitted to Bybit : any order sent to Bybit. Orders Filled : any order that has been filled for any amount. POU : the proportion of your orders within effective price range to all your orders in orderbook. POA : the proportion of your orders within effective price range to all orders within effective price range in orderbook.
User C only has contracts within effective price range, while Bybit have contracts within effective price range in orderbook. After establishing the connection, one can subscribe to a new topic by sending a JSON request. The specific formats are as follows:. The topic indicates the data you would like to receive whilst the filter parses for the specific data you desire - for example, the symbol.
The topic is mandatory but the filter is optional. It is possible to use multiple filters for the same topic by splitting them with a pipe - of course, these filters must all be applicable to the selected topic.
Some topics are pushed at intervals. If the args contain a millisecond param, such as ms , this topic is pushed at intervals. Otherwise, it is pushed constantly. After the subscription response, the first response will be the snapshot response. This shows the entire orderbook. The data is ordered by price, starting with the lowest buys and ending with the highest sells. Following this, all responses are in the delta format, which represents updates to the orderbook relative to the last response.
This is a list of valid options and rules for the different parameters when sending a request to the API. Maximum quantity of 1 million Must be an integer - no decimals, only a whole number of USD contracts 40 - allowed It may not be or below. In pseudocode assuming the price is an increment of 0. For example, if the liquidation price of an open long position is In the case of a short position the price must be less than the liquidation price.
Conditional order Must be equal to order greater than 1. The abandoned endpoints will be deprecated on December 10, Effective immediately, the rate limit will be reduced by half before being completely removed from service on December 17, Currently, this field is useless.
When the funding rate is positive, longs pay shorts. When it is negative, shorts pay longs. When in Cross Margin mod, the number minus your unclosed loss is your real wallet balance.
This is to prevent replay attacks. BTC" if data : print data. Data recording period. What is a reduce-only order? True means your position can only reduce in size if this order is triggered. What is a close on trigger order? For a closing order. It can only reduce your position, not increase it. If the account has insufficient available balance when the closing order is triggered, then other active orders of similar contracts will be cancelled or reduced.
It can be used to ensure your stop loss reduces your position regardless of current available margin. Customised order ID, maximum length at 36 characters, and order ID under the same agency has to be unique. Your active order ID. The unique order ID returned to you when the corresponding active order was created.
Search direction. Defaults to next. Page turning mark. Use return cursor. Sign using origin data, in request please use urlencode. Mainly used to identify the expected direction of the current conditional order. Your conditional order ID. Do not pass this field if you don't want modify it. In Isolated Margin mode, the value is set by user. In Cross Margin mode, the value is the max leverage at current risk level. Pre-occupied calculate parameters. Trailing stop trigger price.
Trailing stops are triggered only when the price reaches the specified price.