coinexchain / dex-api-python Goto Github PK
View Code? Open in Web Editor NEWdex api sdk for python
dex api sdk for python
import time
import dex_api_python
from dex_api_python.rest import ApiException
from dex_api_python.configuration import Configuration
from dex_api_python.api_client import ApiClient
from pprint import pprint
configuration = Configuration()
configuration.host = "https://dex-api.coinex.org"
client = ApiClient(configuration)
# create an instance of the API class
api_instance = dex_api_python.MarketApi(client)
try:
api_response = api_instance.get_order('coinex15e7cud8d39qd368cx28w9vcm4s8nmy2s7xff7a-769')
pprint(api_response)
except ApiException as e:
print("Exception when calling MarketApi->get_order: %s\n" % e)
Return:
({'height': '7353734',
'result': {'type': 'market/Order',
'value': {'deal_money': None,
'deal_stock': None,
'freeze': '166004000',
'frozen_fee': None,
'height': '7348681',
'identify': 1,
'left_stock': '20000',
'order_type': 2,
'price': '8300.200000000000000000',
'price_precision': None,
'quantity': '20000',
'sender': 'coinex15e7cud8d39qd368cx28w9vcm4s8nmy2s7xff7a',
'sequence': '3',
'side': 1,
'time_in_force': '3',
'trading_pair': 'btc/usdt'}}},
How to determine the order status (Open/Closed/Canceled/Partial-closed/...)?
import time
import dex_api_python
from dex_api_python.rest import ApiException
from dex_api_python.configuration import Configuration
from dex_api_python.api_client import ApiClient
from pprint import pprint
configuration = Configuration()
configuration.host = "https://dex-api.coinex.org"
client = ApiClient(configuration)
# create an instance of the API class
api_instance = dex_api_python.MarketApi(client)
account = 'account_example' # str | Bech32 address
time = 789 # int | Unix timestamp
sid = 789 # int | Sequence id
count = 56 # int | Querier order count limited to 1024
token = 'token_example' # str | Symbol (optional)
tag = 'tag_example' # str | Filter responses type by tag string create/fill/cancel (optional)
try:
# Query account's order
api_response = api_instance.query_order(account, time, sid, count, token=token, tag=tag)
pprint(api_response)
except ApiException as e:
print("Exception when calling MarketApi->query_order: %s\n" % e)
Return:
Exception when calling MarketApi->query_order: (404)
Reason: Not Found
HTTP response headers: HTTPHeaderDict({'Date': 'Sat, 20 Jun 2020 13:13:07 GMT', 'Content-Type': 'text/plain; charset=utf-8', 'Content-Length': '19', 'Connection': 'keep-alive', 'Set-Cookie': '__cfduid=dea30579eec62b6f8e3f267164682f1a81592658787; expires=Mon, 20-Jul-20 13:13:07 GMT; path=/; domain=.coinex.org; HttpOnly; SameSite=Lax', 'X-Content-Type-Options': 'nosniff', 'X-Server-Time': '1592658787', 'CF-Cache-Status': 'DYNAMIC', 'cf-request-id': '03737595950000a3004eb76200000001', 'Expect-CT': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"', 'Server': 'cloudflare', 'CF-RAY': '5a65becf5e94a300-HKG'})
HTTP response body: 404 page not found
curl -X GET "https://dex-api.coinex.org/market/user-orders" -H "accept: application/json"
404 page not found
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.