No project description provided
Project description
mango-explorer-v4
Python client library for interacting with Mango Markets v4.
📦 Installation
mango-explorer-v4
is available as a Python package on PyPI and can be installed as:
pip install mango-explorer-v4
Example usage
This example assumes that you have a wallet already set up: visit https://v4alpha.mango.markets to create a Mango account and fund it so that you can place orders. You can find the full sources here.
import asyncio
from mango_explorer_v4 import MangoClient
async def main():
mango_client = await MangoClient.connect(
secret_key='YOUR_SECRET_KEY', # Output from Phantom's "Export Private Key"
mango_account_pk='YOUR_MANGO_ACCOUNT_PK'
)
print(await mango_client.symbols())
# [
# {
# 'name': 'SOL/USDC',
# 'baseCurrency': 'SOL',
# 'quoteCurrency': 'USDC',
# 'makerFees': -5e-05,
# 'takerFees': 0.0001
# }
# ...
# ]
print(await mango_client.place_order('SOL/USDC', 'bid', 10, 0.1, 'limit'))
# (Refresh the UI to see the newly opened order)
print(await mango_client.orderbook_l2('SOL/USDC', 3))
# {
# 'symbol': 'SOL/USDC',
# 'bids': [
# [11.826, 0.899],
# [11.824, 39.436],
# [11.82, 316.421],
# ],
# 'asks': [
# [11.839, 0.78],
# [11.84, 44.392],
# [11.841, 1.1],
# ]}
print(await mango_client.balances())
# [
# {'symbol': 'USDC', 'balance': 2.7435726906761744},
# {'symbol': 'SOL', 'balance': 0.1690007074236178},
# ...
# ]
asyncio.run(main())
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
mango_explorer_v4-0.4.0.tar.gz
(55.8 kB
view hashes)
Built Distribution
Close
Hashes for mango_explorer_v4-0.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad3f03e3259d75b807e64ed3a53bb058c6d8af1bfe3fcc0eebab87d8011dcd85 |
|
MD5 | debae527723c92282a4fe3fa398ea78c |
|
BLAKE2b-256 | a983c68e2fb88dccc9e3ad2a89b3eb04de1805aea7e5c68758d58f8973ce828e |