diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..218f5ca --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,162 @@ +# Changelog + +## Version 2.3.1 + +*July 5, 2018* + +- Update `sprockets` in `Gemfile.lock` to fix security warnings + +## Version 2.3 + +*July 5, 2018* + +- Allows strikethrough in markdown by default. +- Upgrades jQuery to 3.2.1, thanks to [Tomi Takussaari](https://github.com/TomiTakussaari) +- Fixes invalid HTML in `layout.erb`, thanks to [Eric Scouten](https://github.com/scouten) for pointing out +- Hopefully fixes Vagrant memory issues, thanks to [Petter Blomberg](https://github.com/p-blomberg) for the suggestion +- Cleans HTML in headers before setting `document.title`, thanks to [Dan Levy](https://github.com/justsml) +- Allows trailing whitespace in markdown files, thanks to [Samuel Cousin](https://github.com/kuzyn) +- Fixes pushState/replaceState problems with scrolling not changing the document hash, thanks to [Andrey Fedorov](https://github.com/anfedorov) +- Removes some outdated examples, thanks [@al-tr](https://github.com/al-tr), [Jerome Dahdah](https://github.com/jdahdah), and [Ricardo Castro](https://github.com/mccricardo) +- Fixes `nav-padding` bug, thanks [Jerome Dahdah](https://github.com/jdahdah) +- Code style fixes thanks to [Sebastian Zaremba](https://github.com/vassyz) +- Nokogiri version bump thanks to [Grey Baker](https://github.com/greysteil) +- Fix to default `index.md` text thanks to [Nick Busey](https://github.com/NickBusey) + +Thanks to everyone who contributed to this release! + +## Version 2.2 + +*January 19, 2018* + +- Fixes bugs with some non-roman languages not generating unique headers +- Adds editorconfig, thanks to [Jay Thomas](https://github.com/jaythomas) +- Adds optional `NestingUniqueHeadCounter`, thanks to [Vladimir Morozov](https://github.com/greenhost87) +- Small fixes to typos and language, thx [Emir Ribić](https://github.com/ribice), [Gregor Martynus](https://github.com/gr2m), and [Martius](https://github.com/martiuslim)! +- Adds links to Spectrum chat for questions in README and ISSUE_TEMPLATE + +## Version 2.1 + +*October 30, 2017* + +- Right-to-left text stylesheet option, thanks to [Mohammad Hossein Rabiee](https://github.com/mhrabiee) +- Fix for HTML5 history state bug, thanks to [Zach Toolson](https://github.com/ztoolson) +- Small styling changes, typo fixes, small bug fixes from [Marian Friedmann](https://github.com/rnarian), [Ben Wilhelm](https://github.com/benwilhelm), [Fouad Matin](https://github.com/fouad), [Nicolas Bonduel](https://github.com/NicolasBonduel), [Christian Oliff](https://github.com/coliff) + +Thanks to everyone who submitted PRs for this version! + +## Version 2.0 + +*July 17, 2017* + +- All-new statically generated table of contents + - Should be much faster loading and scrolling for large pages + - Smaller Javascript file sizes + - Avoids the problem with the last link in the ToC not ever highlighting if the section was shorter than the page + - Fixes control-click not opening in a new page + - Automatically updates the HTML title as you scroll +- Updated design + - New default colors! + - New spacings and sizes! + - System-default typefaces, just like GitHub +- Added search input delay on large corpuses to reduce lag +- We even bumped the major version cause hey, why not? +- Various small bug fixes + +Thanks to everyone who helped debug or wrote code for this version! It was a serious community effort, and I couldn't have done it alone. + +## Version 1.5 + +*February 23, 2017* + +- Add [multiple tabs per programming language](https://github.com/lord/slate/wiki/Multiple-language-tabs-per-programming-language) feature +- Upgrade Middleman to add Ruby 1.4.0 compatibility +- Switch default code highlighting color scheme to better highlight JSON +- Various small typo and bug fixes + +## Version 1.4 + +*November 24, 2016* + +- Upgrade Middleman and Rouge gems, should hopefully solve a number of bugs +- Update some links in README +- Fix broken Vagrant startup script +- Fix some problems with deploy.sh help message +- Fix bug with language tabs not hiding properly if no error +- Add `!default` to SASS variables +- Fix bug with logo margin +- Bump tested Ruby versions in .travis.yml + +## Version 1.3.3 + +*June 11, 2016* + +Documentation and example changes. + +## Version 1.3.2 + +*February 3, 2016* + +A small bugfix for slightly incorrect background colors on code samples in some cases. + +## Version 1.3.1 + +*January 31, 2016* + +A small bugfix for incorrect whitespace in code blocks. + +## Version 1.3 + +*January 27, 2016* + +We've upgraded Middleman and a number of other dependencies, which should fix quite a few bugs. + +Instead of `rake build` and `rake deploy`, you should now run `bundle exec middleman build --clean` to build your server, and `./deploy.sh` to deploy it to Github Pages. + +## Version 1.2 + +*June 20, 2015* + +**Fixes:** + +- Remove crash on invalid languages +- Update Tocify to scroll to the highlighted header in the Table of Contents +- Fix variable leak and update search algorithms +- Update Python examples to be valid Python +- Update gems +- More misc. bugfixes of Javascript errors +- Add Dockerfile +- Remove unused gems +- Optimize images, fonts, and generated asset files +- Add chinese font support +- Remove RedCarpet header ID patch +- Update language tabs to not disturb existing query strings + +## Version 1.1 + +*July 27, 2014* + +**Fixes:** + +- Finally, a fix for the redcarpet upgrade bug + +## Version 1.0 + +*July 2, 2014* + +[View Issues](https://github.com/tripit/slate/issues?milestone=1&state=closed) + +**Features:** + +- Responsive designs for phones and tablets +- Started tagging versions + +**Fixes:** + +- Fixed 'unrecognized expression' error +- Fixed #undefined hash bug +- Fixed bug where the current language tab would be unselected +- Fixed bug where tocify wouldn't highlight the current section while searching +- Fixed bug where ids of header tags would have special characters that caused problems +- Updated layout so that pages with disabled search wouldn't load search.js +- Cleaned up Javascript diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..cc17fd9 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,46 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at hello@lord.io. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..79d41ff --- /dev/null +++ b/Gemfile @@ -0,0 +1,11 @@ +ruby '>=2.3.1' +source 'https://rubygems.org' + +# Middleman +gem 'middleman', '~>4.2.1' +gem 'middleman-syntax', '~> 3.0.0' +gem 'middleman-autoprefixer', '~> 2.7.0' +gem 'middleman-sprockets', '~> 4.1.0' +gem 'rouge', '~> 2.0.5' +gem 'redcarpet', '~> 3.4.0' +gem 'nokogiri', '~> 1.8.2' diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..eebb95a --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,129 @@ +GEM + remote: https://rubygems.org/ + specs: + activesupport (5.0.1) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (~> 0.7) + minitest (~> 5.1) + tzinfo (~> 1.1) + addressable (2.5.0) + public_suffix (~> 2.0, >= 2.0.2) + autoprefixer-rails (6.6.1) + execjs + backports (3.6.8) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.12.2) + compass-import-once (1.0.5) + sass (>= 3.2, < 3.5) + concurrent-ruby (1.0.5) + contracts (0.13.0) + dotenv (2.2.0) + erubis (2.7.0) + execjs (2.7.0) + fast_blank (1.0.0) + fastimage (2.0.1) + addressable (~> 2) + ffi (1.9.17) + haml (4.0.7) + tilt + hamster (3.0.0) + concurrent-ruby (~> 1.0) + hashie (3.5.1) + i18n (0.7.0) + kramdown (1.13.2) + listen (3.0.8) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + memoist (0.15.0) + middleman (4.2.1) + coffee-script (~> 2.2) + compass-import-once (= 1.0.5) + haml (>= 4.0.5) + kramdown (~> 1.2) + middleman-cli (= 4.2.1) + middleman-core (= 4.2.1) + sass (>= 3.4.0, < 4.0) + middleman-autoprefixer (2.7.1) + autoprefixer-rails (>= 6.5.2, < 7.0.0) + middleman-core (>= 3.3.3) + middleman-cli (4.2.1) + thor (>= 0.17.0, < 2.0) + middleman-core (4.2.1) + activesupport (>= 4.2, < 5.1) + addressable (~> 2.3) + backports (~> 3.6) + bundler (~> 1.1) + contracts (~> 0.13.0) + dotenv + erubis + execjs (~> 2.0) + fast_blank + fastimage (~> 2.0) + hamster (~> 3.0) + hashie (~> 3.4) + i18n (~> 0.7.0) + listen (~> 3.0.0) + memoist (~> 0.14) + padrino-helpers (~> 0.13.0) + parallel + rack (>= 1.4.5, < 3) + sass (>= 3.4) + servolux + tilt (~> 2.0) + uglifier (~> 3.0) + middleman-sprockets (4.1.0) + middleman-core (~> 4.0) + sprockets (>= 3.0) + middleman-syntax (3.0.0) + middleman-core (>= 3.2) + rouge (~> 2.0) + mini_portile2 (2.3.0) + minitest (5.10.1) + nokogiri (1.8.2) + mini_portile2 (~> 2.3.0) + padrino-helpers (0.13.3.3) + i18n (~> 0.6, >= 0.6.7) + padrino-support (= 0.13.3.3) + tilt (>= 1.4.1, < 3) + padrino-support (0.13.3.3) + activesupport (>= 3.1) + parallel (1.10.0) + public_suffix (2.0.5) + rack (2.0.5) + rb-fsevent (0.9.8) + rb-inotify (0.9.8) + ffi (>= 0.5.0) + redcarpet (3.4.0) + rouge (2.0.7) + sass (3.4.23) + servolux (0.12.0) + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + thor (0.19.4) + thread_safe (0.3.5) + tilt (2.0.6) + tzinfo (1.2.2) + thread_safe (~> 0.1) + uglifier (3.0.4) + execjs (>= 0.3.0, < 3) + +PLATFORMS + ruby + +DEPENDENCIES + middleman (~> 4.2.1) + middleman-autoprefixer (~> 2.7.0) + middleman-sprockets (~> 4.1.0) + middleman-syntax (~> 3.0.0) + nokogiri (~> 1.8.2) + redcarpet (~> 3.4.0) + rouge (~> 2.0.5) + +RUBY VERSION + ruby 2.3.3p222 + +BUNDLED WITH + 1.15.4 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5ceddf5 --- /dev/null +++ b/LICENSE @@ -0,0 +1,13 @@ +Copyright 2008-2013 Concur Technologies, Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); you may +not use this file except in compliance with the License. You may obtain +a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations +under the License. \ No newline at end of file diff --git a/README.md b/README.md index fdbac37..1e999da 100644 --- a/README.md +++ b/README.md @@ -1 +1,78 @@ -[Click here](https://docs.kucoin.com) to view the latest KuCoin documentation. + +KuCoin Developer Documentation Improvement Program +------------------------------ +**As a people's exchange, KuCoin will strive to support as many document languages as possible for everyone's convenience. In the process, We hope to get everyone's help.** + +**You can help KuCoin to improve and translate developer documentation together.** + +**For document translators with outstanding contributions, KuCoin will reward a small amount of KCS.** + +**If you want to add a language to this document, please follow these steps:** + +- add **[lang].yml** to **locales** +- add **index.[lang].html.md** to **source/localizable** + +**If you only need to improve the translation of a language, you can directly modify the corresponding index.[lang].html.md.** + +**KuCoin officially updates the English version after the API change, so the translation should be based on the English version. Before submitting the merge request, please be sure to test it. Do not destroy the main structure of the document.** + +
+ +The KuCoin Developer Documentation was created with Slate. Check it out at lord.github.io/slate.
+ +### Prerequisites + +You're going to need: + + - **Linux or macOS** — Windows may work, but is unsupported. + - **Ruby, version 2.3.1 or newer** + - **Bundler** — If Ruby is already installed, but the `bundle` command doesn't work, just run `gem install bundler` in a terminal. + +### Getting Set Up + +1. Fork this repository on GitHub. +2. Clone *your forked repository* (not our original one) to your hard drive with `git clone https://github.com/YOURUSERNAME/slate.git` +3. `cd kucoin-api-docs` +4. Initialize and start Slate. You can either do this locally, or with Vagrant: + +```shell +# either run this to run locally +bundle install +bundle exec middleman server + +# OR run this to run with vagrant +vagrant up +``` + +You can now see the docs at http://localhost:4567. Whoa! That was fast! + +Now that Slate is all set up on your machine, you'll probably want to learn more about [editing Slate markdown](https://github.com/lord/slate/wiki/Markdown-Syntax), or [how to publish your docs](https://github.com/lord/slate/wiki/Deploying-Slate). + +If you'd prefer to use Docker, instructions are available [in the wiki](https://github.com/lord/slate/wiki/Docker). + +### Note on JavaScript Runtime + +For those who don't have JavaScript runtime or are experiencing JavaScript runtime issues with ExecJS, it is recommended to add the [rubyracer gem](https://github.com/cowboyd/therubyracer) to your gemfile and run `bundle` again. + + +Contributors +-------------------- + +Slate was built by [Robert Lord](https://lord.io) while interning at [TripIt](https://www.tripit.com/). + +Thanks to the following people who have submitted major pull requests: + +- [@chrissrogers](https://github.com/chrissrogers) +- [@bootstraponline](https://github.com/bootstraponline) +- [@realityking](https://github.com/realityking) +- [@cvkef](https://github.com/cvkef) + +Also, thanks to [Sauce Labs](http://saucelabs.com) for sponsoring the development of the responsive styles. + +Special Thanks +-------------------- +- [Middleman](https://github.com/middleman/middleman) +- [jquery.tocify.js](https://github.com/gfranko/jquery.tocify.js) +- [middleman-syntax](https://github.com/middleman/middleman-syntax) +- [middleman-gh-pages](https://github.com/edgecase/middleman-gh-pages) +- [Font Awesome](http://fortawesome.github.io/Font-Awesome/) diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..6f2444e --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,44 @@ +Vagrant.configure(2) do |config| + config.vm.box = "ubuntu/trusty64" + config.vm.network :forwarded_port, guest: 4567, host: 4567 + config.vm.provider "virtualbox" do |vb| + vb.memory = "2048" + end + + config.vm.provision "bootstrap", + type: "shell", + inline: <<-SHELL + sudo apt-add-repository ppa:brightbox/ruby-ng + sudo apt-get update + sudo apt-get install -yq ruby2.4 ruby2.4-dev + sudo apt-get install -yq pkg-config build-essential nodejs git libxml2-dev libxslt-dev + sudo apt-get autoremove -yq + gem2.4 install --no-ri --no-rdoc bundler + SHELL + + # add the local user git config to the vm + config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig" + + config.vm.provision "install", + type: "shell", + privileged: false, + inline: <<-SHELL + echo "==============================================" + echo "Installing app dependencies" + cd /vagrant + bundle config build.nokogiri --use-system-libraries + bundle install + SHELL + + config.vm.provision "run", + type: "shell", + privileged: false, + run: "always", + inline: <<-SHELL + echo "==============================================" + echo "Starting up middleman at http://localhost:4567" + echo "If it does not come up, check the ~/middleman.log file for any error messages" + cd /vagrant + bundle exec middleman server --watcher-force-polling --watcher-latency=1 &> ~/middleman.log & + SHELL +end diff --git a/build/.idea/modules.xml b/build/.idea/modules.xml new file mode 100644 index 0000000..66f3350 --- /dev/null +++ b/build/.idea/modules.xml @@ -0,0 +1,8 @@ + +Welcome to KuCoin trader and developer documentation. These documents outline exchange functionality, market details, and APIs.
+ +APIs are separated into two parts: REST API and Websocket feed.
+ +Private APIs require authentication and provide access to placing orders and other account information.
+ +Websocket APIs provide market data , most of them are public.
+In order to receive the latest API change notifications, please add 'Watch' to KuCoin Docs Github.
+ +2/21/19 :
+ +2/20/19 :
+ +2/19/19 :
+ +2/18/19 :
+ +2/16/19 :
+ +1/30/19 :
+ +1/25/19 :
+ +General information of KuCoin System and API.
+Valid orders sent to the matching engine are confirmed immediately and are in the received state. If an order executes against another order immediately, the order is considered done. An order can execute in part or whole. Any part of the order not filled immediately, will be considered open. Orders will stay in the open state until canceled or subsequently filled by new orders. Orders that are no longer eligible for matching (filled or canceled) are in the done state.
+The Self-Trade Prevention is an option (set as not-selected by default) in advanced settings. When you specify STP when placing orders, your order will not fill your other orders. On the contrary, if you did not choose STP in Advanced, your order might be filled by your own orders.
+Market order is currently not supported for DC. When two orders from the same user cross, the smaller order will be canceled and the larger order size will be decremented by the smaller order size. If the two orders are the same size, both will be canceled.
+Cancel the older (resting) order in full. The new order continues to execute.
+Cancel the newer (taking) order in full. The old resting order remains on the order book.
+ +Immediately cancel both orders.
+Client libraries can help you integrate with our API quickly.
+ +OFFICIAL
+ +CCXT is our official SDK provider and you may access KuCoin API through CCXT. For more information, please visit: https://ccxt.trade.
+ +UNOFFICIAL
+ +Thanks to the great community contributors, these are the open source SDKs contributed by community developers. Since each library is updated frequently, KuCoin does not review all source code and does not rigorously test it. KuCoin is not responsible for the security of the SDK. Please conduct a basic code review and assess the risks before use.
+ +If you are a developer, submit your sdk to us and get KCS rewards.
+ +Sandbox is the test environment, used for testing API connection and web trading, and provides all the functionalities for exchanges. In sandbox, you could use fake funds for exchange tests.
+ +The login session and API key in sandbox environment are completely separated from the production environment. You may use the web interface in sandbox environment to create API key.
+ +Notice: After registering in sandbox environment, you will receive an amount of fake funds (BTC, ETH or KCS) automatically released by the system in your account. If you want to trade, please transfer assets from the main account to the trade account. The funds are only for exchange test purpose and cannot be withdrawn.
+ +Sandbox URLs for API test:
+ +Website: +https://sandbox.kucoin.com
+ +REST API: +https://openapi-sandbox.kucoin.com
+When a rate limit is exceeded, a status of 429 Too Many Requests will be returned.
+ +When the rate limit is exceeded multiple times, your IP or account may be suspended. The time range is from 2 minutes to 7 days.
+ +If you are a professional trader or market maker and need a higher limit, please describe your KuCoin account, usage and approximate trading volume and send email to api@kucoin.com.
+We throttle public endpoints by IP: 100 requests per ten seconds.
+We throttle private endpoints by user ID: 200 requests per ten seconds.
+The REST API has endpoints for account and order management as well as public market data.
+ +Base url is https://openapi-v2.kucoin.com or https://api.kucoin.com.
+ +Request URL needs to be determined by BASE and specific endpoint combination.
+Each interface has its own endpoint, described by field HTTP REQUEST in the docs.
+ +For the GET METHOD API, the endpoint needs to contain the query parameters string.
+ +e.g. For "List Accounts", the default endpoint of this api is /api/v1/accounts. +If you pass the "currency" parameter(BTC), the endpoint is /api/v1/accounts?currency=BTC and the final request url is https://openapi-v2.kucoin.com/api/v1/accounts?currency=BTC.
+All requests and responses are application/json content type.
+ +Unless otherwise stated, all timestamp parameters should in milliseconds. e.g. 1544657947759
+For GET, DELETE request, all query parameters need to be included in the request url. (e.g. /api/v1/accounts?currency=BTC)
+ +For POST, PUT request, all query parameters need to be included in the request body with JSON. (e.g. {"currency":"BTC"}). Do not include extra spaces in JSON strings.
+All interfaces may add fields in the future, existing fields will not change, please pay attention to compatibility during programming.
+Errors to bad requests will respond with HTTP error code or system error code. The body will also contain a message parameter indicating the cause.
+{
+ "code": "400100",
+ "msg": "Invalid Parameter."
+}
+
+
+Code | +Meaning | +
---|---|
400 | +Bad Request -- Invalid request format | +
401 | +Unauthorized -- Invalid API Key | +
403 | +Forbidden -- The requested is hidden for administrators only. | +
404 | +Not Found -- The specified resource could not be found. | +
405 | +Method Not Allowed -- You tried to access the resource with an invalid method. | +
415 | +Content-Type: application/json. | +
429 | +Too Many Requests -- Exceeded the access frequency | +
500 | +Internal Server Error -- We had a problem with our server. Try again later. | +
503 | +Service Unavailable -- We're temporarily offline for maintenance. Please try again later. | +
Code | +Meaning | +
---|---|
400001 | +Any of KC-API-KEY, KC-API-SIGN, KC-API-TIMESTAMP, KC-API-PASSPHRASE is missing in your request header | +
400002 | +KC-API-TIMESTAMP Invalid -- Time differs from server time by more than 5 seconds | +
400003 | +KC-API-KEY not exists | +
400004 | +KC-API-PASSPHRASE error | +
400005 | +Signature error -- Please check your signature | +
400006 | +The requested ip address is not in the api whitelist | +
400007 | +Access Denied -- Your api key does not have sufficient permissions to access the uri | +
404000 | +Url Not Found -- The request resource could not be found | +
400100 | +Parameter Error -- You tried to access the resource with invalid parameters | +
411100 | +User are frozen -- User are frozen, please contact us via support center. | +
500000 | +Internal Server Error -- We had a problem with our server. Try again later. | +
While http status code is 200, the error occurs when business failed, you can find api specific business error codes under api detail
+A successful response is indicated by HTTP status code 200 and system code 200000. the success payload is as follows:
+{
+ "code": "200000",
+ "data": "1544657947759"
+}
+
+The response may contain an optional data. If the response has a data it will be documented under each resource below.
+KuCoin uses pagination for all REST requests which return arrays. Pagination allows for fetching results with the current page and is well suited for realtime data. Endpoints like /api/v1/trades, /api/v1/fills, /api/v1/orders, return the latest items by default. To retrieve more results subsequent requests should specify which direction to paginate based on the data previously returned.
+Parameter | +Default | +Description | +
---|---|---|
currentPage | +1 | +Current request page. | +
pageSize | +50 | +Number of results per request. | +
GET /api/v1/orders?currentPage=1&pageSize=50
+Unless otherwise specified, all timestamps from API are returned in milliseconds(e.g. 1546658861000). Most modern languages and libraries will handle this without issues.
+Decimal numbers are returned as strings to preserve full precision across platforms. When making a request, it is recommended that you also convert your numbers to strings to avoid truncation and precision errors.
+ +Integer numbers (like trade id and sequence) are unquoted.
+Before being able to sign any requests, you must create an API key via the KuCoin website. Upon creating a key you will have 3 pieces of information which you must remember:
+ +The Key and Secret will be randomly generated and provided by KuCoin; the Passphrase will be provided by you to further secure your API access. KuCoin stores the salted hash of your passphrase for verification, but cannot recover the passphrase if you forget it.
+You can restrict the functionality of API keys. Before creating the key, you must choose what permissions you would like the key to have. The permissions are:
+ +Please refer to documentation below to see what API key permissions are required for a specific route.
+All REST requests must contain the following headers:
+ + <?php
+ class API {
+ public function __construct($key, $secret, $passphrase) {
+ $this->key = $key;
+ $this->secret = $secret;
+ $this->passphrase = $passphrase;
+ }
+
+ public function signature($request_path = '', $body = '', $timestamp = false, $method = 'GET') {
+
+ $body = is_array($body) ? json_encode($body) : $body; // Body must be in json format
+
+ $timestamp = $timestamp ? $timestamp : time() * 1000;
+
+ $what = $timestamp . $method . $request_path . $body;
+
+ return base64_encode(hash_hmac("sha256", $what, $this->secret, true));
+ }
+ }
+ ?>
+
#Example for get balance of accounts in python
+
+ api_key = "api_key"
+ api_secret = "api_secret"
+ api_passphrase = "api_passphrase"
+ url = 'https://openapi-sandbox.kucoin.com/api/v1/accounts'
+ now = int(time.time() * 1000)
+ str_to_sign = str(now) + 'GET' + '/api/v1/accounts'
+ signature = base64.b64encode(
+ hmac.new(api_secret.encode('utf-8'), str_to_sign.encode('utf-8'), hashlib.sha256).digest())
+ headers = {
+ "KC-API-SIGN": signature,
+ "KC-API-TIMESTAMP": str(now),
+ "KC-API-KEY": api_key,
+ "KC-API-PASSPHRASE": api_passphrase
+ }
+ response = requests.request('get', url, headers=headers)
+ print(response.status_code)
+ print(response.json())
+
+ #Example for create deposit addresses in python
+ url = 'https://openapi-sandbox.kucoin.com/api/v1/deposit-addresses'
+ now = int(time.time() * 1000)
+ data = {"currency": "BTC"}
+ data_json = json.dumps(data)
+ str_to_sign = str(now) + 'POST' + '/api/v1/deposit-addresses' + data_json
+ signature = base64.b64encode(
+ hmac.new(api_secret.encode('utf-8'), str_to_sign.encode('utf-8'), hashlib.sha256).digest())
+ headers = {
+ "KC-API-SIGN": signature,
+ "KC-API-TIMESTAMP": str(now),
+ "KC-API-KEY": api_key,
+ "KC-API-PASSPHRASE": api_passphrase,
+ "Content-Type": "application/json" # specifying content type or using json=data in request
+ }
+ response = requests.request('post', url, headers=headers, data=data_json)
+ print(response.status_code)
+ print(response.json())
+
+The KC-API-SIGN header is generated by creating a sha256 HMAC using the secret key on the prehash string timestamp + method + requestEndpoint + body (JSON string, need to be the same as the parameters passed by the API) and base64-encode the output. The timestamp value is the same as the KC-API-TIMESTAMP header.
+ +The method should be UPPER CASE.
+ +For GET request, the requestEndpoint needs to contain the query string. e.g. /api/v1/deposit-addresses?currency=BTC,the body is the request body string or omitted if there is no request body (typically for GET requests).
+ + +#Example for Create Deposit Address
+
+curl -H "Content-Type:application/json" -H "KC-API-KEY:5c2db93503aa674c74a31734" -H "KC-API-TIMESTAMP:1547015186532" -H "KC-API-PASSPHRASE:Abc123456" -H "KC-API-SIGN:7QP/oM0ykidMdrfNEUmng8eZjg/ZvPafjIqmxiVfYu4="
+-X POST -d '{"currency":"BTC"}' http://openapi-v2.kucoin.com/api/v1/deposit-addresses
+
+KC-API-KEY = 5c2db93503aa674c74a31734
+KC-API-SECRET = f03a5284-5c39-4aaa-9b20-dea10bdcf8e3
+KC-API-PASSPHRASE = Abc123456
+TIMESTAMP = 1547015186532
+METHOD = POST
+ENDPOINT = /api/v1/deposit-addresses
+STRING-TO-SIGN = 1547015186532POST/api/v1/deposit-addresses{"currency":"BTC"}
+KC-API-SIGN = 7QP/oM0ykidMdrfNEUmng8eZjg/ZvPafjIqmxiVfYu4=
+
+
+
+
+The KC-API-TIMESTAMP header MUST be number of milliseconds since Unix Epoch in UTC. Decimal values are allowed. e.g. 1547015186532
+ +Your timestamp must be within 5 seconds of the api service time or your request will be considered expired and rejected. We recommend using the time endpoint to query for the API server time if you believe there many be time skew between your server and the API servers.
+You need to sign the request to use the private user API.
+[{
+ "id": "5bd6e9286d99522a52e458de",
+ "currency": "BTC",
+ "type": "main",
+ "balance": "237582.04299",
+ "available": "237582.032",
+ "holds": "0.01099"
+},
+{
+ "id": "5bd6e9216d99522a52e458d6",
+ "currency": "BTC",
+ "type": "trade",
+ "balance": "1234356",
+ "available": "1234356",
+ "holds": "0"
+}]
+
+
+Get a list of accounts.
+ +See the Deposits section for documentation on how to deposit funds to begin trading.
+GET /api/v1/accounts
+Param | +Type | +Description | +
---|---|---|
currency | +string | +[optional] The code of the currency | +
type | +string | +[optional] Account type ,valid values: main or trade | +
Field | +Description | +
---|---|
id | +The id of the account | +
currency | +The currency of the account | +
type | +Account type ,main or trade | +
balance | +Total funds in the account | +
available | +Funds available to withdraw or trade | +
holds | +Funds on hold (not available for use) | +
For a currency, you have two types of accounts: main and trade. You can easily transfer assets between two accounts for free.
+ +The main account is mainly used for the storage, withdrawal and deposit of funds. The assets in the main account cannot be directly involved in the trading. The assets can be transferred to the trading account and then traded.
+ +The trading account is mainly used for trading. When you place a order, system will use the balance of the trading account. The balance of trading account cannot be used for withdrawal.
+When you place an order, the funds for the order are placed on hold. They cannot be used for other orders or withdrawn. Funds will remain on hold until the order is filled or canceled.
+This endpoint requires the "General" permission.
+{
+ "currency": "KCS",
+ "balance": "1000000060.6299",
+ "available": "1000000060.6299",
+ "holds": "0"
+}
+
+Information for a single account. Use this endpoint when you know the accountId.
+GET /api/v1/accounts/<accountId>
+Param | +Type | +Description | +
---|---|---|
accountId | +string | +id of the account | +
Field | +Description | +
---|---|
currency | +The currency of the account | +
balance | +Total funds in the account | +
holds | +Funds on hold (not available for use) | +
available | +Funds available to withdraw or trade | +
This endpoint requires the "General" permission.
+{
+ "id": "5bd6e9286d99522a52e458de"
+}
+
POST /api/v1/accounts
+Param | +Type | +Description | +
---|---|---|
type | +string | +Account type,main or trade | +
currency | +string | +Currency code | +
Field | +Description | +
---|---|
id | +Return the id of the new account | +
This endpoint requires the "General" permission.
+ +In order to use the API more quickly and conveniently, it is recommended that you create an account on the website first.
+List account activity. Account activity either increases or decreases your account balance. Items are paginated and sorted latest first. See the Pagination section for retrieving additional entries after the first page.
+{
+ "currentPage": 1,
+ "pageSize": 10,
+ "totalNum": 2,
+ "totalPage": 1,
+ "items": [{
+ "currency": "KCS",
+ "amount": "0.0998",
+ "fee": "0",
+ "balance": "1994.040596",
+ "bizType": "withdraw",
+ "direction": "in",
+ "createdAt": 1540296039000,
+ "context": {
+ "orderId": "5bc7f080b39c5c03286eef8a",
+ "currency": "BTC"
+ }
+ },
+ {
+ "currency": "KCS",
+ "amount": "0.0998",
+ "fee": "0",
+ "balance": "1994.140396",
+ "bizType": "trade exchange",
+ "direction": "in",
+ "createdAt": 1540296039000,
+ "context": {
+ "orderId": "5bc7f080b39c5c03286eef8e",
+ "tradeId": "5bc7f080b3949c03286eef8a",
+ "symbol": "BTC-USD"
+ }
+ }
+ ]
+}
+
GET /api/v1/accounts/<accountId>/ledgers
+Param | +Type | +Description | +
---|---|---|
accountId | +string | +Id of the account | +
startAt | +long | +[optional] Start time. Unix timestamp calculated in seconds, the creation time queried shall posterior to the start time | +
endAt | +long | +[optional] End time. Unix timestamp calculated in seconds, the creation time queried shall prior to the end time. | +
Entry type indicates the reason for the account change.
+Type | +Description | +
---|---|
currency | +The currency of the account | +
amount | +Total amount of assets (fees included) involved in assets changes such as transaction, withdrawal and bonus distribution. | +
fee | +Fees generated in transaction, withdrawal, etc. | +
balance | +Remaining funds after transaction | +
bizType | +Business type leading to the changes in funds, such as transaction, withdrawal, etc. | +
direction | +out or in | +
createdAt | +Time of the event | +
context | +Business involved information such as order ID, serial No., etc. | +
If an entry is the result of a trade (match, fee), the context field will contain additional information about the trade.
+This endpoint requires the "General" permission.
+ + +{
+ "currentPage": 1,
+ "pageSize": 10,
+ "totalNum": 2,
+ "totalPage": 1,
+ "items": [
+ {
+ "currency": "ETH",
+ "holdAmount": "5083",
+ "bizType": "Withdraw",
+ "orderId": "5bc7f080b39c5c03286eef8e",
+ "createdAt": 1545898567000,
+ "updatedAt": 1545898567000
+ },
+ {
+ "currency": "ETH",
+ "holdAmount": "1452",
+ "bizType": "Withdraw",
+ "orderId": "5bc7f518b39c5c033818d62d",
+ "createdAt": 1545898567000,
+ "updatedAt": 1545898567000
+ }
+ ]
+}
+
+Holds are placed on an account for any active orders or pending withdraw requests. As an order is filled, the hold amount is updated. If an order is canceled, any remaining hold is removed. For a withdraw, once it is completed, the hold is removed.
+GET /api/v1/accounts/<accountId>/holds
+Param | +Type | +Description | +
---|---|---|
accountId | +string | +Id of the account | +
Entry type indicates the reason for the account hold.
+Type | +Description | +
---|---|
currency | +the currency of the account | +
holdAmount | +Remaining funds freezed (remaining funds freezed = Initial funds freezed – Funds unfreezed) | +
bizType | +Business type leading to the freezing of the funds, such as transaction, withdrawal etc. | +
orderId | +ID of funds freezed order (only recognized identity) | +
createdAt | +Time of the event | +
updatedAt | +Update time | +
The orderId field contains the id of the order or withdraw which created the hold.
+This endpoint requires the "General" permission.
+ + +{
+ "orderId": "5bd6e9286d99522a52e458de"
+}
+
+The inner transfer interface is used for assets transfer among the accounts of a user and is free of charges on the platform. For example, a user could transfer assets for free from the main account to the trading account on the platform.
+POST /api/v1/accounts/inner-transfer
+Param | +Type | +Description | +
---|---|---|
clientOid | +string | +Request id | +
payAccountId | +string | +Account id of payer | +
recAccountId | +string | +Account id of receiver | +
amount | +string | +Transfer amount, a quantity that exceeds the precison of the currency. | +
Type | +Description | +
---|---|
orderId | +Id of funds transfer order | +
This endpoint requires the "Trade" permission.
+{
+ "address": "0x78d3ad1c0aa1bf068e19c94a2d7b16c9c0fcd8b1",
+ "memo": "5c247c8a03aa677cea2a251d"
+}
+
+Create deposit address of currency for deposit. +You can just create one deposit address.
+POST /api/v1/deposit-addresses
+This endpoint requires the "Transfer" permission.
+Param | +Type | +Description | +
---|---|---|
currency | +string | +Currency | +
Type | +Description | +
---|---|
address | +Deposit address | +
memo | +Address remark. If there’s no remark, it is empty. | +
{
+ "address": "0x78d3ad1c0aa1bf068e19c94a2d7b16c9c0fcd8b1",
+ "memo": "5c247c8a03aa677cea2a251d"
+}
+
+Get deposit address of currency for deposit. If return data is null , you may need create a deposit address first.
+GET /api/v1/deposit-addresses?currency=<currency>
+This endpoint requires the "General" permission.
+Param | +Type | +Description | +
---|---|---|
currency | +string | +Currency | +
Type | +Description | +
---|---|
address | +Deposit address | +
memo | +Address remark. If there’s no remark, it is empty. | +
{
+ "currentPage": 1,
+ "pageSize": 5,
+ "totalNum": 2,
+ "totalPage": 1,
+ "items": [{
+ "address": "0x5f047b29041bcfdbf0e4478cdfa753a336ba6989",
+ "memo": "5c247c8a03aa677cea2a251d",
+ "amount": 1,
+ "fee": 0.0001,
+ "currency": "KCS",
+ "isInner": false,
+ "walletTxId": "5bbb57386d99522d9f954c5a@test004",
+ "status": "SUCCESS",
+ "createdAt": 1544178843000,
+ "updatedAt": 1544178891000
+ }, {
+ "address": "0x5f047b29041bcfdbf0e4478cdfa753a336ba6989",
+ "memo": "5c247c8a03aa677cea2a251d",
+ "amount": 1,
+ "fee": 0.0001,
+ "currency": "KCS",
+ "isInner": false,
+ "walletTxId": "5bbb57386d99522d9f954c5a@test003",
+ "status": "SUCCESS",
+ "createdAt": 1544177654000,
+ "updatedAt": 1544178733000
+ }]
+}
+
+Get deposit page list.
+GET /api/v1/deposits
+This endpoint requires the "General" permission.
+Param | +Type | +Description | +
---|---|---|
currency | +string | +[optional] Currency | +
startAt | +long | +[optional] Start time. Unix timestamp calculated in milliseconds, the creation time queried shall posterior to the start time. | +
endAt | +long | +[optional] End time. Unix timestamp calculated in milliseconds, the creation time queried shall prior to the end time. | +
status | +string | +[optional] Status. Available value: PROCESSING, SUCCESS, and FAILURE | +
Type | +Description | +
---|---|
address | +Deposit address | +
memo | +Remark to the deposit address | +
amount | +Deposit amount | +
fee | +Deposit fee | +
currency | +Currency code | +
isInner | +Internal deposit or not | +
walletTxId | +Wallet Txid | +
status | +Status | +
createdAt | +Creation time of the database record | +
updatedAt | +Update time of the database record | +
{
+ "currentPage": 1,
+ "pageSize": 10,
+ "totalNum": 1,
+ "totalPage": 1,
+ "items": [{
+ "id": "5c2dc64e03aa675aa263f1ac",
+ "address": "0x5bedb060b8eb8d823e2414d82acce78d38be7fe9",
+ "memo": "",
+ "currency": "ETH",
+ "amount": 1.0000000,
+ "fee": 0.0100000,
+ "walletTxId": "3e2414d82acce78d38be7fe9",
+ "isInner": false,
+ "status": "FAILURE",
+ "createdAt": 1546503758000,
+ "updatedAt": 1546504603000
+ }]
+}
+
GET /api/v1/withdrawals
+This endpoint requires the "General" permission.
+Param | +Type | +Description | +
---|---|---|
currency | +string | +[optional] Currency code | +
status | +string | +[optional] Status. Available value: PROCESSING, WALLET_PROCESSING, SUCCESS, and FAILURE | +
startAt | +long | +[optional] Start time. Unix timestamp calculated in milliseconds, the creation time queried shall posterior to the start time. | +
endAt | +long | +[optional] End time. Unix timestamp calculated in milliseconds, the creation time queried shall prior to the end time. | +
Type | +Description | +
---|---|
id | +Unique identity | +
address | +Withdrawal address | +
memo | +Remark to the withdrawal address | +
currency | +Currency | +
amount | +Withdrawal amount | +
fee | +Withdrawal fee | +
walletTxId | +Wallet Txid | +
isInner | +Internal withdrawal or not | +
status | +status | +
createdAt | +Creation time | +
updatedAt | +Update time | +
{
+ "currency": "KCS",
+ "limitBTCAmount": "2.0",
+ "usedBTCAmount": "0",
+ "limitAmount": "75.67567568",
+ "remainAmount": "75.67567568",
+ "availableAmount": "9697.41991348",
+ "withdrawMinFee": "0.93000000",
+ "innerWithdrawMinFee": "0.00000000",
+ "withdrawMinSize": "1.4",
+ "isWithdrawEnabled": true,
+ "precision": 8
+}
+
GET /api/v1/withdrawals/quotas
+This endpoint requires the "General" permission.
+Param | +Type | +Description | +
---|---|---|
currency | +string | +currency. e.g. BTC | +
Type | +Description | +
---|---|
currency | +Currency | +
availableAmount | +Current available withdrawal amount | +
remainAmount | +Remaining amount available to withdraw the day | +
withdrawMinSize | +Minimum withdrawal amount | +
limitBTCAmount | +Total BTC amount available to withdraw the day | +
innerWithdrawMinFee | +Fees for internal withdrawal | +
usedBTCAmount | +The estimated BTC amount withdrawn the day | +
isWithdrawEnabled | +Available to withdraw or not | +
withdrawMinFee | +Minimum withdrawal amount | +
precision | +Precision | +
{
+ "withdrawalId": "5bffb63303aa675e8bbe18f9"
+}
+
POST /api/v1/withdrawals
+This endpoint requires the "Transfer" permission.
+Param | +Type | +Description | +
---|---|---|
currency | +string | +Currency | +
address | +string | +Withdrawal address | +
amount | +number | +Withdrawal amount, a multiple and positive number of the amount precision (fees excluded) | +
memo | +string | +[optional] Remark to the withdrawal address | +
isInner | +boolean | +[optional] Internal withdrawal or not. Default setup: false | +
remark | +string | +[optional] Remark | +
Type | +Description | +
---|---|
withdrawalId | +Withdrawal id | +
For cryptocurrency withdrawal, KuCoin supports internal and external transaction fee deduction, which means when the balance in your main account is sufficient to support the withdrawal, the system will initially deduct the transaction fees from your main account. But if the balance in your main account is not sufficient to support the withdrawal, the system will deduct the fees from your withdrawal amount.
+ +For example:
+ +Suppose you are going to withdraw 1 BTC from KuCoin platform (transaction fee: 0.0001BTC), if the balance in your main account is insufficient, the system will deduct the transaction fees from your withdrawal amount. In this case, you will be receiving 0.9999BTC actually.
+Only withdrawals in processing status could be cancelled.
+DELETE /api/v1/withdrawals/<withdrawalId>
+This endpoint requires the "Transfer" permission.
+Param | +Type | +Description | +
---|---|---|
withdrawalId | +string | +unique identity for withdrawal order | +
You need to sign the request to use the private trade API.
+{
+ "orderId": "5bd6e9286d99522a52e458de"
+}
+
+You can place two types of orders: limit and market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your account funds will be put on hold for the duration of the order. How much and which funds are put on hold depends on the order type and parameters specified. See the Holds details below.
+ +Please be noted that the system would deduct the fees from the orders entered the orderbook in advance. Read List Fills to learn more.
+ +Do not include extra spaces in JSON strings.
+The maximum matching orders for a single trading pair in one account is 50 (stop orders included).
+POST /api/v1/orders
+This endpoint requires the "Trade" permission.
+Param | +type | +Description | +
---|---|---|
clientOid | +string | +Unique order id selected by you to identify your order e.g. UUID | +
side | +string | +buy or sell | +
symbol | +string | +a valid trading symbol code. e.g. ETH-BTC | +
type | +string | +[optional] limit or market (default is limit) | +
remark | +string | +[optional] remark for the order, length cannot exceed 100 utf8 characters | +
stop | +string | +[optional] Either loss or entry. Requires stopPrice to be defined | +
stopPrice | +string | +[optional] Only if stop is defined, sets trigger price for stop order | +
stp | +string | +[optional] self trade prevention , CN, CO, CB or DC | +
Param | +type | +Description | +
---|---|---|
price | +string | +price per base currency | +
size | +string | +amount of base currency to buy or sell | +
timeInForce | +string | +[optional] GTC, GTT, IOC, or FOK (default is GTC) | +
cancelAfter | +long | +[optional] cancel after n seconds | +
postOnly | +boolean | +[optional] Post only flag | +
hidden | +boolean | +[optional] Orders not displayed in order book | +
iceberg | +boolean | +[optional] Only visible portion of the order is displayed in the order book | +
visibleSize | +string | +[optional] The maximum visible size of an iceberg order | +
* Requires timeInForce to be GTT
+ +** Invalid when timeInForce is GTC, IOC or FOK
+ +Read Time In Force to learn about GTC、GTT、IOC、FOK.
+Param | +type | +Description | +
---|---|---|
size | +string | +[optional] Desired amount in base currency | +
funds | +string | +[optional] Desired amount of quote currency to use | +
The symbol must match a valid trading symbol. The symbols list is available via the /api/v1/symbols endpoint.
+The optional client_oid field must be a unique id (e.g UUID) generated by your trading application. This field value will be return in order detail. You can use this field to identify your orders in the public feed.
+ +The client_oid is different than the server-assigned order id. You should record the server-assigned order_id as it will be used for future order status updates.
+ +The server-assigned order id is also returned as the id field to this HTTP POST request.
+ + +When placing an order, you can specify the order type. The order type you specify will influence which other order parameters are required as well as how your order will be executed by the matching engine. If type is not specified, the order will default to a limit order.
+ +limit orders are both the default and basic order type. A limit order requires specifying a price and size. The size is the number of bitcoin to buy or sell, and the price is the price per bitcoin. The limit order will be filled at the price specified or better. A sell order can be filled at the specified price per bitcoin or a higher price per bitcoin and a buy order can be filled at the specified price or a lower price depending on market conditions. If market conditions cannot fill the limit order immediately, then the limit order will become part of the open order book until filled by another incoming order or canceled by the user.
+ +market orders differ from limit orders in that they provide no pricing guarantees. They however do provide a way to buy or sell specific amounts of bitcoin or fiat without having to specify the price. Market orders execute immediately and no part of the market order will go on the open order book. Market orders are always considered takers and incur taker fees. When placing a market order you can specify funds and/or size. Funds will limit how much of your quote currency account balance is used and size will limit the bitcoin amount transacted.
+Stop orders become active and wait to trigger based on the movement of the last trade price. There are two types of stop orders, stop loss and stop entry:
+ +stop: 'loss': Triggers when the last trade price changes to a value at or below the stopPrice.
+ +stop: 'entry': Triggers when the last trade price changes to a value at or above the stopPrice.
+ +The last trade price is the last price at which an order was filled. This price can be found in the latest match message. Note that not all match messages may be received due to dropped messages.
+ +Note that when triggered, stop orders execute as either market or limit orders, depending on the type.
+ +When placing a stop loss order, the system would pre-freeze the assets in your account for the order. When you are going to place a stop market order, we recommend you to specify the specific fund for the order when trading.
+The price must be specified in priceIncrement symbol units. The priceIncrement is the smallest unit of price. For the BTC-USDT symbol, the priceIncrement is 0.00001000. Prices less than 0.00001000 will not be accepted, The price for the placed order should be a multiple number of priceIncrement, or the system would report error when you place the order. Not required for market orders.
+The size must be greater than the baseMinSize for the symbol and no larger than the baseMaxSize. The size must be specified in baseIncrement symbol units. Size indicates the amount of BTC (or base currency) to buy or sell.
+The funds field is optionally used for market orders. When specified it indicates how much of the symbol quote currency to buy or sell. For example, a market buy for BTC-USDT with funds specified as 150.00 will spend 150 USD to buy BTC (including any fees). If the funds field is not specified for a market buy order, size must be specified and Kucoin will use available funds in your account to buy bitcoin.
+ +A market sell order can also specify the funds. If funds is specified, it will limit the sell to the amount of funds specified. You can use funds with sell orders to limit the amount of quote currency funds received.
+ +The funds must be greater than the quoteMinSize for the symbol and no larger than the quoteMaxSize. The size must be specified in quoteIncrement symbol units. Funds indicates the amount of USDT (or quote currency) to buy or sell.
+Time in force policies provide guarantees about the lifetime of an order. There are four policies: Good Till Canceled GTC, Good Till Time GTT, Immediate Or Cancel IOC, and Fill Or Kill FOK.
+ +GTC Good Till Canceled orders remain open on the book until canceled. This is the default behavior if no policy is specified.
+ +GTT Good Till Time orders remain open on the book until canceled or the allotted cancelAfter is depleted on the matching engine. GTT orders are guaranteed to cancel before any other order is processed after the cancelAfter seconds placed in order book.
+ +IOC Immediate Or Cancel orders instantly cancel the remaining size of the limit order instead of opening it on the book.
+ +FOK Fill Or Kill orders are rejected if the entire size cannot be matched.
+ +The post-only flag indicates that the order should only make liquidity. If any part of the order results in taking liquidity, the order will be rejected and no part of it will execute.
+The Hidden and iceberg Orders are two options in advanced settings (note: the iceberg order is a special form of the hidden order). You may select “Hidden” or “iceberg” as the policy when placing a limit or stop limit order.
+ +If you ticked “Hidden” when placing orders, your orders would be filled without being displayed on the orderbook. But please be noted that your order could still be viewed at the transaction history.
+ +Different from the hidden order, the iceberg order, as an special form of the hidden order, is divided into visible portion and invisible portion. When placing an iceberg order, you need to set the visible size. The maximum visible size for an iceberg order is 20 while the minimum visible size for it is 1/20 of the total order amount.
+ +Note: The minimum visible size shall be greater than the minimum order size.
+ +The visible portion of an iceberg order would be executed after being matched. After the execution, new portions of the iceberg order would come out until the order is fully filled.
+ +Note: 1)The system would charge taker fees for hidden and iceberg orders.2)If both "iceberg" and "hidden" are selected, your order will be filled as an iceberg order by default.
+For limit buy orders, we will hold price x size USDT. For sell orders, we will hold the number of Bitcoin you wish to sell. Actual fees are assessed at time of trade. If you cancel a partially filled or unfilled order, any remaining funds will be released from hold.
+ +For market buy orders where funds is specified, the funds amount will be put on hold. If only size is specified, all of your account balance (in the quote account) will be put on hold for the duration of the market order (usually a trivially short time). For a sell order, the size in BTC will be put on hold. If size is not specified (and only funds is specified), your entire BTC balance will be on hold for the duration of the market order.
+The Self-Trade Prevention is an option (set as not-selected by default) in advanced settings. When you specify STP when placing orders, your order will not fill your other orders. On the contrary, if you did not choose STP in Advanced, your order might be filled by your own orders. +Market order is currently not supported for DC.
+ +Flag | +Name | +
---|---|
DC | +Decrease and Cancel | +
CO | +Cancel oldest | +
CN | +Cancel newest | +
CB | +Cancel both | +
The HTTP Request will respond when an order is either rejected (insufficient funds, invalid parameters, etc) or received (accepted by the matching engine). A 200 response indicates that the order was received and is active. Active orders may execute immediately (depending on price and market conditions) either partially or fully. A partial execution will put the remaining size of the order in the open state. An order that is filled completely, will go into the done state.
+ +Users listening to streaming market data are encouraged to use the order id field to identify their received messages in the feed.
+A successful order will be assigned an order id. A successful order is defined as one that has been accepted by the matching engine.
+ + +{
+ "cancelledOrderIds": [
+ "5bd6e9286d99522a52e458de"
+ ]
+}
+
+Cancel a previously placed order.
+ +You would receive the request return once the system has received the cancellation request. The cancellation request will be processed by matching engine in sequence. To know if the request is processed(success or not), you may check the order status or update message from the pushes.
+DELETE /api/v1/orders/<order-id>
+This endpoint requires the "Trade" permission.
+ + +If the order could not be canceled (already filled or previously canceled, etc), then an error response will indicate the reason in the message field.
+{
+ "cancelledOrderIds": [
+ "5c52e11203aa677f33e493fb",
+ "5c52e12103aa677f33e493fe",
+ "5c52e12a03aa677f33e49401",
+ "5c52e1be03aa677f33e49404",
+ "5c52e21003aa677f33e49407",
+ "5c6243cb03aa67580f20bf2f",
+ "5c62443703aa67580f20bf32",
+ "5c6265c503aa676fee84129c",
+ "5c6269e503aa676fee84129f",
+ "5c626b0803aa676fee8412a2"
+ ]
+}
+
+With best effort, cancel all open orders. The response is a list of ids of the canceled orders.
+DELETE /api/v1/orders
+This endpoint requires the "Trade" permission.
+You can delete specific symbol using query parameters.
+ +Param | +Type | +Description | +
---|---|---|
symbol | +string | +[optional] Only cancel orders open for a specific symbol | +
{
+ "currentPage": 1,
+ "pageSize": 1,
+ "totalNum": 153408,
+ "totalPage": 153408,
+ "items": [
+ {
+ "id": "5c35c02703aa673ceec2a168",
+ "symbol": "BTC-USDT",
+ "opType": "DEAL",
+ "type": "limit",
+ "side": "buy",
+ "price": "10",
+ "size": "2",
+ "funds": "0",
+ "dealFunds": "0.166",
+ "dealSize": "2",
+ "fee": "0",
+ "feeCurrency": "USDT",
+ "stp": "",
+ "stop": "",
+ "stopTriggered": false,
+ "stopPrice": "0",
+ "timeInForce": "GTC",
+ "postOnly": false,
+ "hidden": false,
+ "iceberg": false,
+ "visibleSize": "0",
+ "cancelAfter": 0,
+ "channel": "IOS",
+ "clientOid": "",
+ "remark": "",
+ "tags": "",
+ "isActive": false,
+ "cancelExist": false,
+ "createdAt": 1547026471000
+ }
+ ]
+ }
+
+List your current orders.
+GET /api/v1/orders
+This endpoint requires the "General" permission.
+You can request for specific orders using query parameters.
+ +Param | +Type | +Description | +
---|---|---|
status | +string | +[optional] active or done, done as default, Only list orders for a specific status . | +
symbol | +string | +[optional] Only list orders for a specific symbol. | +
side | +string | +[optional] buy or sell | +
type | +string | +[optional] limit, market, limit_stop or market_stop | +
startAt | +long | +[optional] Start time. Unix timestamp calculated in milliseconds, the creation time queried shall posterior to the start time. | +
endAt | +long | +[optional] End time. Unix timestamp calculated in milliseconds, the creation time queried shall prior to the end time. | +
Orders which are resting on the order book, will be marked with the active status. Orders which are no longer resting on the order book, will be marked with the done status. There is a small window between an order being done and settled. An order is settled when all of the fills have settled and the remaining holds (if any) have been removed.
+ +For order checking, after inputting the correct parameters, you could check the orders in all status. But if the status parameter is not input into the orders interface, the system would return the orders of done status to you by default.
+ +When you query orders, there is no time limit for the active status of order. The order of the done status can only query data within time range of 24 hours (the start and end time range cannot exceed 24 hours). If it exceeds 24 hours, the system will prompt you exceed the time limit.If you pass the start time when querying orders and do not pass the end time, the system will automatically construct the end time as the start time + 24 hours, and vice versa.
+For high-volume trading it is strongly recommended that you maintain your own list of open orders and use one of the streaming market data feeds to keep it updated. You should poll the open orders endpoint once when you start trading to obtain the current state of any open orders.
+ + +{
+ "currentPage": 1,
+ "pageSize": 1,
+ "totalNum": 153408,
+ "totalPage": 153408,
+ "items": [
+ {
+ "id": "5c35c02703aa673ceec2a168",
+ "symbol": "BTC-USDT",
+ "opType": "DEAL",
+ "type": "limit",
+ "side": "buy",
+ "price": "10",
+ "size": "2",
+ "funds": "0",
+ "dealFunds": "0.166",
+ "dealSize": "2",
+ "fee": "0",
+ "feeCurrency": "USDT",
+ "stp": "",
+ "stop": "",
+ "stopTriggered": false,
+ "stopPrice": "0",
+ "timeInForce": "GTC",
+ "postOnly": false,
+ "hidden": false,
+ "iceberg": false,
+ "visibleSize": "0",
+ "cancelAfter": 0,
+ "channel": "IOS",
+ "clientOid": "",
+ "remark": "",
+ "tags": "",
+ "isActive": false,
+ "cancelExist": false,
+ "createdAt": 1547026471000
+ }
+ ]
+ }
+
+Get a list of 1000 orders in the last 24 hours.
+GET /api/v1/limit/orders
+This endpoint requires the "General" permission.
+ + + + +{
+ "id": "5c35c02703aa673ceec2a168",
+ "symbol": "BTC-USDT",
+ "opType": "DEAL",
+ "type": "limit",
+ "side": "buy",
+ "price": "10",
+ "size": "2",
+ "funds": "0",
+ "dealFunds": "0.166",
+ "dealSize": "2",
+ "fee": "0",
+ "feeCurrency": "USDT",
+ "stp": "",
+ "stop": "",
+ "stopTriggered": false,
+ "stopPrice": "0",
+ "timeInForce": "GTC",
+ "postOnly": false,
+ "hidden": false,
+ "iceberg": false,
+ "visibleSize": "0",
+ "cancelAfter": 0,
+ "channel": "IOS",
+ "clientOid": "",
+ "remark": "",
+ "tags": "",
+ "isActive": false,
+ "cancelExist": false,
+ "createdAt": 1547026471000
+ }
+
+Get a single order by order id.
+GET /api/v1/orders/<order-id>
+This endpoint requires the "General" permission.
+ + + + + + +{
+ "currentPage":1,
+ "pageSize":1,
+ "totalNum":251915,
+ "totalPage":251915,
+ "items":[
+ {
+ "symbol":"BTC-USDT",
+ "tradeId":"5c35c02709e4f67d5266954e",
+ "orderId":"5c35c02703aa673ceec2a168",
+ "counterOrderId":"5c1ab46003aa676e487fa8e3",
+ "side":"buy",
+ "liquidity":"taker",
+ "forceTaker":true,
+ "price":"0.083",
+ "size":"0.8424304",
+ "funds":"0.0699217232",
+ "fee":"0",
+ "feeRate":"0",
+ "feeCurrency":"USDT",
+ "stop":"",
+ "type":"limit",
+ "createdAt":1547026472000
+ }
+ ]
+}
+
+Get a list of recent fills.
+GET /api/v1/fills
+This endpoint requires the "General" permission.
+You can request fills for specific orders using query parameters.
+ +Param | +Type | +Description | +
---|---|---|
orderId | +string | +[optional] Limit list of fills to this orderId(If you specify orderId, ignore other conditions) | +
symbol | +string | +[optional] Limit list of fills to this symbol | +
side | +string | +[optional] buy or sell | +
type | +string | +[optional] limit, market, limit_stop or market_stop | +
startAt | +long | +[optional] Start time. Unix timestamp calculated in milliseconds, the creation time queried shall posterior to the start time. | +
endAt | +long | +[optional] End time. Unix timestamp calculated in milliseconds, the creation time queried shall prior to the end time. | +
Settlement
+ +The settlement contains two parts: 1) Transactional settlement and 2) Fee settlement. After an order is matched, the transactional and fee settlement data would be updated in the data store. Once the data is updated, the system would enable the settlement process and deduct the fees from your pre-frozen assets. After that, the currency would be transferred to the account of the user.
+ +Fees
+ +With the leading matching engine system in the market, users placing orders on KuCoin platform are classified into two types: taker and maker. Takers, as the taker in the market, would be charged with taker fees; while makers as the maker in the market, would be charged with less fees than the taker, or even get maker fees from KuCoin (The exchange platform would compensate the transaction fees for you).
+ +After placing orders on the KuCoin platform, to ensure the execution of these orders, the system would pre-freeze your assets based on the taker fee charges (because the system could not predict the order types you may choose). Please be noted that the system would deduct the fees from the orders entered the orderbook in advance.
+ +If your order is market order, the system would charge taker fees from you.
+ +If your order is limit order and is immediately matched and executed, the system would charge taker fees from you. On the contrary, if the order or part or your order is not executed immediately and enters into the order book, the system would charge maker fees from you if it is executed before being cancelled
+ +After the order is executed and when the left order funds are 0, the transaction is completed. If the remaining funds is not sufficient to support the minimum product (min.: 0.00000001), then the left part in the order would be cancelled.
+ +If your order is a maker order, the system would return the left pre-frozen taker fees to you.
+ +Notice: For a hidden/iceberg order, if it is not executed immediately and becomes a maker order, the system would still charge taker fees from you.
+ +For example:
+ +Take BTC/USDT as the trading pair, if you plan to buy 1 BTC in market price, suppose the fee charge is 0.1% and the data on the order book is as follows:
+ +Price(USDT) | +Size(BTC) | +Side | +
---|---|---|
4200.00 | +0.18412309 | +sell | +
4015.60 | +0.56849308 | +sell | +
4011.32 | +0.24738383 | +sell | +
3995.64 | +0.84738383 | +buy | +
3988.60 | +0.20484000 | +buy | +
3983.85 | +1.37584908 | +buy | +
When you placed a buy order in market price, the order would be executed immediately. The transaction detail is as follows:
+ +Price(USDT) | +Size(BTC) | +Fee(BTC) | +
---|---|---|
4011.32 | +0.24738383 | +0.00024738 | +
4015.60 | +0.56849308 | +0.00056849 | +
4200.00 | +0.18312409 | +0.00018312 | +
The liquidity field indicates if the fill was the result of a liquidity provider or liquidity taker.
+Fills are returned sorted by descending fill time.
+ + +{
+ "currentPage":1,
+ "pageSize":1,
+ "totalNum":251915,
+ "totalPage":251915,
+ "items":[
+ {
+ "symbol":"BTC-USDT",
+ "tradeId":"5c35c02709e4f67d5266954e",
+ "orderId":"5c35c02703aa673ceec2a168",
+ "counterOrderId":"5c1ab46003aa676e487fa8e3",
+ "side":"buy",
+ "liquidity":"taker",
+ "forceTaker":true,
+ "price":"0.083",
+ "size":"0.8424304",
+ "funds":"0.0699217232",
+ "fee":"0",
+ "feeRate":"0",
+ "feeCurrency":"USDT",
+ "stop":"",
+ "type":"limit",
+ "createdAt":1547026472000
+ }
+ ]
+}
+
+Get a list of 1000 fills in the last 24 hours.
+GET /api/v1/limit/fills
+This endpoint requires the "General" permission.
+ + + + +Market data is public and can be used without a signed request.
+[
+ {
+ "symbol": "BTC-USDT",
+ "name": "BTC-USDT",
+ "baseCurrency": "BTC",
+ "quoteCurrency": "USDT",
+ "baseMinSize": "0.00000001",
+ "quoteMinSize": "0.01",
+ "baseMaxSize": "10000",
+ "quoteMaxSize": "100000",
+ "baseIncrement": "0.00000001",
+ "quoteIncrement": "0.01",
+ "priceIncrement": "0.00000001",
+ "enableTrading": true
+ }
+]
+
+Get a list of available currency pairs for trading. This API is used to query related configuration information. If you want to get the market information of the trading symbol, please use AllTicker.
+ +This API
+GET /api/v1/symbols
+You can query all symbols through market parameter.
+ +Param | +Type | +Description | +
---|---|---|
market | +string | +[optional] The trading market. | +
Field | +Type | +Description | +
---|---|---|
symbol | +string | +unique code of symbol, it would not change after renaming | +
name | +string | +Name of trading pair, it would change after renaming | +
baseCurrency | +string | +Base currency | +
quoteCurrency | +string | +Quote currency | +
baseMinSize | +string | +Minimum order quantity | +
quoteMinSize | +string | +Minimum order amount | +
baseMaxSize | +string | +Maximum order quantity | +
quoteMaxSize | +string | +Maximum order amount | +
baseIncrement | +string | +Market order: quantity increment | +
quoteIncrement | +string | +Market order: amount increment | +
priceIncrement | +string | +Limit order: price increment | +
enableTrading | +boolean | +Available for transaction or not | +
The baseMinSize and baseMaxSize fields define the min and max order size. The priceIncrement field specifies the min order price as well as the price increment.This also applies to quote currency.
+ +The order price must be a multiple of this increment (i.e. if the increment is 0.01, order prices of 0.001 or 0.021 would be rejected).
+ + +//Get Ticker
+{
+ "sequence": "1550467636704",
+ "bestAsk": "0.03715004",
+ "size": "0.17",
+ "price": "0.03715005",
+ "bestBidSize": "3.803",
+ "bestBid": "0.03710768",
+ "bestAskSize": "1.788",
+ "time": 1550653727731
+
+}
+
+Ticker include only the inside (i.e. best) buy and sell(buy and sell represent bestBid and bestAsk) data , last price and last trade size.
+GET /api/v1/market/orderbook/level1?symbol=<symbol>
+ + +{
+ "time": 1550653727731,
+ "ticker": [
+ {
+ "symbol": "LOOM-BTC",
+ "buy": "0.00001191",
+ "sell": "0.00001206",
+ "changeRate": "0.057",
+ "changePrice": "0.00000065",
+ "high": "0.0000123",
+ "low": "0.00001109",
+ "vol": "45161.5073",
+ "last": "0.00001204"
+ },
+ {
+ "symbol": "BCD-BTC",
+ "buy": "0.00018564",
+ "sell": "0.0002",
+ "changeRate": "-0.0753",
+ "changePrice": "-0.00001522",
+ "high": "0.00021489",
+ "low": "0.00018351",
+ "vol": "72.99679763",
+ "last": "0.00018664"
+ }
+ ]
+ }
+
+Require market ticker for all trading pairs in the market (including 24h volume).
+GET /api/v1/market/allTickers
+ + +//Get 24hr Stats
+{
+ "symbol": "ETH-BTC",
+ "changeRate": "-0.778",
+ "changePrice": "-0.00778",
+ "open": 1,
+ "close": 0.99222,
+ "high": "1",
+ "low": "0.00222",
+ "vol": "4.2678",
+ "volValue": "2.21016762"
+}
+
+Get 24 hr stats for the symbol. volume is in base currency units. open, high, low are in quote currency units.
+GET /api/v1/market/stats?symbol=<symbol>
+ + +//Get Market List
+{
+ "data":[
+ "BTC",
+ "ETH",
+ "USDT"
+ ]
+}
+
+Get the transaction currency for the entire trading market.
+GET /api/v1/markets
+ + +{
+ "sequence": "3262786978",
+ "time": 1550653727731,
+ "bids": [["6500.12", "0.45054140"],
+ ["6500.11", "0.45054140"]], //[price,size]
+ "asks": [["6500.16", "0.57753524"],
+ ["6500.15", "0.57753524"]]
+}
+
+Get a list of open orders for a symbol.
+ +Level-2 order book includes all bids and asks (aggregated by price), this level return only one size for each active price (as if there was only a single order for that size at the level).
+ +This API will return a part of Order Book within 20 depth or 100 depth for each side(ask or bid). we need to remind you that L2_20 and L2_100 api are different at the rate limit.
+ +It is recommended to use in most cases, it is the fastest Order Book API, and reduces traffic usage.
+ +To maintain up-to-date Order Book in real time, please use it with Websocket Feed.
+GET /api/v1/market/orderbook/level2_20?symbol=<symbol>
+ +GET /api/v1/market/orderbook/level2_100?symbol=<symbol>
+Asks: Sort price from low to high
+ +Bids: Sort price from high to low
+{
+ "sequence": "3262786978",
+ "time": 1550653727731,
+ "bids": [["6500.12", "0.45054140"],
+ ["6500.11", "0.45054140"]], //[price,size]
+ "asks": [["6500.16", "0.57753524"],
+ ["6500.15", "0.57753524"]]
+}
+
+Get a list of open orders for a symbol.
+ +Level-2 order book includes all bids and asks (aggregated by price), this level return only one size for each active price (as if there was only a single order for that size at the level).
+ +This API will return data with full depth.
+ +It is generally used by professional traders because it uses more server resources and traffic, and we have strict access frequency control.
+ +To maintain up-to-date Order Book in real time, please use it with Websocket Feed.
+GET /api/v1/market/orderbook/level2?symbol=<symbol> (Will be deprecated on December 31, 2019)
+ +GET /api/v2/market/orderbook/level2?symbol=<symbol> (Recommend)
+Asks: Sort price from low to high (v2)
+ +Asks: Sort price from high to low (v1)
+ +Bids: Sort price from high to low (v1 & v2)
+ {
+ "sequence": "1545896707028",
+ "time": 1550653727731,
+ "bids": [
+ [
+ "5c2477e503aa671a745c4057", //orderId
+ "6", //price
+ "0.999" //size
+ ],
+ [
+ "5c2477e103aa671a745c4054",
+ "5",
+ "0.999"
+ ]
+ ],
+ "asks": [
+ [
+ "5c24736703aa671a745c401e",
+ "200",
+ "1"
+ ],
+ [
+ "5c2475c903aa671a745c4033",
+ "201",
+ "1"
+ ]
+ ]
+ }
+
+Get a list of open orders for a symbol. Level-3 order book includes all bids and asks (non-aggregated, each item in Level-3 means a single order).
+ +Level 3 is non-aggregated and returns the entire order book.
+ +This API is generally used by professional traders because it uses more server resources and traffic, and we have strict access frequency control.
+ +To Maintain up-to-date Order Book in real time, please use it with Websocket Feed.
+GET /api/v1/market/orderbook/level3?symbol=<symbol>
+Asks: Sort price from low to high
+ +Bids: Sort price from high to low
+ + +[
+ {
+ "sequence": "1545896668571",
+ "price": "0.07", //Filled price
+ "size": "0.004", //Filled amount
+ "side": "buy", //Filled side. The filled side is set to the taker by default.
+ "time": 1545904567062140823 //Transaction time
+ },
+ {
+ "sequence": "1545896668578",
+ "price": "0.054",
+ "size": "0.066",
+ "side": "buy",
+ "time": 1545904581619888405
+ }
+]
+
+List the latest trades for a symbol.
+GET /api/v1/market/histories?symbol=<symbol>
+The trade side indicates the taker order side. The taker order is the order that was match with orders opened on the order book. buy side indicates a up-tick because the taker was a buy order and their order was received. Conversely, sell side indicates an down-tick.
+ + +[
+ [
+ "1545904980", //Start time of the candle cycle
+ "0.058", //opening price
+ "0.049", //closing price
+ "0.058", //highest price
+ "0.049", //lowest price
+ "0.018", //Transaction amount
+ "0.000945" //Transaction volume
+ ],
+ [
+ "1545904920",
+ "0.058",
+ "0.072",
+ "0.072",
+ "0.058",
+ "0.103",
+ "0.006986"
+ ]
+]
+
+Historic rates for a symbol. Rates are returned in grouped buckets based on requested type.
+ + + + +GET /api/v1/market/candles?symbol=<symbol>
+ +Param | +Description | +
---|---|
startAt | +Start time. Unix timestamp calculated in seconds not millisecond | +
endAt | +End time. Unix timestamp calculated in seconds not millisecond | +
type | +Type of candlestick patterns: 1min, 3min, 5min, 15min, 30min, 1hour, 2hour, 4hour, 6hour, 8hour, 12hour, 1day, 1week | +
For each query, the system would return at most 1500 pieces of data. To obtain more data, please page the data by time.
+Each bucket is an array of the following information:
+ +GET /api/v1/market/stats
+These interfaces are public and do not require authentication.
+
+[{
+ "currency": "BTC",
+ "name": "BTC",
+ "fullName": "Bitcoin",
+ "precision": 8,
+ "withdrawalMinSize": "0.002",
+ "withdrawalMinFee": "0.0005",
+ "isWithdrawEnabled": true,
+ "isDepositEnabled": true
+},
+{
+
+ "currency": "ETH",
+ "name": "ETH",
+ "fullName": "Ethereum",
+ "precision": 8,
+ "withdrawalMinSize": "0.02",
+ "withdrawalMinFee": "0.01",
+ "isWithdrawEnabled": true,
+ "isDepositEnabled": true
+
+}]
+
+
+List known currencies.
+GET /api/v1/currencies
+ + + +Response
+ +field | +description | +
---|---|
currency | +Unique and never change | +
name | +The currency name would change after renaming | +
fullName | +The currency full name would change after renaming | +
precision | +Currency precision | +
withdrawalMinSize | +Minimum withdrawal amount | +
withdrawalMinFee | +Minimum withdrawal fees | +
isWithdrawEnabled | +Support withdrawal or not | +
isDepositEnabled | +Support deposit or not | +
CURRENCY CODES
+ +Currency codes will conform to the ISO 4217 standard where possible. Currencies which have or had no representation in ISO 4217 may use a custom code.
+ +Code | +Description | +
---|---|
BTC | +Bitcoin | +
ETH | +Ethereum | +
KCS | +Kucoin Shares | +
For a coin, the "currency" is a fixed value and works as the only recognized identity of the coin. As the "name", "fullnane" and "precision" of a coin are values modifiable, when the "name" of a coin is changed, you should use "currency" to get the coin.
+ +For example:
+ +The "currency" of XRB is "XRB", if the "name" of XRB is changed into "Nano", you should use "XRB" (the currency of XRB) to search the coin.
+Get single currency detail
+{
+ "currency": "BTC",
+ "name": "BTC",
+ "fullName": "Bitcoin",
+ "precision": 8,
+ "withdrawalMinSize": "0.002",
+ "withdrawalMinFee": "0.0005",
+ "isWithdrawEnabled": true,
+ "isDepositEnabled": true
+ }
+
GET /api/v1/currencies/{currency}
+ + + +Response
+ +field | +description | +
---|---|
currency | +Unique and never change | +
name | +The currency name would change after renaming | +
fullName | +The currency full name would change after renaming | +
precision | +Currency precision | +
withdrawalMinSize | +Minimum withdrawal amount | +
withdrawalMinFee | +Minimum withdrawal fees | +
isWithdrawEnabled | +Support withdrawal or not | +
isDepositEnabled | +Support deposit or not | +
Get fiat price for currency
+{
+ "code": "200000",
+ "data": {
+ "BTC": "3911.28000000",
+ "ETH": "144.55492453",
+ "LTC": "48.45888179",
+ "KCS": "0.45546856"
+ }
+}
+
GET /api/v1/prices
+ +Response
+ +field | +description | +
---|---|
base | +[optional] Fiat,eg.USD,EUR, default is USD | +
currencies | +[optional] Cryptocurrencies.For multiple cyrptocurrencies, please separate them with comma one by one. default is all | +
Here are some comprehensive interfaces.
+{
+ "code":"200000",
+ "msg":"success",
+ "data":1546837113087
+}
+
+Get the API server time.
+GET /api/v1/timestamp
+ +EPOCH +The epoch field represents decimal seconds since Unix Epoch
+REST API has a strict call frequency limit, Websocket is the most recommended and fastest way to get real-time data.
+ + +{
+ "code": "200000",
+ "data": {
+ "instanceServers": [
+ {
+ "pingInterval": 50000,
+ "endpoint": "wss://push1-v2.kucoin.net/endpoint",
+ "protocol": "websocket",
+ "encrypt": true,
+ "pingTimeout": 10000
+ }
+ ],
+ "token": "vYNlCtbz4XNJ1QncwWilJnBtmmfe4geLQDUA62kKJsDChc6I4bRDQc73JfIrlFaVYIAE0Gv2--MROnLAgjVsWkcDq_MuG7qV7EktfCEIphiqnlfpQn4Ybg==.IoORVxR2LmKV7_maOR9xOg=="
+ }
+}
+
+You need to apply for a token to create a websocket connection. You only need to choose one of the below two tokens.
+If you only use public channels(e.g. All public market data), please make request as follows to obtain the server list and temporary public token:
+POST /api/v1/bullet-public
+{
+ "code": "200000",
+ "data": {
+ "instanceServers": [
+ {
+ "pingInterval": 50000,
+ "endpoint": "wss://push1-v2.kucoin.com/endpoint",
+ "protocol": "websocket",
+ "encrypt": true,
+ "pingTimeout": 10000
+ }
+ ],
+ "token": "vYNlCtbz4XNJ1QncwWilJnBtmmfe4geLQDUA62kKJsDChc6I4bRDQc73JfIrlFaVYIAE0Gv2--MROnLAgjVsWkcDq_MuG7qV7EktfCEIphiqnlfpQn4Ybg==.IoORVxR2LmKV7_maOR9xOg=="
+ }
+}
+
+For request some additional private channels and messages (e.g. Account balance notice), please make request as follows after authorization to obtain the server list and authorized token.
+POST /api/v1/bullet-private
+field | +description | +
---|---|
pingInterval | +Recommended to send ping interval in millisecond | +
pingTimeout | +After such a long time(millisecond), if you do not receive pong, it will be considered as disconnected. | +
endpoint | +Websocket server address for establishing connection | +
protocol | +Protocol supported | +
encrypt | +Indicate whether SSL encryption is used | +
var socket = new WebSocket("wss://push1.kucoin.com/endpoint?token=xxx&[connectId=xxxxx]");
+
+When the connection is successfully established, the system will send a welcome message.
+{
+ "id":"hQvf8jkno",
+ "type":"welcome"
+}
+
+The connectId is connection id, a unique value taken from the client side. Both the id of the welcome message sent by system after the connection succeed as well as the id of the error message are connectId.
+ + +{
+ "id":"1545910590801",
+ "type":"ping"
+}
+
+To prevent the TCP link being disconnected by the server, the client side needs to send ping messages to the server to keep alive the link.
+ +After the ping message is sent to the server, the system would return a pong message to the client side.
+ +If the server has not received the ping from the client for 60 seconds, the server will disconnect.
+{
+ "id":"1545910590801",
+ "type":"pong"
+}
+
+
+{
+ "id": 1545910660739, //The id should be an unique value
+ "type": "subscribe",
+ "topic": "/market/ticker:BTC-USDT,ETH-USDT", //Topic needs to be subscribed. Some topics support to divisional subscribe the informations of multiple trading pairs through ",".
+ "privateChannel": false, //Adopted the private channel or not. Set as false by default.
+ "response": true //Whether the server needs to return the receipt information of this subscription or not. Set as false by default.
+}
+
+To subscribe channel messages from certain server, the client side should send subscription message to the server.
+ +If the subscription succeed, the system would send ack messages to you. When the response is set as true.
+{
+ "id":"1545910660739",
+ "type":"ack"
+}
+
+While there are topic messages generated, the system would send the corresponding messages to the client side. For details about the message format, please check the definitions of topics.
+Unique string to mark the request.
+The topic you want to subscribe to.
+For some specific topics (e.g. /market/level3), privateChannel is available. The default value of privateChannel is false. If the privateChannel is set to true, the user will only receive messages related himself on the topic. The format of the topic field in the returned data is {topic}:privateChannel:{userId}.
+If the response is set as ture, the system would return the ack messages after the unsubscription succeed.
+Unsubscribe from topics you have subscribed to.
+{
+ "id": "1545910840805", //The id should be an unique value
+ "type": "unsubscribe",
+ "topic": "/market/ticker:BTC-USDT,ETH-USDT", //Topic needs to be unsubscribed. Some topics support to divisional unsubscribe the informations of multiple trading pairs through ",".
+ "privateChannel": false,
+ "response": true, //Whether the server needs to return the receipt information of this subscription or not. Set as false by default.
+}
+
{
+ "id": "1545910840805",
+ "type": "ack"
+}
+
Unique string to mark the request.
+The topic you want to subscribe to.
+For some specific public topics (e.g. /market/level3), privateChannel is available. The default value of privateChannel is false. If the privateChannel is set to true, the user will only receive messages related himself on the topic. The format of the topic field in the returned data is {topic}:privateChannel:{userId}.
+If the response is set as ture, the system would return the ack messages after the unsubscription succeed.
+In one physical connection, you could open different multiplex tunnels to subscribe different topics for different data.
+ +For example, enter command below to open bt1 multiple tunnel :
+ +{"id": "1Jpg30DEdU", "type": "openTunnel", "newTunnelId": "bt1", "response": true}
+ +Add “tunnelId” in the command:
+ +{"id": "1JpoPamgFM", "type": "subscribe", "topic": "/market/ticker:KCS-BTC","tunnelId": "bt1", "response": true}
+ +You would then, receive messages corresponded to id tunnelIId:
+ +{"id": "1JpoPamgFM", "type": "message", "topic": "/market/ticker:KCS-BTC", "subject": "trade.ticker", "tunnelId": "bt1", "data": {...}}
+ +To close the tunnel, you could enter command below:
+ +{"id": "1JpsAHsxKS", "type": "closeTunnel", "tunnelId": "bt1", "response": true}
+The sequence field exists in order book, trade history and snapshot messages by default and the level 3 and level 2 data works to ensure the full connection of the sequence. If the sequence is non-sequential, please enable the calibration logic.
+1.Judge message type. There are three types of messages at present: message (the commonly used messages for push), notice (the notices general used), and command (consecutive command).
+ +2.Judge messages by userId. Messages with userId are private messages, messages without userId are common messages.
+ +3.Judge messages by topic. You could judge the message type through topic.
+ +4.Judge messages by subject. For the same type of messages with the same topic, you could judge the type of messages through their subjects.
+
+{
+ "id": 1545910660739,
+ "type": "subscribe",
+ "topic": "/market/ticker:BTC-USDT",
+ "response": true
+}
+
+Topic: /market/ticker:{symbol},{symbol}...
+{
+ "type":"message",
+ "topic":"/market/ticker:BTC-USDT",
+ "subject":"trade.ticker",
+ "data":{
+ "sequence":"1545896668986",
+ "bestAsk":"0.08",
+ "size":"0.011",
+ "bestBidSize":"0.036",
+ "price":"0.08",
+ "bestAskSize":"0.18",
+ "bestBid":"0.049"
+ }
+}
+
+Subscribe this topic to get the realtime push of BBO changes.
+ +The ticker channel provides real-time price updates every time a match happens. It batches updates in case of cascading matches, greatly reducing bandwidth requirements.
+ +Please note that more information will be added to messages from this channel in the near future.
+ + + + +
+{
+ "id": 1545910660739,
+ "type": "subscribe",
+ "topic": "/market/ticker:all",
+ "response": true
+}
+
+Topic: /market/ticker:all
+{
+ "type":"message",
+ "topic":"/market/ticker:all",
+ "subject":"BTC-USDT",
+ "data":{
+ "sequence":"1545896668986",
+ "bestAsk":"0.08",
+ "size":"0.011",
+ "bestBidSize":"0.036",
+ "price":"0.08",
+ "bestAskSize":"0.18",
+ "bestBid":"0.049"
+ }
+}
+
+Subscribe this topic to get the realtime push of all market symbols BBO change.
+ +The ticker channel provides real-time price updates every 1 second happens.
+ + + + +{
+ "data": {
+ "sequence": "1545896669291",
+ "data": [{
+ "trading": true,
+ "symbol": "KCS-BTC",
+ "buy": 0.00011,
+ "sell": 0.00012,
+ "sort": 100,
+ "volValue": 3.13851792584,
+ "baseCurrency": "KCS",
+ "market": "BTC",
+ "quoteCurrency": "BTC",
+ "symbolCode": "KCS-BTC",
+ "datetime": 1548388122031,
+ "high": 0.00013,
+ "vol": 27514.34842,
+ "low": 0.0001,
+ "changePrice": -1.0e-5,
+ "changeRate": -0.0769,
+ "lastTradedPrice": 0.00012,
+ "board": 0,
+ "mark": 0
+ }]
+ },
+ "subject": "trade.snapshot",
+ "topic": "\/market\/snapshot:BTC",
+ "type": "message"
+}
+
+Topic: /market/snapshot:{symbol}
+ +Subscribe to get the single symbol snapshot data.
+ +The snapshot data is pushed every 2 seconds interval.
+ + + + + + +{
+ "data": {
+ "sequence": "1545896669291",
+ "data": {
+ "trading": true,
+ "symbol": "KCS-BTC",
+ "buy": 0.00011,
+ "sell": 0.00012,
+ "sort": 100,
+ "volValue": 3.13851792584,
+ "baseCurrency": "KCS",
+ "market": "BTC",
+ "quoteCurrency": "BTC",
+ "symbolCode": "KCS-BTC",
+ "datetime": 1548388122031,
+ "high": 0.00013,
+ "vol": 27514.34842,
+ "low": 0.0001,
+ "changePrice": -1.0e-5,
+ "changeRate": -0.0769,
+ "lastTradedPrice": 0.00012,
+ "board": 0,
+ "mark": 0
+ }
+ },
+ "subject": "trade.snapshot",
+ "topic": "\/market\/snapshot:KCS-BTC",
+ "type": "message"
+}
+
+Topic: /market/snapshot:{market}
+ +Subscribe to get snapshot data for the entire market.
+ +You can get market list by Get Market List.
+ +The snapshot data is pushed every 2 seconds interval.
+ + + + + + +{
+ "id": 1545910660740,
+ "type": "subscribe",
+ "topic": "/market/level2:BTC-USDT",
+ "response": true
+}
+
+Topic: /market/level2:{symbol},{symbol}...
+ +Subscribe this topic to get Level2 order book data.
+ +After the conducts, the system would send the increment change data pushed by websocket to you.
+{
+ "type":"message",
+ "topic":"/market/level2:BTC-USDT",
+ "subject":"trade.l2update",
+ "data":{
+ "sequenceStart":1545896669105,
+ "sequenceEnd":1545896669106,
+ "symbol":"BTC-USDT",
+ "changes":{
+ "asks":[["6","1","1545896669105"]], //price, size, sequence
+ "bids":[["4","1","1545896669106"]]
+ }
+ }
+}
+
+Calibration procedure:
+ +1.After receiving the websocket l2update data flow, cache the data.
+ +2.Initiate REST (GET /api/v1/market/orderbook/level2_100?symbol=<symbol>) request to get the snapshot data of l2 order book.
+ +3.Playback the cached l2update data flow and find the sequence of the snapshot (range of location: sequence_start to sequence_end in l2update ). Discard all the l2update prior to sequence_start, then playback the change to snapshot.
+ +4.Put the new l2update data flow to the local snapshot to ensure that the sequence_start of the new l2update link up with the sequence_end of the previous l2update.
+ +5.Update the level2 full data based on sequence according to the size. If the price is 0, ignore the messages and update the sequence. If the size=0, update the sequence and remove the price of which the size is 0 out of level 2. For other cases, please update price.
+ +Subsequent updates will have the type l2update. The changes property of l2updates is an array with [price, size,sequence] tuples. Please note that size is the updated size at that price level, not a delta. A size of "0" indicates the price level can be removed.
+ +Example
+ +Take BTC/USDT as an example, suppose the current order book data in level 2 is as follows:
+ +After subscribing the channel, you would receive changes as follows:
+ +"asks":[
+ +["3988.62","8", 15],
+ +["3988.61","0", 18],
+ +["3988.59","3", 16],
+ +]
+ +"bids":[
+ +["3988.50", "44", "17"]
+ +]
+ + + +Get the snapshot of the order book through REST request (Get Order Book) to build a local order book. Suppose we get the data as follows:
+ +Sequence:16
+ +Data:
+ +"asks":[
+ +["3988.62","8"],
+ +["3988.61","32"],
+ +["3988.60","47"],
+ +["3988.59","3"],
+ +]
+ +"bids":[
+ +["3988.51","56"],
+ +["3988.50","15"],
+ +["3988.49","100"],
+ +["3988.48","10"]
+ +]
+ +The current data on local order book is as follows:
+ +Price | +Size | +Side | +
---|---|---|
3988.62 | +8 | +Sell | +
3988.61 | +32 | +Sell | +
3988.60 | +47 | +Sell | +
3988.59 | +3 | +Sell | +
3988.51 | +56 | +Buy | +
3988.50 | +15 | +Buy | +
3988.49 | +100 | +Buy | +
3988.48 | +10 | +Buy | +
In the beginning, the sequence of your local order book is 16. Discard the feed data of sequence below or equal to 16, apply playback the sequence [17,18] to update the snapshot of the local order book. Now the sequence of your local order book is 18 and your local order book is up-to-date.
+ +Diff:
+ +1.Update size of 3988.50 to 44 (Sequence 17)
+ +2.Remove 3988.61 (Sequence 18)
+ +Now your current order book is up-to-date and final data is as follows:
+ +Price | +Size | +Side | +
---|---|---|
3988.62 | +8 | +Sell | +
3988.60 | +47 | +Sell | +
3988.59 | +3 | +Sell | +
3988.51 | +56 | +Buy | +
3988.50 | +44 | +Buy | +
3988.49 | +100 | +Buy | +
3988.48 | +10 | +Buy | +
{
+ "id": 1545910660741,
+ "type": "subscribe",
+ "topic": "/market/match:BTC-USDT",
+ "privateChannel": false,
+ "response": true
+}
+
+Topic: /market/match:{symbol},{symbol}...
+ +For this topic, privateChannel is available.
+ +Subscribe this topic to obtain the matching event data flow of Level 3.
+ +For each order traded, the system would send you the match messages in the format as follows.
+{
+ "id":"5c24c5da03aa673885cd67aa",
+ "type":"message",
+ "topic":"/market/match:BTC-USDT",
+ "subject":"trade.l3match",
+ "sn":1545896669145,
+ "data":{
+ "sequence":"1545896669145",
+ "symbol":"BTC-USDT",
+ "side":"buy",
+ "size":"0.01022222000000000000",
+ "price":"0.08200000000000000000",
+ "takerOrderId":"5c24c5d903aa6772d55b371e",
+ "time":"1545913818099033203",
+ "type":"match",
+ "makerOrderId":"5c2187d003aa677bd09d5c93",
+ "tradeId":"5c24c5da03aa673885cd67aa"
+ }
+}
+
+
+
+
+{
+ "id": 1545910660742,
+ "type": "subscribe",
+ "topic": "/market/level3:BTC-USDT",
+ "privateChannel": false,
+ "response": true
+}
+
+Topic: /market/level3:{symbol},{symbol}...
+ +For this topic, privateChannel is available.
+ +Subsribe this topic to fully get the updata data for orders and trades.
+ +The full channel provides real-time updates on orders and trades. These updates can be applied on to a level 3 order book snapshot to maintain an accurate and up-to-date copy of the exchange order book.
+ + + +An algorithm to maintain an up-to-date level 3 order book is described below. Please note that you will rarely need to implement this yourself.
+ +The following messages(RECEIVED, OPEN, DONE, MATCH, CHANGE) are sent over the websocket stream in JSON format when subscribing to the full channel:
+{
+ "type":"message",
+ "topic":"/market/level3:BTC-USDT",
+ "subject":"trade.l3received",
+ "data":{
+ "sequence":"1545896669147",
+ "symbol":"BTC-USDT",
+ "side":"sell",
+ "size":"1",
+ "orderId":"5c24c72503aa6772d55b378d",
+ "price":"4.00000000000000000000",
+ "time":"1545914149935808589",
+ "type":"received",
+ "orderType":"limit"
+ }
+}
+
{
+ "type":"message",
+ "topic":"/market/level3:BTC-USDT",
+ "subject":"trade.l3received",
+ "data":{
+ "sequence":"1545896669100",
+ "symbol":"BTC-USDT",
+ "side":"sell",
+ "size":"1",
+ "orderId":"5c24c72503aa6772d55b178d",
+ "time":"1545914149835808589",
+ "type":"received",
+ "orderType":"market",
+ "funds":"100"
+ }
+}
+
+When matching engine receives an order command, the system would send a received message to user.
+ + + + +{
+ "type":"message",
+ "topic":"/market/level3:BTC-USDT",
+ "subject":"trade.l3open",
+ "data":{
+ "sequence":"1545896669148",
+ "symbol":"BTC-USDT",
+ "side":"sell",
+ "size":"1",
+ "orderId":"5c24c72503aa6772d55b378d",
+ "price":"6.00000000000000000000",
+ "time":"1545914149935808632",
+ "type":"open",
+ "remainSize":"1"
+ }
+}
+
+When the remaining part in a limit order enters the order book, the system would send an open message to user.
+ + + + +When the matching life cycle of an order ended, the order would no longer be displayed on the order book and the system will send a done message to user.
+{
+ "type":"message",
+ "topic":"/market/level3:BTC-USDT",
+ "subject":"trade.l3done",
+ "data":{
+ "sequence":"1545896669226",
+ "symbol":"BTC-USDT",
+ "reason":"filled",
+ "side":"buy",
+ "orderId":"5c24c96103aa6772d55b380b",
+ "time":"1545914730696727106",
+ "type":"done"
+ }
+}
+
{
+ "type":"message",
+ "topic":"/market/level3:BTC-USDT",
+ "subject":"trade.l3done",
+ "data":{
+ "sequence":"1545896669227",
+ "symbol":"BTC-USDT",
+ "reason":"canceled",
+ "side":"buy",
+ "orderId":"5c24c96103aa6772d55b381b",
+ "time":"1545914730696797106",
+ "type":"done",
+ "size": "1.12340000000000000000"
+ }
+}
+
+When the matching life cycle of an order ended, the order would no longer be displayed on the order book and the system will send a done message to user.
+ + + + +{
+ "type":"message",
+ "topic":"/market/level3:BTC-USDT",
+ "subject":"trade.l3match",
+ "data":{
+ "sequence":"1545896669291",
+ "symbol":"BTC-USDT",
+ "side":"buy",
+ "size":"0.07600000000000000000",
+ "price":"0.08300000000000000000",
+ "takerOrderId":"5c24ca2e03aa6772d55b38bf",
+ "time":"1545914933083576866",
+ "type":"match",
+ "makerOrderId":"5c20492a03aa677bd099ce9d",
+ "tradeId":"5c24ca3503aa673885cd67ef"
+ }
+}
+
+When two orders become matched, the system would send a match message to user. The Side always indicates the taker, namely the direction of the match triggered.
+ + + + +{
+ "type":"message",
+ "topic":"/market/level3:BTC-USDT",
+ "subject":"trade.l3change",
+ "data":{
+ "sequence":"1545896669656",
+ "symbol":"BTC-USDT",
+ "side":"buy",
+ "orderId":"5c24caff03aa671aef3ca170",
+ "price":"1.00000000000000000000",
+ "newSize":"0.15722222000000000000",
+ "time":"1545915145402532254",
+ "type":"change",
+ "oldSize":"0.18622222000000000000"
+ }
+}
+
+When an order is changed due to STP, the system would send a change message to user.
+ + + + +{
+ "type":"message",
+ "topic":"/market/level3:BTC-USDT",
+ "subject":"trade.l3received",
+ "data": {
+ "sequence":"1545738118241",
+ "symbol":"BTC-USDT",
+ "side":"buy",
+ "orderId":"5c21e80303aa677bd09d7dff",
+ "stopType":"entry",
+ "funds":"1.00000000000000000000",
+ "time":"1545743136994328401",
+ "type":"activate"
+ }
+}
+
+When a stop-limit order is triggered, you would receive an activate message which means that this order started the matching life cycle.
+ + + + +{
+ "type":"message",
+ "topic":"/account/balance",
+ "subject":"account.balance",
+ "data":{
+ "total": "88",
+ "available": "88",
+ "availableChange": "88",
+ "currency": "KCS",
+ "hold": "0",
+ "holdChange": "0",
+ "relationEvent": "main.deposit",
+ "relationEventId": "5c21e80303aa677bd09d7dff",
+ "time": "1545743136994"
+ }
+}
+
+
+You will receive this message when an account balance changes. The message contains the details of the change.
+ +Welcome to KuCoin trader and developer documentation. These documents outline exchange functionality, market details, and APIs.
+ +APIs are separated into two parts: REST API and Websocket feed.
+ +Private APIs require authentication and provide access to placing orders and other account information.
+ +Websocket APIs provide market data , most of them are public.
+In order to receive the latest API change notifications, please add 'Watch' to KuCoin Docs Github.
+ +2/21/19 :
+ +2/20/19 :
+ +2/19/19 :
+ +2/18/19 :
+ +2/16/19 :
+ +1/30/19 :
+ +1/25/19 :
+ +General information of KuCoin System and API.
+Valid orders sent to the matching engine are confirmed immediately and are in the received state. If an order executes against another order immediately, the order is considered done. An order can execute in part or whole. Any part of the order not filled immediately, will be considered open. Orders will stay in the open state until canceled or subsequently filled by new orders. Orders that are no longer eligible for matching (filled or canceled) are in the done state.
+The Self-Trade Prevention is an option (set as not-selected by default) in advanced settings. When you specify STP when placing orders, your order will not fill your other orders. On the contrary, if you did not choose STP in Advanced, your order might be filled by your own orders.
+Market order is currently not supported for DC. When two orders from the same user cross, the smaller order will be canceled and the larger order size will be decremented by the smaller order size. If the two orders are the same size, both will be canceled.
+Cancel the older (resting) order in full. The new order continues to execute.
+Cancel the newer (taking) order in full. The old resting order remains on the order book.
+ +Immediately cancel both orders.
+Client libraries can help you integrate with our API quickly.
+ +OFFICIAL
+ +CCXT is our official SDK provider and you may access KuCoin API through CCXT. For more information, please visit: https://ccxt.trade.
+ +UNOFFICIAL
+ +Thanks to the great community contributors, these are the open source SDKs contributed by community developers. Since each library is updated frequently, KuCoin does not review all source code and does not rigorously test it. KuCoin is not responsible for the security of the SDK. Please conduct a basic code review and assess the risks before use.
+ +If you are a developer, submit your sdk to us and get KCS rewards.
+ +Sandbox is the test environment, used for testing API connection and web trading, and provides all the functionalities for exchanges. In sandbox, you could use fake funds for exchange tests.
+ +The login session and API key in sandbox environment are completely separated from the production environment. You may use the web interface in sandbox environment to create API key.
+ +Notice: After registering in sandbox environment, you will receive an amount of fake funds (BTC, ETH or KCS) automatically released by the system in your account. If you want to trade, please transfer assets from the main account to the trade account. The funds are only for exchange test purpose and cannot be withdrawn.
+ +Sandbox URLs for API test:
+ +Website: +https://sandbox.kucoin.com
+ +REST API: +https://openapi-sandbox.kucoin.com
+When a rate limit is exceeded, a status of 429 Too Many Requests will be returned.
+ +When the rate limit is exceeded multiple times, your IP or account may be suspended. The time range is from 2 minutes to 7 days.
+ +If you are a professional trader or market maker and need a higher limit, please describe your KuCoin account, usage and approximate trading volume and send email to api@kucoin.com.
+We throttle public endpoints by IP: 100 requests per ten seconds.
+We throttle private endpoints by user ID: 200 requests per ten seconds.
+The REST API has endpoints for account and order management as well as public market data.
+ +Base url is https://openapi-v2.kucoin.com or https://api.kucoin.com.
+ +Request URL needs to be determined by BASE and specific endpoint combination.
+Each interface has its own endpoint, described by field HTTP REQUEST in the docs.
+ +For the GET METHOD API, the endpoint needs to contain the query parameters string.
+ +e.g. For "List Accounts", the default endpoint of this api is /api/v1/accounts. +If you pass the "currency" parameter(BTC), the endpoint is /api/v1/accounts?currency=BTC and the final request url is https://openapi-v2.kucoin.com/api/v1/accounts?currency=BTC.
+All requests and responses are application/json content type.
+ +Unless otherwise stated, all timestamp parameters should in milliseconds. e.g. 1544657947759
+For GET, DELETE request, all query parameters need to be included in the request url. (e.g. /api/v1/accounts?currency=BTC)
+ +For POST, PUT request, all query parameters need to be included in the request body with JSON. (e.g. {"currency":"BTC"}). Do not include extra spaces in JSON strings.
+All interfaces may add fields in the future, existing fields will not change, please pay attention to compatibility during programming.
+Errors to bad requests will respond with HTTP error code or system error code. The body will also contain a message parameter indicating the cause.
+{
+ "code": "400100",
+ "msg": "Invalid Parameter."
+}
+
+
+Code | +Meaning | +
---|---|
400 | +Bad Request -- Invalid request format | +
401 | +Unauthorized -- Invalid API Key | +
403 | +Forbidden -- The requested is hidden for administrators only. | +
404 | +Not Found -- The specified resource could not be found. | +
405 | +Method Not Allowed -- You tried to access the resource with an invalid method. | +
415 | +Content-Type: application/json. | +
429 | +Too Many Requests -- Exceeded the access frequency | +
500 | +Internal Server Error -- We had a problem with our server. Try again later. | +
503 | +Service Unavailable -- We're temporarily offline for maintenance. Please try again later. | +
Code | +Meaning | +
---|---|
400001 | +Any of KC-API-KEY, KC-API-SIGN, KC-API-TIMESTAMP, KC-API-PASSPHRASE is missing in your request header | +
400002 | +KC-API-TIMESTAMP Invalid -- Time differs from server time by more than 5 seconds | +
400003 | +KC-API-KEY not exists | +
400004 | +KC-API-PASSPHRASE error | +
400005 | +Signature error -- Please check your signature | +
400006 | +The requested ip address is not in the api whitelist | +
400007 | +Access Denied -- Your api key does not have sufficient permissions to access the uri | +
404000 | +Url Not Found -- The request resource could not be found | +
400100 | +Parameter Error -- You tried to access the resource with invalid parameters | +
411100 | +User are frozen -- User are frozen, please contact us via support center. | +
500000 | +Internal Server Error -- We had a problem with our server. Try again later. | +
While http status code is 200, the error occurs when business failed, you can find api specific business error codes under api detail
+A successful response is indicated by HTTP status code 200 and system code 200000. the success payload is as follows:
+{
+ "code": "200000",
+ "data": "1544657947759"
+}
+
+The response may contain an optional data. If the response has a data it will be documented under each resource below.
+KuCoin uses pagination for all REST requests which return arrays. Pagination allows for fetching results with the current page and is well suited for realtime data. Endpoints like /api/v1/trades, /api/v1/fills, /api/v1/orders, return the latest items by default. To retrieve more results subsequent requests should specify which direction to paginate based on the data previously returned.
+Parameter | +Default | +Description | +
---|---|---|
currentPage | +1 | +Current request page. | +
pageSize | +50 | +Number of results per request. | +
GET /api/v1/orders?currentPage=1&pageSize=50
+Unless otherwise specified, all timestamps from API are returned in milliseconds(e.g. 1546658861000). Most modern languages and libraries will handle this without issues.
+Decimal numbers are returned as strings to preserve full precision across platforms. When making a request, it is recommended that you also convert your numbers to strings to avoid truncation and precision errors.
+ +Integer numbers (like trade id and sequence) are unquoted.
+Before being able to sign any requests, you must create an API key via the KuCoin website. Upon creating a key you will have 3 pieces of information which you must remember:
+ +The Key and Secret will be randomly generated and provided by KuCoin; the Passphrase will be provided by you to further secure your API access. KuCoin stores the salted hash of your passphrase for verification, but cannot recover the passphrase if you forget it.
+You can restrict the functionality of API keys. Before creating the key, you must choose what permissions you would like the key to have. The permissions are:
+ +Please refer to documentation below to see what API key permissions are required for a specific route.
+All REST requests must contain the following headers:
+ + <?php
+ class API {
+ public function __construct($key, $secret, $passphrase) {
+ $this->key = $key;
+ $this->secret = $secret;
+ $this->passphrase = $passphrase;
+ }
+
+ public function signature($request_path = '', $body = '', $timestamp = false, $method = 'GET') {
+
+ $body = is_array($body) ? json_encode($body) : $body; // Body must be in json format
+
+ $timestamp = $timestamp ? $timestamp : time() * 1000;
+
+ $what = $timestamp . $method . $request_path . $body;
+
+ return base64_encode(hash_hmac("sha256", $what, $this->secret, true));
+ }
+ }
+ ?>
+
#Example for get balance of accounts in python
+
+ api_key = "api_key"
+ api_secret = "api_secret"
+ api_passphrase = "api_passphrase"
+ url = 'https://openapi-sandbox.kucoin.com/api/v1/accounts'
+ now = int(time.time() * 1000)
+ str_to_sign = str(now) + 'GET' + '/api/v1/accounts'
+ signature = base64.b64encode(
+ hmac.new(api_secret.encode('utf-8'), str_to_sign.encode('utf-8'), hashlib.sha256).digest())
+ headers = {
+ "KC-API-SIGN": signature,
+ "KC-API-TIMESTAMP": str(now),
+ "KC-API-KEY": api_key,
+ "KC-API-PASSPHRASE": api_passphrase
+ }
+ response = requests.request('get', url, headers=headers)
+ print(response.status_code)
+ print(response.json())
+
+ #Example for create deposit addresses in python
+ url = 'https://openapi-sandbox.kucoin.com/api/v1/deposit-addresses'
+ now = int(time.time() * 1000)
+ data = {"currency": "BTC"}
+ data_json = json.dumps(data)
+ str_to_sign = str(now) + 'POST' + '/api/v1/deposit-addresses' + data_json
+ signature = base64.b64encode(
+ hmac.new(api_secret.encode('utf-8'), str_to_sign.encode('utf-8'), hashlib.sha256).digest())
+ headers = {
+ "KC-API-SIGN": signature,
+ "KC-API-TIMESTAMP": str(now),
+ "KC-API-KEY": api_key,
+ "KC-API-PASSPHRASE": api_passphrase,
+ "Content-Type": "application/json" # specifying content type or using json=data in request
+ }
+ response = requests.request('post', url, headers=headers, data=data_json)
+ print(response.status_code)
+ print(response.json())
+
+The KC-API-SIGN header is generated by creating a sha256 HMAC using the secret key on the prehash string timestamp + method + requestEndpoint + body (JSON string, need to be the same as the parameters passed by the API) and base64-encode the output. The timestamp value is the same as the KC-API-TIMESTAMP header.
+ +The method should be UPPER CASE.
+ +For GET request, the requestEndpoint needs to contain the query string. e.g. /api/v1/deposit-addresses?currency=BTC,the body is the request body string or omitted if there is no request body (typically for GET requests).
+ + +#Example for Create Deposit Address
+
+curl -H "Content-Type:application/json" -H "KC-API-KEY:5c2db93503aa674c74a31734" -H "KC-API-TIMESTAMP:1547015186532" -H "KC-API-PASSPHRASE:Abc123456" -H "KC-API-SIGN:7QP/oM0ykidMdrfNEUmng8eZjg/ZvPafjIqmxiVfYu4="
+-X POST -d '{"currency":"BTC"}' http://openapi-v2.kucoin.com/api/v1/deposit-addresses
+
+KC-API-KEY = 5c2db93503aa674c74a31734
+KC-API-SECRET = f03a5284-5c39-4aaa-9b20-dea10bdcf8e3
+KC-API-PASSPHRASE = Abc123456
+TIMESTAMP = 1547015186532
+METHOD = POST
+ENDPOINT = /api/v1/deposit-addresses
+STRING-TO-SIGN = 1547015186532POST/api/v1/deposit-addresses{"currency":"BTC"}
+KC-API-SIGN = 7QP/oM0ykidMdrfNEUmng8eZjg/ZvPafjIqmxiVfYu4=
+
+
+
+
+The KC-API-TIMESTAMP header MUST be number of milliseconds since Unix Epoch in UTC. Decimal values are allowed. e.g. 1547015186532
+ +Your timestamp must be within 5 seconds of the api service time or your request will be considered expired and rejected. We recommend using the time endpoint to query for the API server time if you believe there many be time skew between your server and the API servers.
+You need to sign the request to use the private user API.
+[{
+ "id": "5bd6e9286d99522a52e458de",
+ "currency": "BTC",
+ "type": "main",
+ "balance": "237582.04299",
+ "available": "237582.032",
+ "holds": "0.01099"
+},
+{
+ "id": "5bd6e9216d99522a52e458d6",
+ "currency": "BTC",
+ "type": "trade",
+ "balance": "1234356",
+ "available": "1234356",
+ "holds": "0"
+}]
+
+
+Get a list of accounts.
+ +See the Deposits section for documentation on how to deposit funds to begin trading.
+GET /api/v1/accounts
+Param | +Type | +Description | +
---|---|---|
currency | +string | +[optional] The code of the currency | +
type | +string | +[optional] Account type ,valid values: main or trade | +
Field | +Description | +
---|---|
id | +The id of the account | +
currency | +The currency of the account | +
type | +Account type ,main or trade | +
balance | +Total funds in the account | +
available | +Funds available to withdraw or trade | +
holds | +Funds on hold (not available for use) | +
For a currency, you have two types of accounts: main and trade. You can easily transfer assets between two accounts for free.
+ +The main account is mainly used for the storage, withdrawal and deposit of funds. The assets in the main account cannot be directly involved in the trading. The assets can be transferred to the trading account and then traded.
+ +The trading account is mainly used for trading. When you place a order, system will use the balance of the trading account. The balance of trading account cannot be used for withdrawal.
+When you place an order, the funds for the order are placed on hold. They cannot be used for other orders or withdrawn. Funds will remain on hold until the order is filled or canceled.
+This endpoint requires the "General" permission.
+{
+ "currency": "KCS",
+ "balance": "1000000060.6299",
+ "available": "1000000060.6299",
+ "holds": "0"
+}
+
+Information for a single account. Use this endpoint when you know the accountId.
+GET /api/v1/accounts/<accountId>
+Param | +Type | +Description | +
---|---|---|
accountId | +string | +id of the account | +
Field | +Description | +
---|---|
currency | +The currency of the account | +
balance | +Total funds in the account | +
holds | +Funds on hold (not available for use) | +
available | +Funds available to withdraw or trade | +
This endpoint requires the "General" permission.
+{
+ "id": "5bd6e9286d99522a52e458de"
+}
+
POST /api/v1/accounts
+Param | +Type | +Description | +
---|---|---|
type | +string | +Account type,main or trade | +
currency | +string | +Currency code | +
Field | +Description | +
---|---|
id | +Return the id of the new account | +
This endpoint requires the "General" permission.
+ +In order to use the API more quickly and conveniently, it is recommended that you create an account on the website first.
+List account activity. Account activity either increases or decreases your account balance. Items are paginated and sorted latest first. See the Pagination section for retrieving additional entries after the first page.
+{
+ "currentPage": 1,
+ "pageSize": 10,
+ "totalNum": 2,
+ "totalPage": 1,
+ "items": [{
+ "currency": "KCS",
+ "amount": "0.0998",
+ "fee": "0",
+ "balance": "1994.040596",
+ "bizType": "withdraw",
+ "direction": "in",
+ "createdAt": 1540296039000,
+ "context": {
+ "orderId": "5bc7f080b39c5c03286eef8a",
+ "currency": "BTC"
+ }
+ },
+ {
+ "currency": "KCS",
+ "amount": "0.0998",
+ "fee": "0",
+ "balance": "1994.140396",
+ "bizType": "trade exchange",
+ "direction": "in",
+ "createdAt": 1540296039000,
+ "context": {
+ "orderId": "5bc7f080b39c5c03286eef8e",
+ "tradeId": "5bc7f080b3949c03286eef8a",
+ "symbol": "BTC-USD"
+ }
+ }
+ ]
+}
+
GET /api/v1/accounts/<accountId>/ledgers
+Param | +Type | +Description | +
---|---|---|
accountId | +string | +Id of the account | +
startAt | +long | +[optional] Start time. Unix timestamp calculated in seconds, the creation time queried shall posterior to the start time | +
endAt | +long | +[optional] End time. Unix timestamp calculated in seconds, the creation time queried shall prior to the end time. | +
Entry type indicates the reason for the account change.
+Type | +Description | +
---|---|
currency | +The currency of the account | +
amount | +Total amount of assets (fees included) involved in assets changes such as transaction, withdrawal and bonus distribution. | +
fee | +Fees generated in transaction, withdrawal, etc. | +
balance | +Remaining funds after transaction | +
bizType | +Business type leading to the changes in funds, such as transaction, withdrawal, etc. | +
direction | +out or in | +
createdAt | +Time of the event | +
context | +Business involved information such as order ID, serial No., etc. | +
If an entry is the result of a trade (match, fee), the context field will contain additional information about the trade.
+This endpoint requires the "General" permission.
+ + +{
+ "currentPage": 1,
+ "pageSize": 10,
+ "totalNum": 2,
+ "totalPage": 1,
+ "items": [
+ {
+ "currency": "ETH",
+ "holdAmount": "5083",
+ "bizType": "Withdraw",
+ "orderId": "5bc7f080b39c5c03286eef8e",
+ "createdAt": 1545898567000,
+ "updatedAt": 1545898567000
+ },
+ {
+ "currency": "ETH",
+ "holdAmount": "1452",
+ "bizType": "Withdraw",
+ "orderId": "5bc7f518b39c5c033818d62d",
+ "createdAt": 1545898567000,
+ "updatedAt": 1545898567000
+ }
+ ]
+}
+
+Holds are placed on an account for any active orders or pending withdraw requests. As an order is filled, the hold amount is updated. If an order is canceled, any remaining hold is removed. For a withdraw, once it is completed, the hold is removed.
+GET /api/v1/accounts/<accountId>/holds
+Param | +Type | +Description | +
---|---|---|
accountId | +string | +Id of the account | +
Entry type indicates the reason for the account hold.
+Type | +Description | +
---|---|
currency | +the currency of the account | +
holdAmount | +Remaining funds freezed (remaining funds freezed = Initial funds freezed – Funds unfreezed) | +
bizType | +Business type leading to the freezing of the funds, such as transaction, withdrawal etc. | +
orderId | +ID of funds freezed order (only recognized identity) | +
createdAt | +Time of the event | +
updatedAt | +Update time | +
The orderId field contains the id of the order or withdraw which created the hold.
+This endpoint requires the "General" permission.
+ + +{
+ "orderId": "5bd6e9286d99522a52e458de"
+}
+
+The inner transfer interface is used for assets transfer among the accounts of a user and is free of charges on the platform. For example, a user could transfer assets for free from the main account to the trading account on the platform.
+POST /api/v1/accounts/inner-transfer
+Param | +Type | +Description | +
---|---|---|
clientOid | +string | +Request id | +
payAccountId | +string | +Account id of payer | +
recAccountId | +string | +Account id of receiver | +
amount | +string | +Transfer amount, a quantity that exceeds the precison of the currency. | +
Type | +Description | +
---|---|
orderId | +Id of funds transfer order | +
This endpoint requires the "Trade" permission.
+{
+ "address": "0x78d3ad1c0aa1bf068e19c94a2d7b16c9c0fcd8b1",
+ "memo": "5c247c8a03aa677cea2a251d"
+}
+
+Create deposit address of currency for deposit. +You can just create one deposit address.
+POST /api/v1/deposit-addresses
+This endpoint requires the "Transfer" permission.
+Param | +Type | +Description | +
---|---|---|
currency | +string | +Currency | +
Type | +Description | +
---|---|
address | +Deposit address | +
memo | +Address remark. If there’s no remark, it is empty. | +
{
+ "address": "0x78d3ad1c0aa1bf068e19c94a2d7b16c9c0fcd8b1",
+ "memo": "5c247c8a03aa677cea2a251d"
+}
+
+Get deposit address of currency for deposit. If return data is null , you may need create a deposit address first.
+GET /api/v1/deposit-addresses?currency=<currency>
+This endpoint requires the "General" permission.
+Param | +Type | +Description | +
---|---|---|
currency | +string | +Currency | +
Type | +Description | +
---|---|
address | +Deposit address | +
memo | +Address remark. If there’s no remark, it is empty. | +
{
+ "currentPage": 1,
+ "pageSize": 5,
+ "totalNum": 2,
+ "totalPage": 1,
+ "items": [{
+ "address": "0x5f047b29041bcfdbf0e4478cdfa753a336ba6989",
+ "memo": "5c247c8a03aa677cea2a251d",
+ "amount": 1,
+ "fee": 0.0001,
+ "currency": "KCS",
+ "isInner": false,
+ "walletTxId": "5bbb57386d99522d9f954c5a@test004",
+ "status": "SUCCESS",
+ "createdAt": 1544178843000,
+ "updatedAt": 1544178891000
+ }, {
+ "address": "0x5f047b29041bcfdbf0e4478cdfa753a336ba6989",
+ "memo": "5c247c8a03aa677cea2a251d",
+ "amount": 1,
+ "fee": 0.0001,
+ "currency": "KCS",
+ "isInner": false,
+ "walletTxId": "5bbb57386d99522d9f954c5a@test003",
+ "status": "SUCCESS",
+ "createdAt": 1544177654000,
+ "updatedAt": 1544178733000
+ }]
+}
+
+Get deposit page list.
+GET /api/v1/deposits
+This endpoint requires the "General" permission.
+Param | +Type | +Description | +
---|---|---|
currency | +string | +[optional] Currency | +
startAt | +long | +[optional] Start time. Unix timestamp calculated in milliseconds, the creation time queried shall posterior to the start time. | +
endAt | +long | +[optional] End time. Unix timestamp calculated in milliseconds, the creation time queried shall prior to the end time. | +
status | +string | +[optional] Status. Available value: PROCESSING, SUCCESS, and FAILURE | +
Type | +Description | +
---|---|
address | +Deposit address | +
memo | +Remark to the deposit address | +
amount | +Deposit amount | +
fee | +Deposit fee | +
currency | +Currency code | +
isInner | +Internal deposit or not | +
walletTxId | +Wallet Txid | +
status | +Status | +
createdAt | +Creation time of the database record | +
updatedAt | +Update time of the database record | +
{
+ "currentPage": 1,
+ "pageSize": 10,
+ "totalNum": 1,
+ "totalPage": 1,
+ "items": [{
+ "id": "5c2dc64e03aa675aa263f1ac",
+ "address": "0x5bedb060b8eb8d823e2414d82acce78d38be7fe9",
+ "memo": "",
+ "currency": "ETH",
+ "amount": 1.0000000,
+ "fee": 0.0100000,
+ "walletTxId": "3e2414d82acce78d38be7fe9",
+ "isInner": false,
+ "status": "FAILURE",
+ "createdAt": 1546503758000,
+ "updatedAt": 1546504603000
+ }]
+}
+
GET /api/v1/withdrawals
+This endpoint requires the "General" permission.
+Param | +Type | +Description | +
---|---|---|
currency | +string | +[optional] Currency code | +
status | +string | +[optional] Status. Available value: PROCESSING, WALLET_PROCESSING, SUCCESS, and FAILURE | +
startAt | +long | +[optional] Start time. Unix timestamp calculated in milliseconds, the creation time queried shall posterior to the start time. | +
endAt | +long | +[optional] End time. Unix timestamp calculated in milliseconds, the creation time queried shall prior to the end time. | +
Type | +Description | +
---|---|
id | +Unique identity | +
address | +Withdrawal address | +
memo | +Remark to the withdrawal address | +
currency | +Currency | +
amount | +Withdrawal amount | +
fee | +Withdrawal fee | +
walletTxId | +Wallet Txid | +
isInner | +Internal withdrawal or not | +
status | +status | +
createdAt | +Creation time | +
updatedAt | +Update time | +
{
+ "currency": "KCS",
+ "limitBTCAmount": "2.0",
+ "usedBTCAmount": "0",
+ "limitAmount": "75.67567568",
+ "remainAmount": "75.67567568",
+ "availableAmount": "9697.41991348",
+ "withdrawMinFee": "0.93000000",
+ "innerWithdrawMinFee": "0.00000000",
+ "withdrawMinSize": "1.4",
+ "isWithdrawEnabled": true,
+ "precision": 8
+}
+
GET /api/v1/withdrawals/quotas
+This endpoint requires the "General" permission.
+Param | +Type | +Description | +
---|---|---|
currency | +string | +currency. e.g. BTC | +
Type | +Description | +
---|---|
currency | +Currency | +
availableAmount | +Current available withdrawal amount | +
remainAmount | +Remaining amount available to withdraw the day | +
withdrawMinSize | +Minimum withdrawal amount | +
limitBTCAmount | +Total BTC amount available to withdraw the day | +
innerWithdrawMinFee | +Fees for internal withdrawal | +
usedBTCAmount | +The estimated BTC amount withdrawn the day | +
isWithdrawEnabled | +Available to withdraw or not | +
withdrawMinFee | +Minimum withdrawal amount | +
precision | +Precision | +
{
+ "withdrawalId": "5bffb63303aa675e8bbe18f9"
+}
+
POST /api/v1/withdrawals
+This endpoint requires the "Transfer" permission.
+Param | +Type | +Description | +
---|---|---|
currency | +string | +Currency | +
address | +string | +Withdrawal address | +
amount | +number | +Withdrawal amount, a multiple and positive number of the amount precision (fees excluded) | +
memo | +string | +[optional] Remark to the withdrawal address | +
isInner | +boolean | +[optional] Internal withdrawal or not. Default setup: false | +
remark | +string | +[optional] Remark | +
Type | +Description | +
---|---|
withdrawalId | +Withdrawal id | +
For cryptocurrency withdrawal, KuCoin supports internal and external transaction fee deduction, which means when the balance in your main account is sufficient to support the withdrawal, the system will initially deduct the transaction fees from your main account. But if the balance in your main account is not sufficient to support the withdrawal, the system will deduct the fees from your withdrawal amount.
+ +For example:
+ +Suppose you are going to withdraw 1 BTC from KuCoin platform (transaction fee: 0.0001BTC), if the balance in your main account is insufficient, the system will deduct the transaction fees from your withdrawal amount. In this case, you will be receiving 0.9999BTC actually.
+Only withdrawals in processing status could be cancelled.
+DELETE /api/v1/withdrawals/<withdrawalId>
+This endpoint requires the "Transfer" permission.
+Param | +Type | +Description | +
---|---|---|
withdrawalId | +string | +unique identity for withdrawal order | +
You need to sign the request to use the private trade API.
+{
+ "orderId": "5bd6e9286d99522a52e458de"
+}
+
+You can place two types of orders: limit and market. Orders can only be placed if your account has sufficient funds. Once an order is placed, your account funds will be put on hold for the duration of the order. How much and which funds are put on hold depends on the order type and parameters specified. See the Holds details below.
+ +Please be noted that the system would deduct the fees from the orders entered the orderbook in advance. Read List Fills to learn more.
+ +Do not include extra spaces in JSON strings.
+The maximum matching orders for a single trading pair in one account is 50 (stop orders included).
+POST /api/v1/orders
+This endpoint requires the "Trade" permission.
+Param | +type | +Description | +
---|---|---|
clientOid | +string | +Unique order id selected by you to identify your order e.g. UUID | +
side | +string | +buy or sell | +
symbol | +string | +a valid trading symbol code. e.g. ETH-BTC | +
type | +string | +[optional] limit or market (default is limit) | +
remark | +string | +[optional] remark for the order, length cannot exceed 100 utf8 characters | +
stop | +string | +[optional] Either loss or entry. Requires stopPrice to be defined | +
stopPrice | +string | +[optional] Only if stop is defined, sets trigger price for stop order | +
stp | +string | +[optional] self trade prevention , CN, CO, CB or DC | +
Param | +type | +Description | +
---|---|---|
price | +string | +price per base currency | +
size | +string | +amount of base currency to buy or sell | +
timeInForce | +string | +[optional] GTC, GTT, IOC, or FOK (default is GTC) | +
cancelAfter | +long | +[optional] cancel after n seconds | +
postOnly | +boolean | +[optional] Post only flag | +
hidden | +boolean | +[optional] Orders not displayed in order book | +
iceberg | +boolean | +[optional] Only visible portion of the order is displayed in the order book | +
visibleSize | +string | +[optional] The maximum visible size of an iceberg order | +
* Requires timeInForce to be GTT
+ +** Invalid when timeInForce is GTC, IOC or FOK
+ +Read Time In Force to learn about GTC、GTT、IOC、FOK.
+Param | +type | +Description | +
---|---|---|
size | +string | +[optional] Desired amount in base currency | +
funds | +string | +[optional] Desired amount of quote currency to use | +
The symbol must match a valid trading symbol. The symbols list is available via the /api/v1/symbols endpoint.
+The optional client_oid field must be a unique id (e.g UUID) generated by your trading application. This field value will be return in order detail. You can use this field to identify your orders in the public feed.
+ +The client_oid is different than the server-assigned order id. You should record the server-assigned order_id as it will be used for future order status updates.
+ +The server-assigned order id is also returned as the id field to this HTTP POST request.
+ + +When placing an order, you can specify the order type. The order type you specify will influence which other order parameters are required as well as how your order will be executed by the matching engine. If type is not specified, the order will default to a limit order.
+ +limit orders are both the default and basic order type. A limit order requires specifying a price and size. The size is the number of bitcoin to buy or sell, and the price is the price per bitcoin. The limit order will be filled at the price specified or better. A sell order can be filled at the specified price per bitcoin or a higher price per bitcoin and a buy order can be filled at the specified price or a lower price depending on market conditions. If market conditions cannot fill the limit order immediately, then the limit order will become part of the open order book until filled by another incoming order or canceled by the user.
+ +market orders differ from limit orders in that they provide no pricing guarantees. They however do provide a way to buy or sell specific amounts of bitcoin or fiat without having to specify the price. Market orders execute immediately and no part of the market order will go on the open order book. Market orders are always considered takers and incur taker fees. When placing a market order you can specify funds and/or size. Funds will limit how much of your quote currency account balance is used and size will limit the bitcoin amount transacted.
+Stop orders become active and wait to trigger based on the movement of the last trade price. There are two types of stop orders, stop loss and stop entry:
+ +stop: 'loss': Triggers when the last trade price changes to a value at or below the stopPrice.
+ +stop: 'entry': Triggers when the last trade price changes to a value at or above the stopPrice.
+ +The last trade price is the last price at which an order was filled. This price can be found in the latest match message. Note that not all match messages may be received due to dropped messages.
+ +Note that when triggered, stop orders execute as either market or limit orders, depending on the type.
+ +When placing a stop loss order, the system would pre-freeze the assets in your account for the order. When you are going to place a stop market order, we recommend you to specify the specific fund for the order when trading.
+The price must be specified in priceIncrement symbol units. The priceIncrement is the smallest unit of price. For the BTC-USDT symbol, the priceIncrement is 0.00001000. Prices less than 0.00001000 will not be accepted, The price for the placed order should be a multiple number of priceIncrement, or the system would report error when you place the order. Not required for market orders.
+The size must be greater than the baseMinSize for the symbol and no larger than the baseMaxSize. The size must be specified in baseIncrement symbol units. Size indicates the amount of BTC (or base currency) to buy or sell.
+The funds field is optionally used for market orders. When specified it indicates how much of the symbol quote currency to buy or sell. For example, a market buy for BTC-USDT with funds specified as 150.00 will spend 150 USD to buy BTC (including any fees). If the funds field is not specified for a market buy order, size must be specified and Kucoin will use available funds in your account to buy bitcoin.
+ +A market sell order can also specify the funds. If funds is specified, it will limit the sell to the amount of funds specified. You can use funds with sell orders to limit the amount of quote currency funds received.
+ +The funds must be greater than the quoteMinSize for the symbol and no larger than the quoteMaxSize. The size must be specified in quoteIncrement symbol units. Funds indicates the amount of USDT (or quote currency) to buy or sell.
+Time in force policies provide guarantees about the lifetime of an order. There are four policies: Good Till Canceled GTC, Good Till Time GTT, Immediate Or Cancel IOC, and Fill Or Kill FOK.
+ +GTC Good Till Canceled orders remain open on the book until canceled. This is the default behavior if no policy is specified.
+ +GTT Good Till Time orders remain open on the book until canceled or the allotted cancelAfter is depleted on the matching engine. GTT orders are guaranteed to cancel before any other order is processed after the cancelAfter seconds placed in order book.
+ +IOC Immediate Or Cancel orders instantly cancel the remaining size of the limit order instead of opening it on the book.
+ +FOK Fill Or Kill orders are rejected if the entire size cannot be matched.
+ +The post-only flag indicates that the order should only make liquidity. If any part of the order results in taking liquidity, the order will be rejected and no part of it will execute.
+The Hidden and iceberg Orders are two options in advanced settings (note: the iceberg order is a special form of the hidden order). You may select “Hidden” or “iceberg” as the policy when placing a limit or stop limit order.
+ +If you ticked “Hidden” when placing orders, your orders would be filled without being displayed on the orderbook. But please be noted that your order could still be viewed at the transaction history.
+ +Different from the hidden order, the iceberg order, as an special form of the hidden order, is divided into visible portion and invisible portion. When placing an iceberg order, you need to set the visible size. The maximum visible size for an iceberg order is 20 while the minimum visible size for it is 1/20 of the total order amount.
+ +Note: The minimum visible size shall be greater than the minimum order size.
+ +The visible portion of an iceberg order would be executed after being matched. After the execution, new portions of the iceberg order would come out until the order is fully filled.
+ +Note: 1)The system would charge taker fees for hidden and iceberg orders.2)If both "iceberg" and "hidden" are selected, your order will be filled as an iceberg order by default.
+For limit buy orders, we will hold price x size USDT. For sell orders, we will hold the number of Bitcoin you wish to sell. Actual fees are assessed at time of trade. If you cancel a partially filled or unfilled order, any remaining funds will be released from hold.
+ +For market buy orders where funds is specified, the funds amount will be put on hold. If only size is specified, all of your account balance (in the quote account) will be put on hold for the duration of the market order (usually a trivially short time). For a sell order, the size in BTC will be put on hold. If size is not specified (and only funds is specified), your entire BTC balance will be on hold for the duration of the market order.
+The Self-Trade Prevention is an option (set as not-selected by default) in advanced settings. When you specify STP when placing orders, your order will not fill your other orders. On the contrary, if you did not choose STP in Advanced, your order might be filled by your own orders. +Market order is currently not supported for DC.
+ +Flag | +Name | +
---|---|
DC | +Decrease and Cancel | +
CO | +Cancel oldest | +
CN | +Cancel newest | +
CB | +Cancel both | +
The HTTP Request will respond when an order is either rejected (insufficient funds, invalid parameters, etc) or received (accepted by the matching engine). A 200 response indicates that the order was received and is active. Active orders may execute immediately (depending on price and market conditions) either partially or fully. A partial execution will put the remaining size of the order in the open state. An order that is filled completely, will go into the done state.
+ +Users listening to streaming market data are encouraged to use the order id field to identify their received messages in the feed.
+A successful order will be assigned an order id. A successful order is defined as one that has been accepted by the matching engine.
+ + +{
+ "cancelledOrderIds": [
+ "5bd6e9286d99522a52e458de"
+ ]
+}
+
+Cancel a previously placed order.
+ +You would receive the request return once the system has received the cancellation request. The cancellation request will be processed by matching engine in sequence. To know if the request is processed(success or not), you may check the order status or update message from the pushes.
+DELETE /api/v1/orders/<order-id>
+This endpoint requires the "Trade" permission.
+ + +If the order could not be canceled (already filled or previously canceled, etc), then an error response will indicate the reason in the message field.
+{
+ "cancelledOrderIds": [
+ "5c52e11203aa677f33e493fb",
+ "5c52e12103aa677f33e493fe",
+ "5c52e12a03aa677f33e49401",
+ "5c52e1be03aa677f33e49404",
+ "5c52e21003aa677f33e49407",
+ "5c6243cb03aa67580f20bf2f",
+ "5c62443703aa67580f20bf32",
+ "5c6265c503aa676fee84129c",
+ "5c6269e503aa676fee84129f",
+ "5c626b0803aa676fee8412a2"
+ ]
+}
+
+With best effort, cancel all open orders. The response is a list of ids of the canceled orders.
+DELETE /api/v1/orders
+This endpoint requires the "Trade" permission.
+You can delete specific symbol using query parameters.
+ +Param | +Type | +Description | +
---|---|---|
symbol | +string | +[optional] Only cancel orders open for a specific symbol | +
{
+ "currentPage": 1,
+ "pageSize": 1,
+ "totalNum": 153408,
+ "totalPage": 153408,
+ "items": [
+ {
+ "id": "5c35c02703aa673ceec2a168",
+ "symbol": "BTC-USDT",
+ "opType": "DEAL",
+ "type": "limit",
+ "side": "buy",
+ "price": "10",
+ "size": "2",
+ "funds": "0",
+ "dealFunds": "0.166",
+ "dealSize": "2",
+ "fee": "0",
+ "feeCurrency": "USDT",
+ "stp": "",
+ "stop": "",
+ "stopTriggered": false,
+ "stopPrice": "0",
+ "timeInForce": "GTC",
+ "postOnly": false,
+ "hidden": false,
+ "iceberg": false,
+ "visibleSize": "0",
+ "cancelAfter": 0,
+ "channel": "IOS",
+ "clientOid": "",
+ "remark": "",
+ "tags": "",
+ "isActive": false,
+ "cancelExist": false,
+ "createdAt": 1547026471000
+ }
+ ]
+ }
+
+List your current orders.
+GET /api/v1/orders
+This endpoint requires the "General" permission.
+You can request for specific orders using query parameters.
+ +Param | +Type | +Description | +
---|---|---|
status | +string | +[optional] active or done, done as default, Only list orders for a specific status . | +
symbol | +string | +[optional] Only list orders for a specific symbol. | +
side | +string | +[optional] buy or sell | +
type | +string | +[optional] limit, market, limit_stop or market_stop | +
startAt | +long | +[optional] Start time. Unix timestamp calculated in milliseconds, the creation time queried shall posterior to the start time. | +
endAt | +long | +[optional] End time. Unix timestamp calculated in milliseconds, the creation time queried shall prior to the end time. | +
Orders which are resting on the order book, will be marked with the active status. Orders which are no longer resting on the order book, will be marked with the done status. There is a small window between an order being done and settled. An order is settled when all of the fills have settled and the remaining holds (if any) have been removed.
+ +For order checking, after inputting the correct parameters, you could check the orders in all status. But if the status parameter is not input into the orders interface, the system would return the orders of done status to you by default.
+ +When you query orders, there is no time limit for the active status of order. The order of the done status can only query data within time range of 24 hours (the start and end time range cannot exceed 24 hours). If it exceeds 24 hours, the system will prompt you exceed the time limit.If you pass the start time when querying orders and do not pass the end time, the system will automatically construct the end time as the start time + 24 hours, and vice versa.
+For high-volume trading it is strongly recommended that you maintain your own list of open orders and use one of the streaming market data feeds to keep it updated. You should poll the open orders endpoint once when you start trading to obtain the current state of any open orders.
+ + +{
+ "currentPage": 1,
+ "pageSize": 1,
+ "totalNum": 153408,
+ "totalPage": 153408,
+ "items": [
+ {
+ "id": "5c35c02703aa673ceec2a168",
+ "symbol": "BTC-USDT",
+ "opType": "DEAL",
+ "type": "limit",
+ "side": "buy",
+ "price": "10",
+ "size": "2",
+ "funds": "0",
+ "dealFunds": "0.166",
+ "dealSize": "2",
+ "fee": "0",
+ "feeCurrency": "USDT",
+ "stp": "",
+ "stop": "",
+ "stopTriggered": false,
+ "stopPrice": "0",
+ "timeInForce": "GTC",
+ "postOnly": false,
+ "hidden": false,
+ "iceberg": false,
+ "visibleSize": "0",
+ "cancelAfter": 0,
+ "channel": "IOS",
+ "clientOid": "",
+ "remark": "",
+ "tags": "",
+ "isActive": false,
+ "cancelExist": false,
+ "createdAt": 1547026471000
+ }
+ ]
+ }
+
+Get a list of 1000 orders in the last 24 hours.
+GET /api/v1/limit/orders
+This endpoint requires the "General" permission.
+ + + + +{
+ "id": "5c35c02703aa673ceec2a168",
+ "symbol": "BTC-USDT",
+ "opType": "DEAL",
+ "type": "limit",
+ "side": "buy",
+ "price": "10",
+ "size": "2",
+ "funds": "0",
+ "dealFunds": "0.166",
+ "dealSize": "2",
+ "fee": "0",
+ "feeCurrency": "USDT",
+ "stp": "",
+ "stop": "",
+ "stopTriggered": false,
+ "stopPrice": "0",
+ "timeInForce": "GTC",
+ "postOnly": false,
+ "hidden": false,
+ "iceberg": false,
+ "visibleSize": "0",
+ "cancelAfter": 0,
+ "channel": "IOS",
+ "clientOid": "",
+ "remark": "",
+ "tags": "",
+ "isActive": false,
+ "cancelExist": false,
+ "createdAt": 1547026471000
+ }
+
+Get a single order by order id.
+GET /api/v1/orders/<order-id>
+This endpoint requires the "General" permission.
+ + + + + + +{
+ "currentPage":1,
+ "pageSize":1,
+ "totalNum":251915,
+ "totalPage":251915,
+ "items":[
+ {
+ "symbol":"BTC-USDT",
+ "tradeId":"5c35c02709e4f67d5266954e",
+ "orderId":"5c35c02703aa673ceec2a168",
+ "counterOrderId":"5c1ab46003aa676e487fa8e3",
+ "side":"buy",
+ "liquidity":"taker",
+ "forceTaker":true,
+ "price":"0.083",
+ "size":"0.8424304",
+ "funds":"0.0699217232",
+ "fee":"0",
+ "feeRate":"0",
+ "feeCurrency":"USDT",
+ "stop":"",
+ "type":"limit",
+ "createdAt":1547026472000
+ }
+ ]
+}
+
+Get a list of recent fills.
+GET /api/v1/fills
+This endpoint requires the "General" permission.
+You can request fills for specific orders using query parameters.
+ +Param | +Type | +Description | +
---|---|---|
orderId | +string | +[optional] Limit list of fills to this orderId(If you specify orderId, ignore other conditions) | +
symbol | +string | +[optional] Limit list of fills to this symbol | +
side | +string | +[optional] buy or sell | +
type | +string | +[optional] limit, market, limit_stop or market_stop | +
startAt | +long | +[optional] Start time. Unix timestamp calculated in milliseconds, the creation time queried shall posterior to the start time. | +
endAt | +long | +[optional] End time. Unix timestamp calculated in milliseconds, the creation time queried shall prior to the end time. | +
Settlement
+ +The settlement contains two parts: 1) Transactional settlement and 2) Fee settlement. After an order is matched, the transactional and fee settlement data would be updated in the data store. Once the data is updated, the system would enable the settlement process and deduct the fees from your pre-frozen assets. After that, the currency would be transferred to the account of the user.
+ +Fees
+ +With the leading matching engine system in the market, users placing orders on KuCoin platform are classified into two types: taker and maker. Takers, as the taker in the market, would be charged with taker fees; while makers as the maker in the market, would be charged with less fees than the taker, or even get maker fees from KuCoin (The exchange platform would compensate the transaction fees for you).
+ +After placing orders on the KuCoin platform, to ensure the execution of these orders, the system would pre-freeze your assets based on the taker fee charges (because the system could not predict the order types you may choose). Please be noted that the system would deduct the fees from the orders entered the orderbook in advance.
+ +If your order is market order, the system would charge taker fees from you.
+ +If your order is limit order and is immediately matched and executed, the system would charge taker fees from you. On the contrary, if the order or part or your order is not executed immediately and enters into the order book, the system would charge maker fees from you if it is executed before being cancelled
+ +After the order is executed and when the left order funds are 0, the transaction is completed. If the remaining funds is not sufficient to support the minimum product (min.: 0.00000001), then the left part in the order would be cancelled.
+ +If your order is a maker order, the system would return the left pre-frozen taker fees to you.
+ +Notice: For a hidden/iceberg order, if it is not executed immediately and becomes a maker order, the system would still charge taker fees from you.
+ +For example:
+ +Take BTC/USDT as the trading pair, if you plan to buy 1 BTC in market price, suppose the fee charge is 0.1% and the data on the order book is as follows:
+ +Price(USDT) | +Size(BTC) | +Side | +
---|---|---|
4200.00 | +0.18412309 | +sell | +
4015.60 | +0.56849308 | +sell | +
4011.32 | +0.24738383 | +sell | +
3995.64 | +0.84738383 | +buy | +
3988.60 | +0.20484000 | +buy | +
3983.85 | +1.37584908 | +buy | +
When you placed a buy order in market price, the order would be executed immediately. The transaction detail is as follows:
+ +Price(USDT) | +Size(BTC) | +Fee(BTC) | +
---|---|---|
4011.32 | +0.24738383 | +0.00024738 | +
4015.60 | +0.56849308 | +0.00056849 | +
4200.00 | +0.18312409 | +0.00018312 | +
The liquidity field indicates if the fill was the result of a liquidity provider or liquidity taker.
+Fills are returned sorted by descending fill time.
+ + +{
+ "currentPage":1,
+ "pageSize":1,
+ "totalNum":251915,
+ "totalPage":251915,
+ "items":[
+ {
+ "symbol":"BTC-USDT",
+ "tradeId":"5c35c02709e4f67d5266954e",
+ "orderId":"5c35c02703aa673ceec2a168",
+ "counterOrderId":"5c1ab46003aa676e487fa8e3",
+ "side":"buy",
+ "liquidity":"taker",
+ "forceTaker":true,
+ "price":"0.083",
+ "size":"0.8424304",
+ "funds":"0.0699217232",
+ "fee":"0",
+ "feeRate":"0",
+ "feeCurrency":"USDT",
+ "stop":"",
+ "type":"limit",
+ "createdAt":1547026472000
+ }
+ ]
+}
+
+Get a list of 1000 fills in the last 24 hours.
+GET /api/v1/limit/fills
+This endpoint requires the "General" permission.
+ + + + +Market data is public and can be used without a signed request.
+[
+ {
+ "symbol": "BTC-USDT",
+ "name": "BTC-USDT",
+ "baseCurrency": "BTC",
+ "quoteCurrency": "USDT",
+ "baseMinSize": "0.00000001",
+ "quoteMinSize": "0.01",
+ "baseMaxSize": "10000",
+ "quoteMaxSize": "100000",
+ "baseIncrement": "0.00000001",
+ "quoteIncrement": "0.01",
+ "priceIncrement": "0.00000001",
+ "enableTrading": true
+ }
+]
+
+Get a list of available currency pairs for trading. This API is used to query related configuration information. If you want to get the market information of the trading symbol, please use AllTicker.
+ +This API
+GET /api/v1/symbols
+You can query all symbols through market parameter.
+ +Param | +Type | +Description | +
---|---|---|
market | +string | +[optional] The trading market. | +
Field | +Type | +Description | +
---|---|---|
symbol | +string | +unique code of symbol, it would not change after renaming | +
name | +string | +Name of trading pair, it would change after renaming | +
baseCurrency | +string | +Base currency | +
quoteCurrency | +string | +Quote currency | +
baseMinSize | +string | +Minimum order quantity | +
quoteMinSize | +string | +Minimum order amount | +
baseMaxSize | +string | +Maximum order quantity | +
quoteMaxSize | +string | +Maximum order amount | +
baseIncrement | +string | +Market order: quantity increment | +
quoteIncrement | +string | +Market order: amount increment | +
priceIncrement | +string | +Limit order: price increment | +
enableTrading | +boolean | +Available for transaction or not | +
The baseMinSize and baseMaxSize fields define the min and max order size. The priceIncrement field specifies the min order price as well as the price increment.This also applies to quote currency.
+ +The order price must be a multiple of this increment (i.e. if the increment is 0.01, order prices of 0.001 or 0.021 would be rejected).
+ + +//Get Ticker
+{
+ "sequence": "1550467636704",
+ "bestAsk": "0.03715004",
+ "size": "0.17",
+ "price": "0.03715005",
+ "bestBidSize": "3.803",
+ "bestBid": "0.03710768",
+ "bestAskSize": "1.788",
+ "time": 1550653727731
+
+}
+
+Ticker include only the inside (i.e. best) buy and sell(buy and sell represent bestBid and bestAsk) data , last price and last trade size.
+GET /api/v1/market/orderbook/level1?symbol=<symbol>
+ + +{
+ "time": 1550653727731,
+ "ticker": [
+ {
+ "symbol": "LOOM-BTC",
+ "buy": "0.00001191",
+ "sell": "0.00001206",
+ "changeRate": "0.057",
+ "changePrice": "0.00000065",
+ "high": "0.0000123",
+ "low": "0.00001109",
+ "vol": "45161.5073",
+ "last": "0.00001204"
+ },
+ {
+ "symbol": "BCD-BTC",
+ "buy": "0.00018564",
+ "sell": "0.0002",
+ "changeRate": "-0.0753",
+ "changePrice": "-0.00001522",
+ "high": "0.00021489",
+ "low": "0.00018351",
+ "vol": "72.99679763",
+ "last": "0.00018664"
+ }
+ ]
+ }
+
+Require market ticker for all trading pairs in the market (including 24h volume).
+GET /api/v1/market/allTickers
+ + +//Get 24hr Stats
+{
+ "symbol": "ETH-BTC",
+ "changeRate": "-0.778",
+ "changePrice": "-0.00778",
+ "open": 1,
+ "close": 0.99222,
+ "high": "1",
+ "low": "0.00222",
+ "vol": "4.2678",
+ "volValue": "2.21016762"
+}
+
+Get 24 hr stats for the symbol. volume is in base currency units. open, high, low are in quote currency units.
+GET /api/v1/market/stats?symbol=<symbol>
+ + +//Get Market List
+{
+ "data":[
+ "BTC",
+ "ETH",
+ "USDT"
+ ]
+}
+
+Get the transaction currency for the entire trading market.
+GET /api/v1/markets
+ + +{
+ "sequence": "3262786978",
+ "time": 1550653727731,
+ "bids": [["6500.12", "0.45054140"],
+ ["6500.11", "0.45054140"]], //[price,size]
+ "asks": [["6500.16", "0.57753524"],
+ ["6500.15", "0.57753524"]]
+}
+
+Get a list of open orders for a symbol.
+ +Level-2 order book includes all bids and asks (aggregated by price), this level return only one size for each active price (as if there was only a single order for that size at the level).
+ +This API will return a part of Order Book within 20 depth or 100 depth for each side(ask or bid). we need to remind you that L2_20 and L2_100 api are different at the rate limit.
+ +It is recommended to use in most cases, it is the fastest Order Book API, and reduces traffic usage.
+ +To maintain up-to-date Order Book in real time, please use it with Websocket Feed.
+GET /api/v1/market/orderbook/level2_20?symbol=<symbol>
+ +GET /api/v1/market/orderbook/level2_100?symbol=<symbol>
+Asks: Sort price from low to high
+ +Bids: Sort price from high to low
+{
+ "sequence": "3262786978",
+ "time": 1550653727731,
+ "bids": [["6500.12", "0.45054140"],
+ ["6500.11", "0.45054140"]], //[price,size]
+ "asks": [["6500.16", "0.57753524"],
+ ["6500.15", "0.57753524"]]
+}
+
+Get a list of open orders for a symbol.
+ +Level-2 order book includes all bids and asks (aggregated by price), this level return only one size for each active price (as if there was only a single order for that size at the level).
+ +This API will return data with full depth.
+ +It is generally used by professional traders because it uses more server resources and traffic, and we have strict access frequency control.
+ +To maintain up-to-date Order Book in real time, please use it with Websocket Feed.
+GET /api/v1/market/orderbook/level2?symbol=<symbol> (Will be deprecated on December 31, 2019)
+ +GET /api/v2/market/orderbook/level2?symbol=<symbol> (Recommend)
+Asks: Sort price from low to high (v2)
+ +Asks: Sort price from high to low (v1)
+ +Bids: Sort price from high to low (v1 & v2)
+ {
+ "sequence": "1545896707028",
+ "time": 1550653727731,
+ "bids": [
+ [
+ "5c2477e503aa671a745c4057", //orderId
+ "6", //price
+ "0.999" //size
+ ],
+ [
+ "5c2477e103aa671a745c4054",
+ "5",
+ "0.999"
+ ]
+ ],
+ "asks": [
+ [
+ "5c24736703aa671a745c401e",
+ "200",
+ "1"
+ ],
+ [
+ "5c2475c903aa671a745c4033",
+ "201",
+ "1"
+ ]
+ ]
+ }
+
+Get a list of open orders for a symbol. Level-3 order book includes all bids and asks (non-aggregated, each item in Level-3 means a single order).
+ +Level 3 is non-aggregated and returns the entire order book.
+ +This API is generally used by professional traders because it uses more server resources and traffic, and we have strict access frequency control.
+ +To Maintain up-to-date Order Book in real time, please use it with Websocket Feed.
+GET /api/v1/market/orderbook/level3?symbol=<symbol>
+Asks: Sort price from low to high
+ +Bids: Sort price from high to low
+ + +[
+ {
+ "sequence": "1545896668571",
+ "price": "0.07", //Filled price
+ "size": "0.004", //Filled amount
+ "side": "buy", //Filled side. The filled side is set to the taker by default.
+ "time": 1545904567062140823 //Transaction time
+ },
+ {
+ "sequence": "1545896668578",
+ "price": "0.054",
+ "size": "0.066",
+ "side": "buy",
+ "time": 1545904581619888405
+ }
+]
+
+List the latest trades for a symbol.
+GET /api/v1/market/histories?symbol=<symbol>
+The trade side indicates the taker order side. The taker order is the order that was match with orders opened on the order book. buy side indicates a up-tick because the taker was a buy order and their order was received. Conversely, sell side indicates an down-tick.
+ + +[
+ [
+ "1545904980", //Start time of the candle cycle
+ "0.058", //opening price
+ "0.049", //closing price
+ "0.058", //highest price
+ "0.049", //lowest price
+ "0.018", //Transaction amount
+ "0.000945" //Transaction volume
+ ],
+ [
+ "1545904920",
+ "0.058",
+ "0.072",
+ "0.072",
+ "0.058",
+ "0.103",
+ "0.006986"
+ ]
+]
+
+Historic rates for a symbol. Rates are returned in grouped buckets based on requested type.
+ + + + +GET /api/v1/market/candles?symbol=<symbol>
+ +Param | +Description | +
---|---|
startAt | +Start time. Unix timestamp calculated in seconds not millisecond | +
endAt | +End time. Unix timestamp calculated in seconds not millisecond | +
type | +Type of candlestick patterns: 1min, 3min, 5min, 15min, 30min, 1hour, 2hour, 4hour, 6hour, 8hour, 12hour, 1day, 1week | +
For each query, the system would return at most 1500 pieces of data. To obtain more data, please page the data by time.
+Each bucket is an array of the following information:
+ +GET /api/v1/market/stats
+These interfaces are public and do not require authentication.
+
+[{
+ "currency": "BTC",
+ "name": "BTC",
+ "fullName": "Bitcoin",
+ "precision": 8,
+ "withdrawalMinSize": "0.002",
+ "withdrawalMinFee": "0.0005",
+ "isWithdrawEnabled": true,
+ "isDepositEnabled": true
+},
+{
+
+ "currency": "ETH",
+ "name": "ETH",
+ "fullName": "Ethereum",
+ "precision": 8,
+ "withdrawalMinSize": "0.02",
+ "withdrawalMinFee": "0.01",
+ "isWithdrawEnabled": true,
+ "isDepositEnabled": true
+
+}]
+
+
+List known currencies.
+GET /api/v1/currencies
+ + + +Response
+ +field | +description | +
---|---|
currency | +Unique and never change | +
name | +The currency name would change after renaming | +
fullName | +The currency full name would change after renaming | +
precision | +Currency precision | +
withdrawalMinSize | +Minimum withdrawal amount | +
withdrawalMinFee | +Minimum withdrawal fees | +
isWithdrawEnabled | +Support withdrawal or not | +
isDepositEnabled | +Support deposit or not | +
CURRENCY CODES
+ +Currency codes will conform to the ISO 4217 standard where possible. Currencies which have or had no representation in ISO 4217 may use a custom code.
+ +Code | +Description | +
---|---|
BTC | +Bitcoin | +
ETH | +Ethereum | +
KCS | +Kucoin Shares | +
For a coin, the "currency" is a fixed value and works as the only recognized identity of the coin. As the "name", "fullnane" and "precision" of a coin are values modifiable, when the "name" of a coin is changed, you should use "currency" to get the coin.
+ +For example:
+ +The "currency" of XRB is "XRB", if the "name" of XRB is changed into "Nano", you should use "XRB" (the currency of XRB) to search the coin.
+Get single currency detail
+{
+ "currency": "BTC",
+ "name": "BTC",
+ "fullName": "Bitcoin",
+ "precision": 8,
+ "withdrawalMinSize": "0.002",
+ "withdrawalMinFee": "0.0005",
+ "isWithdrawEnabled": true,
+ "isDepositEnabled": true
+ }
+
GET /api/v1/currencies/{currency}
+ + + +Response
+ +field | +description | +
---|---|
currency | +Unique and never change | +
name | +The currency name would change after renaming | +
fullName | +The currency full name would change after renaming | +
precision | +Currency precision | +
withdrawalMinSize | +Minimum withdrawal amount | +
withdrawalMinFee | +Minimum withdrawal fees | +
isWithdrawEnabled | +Support withdrawal or not | +
isDepositEnabled | +Support deposit or not | +
Get fiat price for currency
+{
+ "code": "200000",
+ "data": {
+ "BTC": "3911.28000000",
+ "ETH": "144.55492453",
+ "LTC": "48.45888179",
+ "KCS": "0.45546856"
+ }
+}
+
GET /api/v1/prices
+ +Response
+ +field | +description | +
---|---|
base | +[optional] Fiat,eg.USD,EUR, default is USD | +
currencies | +[optional] Cryptocurrencies.For multiple cyrptocurrencies, please separate them with comma one by one. default is all | +
Here are some comprehensive interfaces.
+{
+ "code":"200000",
+ "msg":"success",
+ "data":1546837113087
+}
+
+Get the API server time.
+GET /api/v1/timestamp
+ +EPOCH +The epoch field represents decimal seconds since Unix Epoch
+REST API has a strict call frequency limit, Websocket is the most recommended and fastest way to get real-time data.
+ + +{
+ "code": "200000",
+ "data": {
+ "instanceServers": [
+ {
+ "pingInterval": 50000,
+ "endpoint": "wss://push1-v2.kucoin.net/endpoint",
+ "protocol": "websocket",
+ "encrypt": true,
+ "pingTimeout": 10000
+ }
+ ],
+ "token": "vYNlCtbz4XNJ1QncwWilJnBtmmfe4geLQDUA62kKJsDChc6I4bRDQc73JfIrlFaVYIAE0Gv2--MROnLAgjVsWkcDq_MuG7qV7EktfCEIphiqnlfpQn4Ybg==.IoORVxR2LmKV7_maOR9xOg=="
+ }
+}
+
+You need to apply for a token to create a websocket connection. You only need to choose one of the below two tokens.
+If you only use public channels(e.g. All public market data), please make request as follows to obtain the server list and temporary public token:
+POST /api/v1/bullet-public
+{
+ "code": "200000",
+ "data": {
+ "instanceServers": [
+ {
+ "pingInterval": 50000,
+ "endpoint": "wss://push1-v2.kucoin.com/endpoint",
+ "protocol": "websocket",
+ "encrypt": true,
+ "pingTimeout": 10000
+ }
+ ],
+ "token": "vYNlCtbz4XNJ1QncwWilJnBtmmfe4geLQDUA62kKJsDChc6I4bRDQc73JfIrlFaVYIAE0Gv2--MROnLAgjVsWkcDq_MuG7qV7EktfCEIphiqnlfpQn4Ybg==.IoORVxR2LmKV7_maOR9xOg=="
+ }
+}
+
+For request some additional private channels and messages (e.g. Account balance notice), please make request as follows after authorization to obtain the server list and authorized token.
+POST /api/v1/bullet-private
+field | +description | +
---|---|
pingInterval | +Recommended to send ping interval in millisecond | +
pingTimeout | +After such a long time(millisecond), if you do not receive pong, it will be considered as disconnected. | +
endpoint | +Websocket server address for establishing connection | +
protocol | +Protocol supported | +
encrypt | +Indicate whether SSL encryption is used | +
var socket = new WebSocket("wss://push1.kucoin.com/endpoint?token=xxx&[connectId=xxxxx]");
+
+When the connection is successfully established, the system will send a welcome message.
+{
+ "id":"hQvf8jkno",
+ "type":"welcome"
+}
+
+The connectId is connection id, a unique value taken from the client side. Both the id of the welcome message sent by system after the connection succeed as well as the id of the error message are connectId.
+ + +{
+ "id":"1545910590801",
+ "type":"ping"
+}
+
+To prevent the TCP link being disconnected by the server, the client side needs to send ping messages to the server to keep alive the link.
+ +After the ping message is sent to the server, the system would return a pong message to the client side.
+ +If the server has not received the ping from the client for 60 seconds, the server will disconnect.
+{
+ "id":"1545910590801",
+ "type":"pong"
+}
+
+
+{
+ "id": 1545910660739, //The id should be an unique value
+ "type": "subscribe",
+ "topic": "/market/ticker:BTC-USDT,ETH-USDT", //Topic needs to be subscribed. Some topics support to divisional subscribe the informations of multiple trading pairs through ",".
+ "privateChannel": false, //Adopted the private channel or not. Set as false by default.
+ "response": true //Whether the server needs to return the receipt information of this subscription or not. Set as false by default.
+}
+
+To subscribe channel messages from certain server, the client side should send subscription message to the server.
+ +If the subscription succeed, the system would send ack messages to you. When the response is set as true.
+{
+ "id":"1545910660739",
+ "type":"ack"
+}
+
+While there are topic messages generated, the system would send the corresponding messages to the client side. For details about the message format, please check the definitions of topics.
+Unique string to mark the request.
+The topic you want to subscribe to.
+For some specific topics (e.g. /market/level3), privateChannel is available. The default value of privateChannel is false. If the privateChannel is set to true, the user will only receive messages related himself on the topic. The format of the topic field in the returned data is {topic}:privateChannel:{userId}.
+If the response is set as ture, the system would return the ack messages after the unsubscription succeed.
+Unsubscribe from topics you have subscribed to.
+{
+ "id": "1545910840805", //The id should be an unique value
+ "type": "unsubscribe",
+ "topic": "/market/ticker:BTC-USDT,ETH-USDT", //Topic needs to be unsubscribed. Some topics support to divisional unsubscribe the informations of multiple trading pairs through ",".
+ "privateChannel": false,
+ "response": true, //Whether the server needs to return the receipt information of this subscription or not. Set as false by default.
+}
+
{
+ "id": "1545910840805",
+ "type": "ack"
+}
+
Unique string to mark the request.
+The topic you want to subscribe to.
+For some specific public topics (e.g. /market/level3), privateChannel is available. The default value of privateChannel is false. If the privateChannel is set to true, the user will only receive messages related himself on the topic. The format of the topic field in the returned data is {topic}:privateChannel:{userId}.
+If the response is set as ture, the system would return the ack messages after the unsubscription succeed.
+In one physical connection, you could open different multiplex tunnels to subscribe different topics for different data.
+ +For example, enter command below to open bt1 multiple tunnel :
+ +{"id": "1Jpg30DEdU", "type": "openTunnel", "newTunnelId": "bt1", "response": true}
+ +Add “tunnelId” in the command:
+ +{"id": "1JpoPamgFM", "type": "subscribe", "topic": "/market/ticker:KCS-BTC","tunnelId": "bt1", "response": true}
+ +You would then, receive messages corresponded to id tunnelIId:
+ +{"id": "1JpoPamgFM", "type": "message", "topic": "/market/ticker:KCS-BTC", "subject": "trade.ticker", "tunnelId": "bt1", "data": {...}}
+ +To close the tunnel, you could enter command below:
+ +{"id": "1JpsAHsxKS", "type": "closeTunnel", "tunnelId": "bt1", "response": true}
+The sequence field exists in order book, trade history and snapshot messages by default and the level 3 and level 2 data works to ensure the full connection of the sequence. If the sequence is non-sequential, please enable the calibration logic.
+1.Judge message type. There are three types of messages at present: message (the commonly used messages for push), notice (the notices general used), and command (consecutive command).
+ +2.Judge messages by userId. Messages with userId are private messages, messages without userId are common messages.
+ +3.Judge messages by topic. You could judge the message type through topic.
+ +4.Judge messages by subject. For the same type of messages with the same topic, you could judge the type of messages through their subjects.
+
+{
+ "id": 1545910660739,
+ "type": "subscribe",
+ "topic": "/market/ticker:BTC-USDT",
+ "response": true
+}
+
+Topic: /market/ticker:{symbol},{symbol}...
+{
+ "type":"message",
+ "topic":"/market/ticker:BTC-USDT",
+ "subject":"trade.ticker",
+ "data":{
+ "sequence":"1545896668986",
+ "bestAsk":"0.08",
+ "size":"0.011",
+ "bestBidSize":"0.036",
+ "price":"0.08",
+ "bestAskSize":"0.18",
+ "bestBid":"0.049"
+ }
+}
+
+Subscribe this topic to get the realtime push of BBO changes.
+ +The ticker channel provides real-time price updates every time a match happens. It batches updates in case of cascading matches, greatly reducing bandwidth requirements.
+ +Please note that more information will be added to messages from this channel in the near future.
+ + + + +
+{
+ "id": 1545910660739,
+ "type": "subscribe",
+ "topic": "/market/ticker:all",
+ "response": true
+}
+
+Topic: /market/ticker:all
+{
+ "type":"message",
+ "topic":"/market/ticker:all",
+ "subject":"BTC-USDT",
+ "data":{
+ "sequence":"1545896668986",
+ "bestAsk":"0.08",
+ "size":"0.011",
+ "bestBidSize":"0.036",
+ "price":"0.08",
+ "bestAskSize":"0.18",
+ "bestBid":"0.049"
+ }
+}
+
+Subscribe this topic to get the realtime push of all market symbols BBO change.
+ +The ticker channel provides real-time price updates every 1 second happens.
+ + + + +{
+ "data": {
+ "sequence": "1545896669291",
+ "data": [{
+ "trading": true,
+ "symbol": "KCS-BTC",
+ "buy": 0.00011,
+ "sell": 0.00012,
+ "sort": 100,
+ "volValue": 3.13851792584,
+ "baseCurrency": "KCS",
+ "market": "BTC",
+ "quoteCurrency": "BTC",
+ "symbolCode": "KCS-BTC",
+ "datetime": 1548388122031,
+ "high": 0.00013,
+ "vol": 27514.34842,
+ "low": 0.0001,
+ "changePrice": -1.0e-5,
+ "changeRate": -0.0769,
+ "lastTradedPrice": 0.00012,
+ "board": 0,
+ "mark": 0
+ }]
+ },
+ "subject": "trade.snapshot",
+ "topic": "\/market\/snapshot:BTC",
+ "type": "message"
+}
+
+Topic: /market/snapshot:{symbol}
+ +Subscribe to get the single symbol snapshot data.
+ +The snapshot data is pushed every 2 seconds interval.
+ + + + + + +{
+ "data": {
+ "sequence": "1545896669291",
+ "data": {
+ "trading": true,
+ "symbol": "KCS-BTC",
+ "buy": 0.00011,
+ "sell": 0.00012,
+ "sort": 100,
+ "volValue": 3.13851792584,
+ "baseCurrency": "KCS",
+ "market": "BTC",
+ "quoteCurrency": "BTC",
+ "symbolCode": "KCS-BTC",
+ "datetime": 1548388122031,
+ "high": 0.00013,
+ "vol": 27514.34842,
+ "low": 0.0001,
+ "changePrice": -1.0e-5,
+ "changeRate": -0.0769,
+ "lastTradedPrice": 0.00012,
+ "board": 0,
+ "mark": 0
+ }
+ },
+ "subject": "trade.snapshot",
+ "topic": "\/market\/snapshot:KCS-BTC",
+ "type": "message"
+}
+
+Topic: /market/snapshot:{market}
+ +Subscribe to get snapshot data for the entire market.
+ +You can get market list by Get Market List.
+ +The snapshot data is pushed every 2 seconds interval.
+ + + + + + +{
+ "id": 1545910660740,
+ "type": "subscribe",
+ "topic": "/market/level2:BTC-USDT",
+ "response": true
+}
+
+Topic: /market/level2:{symbol},{symbol}...
+ +Subscribe this topic to get Level2 order book data.
+ +After the conducts, the system would send the increment change data pushed by websocket to you.
+{
+ "type":"message",
+ "topic":"/market/level2:BTC-USDT",
+ "subject":"trade.l2update",
+ "data":{
+ "sequenceStart":1545896669105,
+ "sequenceEnd":1545896669106,
+ "symbol":"BTC-USDT",
+ "changes":{
+ "asks":[["6","1","1545896669105"]], //price, size, sequence
+ "bids":[["4","1","1545896669106"]]
+ }
+ }
+}
+
+Calibration procedure:
+ +1.After receiving the websocket l2update data flow, cache the data.
+ +2.Initiate REST (GET /api/v1/market/orderbook/level2_100?symbol=<symbol>) request to get the snapshot data of l2 order book.
+ +3.Playback the cached l2update data flow and find the sequence of the snapshot (range of location: sequence_start to sequence_end in l2update ). Discard all the l2update prior to sequence_start, then playback the change to snapshot.
+ +4.Put the new l2update data flow to the local snapshot to ensure that the sequence_start of the new l2update link up with the sequence_end of the previous l2update.
+ +5.Update the level2 full data based on sequence according to the size. If the price is 0, ignore the messages and update the sequence. If the size=0, update the sequence and remove the price of which the size is 0 out of level 2. For other cases, please update price.
+ +Subsequent updates will have the type l2update. The changes property of l2updates is an array with [price, size,sequence] tuples. Please note that size is the updated size at that price level, not a delta. A size of "0" indicates the price level can be removed.
+ +Example
+ +Take BTC/USDT as an example, suppose the current order book data in level 2 is as follows:
+ +After subscribing the channel, you would receive changes as follows:
+ +"asks":[
+ +["3988.62","8", 15],
+ +["3988.61","0", 18],
+ +["3988.59","3", 16],
+ +]
+ +"bids":[
+ +["3988.50", "44", "17"]
+ +]
+ + + +Get the snapshot of the order book through REST request (Get Order Book) to build a local order book. Suppose we get the data as follows:
+ +Sequence:16
+ +Data:
+ +"asks":[
+ +["3988.62","8"],
+ +["3988.61","32"],
+ +["3988.60","47"],
+ +["3988.59","3"],
+ +]
+ +"bids":[
+ +["3988.51","56"],
+ +["3988.50","15"],
+ +["3988.49","100"],
+ +["3988.48","10"]
+ +]
+ +The current data on local order book is as follows:
+ +Price | +Size | +Side | +
---|---|---|
3988.62 | +8 | +Sell | +
3988.61 | +32 | +Sell | +
3988.60 | +47 | +Sell | +
3988.59 | +3 | +Sell | +
3988.51 | +56 | +Buy | +
3988.50 | +15 | +Buy | +
3988.49 | +100 | +Buy | +
3988.48 | +10 | +Buy | +
In the beginning, the sequence of your local order book is 16. Discard the feed data of sequence below or equal to 16, apply playback the sequence [17,18] to update the snapshot of the local order book. Now the sequence of your local order book is 18 and your local order book is up-to-date.
+ +Diff:
+ +1.Update size of 3988.50 to 44 (Sequence 17)
+ +2.Remove 3988.61 (Sequence 18)
+ +Now your current order book is up-to-date and final data is as follows:
+ +Price | +Size | +Side | +
---|---|---|
3988.62 | +8 | +Sell | +
3988.60 | +47 | +Sell | +
3988.59 | +3 | +Sell | +
3988.51 | +56 | +Buy | +
3988.50 | +44 | +Buy | +
3988.49 | +100 | +Buy | +
3988.48 | +10 | +Buy | +
{
+ "id": 1545910660741,
+ "type": "subscribe",
+ "topic": "/market/match:BTC-USDT",
+ "privateChannel": false,
+ "response": true
+}
+
+Topic: /market/match:{symbol},{symbol}...
+ +For this topic, privateChannel is available.
+ +Subscribe this topic to obtain the matching event data flow of Level 3.
+ +For each order traded, the system would send you the match messages in the format as follows.
+{
+ "id":"5c24c5da03aa673885cd67aa",
+ "type":"message",
+ "topic":"/market/match:BTC-USDT",
+ "subject":"trade.l3match",
+ "sn":1545896669145,
+ "data":{
+ "sequence":"1545896669145",
+ "symbol":"BTC-USDT",
+ "side":"buy",
+ "size":"0.01022222000000000000",
+ "price":"0.08200000000000000000",
+ "takerOrderId":"5c24c5d903aa6772d55b371e",
+ "time":"1545913818099033203",
+ "type":"match",
+ "makerOrderId":"5c2187d003aa677bd09d5c93",
+ "tradeId":"5c24c5da03aa673885cd67aa"
+ }
+}
+
+
+
+
+{
+ "id": 1545910660742,
+ "type": "subscribe",
+ "topic": "/market/level3:BTC-USDT",
+ "privateChannel": false,
+ "response": true
+}
+
+Topic: /market/level3:{symbol},{symbol}...
+ +For this topic, privateChannel is available.
+ +Subsribe this topic to fully get the updata data for orders and trades.
+ +The full channel provides real-time updates on orders and trades. These updates can be applied on to a level 3 order book snapshot to maintain an accurate and up-to-date copy of the exchange order book.
+ + + +An algorithm to maintain an up-to-date level 3 order book is described below. Please note that you will rarely need to implement this yourself.
+ +The following messages(RECEIVED, OPEN, DONE, MATCH, CHANGE) are sent over the websocket stream in JSON format when subscribing to the full channel:
+{
+ "type":"message",
+ "topic":"/market/level3:BTC-USDT",
+ "subject":"trade.l3received",
+ "data":{
+ "sequence":"1545896669147",
+ "symbol":"BTC-USDT",
+ "side":"sell",
+ "size":"1",
+ "orderId":"5c24c72503aa6772d55b378d",
+ "price":"4.00000000000000000000",
+ "time":"1545914149935808589",
+ "type":"received",
+ "orderType":"limit"
+ }
+}
+
{
+ "type":"message",
+ "topic":"/market/level3:BTC-USDT",
+ "subject":"trade.l3received",
+ "data":{
+ "sequence":"1545896669100",
+ "symbol":"BTC-USDT",
+ "side":"sell",
+ "size":"1",
+ "orderId":"5c24c72503aa6772d55b178d",
+ "time":"1545914149835808589",
+ "type":"received",
+ "orderType":"market",
+ "funds":"100"
+ }
+}
+
+When matching engine receives an order command, the system would send a received message to user.
+ + + + +{
+ "type":"message",
+ "topic":"/market/level3:BTC-USDT",
+ "subject":"trade.l3open",
+ "data":{
+ "sequence":"1545896669148",
+ "symbol":"BTC-USDT",
+ "side":"sell",
+ "size":"1",
+ "orderId":"5c24c72503aa6772d55b378d",
+ "price":"6.00000000000000000000",
+ "time":"1545914149935808632",
+ "type":"open",
+ "remainSize":"1"
+ }
+}
+
+When the remaining part in a limit order enters the order book, the system would send an open message to user.
+ + + + +When the matching life cycle of an order ended, the order would no longer be displayed on the order book and the system will send a done message to user.
+{
+ "type":"message",
+ "topic":"/market/level3:BTC-USDT",
+ "subject":"trade.l3done",
+ "data":{
+ "sequence":"1545896669226",
+ "symbol":"BTC-USDT",
+ "reason":"filled",
+ "side":"buy",
+ "orderId":"5c24c96103aa6772d55b380b",
+ "time":"1545914730696727106",
+ "type":"done"
+ }
+}
+
{
+ "type":"message",
+ "topic":"/market/level3:BTC-USDT",
+ "subject":"trade.l3done",
+ "data":{
+ "sequence":"1545896669227",
+ "symbol":"BTC-USDT",
+ "reason":"canceled",
+ "side":"buy",
+ "orderId":"5c24c96103aa6772d55b381b",
+ "time":"1545914730696797106",
+ "type":"done",
+ "size": "1.12340000000000000000"
+ }
+}
+
+When the matching life cycle of an order ended, the order would no longer be displayed on the order book and the system will send a done message to user.
+ + + + +{
+ "type":"message",
+ "topic":"/market/level3:BTC-USDT",
+ "subject":"trade.l3match",
+ "data":{
+ "sequence":"1545896669291",
+ "symbol":"BTC-USDT",
+ "side":"buy",
+ "size":"0.07600000000000000000",
+ "price":"0.08300000000000000000",
+ "takerOrderId":"5c24ca2e03aa6772d55b38bf",
+ "time":"1545914933083576866",
+ "type":"match",
+ "makerOrderId":"5c20492a03aa677bd099ce9d",
+ "tradeId":"5c24ca3503aa673885cd67ef"
+ }
+}
+
+When two orders become matched, the system would send a match message to user. The Side always indicates the taker, namely the direction of the match triggered.
+ + + + +{
+ "type":"message",
+ "topic":"/market/level3:BTC-USDT",
+ "subject":"trade.l3change",
+ "data":{
+ "sequence":"1545896669656",
+ "symbol":"BTC-USDT",
+ "side":"buy",
+ "orderId":"5c24caff03aa671aef3ca170",
+ "price":"1.00000000000000000000",
+ "newSize":"0.15722222000000000000",
+ "time":"1545915145402532254",
+ "type":"change",
+ "oldSize":"0.18622222000000000000"
+ }
+}
+
+When an order is changed due to STP, the system would send a change message to user.
+ + + + +{
+ "type":"message",
+ "topic":"/market/level3:BTC-USDT",
+ "subject":"trade.l3received",
+ "data": {
+ "sequence":"1545738118241",
+ "symbol":"BTC-USDT",
+ "side":"buy",
+ "orderId":"5c21e80303aa677bd09d7dff",
+ "stopType":"entry",
+ "funds":"1.00000000000000000000",
+ "time":"1545743136994328401",
+ "type":"activate"
+ }
+}
+
+When a stop-limit order is triggered, you would receive an activate message which means that this order started the matching life cycle.
+ + + + +{
+ "type":"message",
+ "topic":"/account/balance",
+ "subject":"account.balance",
+ "data":{
+ "total": "88",
+ "available": "88",
+ "availableChange": "88",
+ "currency": "KCS",
+ "hold": "0",
+ "holdChange": "0",
+ "relationEvent": "main.deposit",
+ "relationEventId": "5c21e80303aa677bd09d7dff",
+ "time": "1545743136994"
+ }
+}
+
+
+You will receive this message when an account balance changes. The message contains the details of the change.
+ +