Official python package to use Tabdeal Exchange API
pip install tabdeal-pythonUsage examples:
from tabdeal.enums import OrderSides, OrderTypes
from tabdeal.spot import Spot
api_key = '<api_key>'
api_secret = '<api_secret>'
client = Spot(api_key, api_secret)
order = client.new_order(symbol='BTC_IRT',
side=OrderSides.BUY,
type=OrderTypes.MARKET,
quantity="0.002")
print(order)Usage example:
from tabdeal.enums import OrderSides, OrderTypes
from tabdeal.future import Future
api_key = "<api_key>"
api_secret = "<api_secret>"
client = Future(api_key, api_secret)
client.ping()
client.exchange_info()
order = client.new_order(
symbol="BTCUSDT",
side=OrderSides.BUY,
type=OrderTypes.MARKET,
quantity="0.001",
)
print(order)Special Margin websocket helpers:
from tabdeal.websocket_client import (
FutureWebsocketClient,
FutureBroadcastWebsocketClient,
)
stream_ws = FutureWebsocketClient()
broadcast_ws = FutureBroadcastWebsocketClient()There are 2 types of exceptions returned from the library:
tabdeal.exceptions.ClientException- This is thrown when server returns
4XX, it's an issue from client side. - It has 4 properties:
status- HTTP status codecode- Server's error codemessage- Server's error messagedetail- Detail of exception
- This is thrown when server returns
tabdeal.exceptions.ServerException- This is thrown when server returns
5XX, it's an issue from server side.
- This is thrown when server returns