# Bitkub Python
A Python library for [bitkub.com](https://github.com/bitkub/bitkub-official-api-docs) API
## Releases
* ```2023-12-14``` version ```3.1.4```
* change sym from quote_base to base_quote
* ```2023-12-11``` version ```3.1.3```
* revise tradingview history
* ```2023-12-01``` version ```3.1.1```
* switch to api v3
* ```2023-03-29``` version ```2.1.0```
* switch to api v2 in [Create buy order](#createbuyorder), [Create sell order](#createsellorder) and [Cancel order](#cancelorder)
* remove [Create sell order by fiat](#createsellorderfiat), Deprecated at 2023-03-27
* ```2022-01-07``` version ```1.1.0```
* add [Create buy order test](#createbuyordertest)
* add [Create sell order test](#createsellordertest)
* [Viewing tradingview history](#viewingtradingviewhistory) endpoint is now deprecated and will be updated with a new endpoint soon. The old endpoint will always return empty result.
* include is_maker in [My order history](#myorderhistory)
* removed address and instead include from_address and to_address in [Crypto deposit history](#cryptodeposithistory)
* add [Crypto internal withdraw](#cryptinternalowithdraw)
* include partial_filled and remaining in [Order info](#orderinfo)
* ```2020-04-02``` version ```1.0.3``` add [generate-address](#cryptogenerateaddress) method
## Table of Contents
- [Installation](#installation)
- [Usage](#usage)
- [Creating a Bitkub](#creating)
- [Set API key & API secret](#api_key)
- [Viewing status](#viewingstatus)
- [Viewing servertime](#viewingservertime)
- [Viewing symbols](#viewingsymbols)
- [Viewing ticker](#viewingticker)
- [Viewing trades](#viewingtrades)
- [Viewing bids](#viewingbids)
- [Viewing asks](#viewingasks)
- [Viewing books](#viewingbooks)
- [Viewing depth](#viewingdepth)
- [Viewing tradingview history](#viewingtradingviewhistory)
- [Viewing wallet](#viewingwallet)
- [Viewing balances](#viewingbalances)
- [Create buy order](#createbuyorder)
- [Create buy order test](#createbuyordertest)
- [Create sell order](#createsellorder)
- [Create sell order test](#createsellordertest)
- [Create sell order by fiat](#createsellorderfiat)
- [Cancel order](#cancelorder)
- [My open orders](#myopenorders)
- [My order history](#myorderhistory)
- [Order info](#orderinfo)
- [Crypto addresses](#cryptoaddressses)
- [Crypto withdraw](#cryptowithdraw)
- [Crypto internal withdraw](#cryptinternalowithdraw)
- [Crypto deposit history](#cryptodeposithistory)
- [Crypto withdraw history](#cryptowithdrawhistory)
- [Crypto generate address](#cryptogenerateaddress)
- [Fiat accounts](#fiataccounts)
- [Fiat withdraw](#fiatwithdraw)
- [Fiat deposit history](#fiatdeposithistory)
- [Fiat withdraw history](#fiatwithdrawhistory)
- [Market wstoken](#marketwstoken)
- [User limits](#userlimits)
- [User trading credits](#usertradingcredits)
## Installation <a name="installation"></a>
pip install bitkub-v2
## Usage <a name="usage"></a>
from bitkub import Bitkub
### Creating a Bitkub Object <a name="creating"></a>
API_KEY = 'YOUR API KEY'
API_SECRET = 'YOUR API SECRET'
# initial obj only non-secure
bitkub = Bitkub()
# initial obj non-secure and secure
bitkub = Bitkub(api_key=API_KEY, api_secret=API_SECRET)
You can find API KEY and API SECRET from [here](https://www.bitkub.com/publicapi).
### Set API key and API secret <a name="api_key"></a>
If you initial obj with only non-secure. You can set up API key and API secret on below.
API_KEY = 'YOUR API KEY'
API_SECRET = 'YOUR API SECRET'
bitkub = Bitkub()
bitkub.set_api_key(API_KEY)
bitkub.set_api_secret(API_SECRET)
### Viewing status <a name="viewingstatus"></a>
Get endpoint status.
#### Function:
bitkub.status()
#### Response:
[
{
'name': 'Non-secure endpoints',
'status': 'ok',
'message': ''
},
{
'name': 'Secure endpoints',
'status': 'ok',
'message': ''
}
]
### Viewing servertime <a name="viewingservertime"></a>
Get server timestamp.
#### Function:
bitkub.servertime()
#### Response:
1701251212273
### Viewing symbols <a name="viewingsymbols"></a>
List all available symbols.
#### Function:
bitkub.symbols()
#### Response:
{
'error': 0,
'result': [
{
'id': 1,
'info': 'Thai Baht to Bitcoin',
'symbol': 'THB_BTC'
},
{
'id': 2,
'info': 'Thai Baht to Ethereum',
'symbol': 'THB_ETH'
}
]
}
### Viewing ticker <a name="viewingticker"></a>
Get ticker information.
#### Function:
bitkub.ticker(sym='THB_BTC')
#### Parameter:
* ```sym``` **string** The symbol (optional) ```default``` ""
#### Response:
{
'THB_BTC': {
'id': 1,
'last': 278000,
'lowestAsk': 278869.41,
'highestBid': 278000,
'percentChange': -1.44,
'baseVolume': 206.01549914,
'quoteVolume': 57883319.04,
'isFrozen': 0,
'high24hr': 284000,
'low24hr': 277579.62,
'change': -4075.81,
'prevClose': 281800,
'prevOpen': 281800
}
}
### Viewing trades <a name="viewingtrades"></a>
List recent trades.
#### Function:
bitkub.trades(sym="THB_BTC", lmt=2)
#### Parameter:
* ```sym``` **string** The symbol
* ```lmt``` **int** No. of limit to Parameter recent trades ```default``` 1
#### Response:
{
'error': 0,
'result': [
[
1583246192, // timestamp
278798.34, // rate
0.00375672, // amount
'BUY' // side
],
[
1583246159,
278000,
0.0001042,
'SELL'
]
]
}
### Viewing bids <a name="viewingbids"></a>
List open buy orders.
#### Function:
bitkub.bids(sym="THB_BTC", lmt=2)
#### Parameter:
* ```sym``` **string** The symbol
* ```lmt``` **int** No. of limit to Parameter open buy orders ```default``` 1
#### Response:
{
'error': 0,
'result': [
[
4632978, // order id
1583245687, // timestamp
73110.59, // volume
278000, // rate
0.26298773 // amount
],
[
4632732,
1583245871,
1312.68,
278000,
0.00472187
]
]
}
### Viewing asks <a name="viewingasks"></a>
List open sell orders.
#### Function:
bitkub.asks(sym="THB_BTC", lmt=2)
#### Parameter:
* ```sym``` **string** The symbol
* ```lmt``` **int** No. of limit to Parameter open sell orders ```default``` 1
#### Response:
{
'error': 0,
'result': [
[
4761288, // order id
1583246870, // timestamp
163813.12, // volume
278499.03, // rate
0.5882 // amount
],
[
4761287,
1583246870,
379232.12,
278499.03,
1.3617
]
]
}
### Viewing books <a name="viewingbooks"></a>
List all open orders.
#### Function:
bitkub.books(sym="THB_BTC", lmt=1)
#### Parameter:
* ```sym``` **string** The symbol
* ```lmt``` **int** No. of imit to Parameter open orders ```default``` 1
#### Response:
{
'error': 0,
'result': {
'asks': [
[
4761425, // order id
1583247105, // timestamp
360885.74, // volume
278300.17, // rate
1.29675 // amount
]
],
'bids': [
[
4633099, // order id
1583247090, // timestamp
622146.15, // volume
277946.2, // rate
2.23836897 // amount
]
]
}
}
### Viewing depth <a name="viewingdepth"></a>
Get depth information.
#### Function:
bitkub.depth(sym='THB_BTC', lmt=1)
#### Parameter:
* ```sym``` **string** The symbol
* ```lmt``` **int** Depth size ```default``` 1
#### Response:
{
'asks': [
[
277946.16,
1.29675
]
],
'bids': [
[
277936.27,
0.94071896
]
]
}
### Viewing tradingview history <a name="viewingtradingviewhistory"></a>
Get historical data for TradingView chart.
#### Function:
bitkub.tradingview(sym='THB_BTC', int=1, frm='', to='')
#### Parameter:
* ```sym``` **string** The symbol
* ```int``` **int** Chart resolution (1, 5, 15, 60, 240, 1D) ```default``` 1
* ```frm``` **int** Timestamp of the starting time
* ```to``` **int** Timestamp of the ending time
#### Response:
{
'c': [
1685000,
1680699.95,
1688998.99,
1692222.22
],
'h': [
1685000,
1685000,
1689000,
1692222.22
],
'l': [
1680053.22,
1671000,
1680000,
1684995.07
],
'o': [
1682500,
1685000,
1680100,
1684995.07
],
's': "ok",
't': [
1633424400,
1633425300,
1633426200,
1633427100
],
'v': [
4.604352630000001,
8.530631670000005,
4.836581560000002,
2.8510189200000022
]
}
### Viewing wallet <a name="viewingwallet"></a>
Get user available balances. ```Required initial secure obj```
#### Function:
bitkub.wallet()
#### Response:
{
'error': 0,
'result': {
'THB': 0,
'BTC': 0,
'ETH': 0
}
}
### Viewing balances <a name="viewingbalances"></a>
Get balances info: this includes both available and reserved balances. ```Required initial secure obj```
#### Function:
bitkub.balances()
#### Response:
{
'error': 0,
'result': {
'THB': {
'available': 0,
'reserved': 0
},
'BTC': {
'available': 0,
'reserved': 0
}
}
}
### Create buy order <a name="createbuyorder"></a>
Create a buy order. ```Required initial secure obj```
#### Function:
bitkub.place_bid(sym='THB_BTC', amt=1, rat=1, typ='limit', client_id='')
#### Parameter:
* ```sym``` **string** The symbol
* ```amt``` **float** Amount you want to spend with no trailing zero (e.g 1000.00 is invalid, 1000 is ok) ```default``` 1
* ```rat``` **float** Rate you want for the order with no trailing zero (e.g 1000.00 is invalid, 1000 is ok) ```default``` 1
* ```typ``` **string** Order type: limit or market (for market order, please specify rat as 0) ```default``` limit
* ```client_id``` **string** your id for reference ( not required )
#### Response:
{
"error": 0,
"result": {
"id": 1, // order id
"hash": "fwQ6dnQWQPs4cbatF5Am2xCDP1J", // order hash
"typ": "limit", // order type
"amt": 1000, // spending amount
"rat": 15000, // rate
"fee": 2.5, // fee
"cre": 2.5, // fee credit used
"rec": 0.06666666, // amount to receive
"ts": 1533834547 // timestamp
"ci": "input_client_id" // input id for reference
}
}
### Create buy order test <a name="createbuyordertest"></a>
<span style="color:white;background:red;"> ⚠️ This API is <strong style="color:yellow;">deprecated.</strong> (2023-11-29) </span>
Create a buy order test. ```Required initial secure obj```
#### Function:
bitkub.place_bid_test(sym='THB_BTC', amt=1, rat=1, typ='limit', client_id='')
#### Parameter:
* ```sym``` **string** The symbol
* ```amt``` **float** Amount you want to spend with no trailing zero (e.g 1000.00 is invalid, 1000 is ok) ```default``` 1
* ```rat``` **float** Rate you want for the order with no trailing zero (e.g 1000.00 is invalid, 1000 is ok) ```default``` 1
* ```typ``` **string** Order type: limit or market ```default``` limit
* ```client_id``` **string** Your id for reference ( no required )
#### Response:
{
'error': 0,
'result': {
'id': 1,
'hash': 'fwQ6dnQWQPs4cbatF5Am2xCDP1J',
'typ': 'limit',
'amt': 1,
'rat': 1,
'fee': 2.5,
'cre': 2.5,
'rec': 0.06666666,
'ts': 1533834547
}
}
### Create sell order <a name="createsellorder"></a>
Create a sell order. ```Required initial secure obj```
#### Function:
bitkub.place_ask(sym='THB_BTC', amt=1, rat=1, typ='limit', client_id='')
#### Parameter:
* ```sym``` **string** The symbol
* ```amt``` **float** Amount you want to sell with no trailing zero (e.g 0.10000000 is invalid, 0.1 is ok) ```default``` 1
* ```rat``` **float** Rate you want for the order with no trailing zero (e.g 1000.00 is invalid, 1000 is ok) ```default``` 1
* ```typ``` **string** Order type: limit or market (for market order, please specify rat as 0) ```default``` limit
* ```client_id``` **string** your id for reference ( not required )
#### Response:
{
"error": 0,
"result": {
"id": 1, // order id
"hash": "fwQ6dnQWQPs4cbatFGc9LPnpqyu", // order hash
"typ": "limit", // order type
"amt": 1.00000000, // selling amount
"rat": 15000, // rate
"fee": 37.5, // fee
"cre": 37.5, // fee credit used
"rec": 15000, // amount to receive
"ts": 1533834844 // timestamp
"ci": "input_client_id" // input id for reference
}
}
### Create sell order test <a name="createsellordertest"></a>
<span style="color:white;background:red;"> ⚠️ This API is <strong style="color:yellow;">deprecated.</strong> (2023-11-29) </span>
Create a sell order test. ```Required initial secure obj```
#### Function:
bitkub.place_ask_test(sym='THB_BTC', amt=1, rat=1, typ='limit', client_id='')
#### Parameter:
* ```sym``` **string** The symbol
* ```amt``` **float** Amount you want to spend with no trailing zero (e.g 1000.00 is invalid, 1000 is ok) ```default``` 1
* ```rat``` **float** Rate you want for the order with no trailing zero (e.g 1000.00 is invalid, 1000 is ok) ```default``` 1
* ```typ``` **string** Order type: limit or market ```default``` limit
* ```client_id``` **string** Your id for reference ( no required )
#### Response:
{
'error': 0,
'result': {
'id': 1,
'hash': 'fwQ6dnQWQPs4cbatF5Am2xCDP1J',
'typ': 'limit',
'amt': 1,
'rat': 1,
'fee': 2.5,
'cre': 2.5,
'rec': 0.06666666,
'ts': 1533834547
}
}
### Create sell order by fiat <a name="createsellorderfiat"></a>
<span style="color:white;background:red;"> ⚠️ This API is <strong style="color:yellow;">deprecated.</strong> (2023-03-27) </span>
Create a sell order by specifying the fiat amount you want to receive (selling amount of cryptocurrency is automatically calculated). ```Required initial secure obj```
#### Function:
bitkub.place_ask_by_fiat(sym='THB_BTC', amt=1, rat=1, typ='limit')
#### Parameter:
* ```sym``` **string** The symbol
* ```amt``` **float** Amount you want to spend with no trailing zero (e.g 1000.00 is invalid, 1000 is ok) ```default``` 1
* ```rat``` **float** Rate you want for the order with no trailing zero (e.g 1000.00 is invalid, 1000 is ok) ```default``` 1
* ```typ``` **string** Order type: limit or market ```default``` limit
#### Response:
{
'error': 0,
'result': {
'id': 1,
'hash': 'fwQ6dnQWQPs4cbatF5Am2xCDP1J',
'typ': 'limit',
'amt': 1,
'rat': 1,
'fee': 2.5,
'cre': 2.5,
'rec': 0.06666666,
'ts': 1533834547
}
}
### Cancel orrder<a name="cancelorder"></a>
Cancel an open order. ```Required initial secure obj```
#### Function:
bitkub.cancel_order(sym='THB_BTC', id=1, sd=1, hash='XXXXXX')
#### Parameter:
* ```sym``` **string** The symbol
* ```id``` **int** Order id you wish to cancel
* ```sd``` **string** Order side: buy or sell ```default``` buy
* ```hash``` **string** Cancel an order with order hash (optional). You don't need to specify sym, id, and sd when you specify order hash.
#### Response:
{
'error': 0
}
### My open orders<a name="myopenorders"></a>
List all open orders of the given symbol. ```Required initial secure obj```
#### Function:
bitkub.my_open_orders(sym='THB_BTC')
#### Parameter:
* ```sym``` **string** The symbol
#### Response:
{
'error': 0,
'result': [
{
'id': 2,
'hash': 'fwQ6dnQWQPs4cbatFSJpMCcKTFR',
'side': 'SELL',
'type': 'limit',
'rate': 15000,
'fee': 35.01,
'credit': 35.01,
'amount': 0.93333334,
'receive': 14000,
'parent_id': 1,
'super_id': 1,
'ts': 1533834844
}
]
}
### My order history<a name="myorderhistory"></a>
List all orders that have already matched. ```Required initial secure obj```
#### Function:
bitkub.my_open_history(sym='THB_BTC', p=1, lmt=10)
#### Parameter:
* ```sym``` **string** The symbol
* ```p``` **string** Page (optional)
* ```lmt``` **string** Limit (optional)
* ```start``` **string** Start timestamp (optional)
* ```end``` **string** End timestamp (optional)
#### Response:
{
'error': 0,
'result': [
{
'txn_id': 'ETHBUY0000000197',
'order_id': 240,
'hash': 'fwQ6dnQWQPs4cbaujNyejinS43a',
'parent_order_id': 0,
'super_order_id': 0,
'taken_by_me': true,
'is_maker': true,
'side': 'buy',
'type': 'limit',
'rate': 13335.57,
'fee': 0.34,
'credit': 0.34,
'amount': 0.00999987,
'ts': 1531513395
}
{
'error': 0,
'result': {
'id': 289,
],
'pagination': {
'page': 2,
'last': 3,
'next': 3,
'prev': 1
}
}
### Order info<a name="orderinfo"></a>
Get information regarding the specified order. ```Required initial secure obj```
#### Function:
bitkub.order_info(sym='THB_BTC', id=1, sd='buy', hash='XXXXXX')
#### Parameter:
* ```sym``` **string** The symbol
* ```id``` **int** Order id
* ```sd``` **string** Order side: buy or sell ```default``` buy
* ```hash``` **string** Lookup an order with order hash (optional). You don't need to specify sym, id, and sd when you specify order hash.
#### Response:
{
'error': 0,
'result': {
'id': 289,
'first': 289,
'parent': 0,
'last': 316,
'amount': 4000,
'rate': 291000,
'fee': 10,
'credit': 10,
'filled': 3999.97,
'total': 4000,
'status': 'filled',
'partial_filled': False,
'remaining': 0,
'history': [
{
'amount': 98.14848,
'credit': 0.25,
'fee': 0.25,
'id': 289,
'rate': 291000,
'timestamp': 1525944169
}
]
}
}
### Crypto addresses<a name="cryptoaddress"></a>
List all crypto addresses. ```Required initial secure obj```
#### Function:
bitkub.crypto_address(p=1, lmt=1)
#### Parameter:
* ```p``` **int** Page (optional) ```default``` 1
* ```lmt``` **int** Limit (optional) ```default``` 10
#### Response:
{
'error': 0,
'result': [
{
'currency': 'BTC',
'address': '3BtxdKw6XSbneNvmJTLVHS9XfNYM7VAe8k',
'tag': 0,
'time': 1570893867
}
],
'pagination': {
'page': 1,
'last": 1
}
}
### Crypto withdraw<a name="cryptowithdraw"></a>
Make a withdrawal to a trusted address. ```Required initial secure obj```
#### Function:
bitkub.crypto_withdraw(cur='BTC', amt=0.1, adr='4asyjKw6XScneNvhJTLVHS9XfNYM7VBf8x', mem='')
#### Parameter:
* ```cur``` **string** Currency for withdrawal (e.g. BTC, ETH)
* ```amt``` **float** Amount you want to withdraw
* ```adr``` **string** Address to which you want to withdraw
* ```mem``` **string** (Optional) Memo or destination tag to which you want to withdraw
#### Response:
{
'error': 0,
'result': {
'txn': 'BTCWD0000012345',
'adr': '4asyjKw6XScneNvhJTLVHS9XfNYM7VBf8x'
'mem': '',
'cur': 'BTC',
'amt': 0.1,
'fee': 0.0002,
'ts': 1569999999
}
}
### Crypto internal withdraw<a name="cryptointernalwithdraw"></a>
Make a withdrawal to a trusted address. ```Required initial secure obj```
The destination address is not required to be a trusted address. This API is not enabled by default, Only KYB users can request this feature by contacting us via support@bitkub.com
#### Function:
bitkub.crypto_internal_withdraw(cur='BTC', amt=0.1, adr='4asyjKw6XScneNvhJTLVHS9XfNYM7VBf8x', mem='')
#### Parameter:
* ```cur``` **string** Currency for withdrawal (e.g. BTC, ETH)
* ```amt``` **float** Amount you want to withdraw
* ```adr``` **string** Address to which you want to withdraw
* ```mem``` **string** (Optional) Memo or destination tag to which you want to withdraw
#### Response:
{
'error': 0,
'result': {
'txn': 'BTCWD0000012345',
'adr': '4asyjKw6XScneNvhJTLVHS9XfNYM7VBf8x'
'mem': '',
'cur': 'BTC',
'amt': 0.1,
'fee': 0.0002,
'ts': 1569999999
}
}
### Crypto deposit history<a name="cryptodeposithistory"></a>
List crypto deposit history. ```Required initial secure obj```
#### Function:
bitkub.crypto_deposit_history(p=1, lmt=1)
#### Parameter:
* ```p``` **int** Page (optional) ```default``` 1
* ```lmt``` **int** Limit (optional) ```default``` 10
#### Response:
{
'error': 0,
'result': [
{
'hash': 'XRPWD0000100276',
'currency': 'XRP',
'amount': 5.75111474,
'from_address': 'sender address',
'to_address': 'receipent address',
'confirmations': 1,
'status': 'complete',
'time': 1570893867
}
],
'pagination': {
'page': 1,
'last': 1
}
}
### Crypto withdraw history<a name="cryptowithdrawhistory"></a>
:
List crypto withdrawal history. ```Required initial secure obj```
#### Function:
bitkub.crypto_withdraw_history(p=1, lmt=1)
#### Parameter:
* ```p``` **int** Page (optional) ```default``` 1
* ```lmt``` **int** Limit (optional) ```default``` 10
#### Response:
{
'error': 0,
'result': [
{
'txn_id': 'XRPWD0000100276',
'hash': 'send_internal',
'currency': 'XRP',
'amount': '5.75111474',
'fee': 0.01,
'address': 'rpXTzCuXtjiPDFysxq8uNmtZBe9Xo97JbW',
'status': 'complete',
'time': 1570893493
}
],
'pagination': {
'page': 1,
'last': 1
}
}
### Crypto generate address<a name="cryptogenerateaddress"></a>
Generate a new crypto address (will replace existing address; previous address can still be used to received funds)
List all approved bank accounts. ```Required initial secure obj```
#### Function:
bitkub.crypto_generate_address(sym='THB_BTC')
#### Parameter:
* ```sym``` **string** The symbol
#### Response:
{
'error': 0,
'result': [
{
'currency': 'BTC',
'address': '0x520165471daa570ab632dd504c6af257bd36edfb',
'memo': ''
}
]
}
### Fiat accounts<a name="fiataccounts"></a>
List all approved bank accounts. ```Required initial secure obj```
#### Function:
bitkub.fiat_accounts(p=1, lmt=1)
#### Parameter:
* ```p``` **int** Page (optional) ```default``` 1
* ```lmt``` **int** Limit (optional) ```default``` 10
#### Response:
{
'error': 0,
'result': [
{
'id': '7262109099',
'bank': 'Kasikorn Bank',
'name': 'Somsak',
'time': 1570893867
}
],
'pagination': {
'page': 1,
'last': 1
}
}
### Fiat withdraw<a name="fiatwithdraw"></a>
Make a withdrawal to an approved bank account. ```Required initial secure obj```
#### Function:
bitkub.fiat_withdraw(id=1, amt=1)
#### Parameter:
* ```id``` **string** Bank account id
* ```amt``` **float** Amount you want to withdraw
#### Response:
{
'error': 0,
'result': {
'txn': 'THBWD0000012345',
'acc': '7262109099',
'cur': 'THB',
'amt': 21,
'fee': 20,
'rec': 1,
'ts': 1569999999
}
}
### Fiat deposit history<a name="fiatdeposithistory"></a>
List fiat deposit history. ```Required initial secure obj```
#### Function:
bitkub.fiat_deposit_history(p=1, lmt=1)
#### Parameter:
* ```p``` **int** Page (optional) ```default``` 1
* ```lmt``` **int** Limit (optional) ```default``` 10
#### Response:
{
'error':0,
'result':[
{
'txn_id': 'THBDP0000012345',
'currency': 'THB',
'amount': 5000.55,
'status': 'complete',
'time': 1570893867
}
],
'pagination':{
'page': 1,
'last': 1
}
}
### Fiat withdraw history<a name="fiatwithdrawhistory"></a>
List fiat withdrawal history. ```Required initial secure obj```
#### Function:
bitkub.fiat_withdraw_history(p=1, lmt=1)
#### Parameter:
* ```p``` **int** Page (optional) ```default``` 1
* ```lmt``` **int** Limit (optional) ```default``` 10
#### Response:
{
'error': 0,
'result': [
{
'txn_id': 'THBDP0000012345',
'currency': 'THB',
'amount': 5000.55,
'fee': 20,
'status': 'complete',
'time': 1570893867
}
],
'pagination':{
'page': 1,
'last': 1
}
}
### Market wstoken<a name="marketwstoken"></a>
Get the token for websocket authentication. ```Required initial secure obj```
#### Function:
bitkub.market_wstoken()
#### Response:
{
'error': 0,
'result': 'sdCBCTwaS2Z1IBB6uTCefIbVN6dQVz9dkDeU96IoFJp14GGhlw9hoUDNe1KSYC23dXBPIqyX2QjVEOFHITxgPMvo8kdVaTkiZBA8KgvVTSMsq6JjjlyERDVZn3tt4PEp'
}
### User limits<a name="userlimits"></a>
Check deposit/withdraw limitations and usage. ```Required initial secure obj```
#### Function:
bitkub.user_limits()
#### Response:
{
'error': 0,
'result': {
'limits': {
'crypto': {
'deposit': 0,
'withdraw': 0
},
'fiat': {
'deposit': 0,
'withdraw': 0
}
},
'usage': {
'crypto': {
'deposit': 0,
'withdraw': 0,
'deposit_percentage': 0,
'withdraw_percentage': 0,
'deposit_thb_equivalent': 0,
'withdraw_thb_equivalent': 0
},
'fiat': {
'deposit': 0,
'withdraw': 0,
'deposit_percentage': 0,
'withdraw_percentage': 0
}
},
'rate': 177100.32
}
}
### User trading-credit<a name="usertradingcredits"></a>
Check trading credit balance. ```Required initial secure obj```
#### Function:
bitkub.user_trading_credits()
#### Response:
{
'error': 0,
'result': 0
}
Raw data
{
"_id": null,
"home_page": "https://github.com/appcorner/bitkub",
"name": "bitkub-v2",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "bitkub,bitkub-python,bitkub-python-sdk",
"author": "appcorner",
"author_email": "appcorner@yahoo.com",
"download_url": "https://files.pythonhosted.org/packages/58/f9/6917432c4e1f430d920122b680d50762233ab5f4d8a5f5281f82d7a1febf/bitkub-v2-3.1.4.tar.gz",
"platform": null,
"description": "# Bitkub Python\r\n\r\n\r\nA Python library for [bitkub.com](https://github.com/bitkub/bitkub-official-api-docs) API\r\n\r\n## Releases\r\n * ```2023-12-14``` version ```3.1.4```\r\n * change sym from quote_base to base_quote\r\n * ```2023-12-11``` version ```3.1.3```\r\n * revise tradingview history\r\n * ```2023-12-01``` version ```3.1.1```\r\n * switch to api v3 \r\n * ```2023-03-29``` version ```2.1.0```\r\n * switch to api v2 in [Create buy order](#createbuyorder), [Create sell order](#createsellorder) and [Cancel order](#cancelorder) \r\n * remove [Create sell order by fiat](#createsellorderfiat), Deprecated at 2023-03-27\r\n * ```2022-01-07``` version ```1.1.0```\r\n * add [Create buy order test](#createbuyordertest)\r\n * add [Create sell order test](#createsellordertest)\r\n * [Viewing tradingview history](#viewingtradingviewhistory) endpoint is now deprecated and will be updated with a new endpoint soon. The old endpoint will always return empty result.\r\n * include is_maker in [My order history](#myorderhistory)\r\n * removed address and instead include from_address and to_address in [Crypto deposit history](#cryptodeposithistory)\r\n * add [Crypto internal withdraw](#cryptinternalowithdraw)\r\n * include partial_filled and remaining in [Order info](#orderinfo)\r\n * ```2020-04-02``` version ```1.0.3``` add [generate-address](#cryptogenerateaddress) method\r\n\r\n## Table of Contents\r\n\r\n- [Installation](#installation)\r\n- [Usage](#usage)\r\n - [Creating a Bitkub](#creating)\r\n - [Set API key & API secret](#api_key)\r\n - [Viewing status](#viewingstatus)\r\n - [Viewing servertime](#viewingservertime)\r\n - [Viewing symbols](#viewingsymbols)\r\n - [Viewing ticker](#viewingticker)\r\n - [Viewing trades](#viewingtrades)\r\n - [Viewing bids](#viewingbids)\r\n - [Viewing asks](#viewingasks)\r\n - [Viewing books](#viewingbooks)\r\n - [Viewing depth](#viewingdepth)\r\n - [Viewing tradingview history](#viewingtradingviewhistory)\r\n - [Viewing wallet](#viewingwallet)\r\n - [Viewing balances](#viewingbalances)\r\n - [Create buy order](#createbuyorder)\r\n - [Create buy order test](#createbuyordertest)\r\n - [Create sell order](#createsellorder)\r\n - [Create sell order test](#createsellordertest)\r\n - [Create sell order by fiat](#createsellorderfiat)\r\n - [Cancel order](#cancelorder)\r\n - [My open orders](#myopenorders)\r\n - [My order history](#myorderhistory)\r\n - [Order info](#orderinfo)\r\n - [Crypto addresses](#cryptoaddressses)\r\n - [Crypto withdraw](#cryptowithdraw)\r\n - [Crypto internal withdraw](#cryptinternalowithdraw)\r\n - [Crypto deposit history](#cryptodeposithistory)\r\n - [Crypto withdraw history](#cryptowithdrawhistory)\r\n - [Crypto generate address](#cryptogenerateaddress)\r\n - [Fiat accounts](#fiataccounts)\r\n - [Fiat withdraw](#fiatwithdraw)\r\n - [Fiat deposit history](#fiatdeposithistory)\r\n - [Fiat withdraw history](#fiatwithdrawhistory)\r\n - [Market wstoken](#marketwstoken)\r\n - [User limits](#userlimits)\r\n - [User trading credits](#usertradingcredits)\r\n\r\n\r\n## Installation <a name=\"installation\"></a>\r\n\r\n pip install bitkub-v2\r\n\r\n## Usage <a name=\"usage\"></a>\r\n\r\n from bitkub import Bitkub\r\n\r\n### Creating a Bitkub Object <a name=\"creating\"></a>\r\n\r\n API_KEY = 'YOUR API KEY'\r\n API_SECRET = 'YOUR API SECRET'\r\n\r\n # initial obj only non-secure\r\n bitkub = Bitkub()\r\n\r\n # initial obj non-secure and secure\r\n bitkub = Bitkub(api_key=API_KEY, api_secret=API_SECRET)\r\n\r\nYou can find API KEY and API SECRET from [here](https://www.bitkub.com/publicapi).\r\n\r\n### Set API key and API secret <a name=\"api_key\"></a>\r\n If you initial obj with only non-secure. You can set up API key and API secret on below.\r\n\r\n API_KEY = 'YOUR API KEY'\r\n API_SECRET = 'YOUR API SECRET'\r\n\r\n bitkub = Bitkub()\r\n bitkub.set_api_key(API_KEY)\r\n bitkub.set_api_secret(API_SECRET)\r\n\r\n### Viewing status <a name=\"viewingstatus\"></a>\r\n\r\nGet endpoint status.\r\n\r\n#### Function:\r\n bitkub.status()\r\n\r\n#### Response:\r\n\r\n [\r\n {\r\n 'name': 'Non-secure endpoints',\r\n 'status': 'ok',\r\n 'message': ''\r\n },\r\n {\r\n 'name': 'Secure endpoints',\r\n 'status': 'ok',\r\n 'message': ''\r\n }\r\n ]\r\n\r\n### Viewing servertime <a name=\"viewingservertime\"></a>\r\n\r\nGet server timestamp.\r\n\r\n#### Function:\r\n bitkub.servertime()\r\n\r\n#### Response:\r\n\r\n 1701251212273\r\n\r\n### Viewing symbols <a name=\"viewingsymbols\"></a>\r\n\r\nList all available symbols.\r\n\r\n#### Function:\r\n bitkub.symbols()\r\n\r\n#### Response:\r\n\r\n {\r\n 'error': 0,\r\n 'result': [\r\n {\r\n 'id': 1,\r\n 'info': 'Thai Baht to Bitcoin',\r\n 'symbol': 'THB_BTC'\r\n },\r\n {\r\n 'id': 2,\r\n 'info': 'Thai Baht to Ethereum',\r\n 'symbol': 'THB_ETH'\r\n }\r\n ]\r\n }\r\n\r\n### Viewing ticker <a name=\"viewingticker\"></a>\r\n\r\nGet ticker information.\r\n\r\n#### Function:\r\n bitkub.ticker(sym='THB_BTC')\r\n\r\n#### Parameter:\r\n\r\n * ```sym``` **string** The symbol (optional) ```default``` \"\"\r\n\r\n#### Response:\r\n\r\n {\r\n 'THB_BTC': {\r\n 'id': 1,\r\n 'last': 278000,\r\n 'lowestAsk': 278869.41,\r\n 'highestBid': 278000,\r\n 'percentChange': -1.44,\r\n 'baseVolume': 206.01549914,\r\n 'quoteVolume': 57883319.04,\r\n 'isFrozen': 0,\r\n 'high24hr': 284000,\r\n 'low24hr': 277579.62,\r\n 'change': -4075.81,\r\n 'prevClose': 281800,\r\n 'prevOpen': 281800\r\n }\r\n }\r\n\r\n### Viewing trades <a name=\"viewingtrades\"></a>\r\n\r\nList recent trades.\r\n\r\n#### Function:\r\n bitkub.trades(sym=\"THB_BTC\", lmt=2)\r\n\r\n#### Parameter:\r\n\r\n * ```sym``` **string** The symbol\r\n * ```lmt``` **int** No. of limit to Parameter recent trades ```default``` 1\r\n\r\n#### Response:\r\n\r\n {\r\n 'error': 0,\r\n 'result': [\r\n [\r\n 1583246192, // timestamp\r\n 278798.34, // rate\r\n 0.00375672, // amount\r\n 'BUY' // side\r\n ],\r\n [\r\n 1583246159,\r\n 278000,\r\n 0.0001042,\r\n 'SELL'\r\n ]\r\n ]\r\n }\r\n\r\n\r\n### Viewing bids <a name=\"viewingbids\"></a>\r\n\r\nList open buy orders.\r\n\r\n#### Function:\r\n bitkub.bids(sym=\"THB_BTC\", lmt=2)\r\n\r\n#### Parameter:\r\n\r\n * ```sym``` **string** The symbol\r\n * ```lmt``` **int** No. of limit to Parameter open buy orders ```default``` 1\r\n\r\n#### Response:\r\n\r\n {\r\n 'error': 0,\r\n 'result': [\r\n [\r\n 4632978, // order id\r\n 1583245687, // timestamp\r\n 73110.59, // volume\r\n 278000, // rate\r\n 0.26298773 // amount\r\n ],\r\n [\r\n 4632732,\r\n 1583245871,\r\n 1312.68,\r\n 278000,\r\n 0.00472187\r\n ]\r\n ]\r\n }\r\n\r\n\r\n### Viewing asks <a name=\"viewingasks\"></a>\r\n\r\nList open sell orders.\r\n\r\n#### Function:\r\n bitkub.asks(sym=\"THB_BTC\", lmt=2)\r\n#### Parameter:\r\n\r\n * ```sym``` **string** The symbol\r\n * ```lmt``` **int** No. of limit to Parameter open sell orders ```default``` 1\r\n\r\n#### Response:\r\n\r\n {\r\n 'error': 0,\r\n 'result': [\r\n [\r\n 4761288, // order id\r\n 1583246870, // timestamp\r\n 163813.12, // volume\r\n 278499.03, // rate\r\n 0.5882 // amount\r\n ],\r\n [\r\n 4761287,\r\n 1583246870,\r\n 379232.12,\r\n 278499.03,\r\n 1.3617\r\n ]\r\n ]\r\n }\r\n\r\n\r\n### Viewing books <a name=\"viewingbooks\"></a>\r\n\r\nList all open orders.\r\n\r\n#### Function:\r\n bitkub.books(sym=\"THB_BTC\", lmt=1)\r\n#### Parameter:\r\n\r\n * ```sym``` **string** The symbol\r\n * ```lmt``` **int** No. of imit to Parameter open orders ```default``` 1\r\n\r\n#### Response:\r\n\r\n {\r\n 'error': 0,\r\n 'result': {\r\n 'asks': [\r\n [\r\n 4761425, // order id\r\n 1583247105, // timestamp\r\n 360885.74, // volume\r\n 278300.17, // rate\r\n 1.29675 // amount\r\n ]\r\n ],\r\n 'bids': [\r\n [\r\n 4633099, // order id\r\n 1583247090, // timestamp\r\n 622146.15, // volume\r\n 277946.2, // rate\r\n 2.23836897 // amount\r\n ]\r\n ]\r\n }\r\n }\r\n\r\n\r\n### Viewing depth <a name=\"viewingdepth\"></a>\r\n\r\nGet depth information.\r\n\r\n#### Function:\r\n bitkub.depth(sym='THB_BTC', lmt=1)\r\n#### Parameter:\r\n\r\n * ```sym``` **string** The symbol\r\n * ```lmt``` **int** Depth size ```default``` 1\r\n\r\n#### Response:\r\n\r\n {\r\n 'asks': [\r\n [\r\n 277946.16,\r\n 1.29675\r\n ]\r\n ],\r\n 'bids': [\r\n [\r\n 277936.27,\r\n 0.94071896\r\n ]\r\n ]\r\n }\r\n\r\n\r\n### Viewing tradingview history <a name=\"viewingtradingviewhistory\"></a>\r\n\r\nGet historical data for TradingView chart.\r\n\r\n#### Function:\r\n bitkub.tradingview(sym='THB_BTC', int=1, frm='', to='')\r\n#### Parameter:\r\n\r\n * ```sym``` **string** The symbol\r\n * ```int``` **int** Chart resolution (1, 5, 15, 60, 240, 1D) ```default``` 1\r\n * ```frm``` **int** Timestamp of the starting time\r\n * ```to``` **int** Timestamp of the ending time\r\n\r\n#### Response:\r\n \r\n {\r\n 'c': [\r\n 1685000,\r\n 1680699.95,\r\n 1688998.99,\r\n 1692222.22\r\n ],\r\n 'h': [\r\n 1685000,\r\n 1685000,\r\n 1689000,\r\n 1692222.22\r\n ],\r\n 'l': [\r\n 1680053.22,\r\n 1671000,\r\n 1680000,\r\n 1684995.07\r\n ],\r\n 'o': [\r\n 1682500,\r\n 1685000,\r\n 1680100,\r\n 1684995.07\r\n ],\r\n 's': \"ok\",\r\n 't': [\r\n 1633424400,\r\n 1633425300,\r\n 1633426200,\r\n 1633427100\r\n ],\r\n 'v': [\r\n 4.604352630000001,\r\n 8.530631670000005,\r\n 4.836581560000002,\r\n 2.8510189200000022\r\n ]\r\n }\r\n\r\n\r\n### Viewing wallet <a name=\"viewingwallet\"></a>\r\n\r\nGet user available balances. ```Required initial secure obj```\r\n\r\n#### Function:\r\n bitkub.wallet()\r\n\r\n#### Response:\r\n\r\n {\r\n 'error': 0,\r\n 'result': {\r\n 'THB': 0,\r\n 'BTC': 0,\r\n 'ETH': 0\r\n }\r\n }\r\n\r\n\r\n### Viewing balances <a name=\"viewingbalances\"></a>\r\n\r\nGet balances info: this includes both available and reserved balances. ```Required initial secure obj```\r\n\r\n#### Function:\r\n bitkub.balances()\r\n\r\n#### Response:\r\n\r\n {\r\n 'error': 0,\r\n 'result': {\r\n 'THB': {\r\n 'available': 0,\r\n 'reserved': 0\r\n },\r\n 'BTC': {\r\n 'available': 0,\r\n 'reserved': 0\r\n }\r\n }\r\n }\r\n\r\n\r\n### Create buy order <a name=\"createbuyorder\"></a>\r\n\r\nCreate a buy order. ```Required initial secure obj```\r\n\r\n#### Function:\r\n bitkub.place_bid(sym='THB_BTC', amt=1, rat=1, typ='limit', client_id='')\r\n\r\n#### Parameter:\r\n * ```sym``` **string** The symbol\r\n * ```amt``` **float** Amount you want to spend with no trailing zero (e.g 1000.00 is invalid, 1000 is ok) ```default``` 1\r\n * ```rat``` **float** Rate you want for the order with no trailing zero (e.g 1000.00 is invalid, 1000 is ok) ```default``` 1\r\n * ```typ``` **string** Order type: limit or market (for market order, please specify rat as 0) ```default``` limit\r\n * ```client_id``` **string** your id for reference ( not required )\r\n\r\n\r\n#### Response:\r\n\r\n {\r\n \"error\": 0,\r\n \"result\": {\r\n \"id\": 1, // order id\r\n \"hash\": \"fwQ6dnQWQPs4cbatF5Am2xCDP1J\", // order hash\r\n \"typ\": \"limit\", // order type\r\n \"amt\": 1000, // spending amount\r\n \"rat\": 15000, // rate\r\n \"fee\": 2.5, // fee\r\n \"cre\": 2.5, // fee credit used\r\n \"rec\": 0.06666666, // amount to receive\r\n \"ts\": 1533834547 // timestamp\r\n \"ci\": \"input_client_id\" // input id for reference\r\n }\r\n }\r\n\r\n### Create buy order test <a name=\"createbuyordertest\"></a>\r\n<span style=\"color:white;background:red;\"> \u26a0\ufe0f This API is <strong style=\"color:yellow;\">deprecated.</strong> (2023-11-29) </span>\r\n\r\nCreate a buy order test. ```Required initial secure obj```\r\n\r\n#### Function:\r\n bitkub.place_bid_test(sym='THB_BTC', amt=1, rat=1, typ='limit', client_id='')\r\n\r\n#### Parameter:\r\n * ```sym``` **string** The symbol\r\n * ```amt``` **float** Amount you want to spend with no trailing zero (e.g 1000.00 is invalid, 1000 is ok) ```default``` 1\r\n * ```rat``` **float** Rate you want for the order with no trailing zero (e.g 1000.00 is invalid, 1000 is ok) ```default``` 1\r\n * ```typ``` **string** Order type: limit or market ```default``` limit\r\n * ```client_id``` **string** Your id for reference ( no required )\r\n\r\n\r\n#### Response:\r\n\r\n {\r\n 'error': 0,\r\n 'result': {\r\n 'id': 1,\r\n 'hash': 'fwQ6dnQWQPs4cbatF5Am2xCDP1J',\r\n 'typ': 'limit',\r\n 'amt': 1,\r\n 'rat': 1,\r\n 'fee': 2.5,\r\n 'cre': 2.5,\r\n 'rec': 0.06666666,\r\n 'ts': 1533834547\r\n }\r\n }\r\n\r\n\r\n### Create sell order <a name=\"createsellorder\"></a>\r\n\r\nCreate a sell order. ```Required initial secure obj```\r\n\r\n#### Function:\r\n bitkub.place_ask(sym='THB_BTC', amt=1, rat=1, typ='limit', client_id='')\r\n\r\n#### Parameter:\r\n * ```sym``` **string** The symbol\r\n * ```amt``` **float** Amount you want to sell with no trailing zero (e.g 0.10000000 is invalid, 0.1 is ok) ```default``` 1\r\n * ```rat``` **float** Rate you want for the order with no trailing zero (e.g 1000.00 is invalid, 1000 is ok) ```default``` 1\r\n * ```typ``` **string** Order type: limit or market (for market order, please specify rat as 0) ```default``` limit\r\n * ```client_id``` **string** your id for reference ( not required )\r\n\r\n\r\n#### Response:\r\n\r\n {\r\n \"error\": 0,\r\n \"result\": {\r\n \"id\": 1, // order id\r\n \"hash\": \"fwQ6dnQWQPs4cbatFGc9LPnpqyu\", // order hash\r\n \"typ\": \"limit\", // order type\r\n \"amt\": 1.00000000, // selling amount\r\n \"rat\": 15000, // rate\r\n \"fee\": 37.5, // fee\r\n \"cre\": 37.5, // fee credit used\r\n \"rec\": 15000, // amount to receive\r\n \"ts\": 1533834844 // timestamp\r\n \"ci\": \"input_client_id\" // input id for reference\r\n }\r\n }\r\n\r\n\r\n### Create sell order test <a name=\"createsellordertest\"></a>\r\n<span style=\"color:white;background:red;\"> \u26a0\ufe0f This API is <strong style=\"color:yellow;\">deprecated.</strong> (2023-11-29) </span>\r\n\r\nCreate a sell order test. ```Required initial secure obj```\r\n\r\n#### Function:\r\n bitkub.place_ask_test(sym='THB_BTC', amt=1, rat=1, typ='limit', client_id='')\r\n\r\n#### Parameter:\r\n * ```sym``` **string** The symbol\r\n * ```amt``` **float** Amount you want to spend with no trailing zero (e.g 1000.00 is invalid, 1000 is ok) ```default``` 1\r\n * ```rat``` **float** Rate you want for the order with no trailing zero (e.g 1000.00 is invalid, 1000 is ok) ```default``` 1\r\n * ```typ``` **string** Order type: limit or market ```default``` limit\r\n * ```client_id``` **string** Your id for reference ( no required )\r\n\r\n\r\n#### Response:\r\n\r\n {\r\n 'error': 0,\r\n 'result': {\r\n 'id': 1,\r\n 'hash': 'fwQ6dnQWQPs4cbatF5Am2xCDP1J',\r\n 'typ': 'limit',\r\n 'amt': 1,\r\n 'rat': 1,\r\n 'fee': 2.5,\r\n 'cre': 2.5,\r\n 'rec': 0.06666666,\r\n 'ts': 1533834547\r\n }\r\n }\r\n\r\n\r\n### Create sell order by fiat <a name=\"createsellorderfiat\"></a>\r\n<span style=\"color:white;background:red;\"> \u26a0\ufe0f This API is <strong style=\"color:yellow;\">deprecated.</strong> (2023-03-27) </span>\r\n\r\nCreate a sell order by specifying the fiat amount you want to receive (selling amount of cryptocurrency is automatically calculated). ```Required initial secure obj```\r\n\r\n#### Function:\r\n bitkub.place_ask_by_fiat(sym='THB_BTC', amt=1, rat=1, typ='limit')\r\n\r\n#### Parameter:\r\n * ```sym``` **string** The symbol\r\n * ```amt``` **float** Amount you want to spend with no trailing zero (e.g 1000.00 is invalid, 1000 is ok) ```default``` 1\r\n * ```rat``` **float** Rate you want for the order with no trailing zero (e.g 1000.00 is invalid, 1000 is ok) ```default``` 1\r\n * ```typ``` **string** Order type: limit or market ```default``` limit\r\n\r\n\r\n#### Response:\r\n\r\n {\r\n 'error': 0,\r\n 'result': {\r\n 'id': 1,\r\n 'hash': 'fwQ6dnQWQPs4cbatF5Am2xCDP1J',\r\n 'typ': 'limit',\r\n 'amt': 1,\r\n 'rat': 1,\r\n 'fee': 2.5,\r\n 'cre': 2.5,\r\n 'rec': 0.06666666,\r\n 'ts': 1533834547\r\n }\r\n }\r\n\r\n\r\n### Cancel orrder<a name=\"cancelorder\"></a>\r\n\r\nCancel an open order. ```Required initial secure obj```\r\n\r\n#### Function:\r\n bitkub.cancel_order(sym='THB_BTC', id=1, sd=1, hash='XXXXXX')\r\n\r\n#### Parameter:\r\n * ```sym``` **string** The symbol\r\n * ```id``` **int** Order id you wish to cancel\r\n * ```sd``` **string** Order side: buy or sell ```default``` buy\r\n * ```hash``` **string** Cancel an order with order hash (optional). You don't need to specify sym, id, and sd when you specify order hash.\r\n\r\n\r\n#### Response:\r\n\r\n {\r\n 'error': 0\r\n }\r\n\r\n\r\n### My open orders<a name=\"myopenorders\"></a>\r\n\r\nList all open orders of the given symbol. ```Required initial secure obj```\r\n\r\n#### Function:\r\n bitkub.my_open_orders(sym='THB_BTC')\r\n\r\n#### Parameter:\r\n * ```sym``` **string** The symbol\r\n\r\n\r\n#### Response:\r\n\r\n {\r\n 'error': 0,\r\n 'result': [\r\n {\r\n 'id': 2,\r\n 'hash': 'fwQ6dnQWQPs4cbatFSJpMCcKTFR',\r\n 'side': 'SELL',\r\n 'type': 'limit',\r\n 'rate': 15000,\r\n 'fee': 35.01,\r\n 'credit': 35.01,\r\n 'amount': 0.93333334,\r\n 'receive': 14000,\r\n 'parent_id': 1,\r\n 'super_id': 1,\r\n 'ts': 1533834844\r\n }\r\n ]\r\n }\r\n\r\n\r\n### My order history<a name=\"myorderhistory\"></a>\r\n\r\nList all orders that have already matched. ```Required initial secure obj```\r\n\r\n#### Function:\r\n bitkub.my_open_history(sym='THB_BTC', p=1, lmt=10)\r\n\r\n#### Parameter:\r\n * ```sym``` **string** The symbol\r\n * ```p``` **string** Page (optional)\r\n * ```lmt``` **string** Limit (optional)\r\n * ```start``` **string** Start timestamp (optional)\r\n * ```end``` **string** End timestamp (optional)\r\n\r\n\r\n#### Response:\r\n\r\n {\r\n 'error': 0,\r\n 'result': [\r\n {\r\n 'txn_id': 'ETHBUY0000000197',\r\n 'order_id': 240,\r\n 'hash': 'fwQ6dnQWQPs4cbaujNyejinS43a',\r\n 'parent_order_id': 0,\r\n 'super_order_id': 0,\r\n 'taken_by_me': true,\r\n 'is_maker': true,\r\n 'side': 'buy',\r\n 'type': 'limit',\r\n 'rate': 13335.57,\r\n 'fee': 0.34,\r\n 'credit': 0.34,\r\n 'amount': 0.00999987,\r\n 'ts': 1531513395\r\n }\r\n\r\n {\r\n 'error': 0,\r\n 'result': {\r\n 'id': 289,\r\n ],\r\n 'pagination': {\r\n 'page': 2,\r\n 'last': 3,\r\n 'next': 3,\r\n 'prev': 1\r\n }\r\n }\r\n\r\n\r\n### Order info<a name=\"orderinfo\"></a>\r\n\r\nGet information regarding the specified order. ```Required initial secure obj```\r\n\r\n#### Function:\r\n bitkub.order_info(sym='THB_BTC', id=1, sd='buy', hash='XXXXXX')\r\n\r\n#### Parameter:\r\n * ```sym``` **string** The symbol\r\n * ```id``` **int** Order id\r\n * ```sd``` **string** Order side: buy or sell ```default``` buy\r\n * ```hash``` **string** Lookup an order with order hash (optional). You don't need to specify sym, id, and sd when you specify order hash.\r\n\r\n\r\n#### Response:\r\n\r\n {\r\n 'error': 0,\r\n 'result': {\r\n 'id': 289,\r\n 'first': 289,\r\n 'parent': 0,\r\n 'last': 316,\r\n 'amount': 4000,\r\n 'rate': 291000,\r\n 'fee': 10,\r\n 'credit': 10,\r\n 'filled': 3999.97,\r\n 'total': 4000,\r\n 'status': 'filled',\r\n 'partial_filled': False,\r\n 'remaining': 0,\r\n 'history': [\r\n {\r\n 'amount': 98.14848,\r\n 'credit': 0.25,\r\n 'fee': 0.25,\r\n 'id': 289,\r\n 'rate': 291000,\r\n 'timestamp': 1525944169\r\n }\r\n ]\r\n }\r\n }\r\n\r\n\r\n### Crypto addresses<a name=\"cryptoaddress\"></a>\r\n\r\nList all crypto addresses. ```Required initial secure obj```\r\n\r\n#### Function:\r\n bitkub.crypto_address(p=1, lmt=1)\r\n\r\n#### Parameter:\r\n * ```p``` **int** Page (optional) ```default``` 1\r\n * ```lmt``` **int** Limit (optional) ```default``` 10\r\n\r\n\r\n#### Response:\r\n\r\n {\r\n 'error': 0,\r\n 'result': [\r\n {\r\n 'currency': 'BTC',\r\n 'address': '3BtxdKw6XSbneNvmJTLVHS9XfNYM7VAe8k',\r\n 'tag': 0,\r\n 'time': 1570893867\r\n }\r\n ],\r\n 'pagination': {\r\n 'page': 1,\r\n 'last\": 1\r\n }\r\n }\r\n\r\n\r\n### Crypto withdraw<a name=\"cryptowithdraw\"></a>\r\n\r\nMake a withdrawal to a trusted address. ```Required initial secure obj```\r\n\r\n#### Function:\r\n bitkub.crypto_withdraw(cur='BTC', amt=0.1, adr='4asyjKw6XScneNvhJTLVHS9XfNYM7VBf8x', mem='')\r\n\r\n#### Parameter:\r\n * ```cur``` **string** Currency for withdrawal (e.g. BTC, ETH)\r\n * ```amt``` **float** Amount you want to withdraw\r\n * ```adr``` **string** Address to which you want to withdraw\r\n * ```mem``` **string** (Optional) Memo or destination tag to which you want to withdraw\r\n\r\n\r\n#### Response:\r\n\r\n {\r\n 'error': 0,\r\n 'result': {\r\n 'txn': 'BTCWD0000012345',\r\n 'adr': '4asyjKw6XScneNvhJTLVHS9XfNYM7VBf8x'\r\n 'mem': '',\r\n 'cur': 'BTC',\r\n 'amt': 0.1,\r\n 'fee': 0.0002,\r\n 'ts': 1569999999\r\n }\r\n }\r\n\r\n\r\n### Crypto internal withdraw<a name=\"cryptointernalwithdraw\"></a>\r\n\r\nMake a withdrawal to a trusted address. ```Required initial secure obj```\r\n\r\nThe destination address is not required to be a trusted address. This API is not enabled by default, Only KYB users can request this feature by contacting us via support@bitkub.com\r\n\r\n#### Function:\r\n bitkub.crypto_internal_withdraw(cur='BTC', amt=0.1, adr='4asyjKw6XScneNvhJTLVHS9XfNYM7VBf8x', mem='')\r\n\r\n#### Parameter:\r\n * ```cur``` **string** Currency for withdrawal (e.g. BTC, ETH)\r\n * ```amt``` **float** Amount you want to withdraw\r\n * ```adr``` **string** Address to which you want to withdraw\r\n * ```mem``` **string** (Optional) Memo or destination tag to which you want to withdraw\r\n\r\n\r\n#### Response:\r\n\r\n {\r\n 'error': 0,\r\n 'result': {\r\n 'txn': 'BTCWD0000012345',\r\n 'adr': '4asyjKw6XScneNvhJTLVHS9XfNYM7VBf8x'\r\n 'mem': '',\r\n 'cur': 'BTC',\r\n 'amt': 0.1,\r\n 'fee': 0.0002,\r\n 'ts': 1569999999\r\n }\r\n }\r\n\r\n\r\n### Crypto deposit history<a name=\"cryptodeposithistory\"></a>\r\n\r\nList crypto deposit history. ```Required initial secure obj```\r\n\r\n#### Function:\r\n bitkub.crypto_deposit_history(p=1, lmt=1)\r\n\r\n#### Parameter:\r\n * ```p``` **int** Page (optional) ```default``` 1\r\n * ```lmt``` **int** Limit (optional) ```default``` 10\r\n\r\n\r\n#### Response:\r\n\r\n {\r\n 'error': 0,\r\n 'result': [\r\n {\r\n 'hash': 'XRPWD0000100276',\r\n 'currency': 'XRP',\r\n 'amount': 5.75111474,\r\n 'from_address': 'sender address',\r\n 'to_address': 'receipent address',\r\n 'confirmations': 1,\r\n 'status': 'complete',\r\n 'time': 1570893867\r\n }\r\n ],\r\n 'pagination': {\r\n 'page': 1,\r\n 'last': 1\r\n }\r\n }\r\n\r\n\r\n### Crypto withdraw history<a name=\"cryptowithdrawhistory\"></a>\r\n:\r\nList crypto withdrawal history. ```Required initial secure obj```\r\n\r\n#### Function:\r\n bitkub.crypto_withdraw_history(p=1, lmt=1)\r\n\r\n#### Parameter:\r\n * ```p``` **int** Page (optional) ```default``` 1\r\n * ```lmt``` **int** Limit (optional) ```default``` 10\r\n\r\n\r\n#### Response:\r\n\r\n {\r\n 'error': 0,\r\n 'result': [\r\n {\r\n 'txn_id': 'XRPWD0000100276',\r\n 'hash': 'send_internal',\r\n 'currency': 'XRP',\r\n 'amount': '5.75111474',\r\n 'fee': 0.01,\r\n 'address': 'rpXTzCuXtjiPDFysxq8uNmtZBe9Xo97JbW',\r\n 'status': 'complete',\r\n 'time': 1570893493\r\n }\r\n ],\r\n 'pagination': {\r\n 'page': 1,\r\n 'last': 1\r\n }\r\n }\r\n\r\n\r\n### Crypto generate address<a name=\"cryptogenerateaddress\"></a>\r\nGenerate a new crypto address (will replace existing address; previous address can still be used to received funds)\r\nList all approved bank accounts. ```Required initial secure obj```\r\n\r\n#### Function:\r\n bitkub.crypto_generate_address(sym='THB_BTC')\r\n\r\n#### Parameter:\r\n * ```sym``` **string** The symbol\r\n\r\n\r\n#### Response:\r\n\r\n {\r\n 'error': 0,\r\n 'result': [\r\n {\r\n 'currency': 'BTC',\r\n 'address': '0x520165471daa570ab632dd504c6af257bd36edfb',\r\n 'memo': ''\r\n }\r\n ]\r\n }\r\n\r\n\r\n\r\n### Fiat accounts<a name=\"fiataccounts\"></a>\r\n\r\nList all approved bank accounts. ```Required initial secure obj```\r\n\r\n#### Function:\r\n bitkub.fiat_accounts(p=1, lmt=1)\r\n\r\n#### Parameter:\r\n * ```p``` **int** Page (optional) ```default``` 1\r\n * ```lmt``` **int** Limit (optional) ```default``` 10\r\n\r\n\r\n#### Response:\r\n\r\n {\r\n 'error': 0,\r\n 'result': [\r\n {\r\n 'id': '7262109099',\r\n 'bank': 'Kasikorn Bank',\r\n 'name': 'Somsak',\r\n 'time': 1570893867\r\n }\r\n ],\r\n 'pagination': {\r\n 'page': 1,\r\n 'last': 1\r\n }\r\n }\r\n\r\n\r\n### Fiat withdraw<a name=\"fiatwithdraw\"></a>\r\n\r\nMake a withdrawal to an approved bank account. ```Required initial secure obj```\r\n\r\n#### Function:\r\n bitkub.fiat_withdraw(id=1, amt=1)\r\n\r\n#### Parameter:\r\n * ```id``` **string** Bank account id\r\n * ```amt``` **float** Amount you want to withdraw\r\n\r\n\r\n#### Response:\r\n\r\n {\r\n 'error': 0,\r\n 'result': {\r\n 'txn': 'THBWD0000012345',\r\n 'acc': '7262109099',\r\n 'cur': 'THB',\r\n 'amt': 21,\r\n 'fee': 20,\r\n 'rec': 1,\r\n 'ts': 1569999999\r\n }\r\n }\r\n\r\n\r\n### Fiat deposit history<a name=\"fiatdeposithistory\"></a>\r\n\r\nList fiat deposit history. ```Required initial secure obj```\r\n\r\n#### Function:\r\n bitkub.fiat_deposit_history(p=1, lmt=1)\r\n\r\n#### Parameter:\r\n * ```p``` **int** Page (optional) ```default``` 1\r\n * ```lmt``` **int** Limit (optional) ```default``` 10\r\n\r\n\r\n#### Response:\r\n\r\n {\r\n 'error':0,\r\n 'result':[\r\n {\r\n 'txn_id': 'THBDP0000012345',\r\n 'currency': 'THB',\r\n 'amount': 5000.55,\r\n 'status': 'complete',\r\n 'time': 1570893867\r\n }\r\n ],\r\n 'pagination':{\r\n 'page': 1,\r\n 'last': 1\r\n }\r\n }\r\n\r\n\r\n### Fiat withdraw history<a name=\"fiatwithdrawhistory\"></a>\r\n\r\nList fiat withdrawal history. ```Required initial secure obj```\r\n\r\n#### Function:\r\n bitkub.fiat_withdraw_history(p=1, lmt=1)\r\n\r\n#### Parameter:\r\n * ```p``` **int** Page (optional) ```default``` 1\r\n * ```lmt``` **int** Limit (optional) ```default``` 10\r\n\r\n\r\n#### Response:\r\n\r\n {\r\n 'error': 0,\r\n 'result': [\r\n {\r\n 'txn_id': 'THBDP0000012345',\r\n 'currency': 'THB',\r\n 'amount': 5000.55,\r\n 'fee': 20,\r\n 'status': 'complete',\r\n 'time': 1570893867\r\n }\r\n ],\r\n 'pagination':{\r\n 'page': 1,\r\n 'last': 1\r\n }\r\n }\r\n\r\n\r\n### Market wstoken<a name=\"marketwstoken\"></a>\r\n\r\nGet the token for websocket authentication. ```Required initial secure obj```\r\n\r\n#### Function:\r\n bitkub.market_wstoken()\r\n\r\n#### Response:\r\n\r\n {\r\n 'error': 0,\r\n 'result': 'sdCBCTwaS2Z1IBB6uTCefIbVN6dQVz9dkDeU96IoFJp14GGhlw9hoUDNe1KSYC23dXBPIqyX2QjVEOFHITxgPMvo8kdVaTkiZBA8KgvVTSMsq6JjjlyERDVZn3tt4PEp'\r\n }\r\n\r\n### User limits<a name=\"userlimits\"></a>\r\n\r\nCheck deposit/withdraw limitations and usage. ```Required initial secure obj```\r\n\r\n#### Function:\r\n bitkub.user_limits()\r\n\r\n#### Response:\r\n\r\n {\r\n 'error': 0,\r\n 'result': {\r\n 'limits': {\r\n 'crypto': {\r\n 'deposit': 0,\r\n 'withdraw': 0\r\n },\r\n 'fiat': {\r\n 'deposit': 0,\r\n 'withdraw': 0\r\n }\r\n },\r\n 'usage': {\r\n 'crypto': {\r\n 'deposit': 0,\r\n 'withdraw': 0,\r\n 'deposit_percentage': 0,\r\n 'withdraw_percentage': 0,\r\n 'deposit_thb_equivalent': 0,\r\n 'withdraw_thb_equivalent': 0\r\n },\r\n 'fiat': {\r\n 'deposit': 0,\r\n 'withdraw': 0,\r\n 'deposit_percentage': 0,\r\n 'withdraw_percentage': 0\r\n }\r\n },\r\n 'rate': 177100.32\r\n }\r\n }\r\n\r\n\r\n### User trading-credit<a name=\"usertradingcredits\"></a>\r\n\r\nCheck trading credit balance. ```Required initial secure obj```\r\n\r\n#### Function:\r\n bitkub.user_trading_credits()\r\n\r\n#### Response:\r\n\r\n {\r\n 'error': 0,\r\n 'result': 0\r\n }\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python library for Bitkub API v3",
"version": "3.1.4",
"project_urls": {
"Homepage": "https://github.com/appcorner/bitkub"
},
"split_keywords": [
"bitkub",
"bitkub-python",
"bitkub-python-sdk"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "58f96917432c4e1f430d920122b680d50762233ab5f4d8a5f5281f82d7a1febf",
"md5": "4e35432948a7eca6d3d23ac31ce3a22a",
"sha256": "32fe362f7a97602d242260708083a365735bf268a233d00ab6ba5323880e317f"
},
"downloads": -1,
"filename": "bitkub-v2-3.1.4.tar.gz",
"has_sig": false,
"md5_digest": "4e35432948a7eca6d3d23ac31ce3a22a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 18513,
"upload_time": "2023-12-15T03:19:26",
"upload_time_iso_8601": "2023-12-15T03:19:26.076996Z",
"url": "https://files.pythonhosted.org/packages/58/f9/6917432c4e1f430d920122b680d50762233ab5f4d8a5f5281f82d7a1febf/bitkub-v2-3.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-15 03:19:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "appcorner",
"github_project": "bitkub",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "bitkub-v2"
}