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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mercor-sdk-0.1.2.tar.gz.
File metadata
- Download URL: mercor-sdk-0.1.2.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.7 CPython/3.9.2 Linux/5.10.0-8-amd64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ec3717a58a94a48982080e326a21516dd0b5ad014d271b3db8bad67064c68bd
|
|
| MD5 |
3744bb3012fe79083ffa5c754992517f
|
|
| BLAKE2b-256 |
6ff7c6b781783fec6647f2edf6bb945fa2fed5eb18e834a0b91a801d7d4269be
|
File details
Details for the file mercor_sdk-0.1.2-py3-none-any.whl.
File metadata
- Download URL: mercor_sdk-0.1.2-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.7 CPython/3.9.2 Linux/5.10.0-8-amd64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6198e2d8022024c6f865ad98459cad10219c8ef6ab0b2e18308432d2a89ee8b3
|
|
| MD5 |
9a26327effaad0b1feb0a9038ab760e5
|
|
| BLAKE2b-256 |
8ec553def2dd00354a00b58c5adcc9b5243085c1dd72dbfe9405fc4d7d332c43
|