Skip to main content

Software development kit for the Mercor trading API

Project description

Mercor SDK

Introduction

The Mercor software development kit is meant for users of the Mercor trading API that wish to access it using the Python programming language. Using this SDK will have the benefit of removing some of the boilerplate for calling the different endpoints.

Installation

python -m pip install mercor-sdk

Usage

Importing the client and token:

from mercor_sdk.client import MercorClient
from mercor_sdk.tokens import CryptoToken

Instantiating the client:

client = MercorClient("<my_algorithm_address>", "<my_password>")

Viewing the current balance of the algorithm:

balance = client.balance()
print(balance.supply)

Placing a buy order:

trade = client.buy(slippage=0.05, relative_amount=0.5)
print(trade.transaction_hash)

Placing a sell order:

trade = client.sell(slippage=0.05, relative_amount=0.5)
print(trade.transaction_hash)

Retrieving the status of a buy or sell order:

status = client.status(transaction_hash=trade.transaction_hash.value)
print(status.message)

Accessing data from the ticker:

ticker = client.ticker_list()
print(ticker[CryptoToken.ETH])

Accessing data for a specific token from the ticker:

token = client.ticker(CryptoToken.ETH)
print(token.price)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mercor-sdk-0.1.2.tar.gz (7.8 kB view hashes)

Uploaded Source

Built Distribution

mercor_sdk-0.1.2-py3-none-any.whl (9.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page