Giter Club home page Giter Club logo

bitkub-official-api-docs's Introduction

bitkub-official-api-docs

Official Documentation for Bitkub APIs

  • The documentation described here is official. This means the documentation is officially supported and maintained by Bitkub's own development team.
  • The use of any other projects is not supported; please make sure you are visiting bitkub/bitkub-official-api-docs.
Name Description
restful-api.md Details on the RESTful API (/api)
websocket-api.md Details on the Websocket API (/websocket-api)

bitkub-official-api-docs's People

Contributors

golfbitkub avatar kaochaiyakarn-bitkub avatar natzbitkub avatar ponlamai-sangapong avatar topcho-bitkub avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bitkub-official-api-docs's Issues

Occasional 14-60 seconds delay in HTTP POST request (place bid/ask, get balance, etc_.

HTTP request ที่ เป็น POST เช่น get balance, place ask บางทีมันมี delay 14-30 วิ หรือไม่ก้ error : 8 ( invalid timestamp) (เเต่ถ้าเป็น HTTP Get นี่คือไม่มีปันหาเลยครับ)

ละเเบบนี้คือผมเสียหายเพราะ สั่ง market order ไป เเต่ ดีเล ไป 14-30วิ เเล้วราคาที่มัน matchนี่คือราคาที่ไม่ต้องการเเล้วไม่สามารถยกเลิกคำสั่งได้ด้วย อันนี้ทดสอบจากหลาย user ละครับเป็นทุกคน

try running the below code for 1-2 minutes and you will understand

`

def get_balance(symbol):
    # check server time
    ts = round(time.time())   #int(response.text)
    # check balances
    header = {
        'Accept': 'application/json',
        'Content-Type': 'application/json',
        'X-BTK-APIKEY': API_KEY,
    }
    data = {
        'ts': ts,
    }
    signature = sign(data)
    data['sig'] = signature

    #print('Payload with signature: ' + json_encode(data))
    response = requests.post(API_HOST + '/api/market/balances', headers=header, data=json_encode(data))
    arr = json.loads(response.text)
    #print('Balances: ' + response.text)
    if(int (arr['error']!=0)):
        print(arr)
    return arr['result'][symbol]['available']
while(True):
     start = time.time()
     print(get_balance("ETH"))
     end = time.time()
     print("Time to complete HTTP POST=",end-start)

Minimum place-ask Amount

Can't place-ask order

[sym] => THB_BTC
[amt] => 0.0000157

error code : 12

but on website it work.

what the hell in API Bitkub

my order is
{'error': 0, 'result': {'amount': 450, 'client_id': '', 'credit': 0, 'fee': 1.13, 'filled': 0, 'first': 11051792, 'history': [], 'id': 11051792, 'last': None, 'parent': 0, 'rate': 9, 'side': 'buy', 'status': 'unfilled', 'total': None}}

this order has filled but API show status: unfilled

2021-01-11_13-35-03

Creating or canceling an order drops balance to 0 for short time

When creating or canceling an order, the balance drops to 0 for short time. This makes it pretty unreliable to use the balance endpoint as source of trust.

Example:

We have an open order to sell Bitcoin.

[08:25:02] Balance Bitcoin: 0.0 (available) 0.5 (reserved)
[08:25:03] Balance Bitcoin: 0.0 (available) 0.5 (reserved)
[08:25:04] Balance Bitcoin: 0.0 (available) 0.5 (reserved)

We send cancel request

[08:25:05] Balance Bitcoin: 0.0 (available) 0.0 (reserved)

[08:25:06] Balance Bitcoin: 0.5 (available) 0.0 (reserved)
[08:25:07] Balance Bitcoin: 0.5 (available) 0.0 (reserved)
[08:25:08] Balance Bitcoin: 0.5 (available) 0.0 (reserved)

Flutter: ดึงข้อมูลจาก api ได้ค่าเดิมตลอด

ทดลองดึงข้อมูลเหรียญ BTC มูลค่าล่าสุด ได้ค่าเดิมตลอด
(Python ค่าเปลี่ยนปกติ)
API ที่ใช้: https://api.bitkub.com/api/market/ticker

depencies:
http: ^0.13.4

Basic code:

import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String url = "https://api.bitkub.com/api/market/ticker";
  String txt = "-";

  getData() async {
    Map<String, dynamic> result = {};
    try {
      var uri = Uri.parse(url);
      var request = http.MultipartRequest('GET', uri);
      final response = await request.send();
      result = json.decode(await response.stream.bytesToString());
    } catch (e) {
      print("api e -> $e");
    }
    setState(() => txt = (result['THB_BTC']['last'] ?? "-").toString());
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: SafeArea(
          child: Center(
            child: InkWell(
              child: Text(txt,style: TextStyle(fontSize: 80),),
              onTap: getData,
            ),
          ),
        ),
      ),
    );
  }
}

Websocket Orderbook

Introduction

I am trying to subscribe to the order book on bitkub using WebSocket-client lib using python. But I need to subscribe to multiple symbols at a time. But I can't seem to find any such method on the doc. Even using loop didn't work because it sends the stream of the last symbol in the list.

Code

if __name__ == "__main__":
    websocket.enableTrace(True)
    while True:
        ws = websocket.WebSocketApp("wss://api.bitkub.com/websocket-api/orderbook/1",
                                on_open=on_open,
                                on_message=on_message,
                                on_error=on_error,
                                on_close=on_close)

        ws.run_forever()

This is the crux of the code I am following. I have removed the loop because it was not working out anyways.

Help wanted

Can anyone suggest me a way to access the stream of multiple symbols at a time?. I'd be grateful to you.

I want code to c#

Python defines a difficulty user interface.
I want to write on other languages please.
I hove this opinion will be considered.

How to calculate Fee at Buy Order?

Hi, I'm trying to find how to calculate the fee but I'm confused. Please check screenshots.
This filled order was
Amount: 2.000 USDT
Side: Buy
Rate: 30,45
So, the fee is should be: 30,45 x 2.000 x 0,0025 = 152,25 Isn't it?
If not, how can be 152.64 please explain how can I calculate by myself.

image
image

fiat withdraw doesn't work

Bitkub.send :request, "fiat/withdraw", {id: "0548821525", amt: 50000.0}
"{\"amt\"=>50000.0, \"id\"=>\"0548821525\", \"ts\"=>1574214298, \"sig\"=>\"8cb884a52148c0d50263244818af9cb410506f04e5673aa7434c07f9954c4de7\"}"
 => #<HTTParty::Response:0x5648ec23d940 parsed_response={"error"=>10}

yes, i have enough balance

yes, it's an approved bankaccount

yes, your API is trash and you don't know what you're doing

parent, super, last - order id

Could you give some explanation regarding parent, super and last order id?

Using the id (which I received from placing an order) to cancel an unfilled order works. Does the id work to cancel partially filled orders as well?

API Error Code 12 Invalid amount จำนวนเหรียญขั้นต่ำในการขายคือเท่าไหร่ ?

ลองทดสอบส่งคำสั่งขายไปที่ Endpoint => /api/market/place-ask ด้วยข้อมูลด่านล่างนี้

{ "ts": 1648622398774, "sym": "THB_BTC", "amt": 0.00005115, "rat": 0, "typ": "market", "sig": "238dfa09ea75e3423....." }

แล้วได้รับการตอบกลับจาก Server มาว่า Error Code 12 Invalid amount จึงอยากทราบว่าจำนวนขั้นต่ำในการใช้ API สั่งขายเหรียญใน Bitkub คือจำนวนเท่าไร ?

**ทดสอบขาย BTC ในเว็บ bitkub จำนวน 0.00005115 แล้วสามารถขายได้ปกติครับแต่ในการใช้ api สั่งขายกลับทำไม่ได้เหมือนในเว็บ

Add method: GET /api/market/all-tickers

your current method GET /api/market/ticker is not easily maintainable by clients, because it's supposed to be a JSON array but you're presenting it as a JSON object.
We can of course parse the JSON object, but every time you add a new symbol we'll be forced to amend the code. If instead you give us a JSON array, a new symbol will not break our code/logic.

The proposed API
I am proposing the following API addition, not changing the existing one. Adding a new API method will not break the existing implementation, but it will give your users an alternative (a list) to the current API:

GET /api/market/all-tickers

Description:
Get ticker information for all available symbols.

Query:
None

Response:
[
{
"id": 1,
"symbol": "THB_BTC",
"last": 216415.00,
"lowestAsk": 216678.00,
"highestBid": 215000.00,
"percentChange": 1.91,
"baseVolume": 71.02603946,
"quoteVolume": 15302897.99,
"isFrozen": 0,
"high24hr": 221396.00,
"low24hr": 206414.00
},
{
"id": 2,
"symbol":"THB_ETH",
"last": 11878.00,
"lowestAsk": 12077.00,
"highestBid": 11893.00,
"percentChange": -0.49,
"baseVolume": 455.17839270,
"quoteVolume": 5505664.42,
"isFrozen": 0,
"high24hr": 12396.00,
"low24hr": 11645.00
}
]

Request: Public API Exchange Info

อยากได้ Public API สำหรับข้อมูลของ Exchange เรื่องของเงื่อนไขการวาง Order, เงื่อนไขการถอน เป็นต้น

ตัวอย่างเช่น

  1. ข้อมูลการวาง Order
  • จำนวนเหรียญขั้นต่ำ เช่น THB 10 บาท, BTC 0.0001 เหรียญ
  • จำนวนทศนิยม ต้องไม่เกินกี่หลัก เช่น THB 2 หลัก, BTC 8 หลัก
  • สถานะของการวาง Order เช่น เทรดได้, ปิดปรับปรุง
  1. ข้อมูลการถอน
  • จำนวนเหรียญขั้นต่ำที่ถอนได้ เช่น THB 30 บาท, BTC 0.001 เหรียญ
  • ค่าธรรมเนียมในการถอน เช่น THB 20 บาท, BTC 0.0001 เหรียญ
  • สถานะการถอน เช่น ถอนได้, ปิดปรับปรุง

ตัวอย่าง Output

{
  "order": {
    "THB": {
      "minPlaceOrder": 10,
      "decimal": 2,
      "enable": true
    },
    "BTC": {
      "minPlaceOrder": 0.0001,
      "decimal": 8,
      "enable": false
    }
  },
  "widthdraw": {
    "THB": {
      "min": 30,
      "fee": 20,
      "enable": true
    },
    "BTC": {
      "min": 0.001,
      "fee": 0.0001,
      "enable": false
    }
  }
}

Looking for stop-limit API

Hi team,

I've seen the stop-limit feature on the Bitkub website but somehow it doesn't show up on RESTful API

If you guys are developing this API, can you guys provide the ETD?

Thanks

ตอนนี้ไม่สามารถใช้งาน endpoint api ได้หรอครับ

พอดีผมลองรันไฟล์ python ตัวอย่างแล้วมัน return ค่ากลับมาว่า Access Denied

Access denied

This website is using a security service to protect itself from online attacks.

  • Ray ID: 645159d6cac2c8eb
  • Timestamp: 2021-04-24 18:21:22 UTC
  • Your IP address: 58.11.11.44
  • Requested URL: api.bitkub.com/api/market/wallet
  • Error reference number: 1020
  • Server ID: FL_129F29
  • User-Agent: python-requests/2.25.1

API ปัดทศนิยมหลักที่ 8 ผิด ใน `my-order-history` เมื่อเทียบ `history-database` บนหน้าเว็บ

จาก api ที่ยิงไป my-order-history จะได้ amount 4.703869
แต่ถ้าไปเปิดหน้าเว็บ ที่ยิง api ไปที่ history-database amount จะได้ 4.69213888 แทน ไม่ได้ผิดทุกรายการนะครับ ผิด แค่ buy บางรายการเท่านั้น จากตัวอย่าง ที่ txn_id: "KUBBUY0005645511"

ซึ่งผมคิดว่าเกิดจากการปัดทศนิยมหลักที่ 8 ของฝั่ง API ทำให้ค่า FEE ผิดไปด้วย หลังจากคำนวณด้วย 0.25% แล้ว

จาก API my-order-history
image

จาก API history-database
image

GET /api/market/bids fields are required

Tried running

data = {
    "sym": "THB_DOGE",
    "lmt": 10
}

response = requests.get(
    API_HOST + '/api/market/bids', headers=header, data=json_encode(data))
print('Response: ' + response.text)

and the error was

Response: {"error":10,"result":{"lmt":["The lmt field is required","The lmt field must be numeric"],"sym":["The sym field is required"]}}

Is the function not fully implemented?

order-info: {"error":24,"result":null}

/api/market/order-info

Server time: 1569287859
Signing payload: {"id":1734662,"sd":"buy","sym":"THB_USDT","ts":1569287859}
Payload with signature: {"id":1734662,"sd":"buy","sig":"557cf85adc5a1bd54173ebc5c27c56c24b10cf15cc56c018872848510d57073b","sym":"THB_USDT","ts":1569287859}
order-info: {"error":24,"result":null}

Other interfaces are normal

restful-api.md: specify timestamp is UNIX time in milliseconds

In file restful-api.md, the timestamp information should be amended to specify that timestamp field ts is the UNIX time in milliseconds.

Change:
The payload is always JSON. Always include timestamp in the payload; use ts as the key name for timestamp.

To:
The payload is always JSON. Always include timestamp in the payload; use ts as the key name for timestamp. The timestamp is the UNIX time in milliseconds.

Please provide API for Withdrawal & Deposit info

ขอ API เพื่อเช็คสถานะว่าเหรียญสามารถ withdraw/deposit ได้หรือไม่ , รวมถึงจำนวนขั้นต่ำและ fee ครับ

ตัวอย่าง output

{
"BTC": {
"depositEnable": true,
"withdrawEnable": true,
"withdrawFee": "0.0004"
"withdrawMin": "0.0008"
"network": "BTC"
},
"ETH": {
"depositEnable": true,
"withdrawEnable": false,
"withdrawFee": "0.005"
"withdrawMin": "0.01"
"network": "ETH"
}
}

ขอบคุณครับ

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.