Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 2024-11 #132

Draft
wants to merge 60 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
7ccf770
hf orders added
yzh-pelle Nov 2, 2024
ef96e39
get_user_info added
yzh-pelle Nov 2, 2024
c47a68a
get_account_activity updated with **params
yzh-pelle Nov 2, 2024
1f32786
hf_get_account_activity added
yzh-pelle Nov 2, 2024
8a98be2
Update client.py
yzh-pelle Nov 2, 2024
7aa1068
Update client.py
yzh-pelle Nov 2, 2024
e1048e9
get_futures_account_activity added
yzh-pelle Nov 2, 2024
62a3724
create_subaccount added
yzh-pelle Nov 2, 2024
de8f986
get_subaccounts_v2 added
rayBastard Nov 4, 2024
3bff03e
get_subaccount_balance added
rayBastard Nov 4, 2024
b90b94c
get_all_subaccounts_balance and get_all_subaccounts_balance_v2 added
rayBastard Nov 4, 2024
2b1169b
get_subaccount_api_list, create_subaccount_api, modify_subaccount_api…
rayBastard Nov 4, 2024
461b6e0
create_deposit_address updated
rayBastard Nov 4, 2024
360e6ec
create_deposit_address_v3 added
rayBastard Nov 4, 2024
6b0c8db
create_deposit_address and get_deposit_addresses updated
rayBastard Nov 4, 2024
04ad1e3
get_deposits updated
rayBastard Nov 4, 2024
91b777c
get_deposit_history added
rayBastard Nov 4, 2024
3f0fca0
typo fixed
rayBastard Nov 4, 2024
b48354e
get_withdrawals updated
rayBastard Nov 4, 2024
a8bf600
get_historical_withdrawals added
rayBastard Nov 4, 2024
a43a479
get_withdrawal_quotas, create_withdrawal, cancel_withdrawal updated
rayBastard Nov 4, 2024
ed76801
transfer endpoints added
rayBastard Nov 4, 2024
08c4e5f
Trade fee endpoints added
rayBastard Nov 4, 2024
9cd7c95
Currency endpoints updated
rayBastard Nov 4, 2024
2356027
market endpoints updated
rayBastard Nov 4, 2024
eb966cd
get_announcements added
yzh-pelle Nov 5, 2024
494a592
get_user_type added
yzh-pelle Nov 5, 2024
3d7c95c
hf_create_order added
yzh-pelle Nov 5, 2024
05977ff
client.py updated
yzh-pelle Nov 5, 2024
8f0bb44
hf_create_order, hf_create_limit_order and hf_create_market_order upd…
yzh-pelle Nov 7, 2024
efe3717
create_order added
yzh-pelle Nov 7, 2024
cc7c109
create_test_order added
yzh-pelle Nov 7, 2024
778faee
create_orders added
yzh-pelle Nov 7, 2024
bdfff37
create_orders updated
yzh-pelle Nov 7, 2024
3d86724
delete methods updated
yzh-pelle Nov 8, 2024
9a303f9
get_orders updated
yzh-pelle Nov 11, 2024
883d8be
get_recent_orders added
yzh-pelle Nov 11, 2024
4fd7d41
methods for create and delete hf orders added
yzh-pelle Nov 11, 2024
e12aa8e
hf get methods added
rayBastard Nov 12, 2024
cef97ca
get_fills updated
rayBastard Nov 12, 2024
40bf691
methods for stop orders added
yzh-pelle Nov 13, 2024
3cfa9e4
methods for oco orders added
yzh-pelle Nov 13, 2024
8d86abe
methods for margin and hf_margin orders added
yzh-pelle Nov 14, 2024
540aa1b
margin info endpoints added
rayBastard Nov 17, 2024
581d4f8
typo fixed
rayBastard Nov 17, 2024
f097862
margin_get_isolated_synbols_config, margin_get_isolated_account_info,…
rayBastard Nov 17, 2024
119a7e2
margin trading endpoints added
rayBastard Nov 17, 2024
061f96c
Lending Market Endpoints added
rayBastard Nov 17, 2024
8e158ca
margin_get_account_detail, margin_get_cross_account_detail added
rayBastard Nov 17, 2024
1c1a2bd
futures_get_all_subaccounts_balance, futures_get_account_detail, marg…
rayBastard Nov 17, 2024
f841e00
futures market endpoints added
rayBastard Nov 18, 2024
b60c60c
typo fixed
rayBastard Nov 18, 2024
036ac0b
futures fills added
rayBastard Nov 18, 2024
44e7d42
futures_get_risk_limit_level, futures_modify_risk_limit_level added
rayBastard Nov 18, 2024
3ba73a7
Futures Funding Fees Endpoints added
rayBastard Nov 18, 2024
24b19c3
base url updated for futures endpoints
yzh-pelle Nov 19, 2024
4c4f568
futures_create_order, futures_create_test_order and futures_create_st…
yzh-pelle Nov 19, 2024
e31037f
endpoints for futures orders added
yzh-pelle Nov 20, 2024
c8e16ff
Futures Position Endpoints added
rayBastard Nov 24, 2024
b896027
generate_async_client.js added
yzh-pelle Nov 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions generate_async_client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
const fs = require ('fs')
const SOURSE_FILE_NAME = './kucoin/client.py'
const TARGET_FILE_NAME = './kucoin/async_client_generated.py'
const REQUESTS = ['_get', '_post', '_put', '_delete', '_request']
const METHOD_DEFINITION_MATCH = /def\s(\w+)/
const METHOD_CALL_MATCH = /self\.(\w+)\(/
const DEFINITION_PREFIX = 'def'
const ASYNC_DEFINITION_PREFIX = 'async def'
const CALL_PREFIX = 'self.'
const ASYNC_CALL_PREFIX = 'await self.'
const ASYNC_CLIENT_TEMPLATE = 'import asyncio'
const SPECIAL_REPLACEMENTS = {} // Add special replacements here
const SPECIAL_REPLACEMENTS_KEYS = Object.keys (SPECIAL_REPLACEMENTS)

function replaceKeywords (data) {
const lines = data.split ('\n')
const asyncClient = [ ASYNC_CLIENT_TEMPLATE ]
for (let line of lines) {
let specialMatch = false
for (let key of SPECIAL_REPLACEMENTS_KEYS) {
if (line.includes (key)) {
asyncClient.push (line.replace (key, SPECIAL_REPLACEMENTS[key]))
delete SPECIAL_REPLACEMENTS[key]
specialMatch = true
break
}
}
if (specialMatch) {
continue
}
const methodDefinition = line.match (METHOD_DEFINITION_MATCH)
const methodCall = line.match (METHOD_CALL_MATCH)
const match = methodDefinition || methodCall
if (match) {
const methodName = match[1]
let replacementRequired = true
if (methodName.startsWith ('_') && !REQUESTS.includes (methodName)) {
replacementRequired = false
}
if (replacementRequired) {
if (methodDefinition) {
line = line.replace (DEFINITION_PREFIX, ASYNC_DEFINITION_PREFIX)
} else if (methodCall) {
line = line.replace (CALL_PREFIX, ASYNC_CALL_PREFIX)
}
}
}
asyncClient.push (line)
}
return asyncClient.join ('\n')
}

fs.readFile (SOURSE_FILE_NAME, 'utf8', (err, data) => {
if (err) {
console.error (err)
return
}
const asyncClient = replaceKeywords (data)
fs.writeFile (TARGET_FILE_NAME, asyncClient, (err) => {
if (err) {
console.error (err)
return
}
console.log (TARGET_FILE_NAME + ' file is generated')})
})
Loading