Crypto API for Smart Order Routing

smart order routing cover cropped.png

Over the last 6 months, the Shrimpy team has revolutionized the crypto trading scene by releasing the very first Universal Crypto Exchange Trading APIs designed for application developers. Supporting 16 exchanges, our mission is to integrate every major exchange to provide the most complete set of unified exchange APIs. Hundreds of developers are already building the next generation of trading services using these APIs. Sign up today and join our developer Telegram to start exploring how Shrimpy can simplify your development process. 

Although our APIs are already changing the way developers build crypto applications, we aren’t done innovating yet. The Shrimpy team is excited to announce we will be bringing advanced order types to each of our supported exchanges. This endeavor begins with the release of our Smart Order Routing (SOR) trading endpoints. Available to every developer for immediate integration now, we encourage you to try it out for free today! 

Shrimpy | Crypto Trading APIs for Developers

Smart Order Routing is the process of automatically taking advantage of the best price available across multiple market pairs to optimize the outcome of an order. The first iteration of our SOR will evaluate trade opportunities through every available market pair on an individual exchange to execute this strategy. Future versions of our SOR will incorporate multiple exchanges and liquidity pools to further expand our vision for Shrimpy’s SOR.

The Shrimpy API now allows developers to add support for SOR without the leg work required to develop such a complex feature. The SOR endpoint automatically evaluates every market which connects your current and target assets. Shrimpy will then intelligently route the trades while controlling for spread, slippage, execution time, optimal trading patterns, and trade limits. Every trade we execute is a precisely placed limit order which intends to maximize the outcome of the routing process. 

1111.png

Conceptual Example

Smart Order Routing is a complex real-time evaluation of the market to execute the most optimal trades. Imagine we want to move our LTC position to XMR. On the exchange we are using in this example, let’s say there are 4 different quote currencies that connect these two assets: ETH, XRP, USDT, and BTC. Shrimpy will evaluate each of these routes to find the best path. We’ve even designed Shrimpy to intelligently route portions of the funds through different routes based on the changes in the market, spread, and slippage. The outcome could be numerous trades across each of these quote currencies to successfully reach the destination asset.

Software Example

While this concept is complex, developers need not worry. The endpoints to execute this complex network of trades is one of the easiest things you will do all day. 

Creating a Trade

Let’s start by evaluating how to construct a SOR trade that we will send to Shrimpy for execution. In this example, we will trade 20 KCS for BTC.

Click here to visit the docs

Request

POST https://dev-api.shrimpy.io/v1/users/<userId>/accounts/<exchangeAccountId>/trades

Request Body

{
    "fromSymbol": "KCS",
    "toSymbol": "BTC",
    "amount": "20",
    "smartRouting": true,
}

Response:

{
    "id": "72dff099-54c0-4a32-b046-5c19d4f55758"
}

That’s it! Our entire SOR execution engine can be accessed by sending a single request with a few parameters. We find in the “Request Body” the four parameters required to execute a SOR request. 

fromSymbol

The “fromSymbol” is the asset we want to sell. 

toSymbol

The “toSymbol” is the asset we want to buy.

amount

The “amount” is the amount of the “fromSymbol” we want to sell, in units of the “fromSymbol”.

smartRouting

The “smartRouting” is a boolean to say whether or not we want to use the SOR feature.

Get Trade Status

Now that we’ve executed a trade with SOR, we can collect information about the trades executed by getting the trade status. Once again, Shrimpy makes this easy. 

Read more in the developer docs

Request

GET https://dev-api.shrimpy.io/v1/users/<userId>/accounts/<exchangeAccountId>/trades/72dff099-54c0-4a32-b046-5c19d4f55758

Response:

