Skip to content

Latest commit

Β 

History

444 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

KuCoin Universal SDK

License Badge
Language

The KuCoin Universal SDK is the official SDK provided by KuCoin, offering a unified and seamless interface for accessing KuCoin's trading platform. Built using code generation technology, it ensures consistency and rapid updates across multiple programming languages, simplifying integration with consistent APIs.

πŸš€ Features

  • Unified API for Spot, Futures, and Broker: Combines APIs for Spot Trading, Futures Trading, and Broker services into a single SDK, offering seamless integration.

  • Well-Designed Abstractions: Provides clear and consistent abstractions to simplify development while maintaining flexibility.

  • Strong Typing Support: Built with strong typing to ensure code correctness and reliability, enhancing the developer experience.

  • Intuitive Usage Patterns: Designed for ease of use with minimal learning curve, featuring detailed documentation and in-code comments.

  • Editor and IDE Friendly: Fully compatible with popular editors and IDEs, offering intelligent autocompletion, type hints, and inline documentation.

  • Language-Standard Compliance: Adheres to the coding conventions and standards of the supported programming languages for consistent and predictable behavior.

  • Extensibility: Designed with modularity in mind, enabling developers to easily extend or adapt the SDK to meet specific use cases or integrate additional features.

πŸ› οΈ Installation

Latest Version: 1.3.2(Global API version)

Python Installation

pip install kucoin-universal-sdk

Golang Installation

go get github.com/Kucoin/kucoin-universal-sdk/sdk/golang
go mod tidy

Node.js Installation

npm install kucoin-universal-sdk

PHP Installation(0.1.4-alpha)

Note: This SDK is currently in the Alpha phase. We are actively iterating and improving its features, stability, and documentation. Feedback and contributions are highly encouraged to help us refine the SDK.

composer require kucoin/kucoin-universal-sdk=0.1.4-alpha

Java Installation(0.1.2-alpha)

Note: This SDK is currently in the Alpha phase. We are actively iterating and improving its features, stability, and documentation. Feedback and contributions are highly encouraged to help us refine the SDK.

<dependency>
    <groupId>com.kucoin</groupId>
    <artifactId>kucoin-universal-sdk</artifactId>
    <version>0.1.2-alpha</version>
</dependency>

πŸ“– Getting Started

Here's a quick UTA REST example to get you started with the SDK in Python. The API key must have UTA permission enabled.

import os

from kucoin_universal_sdk.api import DefaultClient
from kucoin_universal_sdk.model import (
    ClientOptionBuilder,
    GLOBAL_API_ENDPOINT,
    GLOBAL_BROKER_API_ENDPOINT,
    GLOBAL_FUTURES_API_ENDPOINT,
    TransportOptionBuilder,
)


def required_env(name: str) -> str:
    value = os.getenv(name)
    if not value:
        raise RuntimeError(f"Missing environment variable: {name}")
    return value


def example():
    http_transport_option = (
        TransportOptionBuilder()
        .set_keep_alive(True)
        .build()
    )

    client_option = (
        ClientOptionBuilder()
        .set_key(required_env("API_KEY"))
        .set_secret(required_env("API_SECRET"))
        .set_passphrase(required_env("API_PASSPHRASE"))
        .set_spot_endpoint(GLOBAL_API_ENDPOINT)
        .set_futures_endpoint(GLOBAL_FUTURES_API_ENDPOINT)
        .set_broker_endpoint(GLOBAL_BROKER_API_ENDPOINT)
        .set_transport_option(http_transport_option)
        .build()
    )
    client = DefaultClient(client_option)

    # UTA REST: query unified account overview.
    account_api = client.rest_service().get_uta_service().get_account_api()
    response = account_api.get_account_overview()
    print(response.data)


if __name__ == "__main__":
    example()

For other languages, refer to the Examples section.

πŸ“š Documentation

πŸ“‚ Examples

Find usage examples for your desired language by selecting the corresponding link below:

Language Example Directory
Python sdk/python/examples/
Go sdk/go/examples/
Node.js sdk/node/examples/
PHP sdk/php/examples/
Java sdk/java/examples/

πŸ“‹ Changelog

For a detailed list of changes, see the Changelog.

πŸ—οΈ Technical Design

The KuCoin Universal SDK is built with a code-generation-first approach to ensure consistency, scalability, and rapid updates across all supported languages. By leveraging the OpenAPI Specification and a custom code generator, the SDK achieves the following advantages:

  • Consistency: All SDKs provide a unified experience by adhering to the same core design principles, regardless of the programming language.
  • Scalability: Modular design allows for easy extension of functionality and quick adaptation to API changes.
  • Rapid Updates: Updates to the API can be seamlessly reflected in all SDKs by simply regenerating the code from the updated specifications.
  • Language-Specific Optimization: Generated code follows idiomatic practices of the target language, ensuring a natural developer experience.

This design ensures that developers can rely on the SDK for high-quality, up-to-date, and consistent integrations across all languages.

🀝 Contribution Guidelines

We welcome contributions from the community! Please check out our Contribution Guidelines for details on how to get involved.

πŸ“ License

This project is licensed under the MIT License. For more details, see the LICENSE file.

Third-Party Licenses

This project uses the following dependency licensed under the Apache License 2.0:

  • OpenAPI Generator: For generating SDK code from OpenAPI specifications.

You must comply with the terms of the Apache License 2.0 when using or distributing this dependency. For more information, refer to the Apache License.

πŸ“§ Contact Support

If you encounter any issues or have questions, feel free to reach out through:

⚠️ Disclaimer

  • Financial Risk: This SDK is provided as a development tool to integrate with KuCoin's trading platform. It does not provide financial advice. Trading cryptocurrencies involves substantial risk, including the risk of loss. Users should assess their financial circumstances and consult with financial advisors before engaging in trading.

  • No Warranty: The SDK is provided "as is" without any guarantees of accuracy, reliability, or suitability for a specific purpose. Use it at your own risk.

  • Compliance: Users are responsible for ensuring compliance with all applicable laws and regulations in their jurisdiction when using this SDK.

By using this SDK, you acknowledge that you have read, understood, and agreed to this disclaimer.

Releases

Packages

Used by

Contributors

Languages