Documentation

Getting Started


Installation

pip3 install aark-sdk

Initializing the Client

import client from client

pk=""
arbitrum_rpc_url="" #optional

client = client(pk, arbitrum_rpc)

Order


Place Order

client.order(1, "BTC", True) # 1 BTC long market order
client.order(1, "BTC", True, True, 33000) # 1 BTC long limit order at $33000
client.order(1, "BTC", True, trigger_price = 32000) # 1 BTC long trigger order at $32000

Params and Response:

  • params

    • qty: Decimal

    • symbol: str

    • is_long: bool

    • is_limit: bool = False [Optional]

    • price: Decimal = 0 [Optional]

    • slippage_tolerance: Decimal = 0 [Optional]

    • trigger_price: Decimal = 0 [Optional]

  • response

    • bool

      • return True when order succeeds

Get Limit Order

limit_orders = client.get_limit_orders() # get all active limit orders
btc_limit_orders = client.get_limit_orders("BTC") # get only activate BTC limit orders

Params and Response:

  • params

    • symbol: str [Optional]

Response Example
[{'marketId': 7, 'orderId': 123, 'user': '', 'qty': '1.000000000000000000', 'price': '60.823263360000000000', 'isLong': False, 'filled': '0.000000000000000000', 'tx': '0x', 'timestamp': 0, 'status': 0}]

Cancel Limit Order

order_id=123 #get from `get_limit_orders`
client.cancel_limit_order(order_id)

Params and Response:

  • params

    • order_id: int

  • response

    • bool

      • return True when cancel succeeds

Get Trigger Order

trigger_orders = client.get_trigger_orders()

Params and Response:

params: none

Response Example
[{'marketId': 7, 'isLimit': 0, 'nonce': '1699858120335', 'orderPrice': '58.62760600', 'triggerPrice': '59.21390000', 'triggerType': '1', 'price': '59.21390000', 'qty': '442.0480620126', 'slippageTolerance': '0.00000000', 'isLong': 0, 'orderType': 'takeProfit'}]

Note

  • orderPrice, triggerType is negligble

  • price is used as limit order price

  • slippageTolerance doesn't work when it's zero

Cancel Trigger Order

#get from `get_trigger_order`
nonce=123
trigger_price=32154.154

client.cancel_trigger_order(nonce, trigger_price)

Params and Response:

  • params

    • nonce: int

    • trigger_price: Decimal

  • response

    • bool

      • return True when cancel succeeds

Account


Get Account Status

status = client.get_futures_status()

Params and Response:

params: none

Response Example
{'positions': [{'market': 'SOL', 'qty': Decimal('442.0480620126'), 'entry_price': Decimal('58.11238528')}], 'collaterals': [{'token_address': '0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F', 'qty': Decimal('0'), 'withdrawable': Decimal('0')}], 'account_value': Decimal('2708.08375796926788'), 'weighted_balance': Decimal('2708.08375796926788'), 'free': Decimal('1875.86744547024996'), 'pending_funding_fee': Decimal('2.91533508807809374'), 'initial_margin': Decimal('832.216312499017925'), 'maintenance_margin': Decimal('387.678406443641891')}

Note

  • each collateral's collateral ratio is applied to weighted_balance

  • free is remained weighted balance for order

  • maintenance_margin is minimum required weighted balance to avoid liquidation

Market Info


Get Markets

markets = client.get_markets()

Params and Response:

params: none

Response Example
{'ETH': {'symbol': 'ETH', 'acc_funding_factor': Decimal('30557259416163093701'), 'funding_rate': Decimal('0.00404066805754170996'), 'skewness': Decimal('115.4541503094'), 'depth_factor': Decimal('12500'), 'cap': Decimal('625'), 'index_price': 2059.083927904228, 'mark_price': Decimal('2059.27411173247749')}, 'BTC': {'symbol': 'BTC', 'acc_funding_factor': Decimal('558852278448117140118'), 'funding_rate': Decimal('0.00165945019181623522'), 'skewness': Decimal('7.2479927908'), 'depth_factor': Decimal('1500'), 'cap': Decimal('75'), 'index_price': 37048.42673443249, 'mark_price': Decimal('37050.2169126317019')}, 'BNB': {'symbol': 'BNB', 'acc_funding_factor': Decimal('-1716291645199151782'), 'funding_rate': Decimal('0.000370333446011577626'), 'skewness': Decimal('57.4426793624'), 'depth_factor': Decimal('24000'), 'cap': Decimal('4800'), 'index_price': 246.84848340507023, 'mark_price': Decimal('246.854391587688280')}, 'XRP': {'symbol': 'XRP', 'acc_funding_factor': Decimal('4255947092089895'), 'funding_rate': Decimal('0.00211696372697891909'), 'skewness': Decimal('135731.5915140923'), 'depth_factor': Decimal('10000000'), 'cap': Decimal('2000000'), 'index_price': 0.65798762472732, 'mark_price': Decimal('0.658076934434820790')}, 'MATIC': {'symbol': 'MATIC', 'acc_funding_factor': Decimal('-3775407241663156'), 'funding_rate': Decimal('0.00170333490828048577'), 'skewness': Decimal('43259.9190203482'), 'depth_factor': Decimal('6000000'), 'cap': Decimal('600000'), 'index_price': 0.8903596392505608, 'mark_price': Decimal('0.890423834060382437')}, 'ARB': {'symbol': 'ARB', 'acc_funding_factor': Decimal('35796837046560752'), 'funding_rate': Decimal('0.00125636148225209332'), 'skewness': Decimal('13420.4647623895'), 'depth_factor': Decimal('2500000'), 'cap': Decimal('500000'), 'index_price': 1.1667432747691127, 'mark_price': Decimal('1.16680590771713584')}, 'SOL': {'symbol': 'SOL', 'acc_funding_factor': Decimal('350055165898185142'), 'funding_rate': Decimal('0.00205332591182332941'), 'skewness': Decimal('879.4215691105'), 'depth_factor': Decimal('100000'), 'cap': Decimal('20000'), 'index_price': 58.70461127704593, 'mark_price': Decimal('58.7097738871822556')}, 'USDT': {'symbol': 'USDT', 'acc_funding_factor': Decimal('508230347212628'), 'funding_rate': Decimal('1.69907014694694725E-7'), 'skewness': Decimal('25.7441989948'), 'depth_factor': Decimal('10000000'), 'cap': Decimal('2000000'), 'index_price': 1.0005467751226196, 'mark_price': Decimal('1.00054680088089486')}, 'DOGE': {'symbol': 'DOGE', 'acc_funding_factor': Decimal('933798778933163'), 'funding_rate': Decimal('0.00387975148327572923'), 'skewness': Decimal('422734.1096768216'), 'depth_factor': Decimal('80000000'), 'cap': Decimal('4000000'), 'index_price': 0.07828696025290982, 'mark_price': Decimal('0.0782910970739650479')}, 'LINK': {'symbol': 'LINK', 'acc_funding_factor': Decimal('107188174670256855'), 'funding_rate': Decimal('0.00190177897430805004'), 'skewness': Decimal('2706.573797689'), 'depth_factor': Decimal('400000'), 'cap': Decimal('80000'), 'index_price': 15.492865751148658, 'mark_price': Decimal('15.4939140657609874')}}

Note

  • funding_rate's time frame is 1 hour

Last updated