Python Library for the Universal Crypto Exchange APIs

Shrimpy x Python.png

The Shrimpy team is excited to announce we have released a python library for the Shrimpy developer APIs. This library provides a convenient way for our Python developers to build on top of the Shrimpy developer APIs.

Access the Python library here.

Throughout the rest of this article, we will cover examples of how this library can be used to convenient access everything the Shrimpy developer APIs have to offer.

Examples

Let’s dig into some examples of how we can use this library to make calls to the Shrimpy developer APIs.

Follow along with these examples by visiting our API documentation page here.

Get Order Book

Get the latest order book data from any major exchange.

orderbooks = client.get_orderbooks(
    'bittrex',  # exchange
    'XLM',      # base_symbol
    'BTC',      # quote_symbol
    10          # limit
)

Get Candle Sticks

Get the real-time candle sticks for each asset pair across every major exchange.

candles = client.get_candles(
    'bittrex',  # exchange
    'XLM',      # base_trading_symbol
    'BTC',      # quote_trading_symbol
    '15m'       # interval
)

Link an Exchange Account

This links an exchange account to a user so you can trade, collect data on the exchange account, and execute portfolio management strategies.

link_account_response = client.link_account(
    '701e0d16-1e9e-42c9-b6a1-4cada1f395b8',                             # user_id
    'binance',                                                          # exchange
    'GOelL5FT6TklPxAzICIQK25aqct52T2lHoKvtcwsFla5sbVXmeePqVJaoXmXI6Qd', # public_key (a.k.a. apiKey)
    'SelUuFq1sF2zGd97Lmfbb4ghITeziKo9IvM5NltjEdffatRN1N5vfHXIU6dsqRQw',  # private_key (a.k.a. secretKey
    'mypassphrase'                                                       # (optional)passphrase - required for exchanges with passphrases like CoinbasePro
)
account_id = link_account_response['id']

Get Balances of Assets on Exchange

Once the exchange account is linked, you can retrieve the amount of each asset that is owned by the user on this exchange account.

balance = client.get_balance(
    '701e0d16-1e9e-42c9-b6a1-4cada1f395b8', # user_id
    123                                     # account_id
)

Place a limit order

Place a limit order for any asset pair on any major exchange.

place_limit_order_response = client.place_limit_order(
    '701e0d16-1e9e-42c9-b6a1-4cada1f395b8', # user_id
    123,                                    # account_id
    'ETH',                                  # base_symbol
    'BTC',                                  # quote_symbol
    '0.01',                                 # quantity of base_symbol
    '0.026',                                # price
    'SELL',                                 # side
    'IOC',                                  # time_in_force
)
limit_order_id = place_limit_order_response['id']

Execute Smart Order Routing Trades

In addition to placing limit orders, we also provide a built in feature to intelligently execute smart order routing strategies. With this simple endpoint, Shrimpy will automatically route your funds through the optimal asset pairs to buy and sell the assets you choose.

create_trade_response = client.create_trade(
    '701e0d16-1e9e-42c9-b6a1-4cada1f395b8', # user_id
    123,                                    # account_id
    'BTC',                                  # from_symbol
    'ETH',                                  # to_symbol
    '0.01',                                 # amount of from_symbol
    True                                    # smart_routing
)
trade_id = create_trade_response['id']

That’s not all!

Shrimpy supports a number of different endpoints for collecting data, executing trades, and more. The examples provided above are just a small snippet of what we have available for you. Sign up for your free developer API account here. If you ever need anything, don’t hesitate to reach out in our Telegram or Discord. We’re always excited to learn more about what everyone is building, answer questions, and help any way we can.

About Shrimpy

Shrimpy is a free application for crypto market indexing, rebalancing, and portfolio management. Begin automating your portfolio in less than 3 minutes by linking each of your exchange accounts. Shrimpy supports Binance, Bittrex, Kraken, Coinbase Pro, KuCoin, Poloniex, and more!

Shrimpy’s Universal Crypto Exchange APIs are the only unified APIs for crypto exchanges that are specifically designed for application developers. Manage user exchange accounts, execute trading strategies, collect data, and simplify the way you connect to each exchange.

~The Shrimpy Team