Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@

API documentation [Changelog](https://www.kucoin.com/docs-new/change-log)

Current synchronized API documentation version [20250313](https://www.kucoin.com/docs-new/change-log#20250313)
Current synchronized API documentation version [20250529](https://www.kucoin.com/docs-new/change-log#20250529)

## 2025-06-11(1.3.0)
- Update the latest APIs, documentation, etc
- Introduced a new testing framework for all SDKs
- Expanded regression-test coverage for Python components
- Updated Node.js dependencies to address security vulnerabilities

## 2025-06-11(PHP 0.1.2-alpha)
- Update the latest APIs, documentation, etc

## 2025-05-29(PHP 0.1.1-alpha)
- Fix compatibility issues on non-macOS systems by enforcing case-sensitive PSR-4 autoloading.
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ $(SUBDIRS):
.PHONY: generate
generate: setup-logs
$(call generate-postman)
$(call generate-code,golang,/pkg/generate,1.2.1)
$(call generate-code,golang,/pkg/generate)
$(call generate-code,python,/kucoin_universal_sdk/generate)
$(call generate-code,node,/src/generate)
$(call generate-code,php,/src/Generate,0.1.1-alpha)
$(call generate-code,php,/src/Generate,0.1.2-alpha)

.PHONY: gen-postman
gen-postman: preprocessor
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ The **KuCoin Universal SDK** is the official SDK provided by KuCoin, offering a

## 🛠️ Installation

### Latest Version: `1.2.0`(Global API version)
### Latest Version: `1.3.0`(Global API version)

### Python Installation(1.2.1.post1)
### Python Installation

```bash
pip install kucoin-universal-sdk
```

### Golang Installation(1.2.1)
### Golang Installation

```bash
go get github.com/Kucoin/kucoin-universal-sdk/sdk/golang
Expand All @@ -52,10 +52,10 @@ go mod tidy
npm install kucoin-universal-sdk
```

### PHP Installation(0.1.1-alpha)
### PHP 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.
```bash
composer require kucoin/kucoin-universal-sdk=0.1.1-alpha
composer require kucoin/kucoin-universal-sdk=0.1.2-alpha
```

### Postman Installation
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.2.0
v1.3.0
23 changes: 12 additions & 11 deletions generator/plugin/src/main/resources/php-sdk/model_ws.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,20 @@ class {{classname}} implements Serializable{
return $serializer->serialize($this, 'json');
}

/**
* @param string $json
* @param Serializer $serializer
* @return self
*/
public static function jsonDeserialize($json , $serializer) {
if ($json === null) {
return new self();
}
{{#vars}}
{{#isPrimitiveType}}
$obj = new self();
$obj->data = $json;
return $obj;
{{/isPrimitiveType}}
{{^isPrimitiveType}}
$item = $serializer->deserialize($json, 'array<{{modelPackage}}\{{complexType}}>', 'json');
$obj = new self();
$obj->data = $item;
return $obj;
{{/isPrimitiveType}}
$data = $serializer->deserialize($json, '{{{vendorExtensions.annotationType}}}', 'json');
$obj = new self();
$obj->data = $data;
return $obj;
{{/vars}}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ class {{classname}}(BaseModel):
if obj is None:
return None

{{#vendorExtensions.x-original-response}}
# original response
obj = {'data':obj}
{{/vendorExtensions.x-original-response}}
if not isinstance(obj, dict):
return cls.model_validate(obj)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class SdkGeneratorTest {
private static final String SDK_NAME = "php-sdk";
private static final String SPEC_NAME = "../../spec/rest/api/openapi-account-subaccount.json";
private static final String SPEC_ENTRY_NAME = "../../spec/rest/entry/openapi-account.json";
private static final String WS_SPEC_NAME = "../../spec/ws/openapi-margin-private.json";
private static final String WS_SPEC_NAME = "../../spec/ws/openapi-futures-private.json";
private static final String OUTPUT_DIR = "./out";
private static final String CSV_PATH = "../../spec";

Expand Down
14 changes: 13 additions & 1 deletion generator/postman/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,24 @@ def gen_api(self, item):
index = path.index(path_var_name_ext)
path[index] = "{{" + path_var_name + "}}"




# update request
req_body = {}
if 'type' in request and request['type'] == 'application/json':

example_data = None
if 'examples' in request:
examples = request['examples']
if len(examples) > 0:
example = examples[0]
if isinstance(example, dict):
example_data = example['value']

req_body = {
"mode": "raw",
"raw": request['example'],
"raw": example_data,
"options": {
"raw": {
"language": "json"
Expand Down
14 changes: 12 additions & 2 deletions generator/preprocessor/api_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,18 +293,28 @@ def generate_path_operation(api):

body_data = api_data['requestBody']

example_data = None
if 'examples' in body_data:
examples = body_data['examples']
if len(examples) > 0:
example = examples[0]
if isinstance(example, dict):
example_data = example['value']



ApiMetaUtil.update_schema(body_data['jsonSchema'])
# ApiMetaUtil.update_response_schema_required(body_data)
path_operation['requestBody'] = {
'content': {
'application/json': {
'schema': body_data['jsonSchema'],
'example': body_data['example'],
'example': example_data,
}
}
}
try:
example_raw = body_data['example']
example_raw = example_data
filtered_data = "\n".join(
line for line in example_raw.splitlines() if not line.strip().startswith("//"))

Expand Down
10 changes: 10 additions & 0 deletions generator/preprocessor/meta_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ def clear_field(obj):
for o in obj:
MetaTools.clear_field(o)

@staticmethod
def clear_developing(obj):
if 'apiCollection' in obj:
api_collection = obj['apiCollection']
if isinstance(api_collection,list) and 'items' in api_collection[0]:
for item in api_collection[0]['items']:
if 'name' in item and item['name'] == 'Developing':
item['items'] = []

@staticmethod
def clear_api_collection(data):
if type(data) is list:
Expand Down Expand Up @@ -99,6 +108,7 @@ def __init__(self, file_path:str):

def clean(self):
self.clear_garbage()
MetaTools.clear_developing(self.data)
MetaTools.clear_field(self.data)

def write(self):
Expand Down
14 changes: 13 additions & 1 deletion sdk/golang/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@

API documentation [Changelog](https://www.kucoin.com/docs-new/change-log)

Current synchronized API documentation version [20250313](https://www.kucoin.com/docs-new/change-log#20250313)
Current synchronized API documentation version [20250529](https://www.kucoin.com/docs-new/change-log#20250529)

## 2025-06-11(1.3.0)
- Update the latest APIs, documentation, etc
- Introduced a new testing framework for all SDKs
- Expanded regression-test coverage for Python components
- Updated Node.js dependencies to address security vulnerabilities

## 2025-06-11(PHP 0.1.2-alpha)
- Update the latest APIs, documentation, etc

## 2025-05-29(PHP 0.1.1-alpha)
- Fix compatibility issues on non-macOS systems by enforcing case-sensitive PSR-4 autoloading.

## 2025-05-27(GO 1.2.1)
- Fix the Golang type mapping: map OpenAPI number type to float64 to prevent overflow
Expand Down
2 changes: 1 addition & 1 deletion sdk/golang/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ For an overview of the project and SDKs in other languages, refer to the [Main R

## 📦 Installation

### Latest Version: `1.2.1`
### Latest Version: `1.3.0`
Install the Golang SDK using `go get`:

```bash
Expand Down
6 changes: 3 additions & 3 deletions sdk/golang/pkg/generate/account/account/api_account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func TestAccountGetCrossMarginAccountRespModel(t *testing.T) {
// Get Account - Cross Margin
// /api/v3/margin/accounts

data := "{\n \"code\": \"200000\",\n \"data\": {\n \"totalAssetOfQuoteCurrency\": \"0.02\",\n \"totalLiabilityOfQuoteCurrency\": \"0\",\n \"debtRatio\": \"0\",\n \"status\": \"EFFECTIVE\",\n \"accounts\": [\n {\n \"currency\": \"USDT\",\n \"total\": \"0.02\",\n \"available\": \"0.02\",\n \"hold\": \"0\",\n \"liability\": \"0\",\n \"maxBorrowSize\": \"0\",\n \"borrowEnabled\": true,\n \"transferInEnabled\": true\n }\n ]\n }\n}"
data := "{\n \"code\": \"200000\",\n \"data\": {\n \"totalAssetOfQuoteCurrency\": \"40.8648372\",\n \"totalLiabilityOfQuoteCurrency\": \"0\",\n \"debtRatio\": \"0\",\n \"status\": \"EFFECTIVE\",\n \"accounts\": [\n {\n \"currency\": \"USDT\",\n \"total\": \"38.68855864\",\n \"available\": \"20.01916691\",\n \"hold\": \"18.66939173\",\n \"liability\": \"0\",\n \"liabilityPrincipal\": \"0\",\n \"liabilityInterest\": \"0\",\n \"maxBorrowSize\": \"163\",\n \"borrowEnabled\": true,\n \"transferInEnabled\": true\n }\n ]\n }\n}"
commonResp := &types.RestResponse{}
err := json.Unmarshal([]byte(data), commonResp)
assert.Nil(t, err)
Expand All @@ -165,7 +165,7 @@ func TestAccountGetIsolatedMarginAccountReqModel(t *testing.T) {
// Get Account - Isolated Margin
// /api/v3/isolated/accounts

data := "{\"symbol\": \"example_string_default_value\", \"quoteCurrency\": \"USDT\", \"queryType\": \"ISOLATED\"}"
data := "{\"symbol\": \"BTC-USDT\", \"quoteCurrency\": \"USDT\", \"queryType\": \"ISOLATED\"}"
req := &GetIsolatedMarginAccountReq{}
err := json.Unmarshal([]byte(data), req)
req.ToMap()
Expand All @@ -177,7 +177,7 @@ func TestAccountGetIsolatedMarginAccountRespModel(t *testing.T) {
// Get Account - Isolated Margin
// /api/v3/isolated/accounts

data := "{\n \"code\": \"200000\",\n \"data\": {\n \"totalAssetOfQuoteCurrency\": \"0.01\",\n \"totalLiabilityOfQuoteCurrency\": \"0\",\n \"timestamp\": 1728725465994,\n \"assets\": [\n {\n \"symbol\": \"BTC-USDT\",\n \"status\": \"EFFECTIVE\",\n \"debtRatio\": \"0\",\n \"baseAsset\": {\n \"currency\": \"BTC\",\n \"borrowEnabled\": true,\n \"transferInEnabled\": true,\n \"liability\": \"0\",\n \"total\": \"0\",\n \"available\": \"0\",\n \"hold\": \"0\",\n \"maxBorrowSize\": \"0\"\n },\n \"quoteAsset\": {\n \"currency\": \"USDT\",\n \"borrowEnabled\": true,\n \"transferInEnabled\": true,\n \"liability\": \"0\",\n \"total\": \"0.01\",\n \"available\": \"0.01\",\n \"hold\": \"0\",\n \"maxBorrowSize\": \"0\"\n }\n }\n ]\n }\n}"
data := "{\n \"code\": \"200000\",\n \"data\": {\n \"totalAssetOfQuoteCurrency\": \"4.97047372\",\n \"totalLiabilityOfQuoteCurrency\": \"0.00038891\",\n \"timestamp\": 1747303659773,\n \"assets\": [\n {\n \"symbol\": \"BTC-USDT\",\n \"status\": \"EFFECTIVE\",\n \"debtRatio\": \"0\",\n \"baseAsset\": {\n \"currency\": \"BTC\",\n \"borrowEnabled\": true,\n \"transferInEnabled\": true,\n \"liability\": \"0\",\n \"liabilityPrincipal\": \"0\",\n \"liabilityInterest\": \"0\",\n \"total\": \"0\",\n \"available\": \"0\",\n \"hold\": \"0\",\n \"maxBorrowSize\": \"0\"\n },\n \"quoteAsset\": {\n \"currency\": \"USDT\",\n \"borrowEnabled\": true,\n \"transferInEnabled\": true,\n \"liability\": \"0.00038891\",\n \"liabilityPrincipal\": \"0.00038888\",\n \"liabilityInterest\": \"0.00000003\",\n \"total\": \"4.97047372\",\n \"available\": \"4.97047372\",\n \"hold\": \"0\",\n \"maxBorrowSize\": \"44\"\n }\n }\n ]\n }\n}"
commonResp := &types.RestResponse{}
err := json.Unmarshal([]byte(data), commonResp)
assert.Nil(t, err)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading