Package: satang-pro-sdk
Welcome to satangproUpdated 15 Sep 2022This is an official Python SDK for the Satangpro APIIf you don’t have Satangpro account yetclick
hereThis python SDK is an easier tool for using Satangpro APISource codehttps://github.com/satang-officialDocumentationhttps://docs.satangcorp.com/Satangpro Telegramhttps://t.me/joinchat/N3FyBg8ckQB3e1giJ79MgASatangpro Facebook pagehttps://www.facebook.com/satangcorpSatangpro support emailsupport@satangcorp.comFeaturesCall function and input specify parameters then finish! all done.19 Open API functionare ready for you!No need to request signature for sending API request, this SDK will
do it for you.SDK do not cache any data given to it, feel free to use!Shorten coding redundant authentication from documentation, only one
line of code is needed.NoticeSatangpro SDK will returnresponse objectso you need to
specify Methods such asresponse.json(), etc.Quick StartRegister an account with
Satangpro.Generate an API
Keyand assign
relevant permissions.Installationpip install satang-pro-sdkInitial Stepfrom satang_pro_sdk import Satangpro
satang_api_key = 'live_12345.....'
satang_api_secret = '7oDsUT.....'
sp = Satangpro(satang_api_key,satang_api_secret)Example (8 of 19 Functions)List of Contentsget open order information of selected pairget information of all pair best offer and bid orderget user listed order on satangpro exchangeget list of price and grouping amountget list of kline & candlestick information of selected paircreate ordercancel ordercancel all open orderFunction 1get open order information of selected pairThis function take 2 parameters such aspairandsidepaircoin symbol such as ‘btc_thb’, ‘eth_thb, etc.’sidesymbol such as ‘buy’, ‘sell’sidedoes not have to specify, it take initial value as empty
string# no specify sidebtc_order = sp.get_order(pair = 'btc_thb')Resposne ofprint(btc_order.json()){
'bid':[{'price': '12345', 'amount': '0.02', {'price': . . .}], 'ask':[{'price': '12346', 'amount': '0.01',}, {'price': . . .}]
}# specifyside** as ‘buy’ or ‘sell’**btc_order = sp.get_order(pair='btc_thb', side='buy').json()Resposne ofprint(btc_order.json())[
{'price':'12345', 'amount':'0.02'}, {price: . . . }
]Function 2get information of all pair best offer and bid orderThis function take none parameterbest_order = sp.get_order_ticker()Response ofprint(best_order.json()){
'BTC_THB': {
'bid': {'price': '12345, 'amount': '0.02'}, 'ask': {'price': '12346', 'amount': '0.01'} },
'USDT_THB': { . . .
.
}Function 3get user listed order on satangpro exchangeThis function take 4 parameterspaircoin symbol such as ‘btc_thb’, ‘eth_thb, etc.’limitspecify subset data take as integeroffsetspecify start index of subset take as positive integerstatusspecify complete or incomplete order status take as
‘open’, ‘close’limit, offset and statusdo not have to specify, they take initial
value as limit = 10, offset = 0 and status = empty string# only pair is specifymy_btc_list_order = sp.get_list_order(pair='btc_thb')Response ofprint(my_btc_list_order.json())[
{'id': 23456, 'type': 'limit', 'price': '12345', 'amount': '0.02', 'remaining_amount': '0', 'average_price': '800000', 'side': 'buy', 'cost': '16042.2', 'created_at': '2022-07-10T12:33:49.505228Z', 'status': 'complete'}, {'id': 23457, . . .}, . . .
]# pair and limit = 1 are specifymy_btc_list_order = sp.get_list_order(pair='btc_thb', limit = 1)Response ofprint(my_btc_list_order.json())[
{'id': 23456, 'type': 'limit', 'price': '12345', 'amount': '0.02', 'remaining_amount': '0', 'average_price': '800000', 'side': 'buy', 'cost': '16042.2', 'created_at': '2022-07-10T12:33:49.505228Z', 'status': 'complete'},
]# pair and offset = 1 are specify# offsest take as index count from lastest to oldest
my_btc_list_order = sp.get_list_order(pair='btc_thb', offset = 1)Response ofprint(my_btc_list_order.json())[
{'id': 23457, 'type': 'limit', 'price': '12348', 'amount': '0.04', 'remaining_amount': '0', 'average_price': '900000', 'side': 'buy', 'cost': '16067.2', 'created_at': '2022-07-10T19:53:49.505228Z', 'status': 'complete'},
]# pair and status = ‘open’ are specify (Assume no open order)# status refer to position of order
my_btc_list_order = sp.get_list_order(pair='btc_thb', status = 'open')Response ofprint(my_btc_list_order.json())[]# pair and status = ‘close’ are specify# status refer to position of order
my_btc_list_order = sp.get_list_order(pair='btc_thb', status = 'close')Response ofprint(my_btc_list_order.json())[
{'id': 23456, 'type': 'limit', 'price': '12345', 'amount': '0.02', 'remaining_amount': '0', 'average_price': '800000', 'side': 'buy', 'cost': '16042.2', 'created_at': '2022-07-10T12:33:49.505228Z', 'status': 'complete'}, {'id': 23457, . . .}, . . .
]Function 4get list of price and grouping amountThis function take 1 parameter such aspairpaircoin symbol such as ‘btc_thb’, ‘eth_thb, etc.’all_btc_order = sp.get_order_depth(pair='btc_thb')Response ofprint(all_btc_order.json()){
'lastUpdateId': 54321, 'bids': [ ['12345', '0.02'], . . .
], 'asks': [
['12346', '0.01'], . . .
]
}Function 5get list of kline & candlestick information of selected pairThis function take 2 parameters such aspair and intervalpaircoin symbol such as ‘btc_thb’, ‘eth_thb, etc.’intervalspecify time limit of support information such as 1m,
3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1Mmfor minute,hfor hour,dfor day,wfor week andMfor
monthintervaldo not have to specify, it takes initial value as 1hkline_candlestick_btc = sp.get_kline_candlestick(pair='btc_thb')Response ofprint(kline_candlestick_btc.json())[
[1660140000000, '800000', '800000', '800000', '800000', '0', 1660143599999, '0', 0, '0', '0', '0'], [1660143600000, '800000', '800000', '800000', '800000', '0', 1660147199999, '0', 0, '0', '0', '0'], . . .
]Function 6create orderthis function take 4 parameterspaircoin symbol such as ‘btc_thb’, ‘eth_thb, etc.’amountspecify coin amount of selected pairif side = ‘sell’ based oncoinin wallet, if side = ‘buy’ based
onTHBin walletpricespecify price in THBif specify price is more than or less than price limitserverwill returnerrorsidespecify position such as ‘buy’ or ‘sell’# create order function similar to how to call python function
# want to buy usdt 3 coin at 42 baht
sp.create_order(pair='usdt_thb',amount=3,price=42,side='buy')Response ofprint(sp.create_order(pair=‘usdt_thb’,amount=3,price=42,side=‘buy’).json())# originally, this function do not return any output
# for print order (not recommend because python send post request twice)

{
'id': 1234567, 'type': 'limit', 'side': 'buy', 'pair': 'usdt_thb', 'open_cost': '123456', 'average_price': '0', 'value': '0', 'cost': '0', 'fee_percent': '0.25', 'taker_fee_percent': '0.25', 'vat_percent': '7', 'time_in_force': 'GTC', 'status': 'processing', 'user_id': 123, 'created_at': '2022-08-31T10:21:23.347858Z', 'created_by_ip': '123.123.123.123', 'updated_at': '2022-08- 31T10:21:23.347858Z', 'price': '42', 'amount': '3', 'remain_amount': '3'
}Function 7cancel orderthis function take 2 parameterspaircoin symbol such as ‘btc_thb’, ‘eth_thb’order_idspecify order id# cancel order function similar to how to call python function
# order_id can get through get_list_order(pair = 'selected_pair', status = 'open') function
sp.cancel_order(pair='usdt_thb',order_id= 12345)Response ofprint(sp.cancel_order(pair=‘usdt_thb’,order_id=
12345).json())# originally, this function do not return any output
# for print order (not recommend because python send request twice that make order_id not valid because first order_id was cancel)Example of cancel order#create open order
sp.create_order(pair='usdt_thb',amount=3,price=42,side='buy')

#check order id of created open order
order_id = sp.get_list_order(pair='usdt_thb',offset=0,limit=1,status='open').json()[0]['id']

#print to check order id
print(f'order id = {order_id}')

#cancel order that was created
sp.cancel_order(pair='usdt_thb',order_id=order_id)

#make sure server response to cancel request
time.sleep(2)

#check order id of created open order (should not be the same with previous order id)
order_id = sp.get_list_order(pair='usdt_thb',offset=0,limit=1,status='open').json()[0]['id']

#print to check order id
print(f'order id = {order_id}')Function 8cancel all open orderthis function take 1 parameterpaircoin symbol such as ‘btc_thb’, ‘eth_thb, etc.’# cancel all order function similar to how to call python function
sp.cancel_all_order(pair='usdt_thb')Response# originally, this function do not return any output
# can check open order by get_list_order() API FunctionSummaryPython SDK for the Satangpro API have 19 function which classified into
2 class which areTake parametersandNone parametersTake parameters (parameters)boldparameters refer tomust specifynon-bold = {initial value} of that parameters (Ex.
get_kline_candlestick() -> interval = ‘1h’ if not specify interval value
)get_order (pair, side = ’’)return dictionary contain order information of specify pairget_list_order (pair, limit = 10, offset = 0, status = ’’)return list contain all of user order information of specify pairget_order_depth (pair)return list of price and grouping amount in that priceget_kline_candlestick (pair, interval = ‘1h’)return list of kline & candlestick information of specify pairget_aggregate_trade (pair)return list of dictionary contain a = ‘trade_id’, p = ‘price in that
trade’ and q = ‘amount of coin in that trade’create_order (pair, amount, price, side)send buy or sell order of specify pair to Satangpro servercancel_order (pair, order_id)send cancel order of selected order_id to Satangpro servercancel_all_order_bypair (pair)cancel all open order in specify pairthb_deposit_hist (limit = 10, offset = 0)return dict of personal information THB_depositthb_withdrawal_hist (limit = 10, offset = 0)return dict of personal information THB_withdrawalcrypto_deposit_hist (limit = 10, offset = 0)return dict of personal information crypto_depositcrypto_withdrawal_hist (limit = 10, offset = 0)return dict of personal information crypto_withdrawalNone parametersget_inforeturn dictionary contain all information of user accountget_order_tickerreturn dictionary contain all pair best offer and bid orderget_exchange_inforeturn dictionary of exchange information such as timezone,
coin_symbol, etc.get_24hr_tickerreturn list of dictionary contain all pair best offer and bid order
in 24-hourgenerate_listen_keyreturn listenkey as a token to connect with Satangpro Websocket,
expire within 1 hourkeep_alive_listen_keyreturn listenkey but keep it alive more than 1 hourget_configsreturn configs of Satangpro system