{
    "trade": {
        "id": "72dff099-54c0-4a32-b046-5c19d4f55758",
        "fromSymbol": "KCS",
        "toSymbol": "BTC",
        "amount": "20",
        "status": "completed",
        "success": true,
        "errorCode": 0,
        "errorMessage": "",
        "exchangeApiErrors": [],
        "smartRouting": true,
        "maxSpreadPercent": "10",
        "maxSlippagePercent": "10",
        "triggeredMaxSpread": false,
        "triggeredMaxSlippage": false
    },
    "changes": [
        {
            "symbol": "KCS",
            "nativeValue": "-20",
            "btcValue": -0.0028169,
            "usdValue": -20.05604616757
        },
        {
            "symbol": "BTC",
            "nativeValue": "0.0028134",
            "btcValue": 0.0028169,
            "usdValue": 20.05604616757
        }
    ],
    "fills": [
        {
            "baseAmount": "20",
            "baseSymbol": "KCS",
            "btcValue": 0.0028169,
            "price": "0.00014067",
            "quoteAmount": "0.0028134",
            "quoteSymbol": "BTC",
            "side": "SELL",
            "usdValue": 20.05604616757
        }
    ]
}

This is a lot of information, so let’s take a closer look at how to read the results of this trade. 

trade

This provides the status of the order and details of the request. Any errors we experience during the course of the order execution will be placed in this section. 

changes

This section provides the asset balance changes. In this instance, since we traded 20 KCS for BTC, we see our balance for KCS was reduced by 20 (therefore shown as “-20”) and our balance for BTC was increased by 0.0028134 (therefore shown as “0.0028134”). 

fills

The final section lists the trades Shrimpy executed to accomplish the requested order. The list of “fills” could contain a single trade which executed the entire balance or the list could contain hundreds of complex trades that were strategically placed to route the order intelligently through alternative trading pairs. The number of fills can vary drastically based on the conditions of the market, which assets are being bought or sold, and the size of funds. 

Integration

The SOR endpoints are available for immediate integration for any of our application developers. Instantly providing access to executing Smart Order Routing strategies on 16 exchanges. There is no difference between integrating SOR for Binance, Bittrex, Kraken, Poloniex, KuCoin, or any of the other exchanges we support. Shrimpy simplifies the integration to a single set of APIs that link every major exchange.

The request flow for integrating the Shrimpy APIs into your application.

The request flow for integrating the Shrimpy APIs into your application.

Integrating with Shrimpy means your infrastructure gets a break. Instead of bogging down your servers with millions of requests, all of your users can directly connect with Shrimpy to execute orders, collect data, and manage their exchange accounts. 

Shrimpy directly manages the accounts of your users. We communicate with each user to manage their accounts, collect data, and execute trades.

Shrimpy directly manages the accounts of your users. We communicate with each user to manage their accounts, collect data, and execute trades.

The Shrimpy servers will handle connecting with each exchange for your users, essentially acting as a complete user management solution. Shrimpy scales as your application scales. Instead of maintaining a farm of hundreds of servers to scale to tens of thousands of customers, Shrimpy scales instantly with your business. Our team handles the entire real-time infrastructure and networking required for the most robust trading applications.

Get Started!

The Shrimpy APIs enable every developer to have access to institutional grade trading tools. Take advantage of these game changing features by integrating Shrimpy into your infrastructure today. Simplify your development and have piece of mind as we handle the complexities of exchange integration for you. 

Shrimpy | Crypto Trading APIs for Developers

About Shrimpy

Shrimpy is an automated crypto trading & portfolio management tool that lets users automate their crypto portfolio with only a few clicks. Shrimpy also supports the most advanced trading APIs for application developers.

Shrimpy’s Crypto Trading API was created as a cloud-based solution to address several crypto developer roadblocks including exchange trading, product scalability, and user management

CoinOrderBook is a free cryptocurrency market data provider which leverages the Shrimpy developer APIs to collect real-time market data. In addition to exchange asset listings, CoinOrderBook analyzes arbitrage opportunities, order book data, and trading pair spreads.

~The Shrimpy Team