From bf7066464fe799077493118b1306d4cc8d9b7abf Mon Sep 17 00:00:00 2001 From: Cors88 Date: Thu, 30 Jan 2025 21:42:01 +0300 Subject: [PATCH 01/30] Add method WithdrawInfo for Bithumb --- Project.toml | 2 +- examples/Bithumb/Spot.jl | 6 ++ src/Bithumb/Bithumb.jl | 29 +++++--- src/Bithumb/Spot/API/WithdrawInfo.jl | 98 ++++++++++++++++++++++++++++ src/Bithumb/Spot/Spot.jl | 3 + 5 files changed, 128 insertions(+), 10 deletions(-) create mode 100644 src/Bithumb/Spot/API/WithdrawInfo.jl diff --git a/Project.toml b/Project.toml index 59c659c0..b27733ee 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "CryptoExchangeAPIs" uuid = "5e3d4798-c815-4641-85e1-deed530626d3" -version = "0.33.0" +version = "0.33.1" [deps] Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" diff --git a/examples/Bithumb/Spot.jl b/examples/Bithumb/Spot.jl index 30204b8a..34ff525b 100644 --- a/examples/Bithumb/Spot.jl +++ b/examples/Bithumb/Spot.jl @@ -46,3 +46,9 @@ Bithumb.Spot.user_transactions_log( count = 50, searchGb = Bithumb.Spot.UserTransactionsLog.ALL, ) + +Bithumb.Spot.withdraw_info( + bithumb_client; + currency = "ETH", + net_type = "ETH", +) diff --git a/src/Bithumb/Bithumb.jl b/src/Bithumb/Bithumb.jl index f005c243..f1b1737e 100644 --- a/src/Bithumb/Bithumb.jl +++ b/src/Bithumb/Bithumb.jl @@ -10,6 +10,7 @@ export BithumbCommonQuery, using Serde using Dates, NanoDates, TimeZones, Base64, Nettle +using UUIDs, JSONWebTokens using ..CryptoExchangeAPIs import ..CryptoExchangeAPIs: Maybe, AbstractAPIsError, AbstractAPIsData, AbstractAPIsQuery, AbstractAPIsClient @@ -93,13 +94,25 @@ function CryptoExchangeAPIs.request_sign!(::BithumbClient, query::Q, ::String):: end function CryptoExchangeAPIs.request_sign!(client::BithumbClient, query::Q, endpoint::String)::Q where {Q<:BithumbPrivateQuery} - query.nonce = Dates.now(UTC) - query.endpoint = Serde.SerQuery.escape_query("/" * endpoint) + query.signature = nothing - body = Serde.to_query(query) - salt = string("/", endpoint, Char(0), body, Char(0), round(Int64, 1000 * datetime2unix(query.nonce))) - query.signature = Base64.base64encode(hexdigest("sha512", client.secret_key, salt)) - return query + body = Dict{String,Any}( + "access_key" => client.public_key, + "nonce" => string(UUIDs.uuid4()), + "timestamp" => string(time2unix(now(UTC))), + ) + if !isempty(Serde.to_query(query)) + qstr = Serde.to_query(query) + merge!(body, Dict{String,Any}( + "query_hash" => hexdigest("sha512", qstr), + "query_hash_alg" => "SHA512", + )) + end + hs512 = JSONWebTokens.HS512(client.secret_key) + token = JSONWebTokens.encode(hs512, body) + query.signature = "Bearer $token" + return nothing + end function CryptoExchangeAPIs.request_sign!(::BithumbClient, query::Q, ::String)::Q where {Q<:BithumbAccessQuery} @@ -122,9 +135,7 @@ end function CryptoExchangeAPIs.request_headers(client::BithumbClient, query::BithumbPrivateQuery)::Vector{Pair{String,String}} return Pair{String,String}[ - "Api-Key" => client.public_key, - "Api-Sign" => query.signature, - "Api-Nonce" => string(round(Int64, 1000 * datetime2unix(query.nonce))), + "Authorization" => query.signature, ] end diff --git a/src/Bithumb/Spot/API/WithdrawInfo.jl b/src/Bithumb/Spot/API/WithdrawInfo.jl new file mode 100644 index 00000000..bd197629 --- /dev/null +++ b/src/Bithumb/Spot/API/WithdrawInfo.jl @@ -0,0 +1,98 @@ +module WithdrawInfo + +Base.@kwdef mutable struct WithdrawInfoQuery <: PrivateQuery + currency::String + net_type::String + + signature::Maybe{String} = nothing +end + +struct MemberLevel + security_level::Maybe{Int64} + fee_level::Maybe{Int64} + email_verified::Maybe{Bool} + identity_auth_verified::Maybe{Bool} + bank_account_verified::Maybe{Bool} + two_factor_auth_verified::Maybe{Bool} + locked::Maybe{Bool} + wallet_locked::Maybe{Bool} +end + +struct Currency + code::String + withdraw_fee::Float64 + is_coin::Bool + wallet_state::String + wallet_support::Vector{String} +end + +struct Account + currency::String + balance::Float64 + locked::Float64 + avg_buy_price::Float64 + avg_buy_price_modified::Bool + unit_currency::String +end + +struct WithdrawLimit + currency::String + minimum::Float64 + onetime::Float64 + daily::Float64 + remaining_daily::Float64 + fixed::Int64 + can_withdraw::Bool + remaining_daily_krw::Maybe{Float64} +end + +struct WithdrawInfo <: AbstractResult + member_level::MemberLevel + currency::Currency + account::Account + withdraw_limit::WithdrawLimit +end + +security_level(x::WithdrawInfo) = x.member_level.security_level +fee_level(x::WithdrawInfo) = x.member_level.fee_level +email_verified(x::WithdrawInfo) = x.member_level.email_verified +identity_auth_verified(x::WithdrawInfo) = x.member_level.identity_auth_verified +bank_account_verified(x::WithdrawInfo) = x.member_level.bank_account_verified +two_factor_auth_verified(x::WithdrawInfo) = x.member_level.two_factor_auth_verified +member_level_locked(x::WithdrawInfo) = x.member_level.locked +wallet_locked(x::WithdrawInfo) = x.member_level.wallet_locked +code(x::WithdrawInfo) = x.currency.code +withdraw_fee(x::WithdrawInfo) = x.currency.withdraw_fee +is_coin(x::WithdrawInfo) = x.currency.is_coin +wallet_state(x::WithdrawInfo) = x.currency.wallet_state +wallet_support(x::WithdrawInfo) = x.currency.wallet_support +account_currency(x::WithdrawInfo) = x.account.currency +balance(x::WithdrawInfo) = x.account.balance +account_locked(x::WithdrawInfo) = x.account.locked +avg_buy_price(x::WithdrawInfo) = x.account.avg_buy_price +avg_buy_price_modified(x::WithdrawInfo) = x.account.avg_buy_price_modified +unit_currency(x::WithdrawInfo) = x.account.unit_currency +withdraw_limit_currency(x::WithdrawInfo) = x.withdraw_limit.currency +minimum(x::WithdrawInfo) = x.withdraw_limit.minimum +onetime(x::WithdrawInfo) = x.withdraw_limit.onetime +daily(x::WithdrawInfo) = x.withdraw_limit.daily +remaining_daily(x::WithdrawInfo) = x.withdraw_limit.remaining_daily +fixed(x::WithdrawInfo) = x.withdraw_limit.fixed +can_withdraw(x::WithdrawInfo) = x.withdraw_limit.can_withdraw +remaining_daily_krw(x::WithdrawInfo) = x.withdraw_limit.remaining_daily_krw + + +""" + withdraw_info(client::Client; $(CCTX.query_info(WithdrawInfoQuery))) +Check the possible withdrawal information of the currency. +https://apidocs.bithumb.com/reference/%EC%B6%9C%EA%B8%88-%EA%B0%80%EB%8A%A5-%EC%A0%95%EB%B3%B4 +""" +function withdraw_info(client::Client, query::WithdrawInfoQuery) + return CctxQuery{WithdrawInfo}("GET", "v1/withdraws/chance", query)(client) +end + +function withdraw_info(client::Client; kw...) + return withdraw_info(client, WithdrawInfoQuery(; kw...)) +end + +end \ No newline at end of file diff --git a/src/Bithumb/Spot/Spot.jl b/src/Bithumb/Spot/Spot.jl index 013cb1e4..7eff5f21 100644 --- a/src/Bithumb/Spot/Spot.jl +++ b/src/Bithumb/Spot/Spot.jl @@ -26,4 +26,7 @@ using .Ticker include("API/UserTransactions.jl") using .UserTransactions +include("API/WithdrawInfo.jl") +using .UserTransactions + end From 8b351969a0c0dd3a149a407ea74002b228f786a7 Mon Sep 17 00:00:00 2001 From: Cors88 Date: Thu, 30 Jan 2025 22:20:28 +0300 Subject: [PATCH 02/30] Add method WithdrawInfo for Bithumb --- src/Bithumb/Spot/Spot.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bithumb/Spot/Spot.jl b/src/Bithumb/Spot/Spot.jl index 7eff5f21..368b899d 100644 --- a/src/Bithumb/Spot/Spot.jl +++ b/src/Bithumb/Spot/Spot.jl @@ -27,6 +27,6 @@ include("API/UserTransactions.jl") using .UserTransactions include("API/WithdrawInfo.jl") -using .UserTransactions +using .WithdrawInfo end From ef564175aafa01029eb9a586d5f7a9d22e4c5412 Mon Sep 17 00:00:00 2001 From: Cors88 Date: Fri, 31 Jan 2025 15:05:28 +0300 Subject: [PATCH 03/30] Update WithdrawInfo.jl --- src/Bithumb/Spot/API/WithdrawInfo.jl | 46 ++++++---------------------- 1 file changed, 9 insertions(+), 37 deletions(-) diff --git a/src/Bithumb/Spot/API/WithdrawInfo.jl b/src/Bithumb/Spot/API/WithdrawInfo.jl index bd197629..71af235b 100644 --- a/src/Bithumb/Spot/API/WithdrawInfo.jl +++ b/src/Bithumb/Spot/API/WithdrawInfo.jl @@ -1,9 +1,8 @@ module WithdrawInfo -Base.@kwdef mutable struct WithdrawInfoQuery <: PrivateQuery +Base.@kwdef mutable struct WithdrawInfoQuery <: BithumbPrivateQuery currency::String net_type::String - signature::Maybe{String} = nothing end @@ -46,53 +45,26 @@ struct WithdrawLimit remaining_daily_krw::Maybe{Float64} end -struct WithdrawInfo <: AbstractResult +struct WithdrawInfo <: BithumbData member_level::MemberLevel currency::Currency account::Account withdraw_limit::WithdrawLimit end -security_level(x::WithdrawInfo) = x.member_level.security_level -fee_level(x::WithdrawInfo) = x.member_level.fee_level -email_verified(x::WithdrawInfo) = x.member_level.email_verified -identity_auth_verified(x::WithdrawInfo) = x.member_level.identity_auth_verified -bank_account_verified(x::WithdrawInfo) = x.member_level.bank_account_verified -two_factor_auth_verified(x::WithdrawInfo) = x.member_level.two_factor_auth_verified -member_level_locked(x::WithdrawInfo) = x.member_level.locked -wallet_locked(x::WithdrawInfo) = x.member_level.wallet_locked -code(x::WithdrawInfo) = x.currency.code -withdraw_fee(x::WithdrawInfo) = x.currency.withdraw_fee -is_coin(x::WithdrawInfo) = x.currency.is_coin -wallet_state(x::WithdrawInfo) = x.currency.wallet_state -wallet_support(x::WithdrawInfo) = x.currency.wallet_support -account_currency(x::WithdrawInfo) = x.account.currency -balance(x::WithdrawInfo) = x.account.balance -account_locked(x::WithdrawInfo) = x.account.locked -avg_buy_price(x::WithdrawInfo) = x.account.avg_buy_price -avg_buy_price_modified(x::WithdrawInfo) = x.account.avg_buy_price_modified -unit_currency(x::WithdrawInfo) = x.account.unit_currency -withdraw_limit_currency(x::WithdrawInfo) = x.withdraw_limit.currency -minimum(x::WithdrawInfo) = x.withdraw_limit.minimum -onetime(x::WithdrawInfo) = x.withdraw_limit.onetime -daily(x::WithdrawInfo) = x.withdraw_limit.daily -remaining_daily(x::WithdrawInfo) = x.withdraw_limit.remaining_daily -fixed(x::WithdrawInfo) = x.withdraw_limit.fixed -can_withdraw(x::WithdrawInfo) = x.withdraw_limit.can_withdraw -remaining_daily_krw(x::WithdrawInfo) = x.withdraw_limit.remaining_daily_krw - - """ - withdraw_info(client::Client; $(CCTX.query_info(WithdrawInfoQuery))) + withdraw_info(client::BithumbClient, query::WithdrawInfoQuery) Check the possible withdrawal information of the currency. https://apidocs.bithumb.com/reference/%EC%B6%9C%EA%B8%88-%EA%B0%80%EB%8A%A5-%EC%A0%95%EB%B3%B4 """ -function withdraw_info(client::Client, query::WithdrawInfoQuery) - return CctxQuery{WithdrawInfo}("GET", "v1/withdraws/chance", query)(client) +function withdraw_info(client::BithumbClient, query::WithdrawInfoQuery) + CryptoExchangeAPIs.request_sign!(client, query, "v1/withdraws/chance") + + return APIsRequest{Data{WithdrawInfo}}("GET", "v1/withdraws/chance", query)(client) end -function withdraw_info(client::Client; kw...) +function withdraw_info(client::BithumbClient; kw...) return withdraw_info(client, WithdrawInfoQuery(; kw...)) end -end \ No newline at end of file +end From 005f937cd4895af6b7b7576ca0aaa26468a615da Mon Sep 17 00:00:00 2001 From: Cors88 Date: Fri, 31 Jan 2025 15:17:21 +0300 Subject: [PATCH 04/30] Update WithdrawInfo.jl --- src/Bithumb/Spot/API/WithdrawInfo.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Bithumb/Spot/API/WithdrawInfo.jl b/src/Bithumb/Spot/API/WithdrawInfo.jl index 71af235b..0acd0617 100644 --- a/src/Bithumb/Spot/API/WithdrawInfo.jl +++ b/src/Bithumb/Spot/API/WithdrawInfo.jl @@ -1,4 +1,7 @@ module WithdrawInfo +using CryptoExchangeAPIs.Bithumb: BithumbPrivateQuery, BithumbData, Data +using CryptoExchangeAPIs: Maybe, APIsRequest +using Dates, NanoDates, TimeZones Base.@kwdef mutable struct WithdrawInfoQuery <: BithumbPrivateQuery currency::String @@ -58,6 +61,7 @@ Check the possible withdrawal information of the currency. https://apidocs.bithumb.com/reference/%EC%B6%9C%EA%B8%88-%EA%B0%80%EB%8A%A5-%EC%A0%95%EB%B3%B4 """ function withdraw_info(client::BithumbClient, query::WithdrawInfoQuery) + # Подписание запроса CryptoExchangeAPIs.request_sign!(client, query, "v1/withdraws/chance") return APIsRequest{Data{WithdrawInfo}}("GET", "v1/withdraws/chance", query)(client) @@ -67,4 +71,4 @@ function withdraw_info(client::BithumbClient; kw...) return withdraw_info(client, WithdrawInfoQuery(; kw...)) end -end +end # module WithdrawInfo From 0c33ad4a9484a32ce0acde09db54c6153413b161 Mon Sep 17 00:00:00 2001 From: Cors88 Date: Fri, 31 Jan 2025 15:17:38 +0300 Subject: [PATCH 05/30] Update WithdrawInfo.jl --- src/Bithumb/Spot/API/WithdrawInfo.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Bithumb/Spot/API/WithdrawInfo.jl b/src/Bithumb/Spot/API/WithdrawInfo.jl index 0acd0617..3a8a47be 100644 --- a/src/Bithumb/Spot/API/WithdrawInfo.jl +++ b/src/Bithumb/Spot/API/WithdrawInfo.jl @@ -61,7 +61,6 @@ Check the possible withdrawal information of the currency. https://apidocs.bithumb.com/reference/%EC%B6%9C%EA%B8%88-%EA%B0%80%EB%8A%A5-%EC%A0%95%EB%B3%B4 """ function withdraw_info(client::BithumbClient, query::WithdrawInfoQuery) - # Подписание запроса CryptoExchangeAPIs.request_sign!(client, query, "v1/withdraws/chance") return APIsRequest{Data{WithdrawInfo}}("GET", "v1/withdraws/chance", query)(client) @@ -71,4 +70,4 @@ function withdraw_info(client::BithumbClient; kw...) return withdraw_info(client, WithdrawInfoQuery(; kw...)) end -end # module WithdrawInfo +end From 8a621a5ca5b11d8c7dc8a53f8cab2d9897b210bc Mon Sep 17 00:00:00 2001 From: Cors88 Date: Fri, 31 Jan 2025 15:23:33 +0300 Subject: [PATCH 06/30] Update WithdrawInfo.jl From 71d19a23170abef0787c66545717bd6c0237f437 Mon Sep 17 00:00:00 2001 From: Cors88 Date: Fri, 31 Jan 2025 15:28:28 +0300 Subject: [PATCH 07/30] Update WithdrawInfo.jl --- src/Bithumb/Spot/API/WithdrawInfo.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Bithumb/Spot/API/WithdrawInfo.jl b/src/Bithumb/Spot/API/WithdrawInfo.jl index 3a8a47be..2439fd8d 100644 --- a/src/Bithumb/Spot/API/WithdrawInfo.jl +++ b/src/Bithumb/Spot/API/WithdrawInfo.jl @@ -1,4 +1,5 @@ module WithdrawInfo + using CryptoExchangeAPIs.Bithumb: BithumbPrivateQuery, BithumbData, Data using CryptoExchangeAPIs: Maybe, APIsRequest using Dates, NanoDates, TimeZones From a8b149b1818ff3bb457a16c7b582c3c0570268ff Mon Sep 17 00:00:00 2001 From: Cors88 Date: Fri, 31 Jan 2025 15:35:06 +0300 Subject: [PATCH 08/30] Update WithdrawInfo.jl --- src/Bithumb/Spot/API/WithdrawInfo.jl | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Bithumb/Spot/API/WithdrawInfo.jl b/src/Bithumb/Spot/API/WithdrawInfo.jl index 2439fd8d..feccb370 100644 --- a/src/Bithumb/Spot/API/WithdrawInfo.jl +++ b/src/Bithumb/Spot/API/WithdrawInfo.jl @@ -4,6 +4,18 @@ using CryptoExchangeAPIs.Bithumb: BithumbPrivateQuery, BithumbData, Data using CryptoExchangeAPIs: Maybe, APIsRequest using Dates, NanoDates, TimeZones +export WithdrawInfoQuery, +MemberLevel, +Currency, +Account, +WithdrawLimit, +WithdrawInfo, +withdraw_info + +function Serde.SerQuery.ser_type(::Type{<:BithumbPrivateQuery}, x::SearchStatus)::Int64 + return Int64(x) +end + Base.@kwdef mutable struct WithdrawInfoQuery <: BithumbPrivateQuery currency::String net_type::String @@ -56,11 +68,6 @@ struct WithdrawInfo <: BithumbData withdraw_limit::WithdrawLimit end -""" - withdraw_info(client::BithumbClient, query::WithdrawInfoQuery) -Check the possible withdrawal information of the currency. -https://apidocs.bithumb.com/reference/%EC%B6%9C%EA%B8%88-%EA%B0%80%EB%8A%A5-%EC%A0%95%EB%B3%B4 -""" function withdraw_info(client::BithumbClient, query::WithdrawInfoQuery) CryptoExchangeAPIs.request_sign!(client, query, "v1/withdraws/chance") From 2e86fd850a08f7f08505f9ac28d9f7e48f20dc95 Mon Sep 17 00:00:00 2001 From: Evgenii Popov Date: Fri, 31 Jan 2025 16:24:47 +0300 Subject: [PATCH 09/30] Add method WithdrawInfo for Bithumb --- src/Bithumb/Spot/API/WithdrawInfo.jl | 107 +++++++++++++++++++++------ 1 file changed, 86 insertions(+), 21 deletions(-) diff --git a/src/Bithumb/Spot/API/WithdrawInfo.jl b/src/Bithumb/Spot/API/WithdrawInfo.jl index feccb370..d51649b5 100644 --- a/src/Bithumb/Spot/API/WithdrawInfo.jl +++ b/src/Bithumb/Spot/API/WithdrawInfo.jl @@ -1,21 +1,17 @@ module WithdrawInfo +export WithdrawInfoQuery, +MemberLevel, + Currency, + Account, + WithdrawLimit, + WithdrawInfo, + withdraw_info + using CryptoExchangeAPIs.Bithumb: BithumbPrivateQuery, BithumbData, Data using CryptoExchangeAPIs: Maybe, APIsRequest using Dates, NanoDates, TimeZones -export WithdrawInfoQuery, -MemberLevel, -Currency, -Account, -WithdrawLimit, -WithdrawInfo, -withdraw_info - -function Serde.SerQuery.ser_type(::Type{<:BithumbPrivateQuery}, x::SearchStatus)::Int64 - return Int64(x) -end - Base.@kwdef mutable struct WithdrawInfoQuery <: BithumbPrivateQuery currency::String net_type::String @@ -68,14 +64,83 @@ struct WithdrawInfo <: BithumbData withdraw_limit::WithdrawLimit end -function withdraw_info(client::BithumbClient, query::WithdrawInfoQuery) - CryptoExchangeAPIs.request_sign!(client, query, "v1/withdraws/chance") - - return APIsRequest{Data{WithdrawInfo}}("GET", "v1/withdraws/chance", query)(client) -end +""" + withdraw_info(client::BithumbClient, query::WithdrawInfoQuery) + withdraw_info(client::BithumbClient; kw...) +Retrieves detailed information about the withdrawal capabilities for a specific currency on the Bithumb exchange. +[`GET /v1/withdraws/chance`](https://apidocs.bithumb.com/reference/%EC%B6%9C%EA%B8%88-%EA%B0%80%EB%8A%A5-%EC%A0%95%EB%B3%B4) -function withdraw_info(client::BithumbClient; kw...) - return withdraw_info(client, WithdrawInfoQuery(; kw...)) -end +## Description: +The `withdraw_info` function provides comprehensive details about the user's ability to withdraw a specific currency. +This includes information about the user's verification status, currency-specific details, account balances, and withdrawal limits. + +## Parameters: +| Parameter | Type | Required | Description | +|-------------|-----------|----------|--------------------------------------| +| currency | String | Yes | The currency code (e.g., "BTC"). | +| net_type | String | Yes | The network type (e.g., "BTC"). | + +## Code samples: +```julia +using Serde +using CryptoExchangeAPIs.Bithumb + +# Ensure that the environment variables BITHUMB_PUBLIC_KEY and BITHUMB_SECRET_KEY are set. +bithumb_client = Bithumb.Client(; + base_url = "https://api.bithumb.com", + public_key = ENV["BITHUMB_PUBLIC_KEY"], + secret_key = ENV["BITHUMB_SECRET_KEY"], +) +result = WithdrawInfo.withdraw_info( + bithumb_client; + currency = "BTC", + net_type = "BTC", +) +to_pretty_json(result.result) +``` +## Result: -end +```json +{ + "status": "0000", + "date": null, + "data": { + "member_level": { + "security_level": 3, + "fee_level": 1, + "email_verified": true, + "identity_auth_verified": true, + "bank_account_verified": true, + "two_factor_auth_verified": true, + "locked": false, + "wallet_locked": false + }, + "currency": { + "code": "BTC", + "withdraw_fee": 0.0005, + "is_coin": true, + "wallet_state": "working", + "wallet_support": ["KRW", "BTC"] + }, + "account": { + "currency": "BTC", + "balance": 1.0, + "locked": 0.0, + "avg_buy_price": 10000.0, + "avg_buy_price_modified": false, + "unit_currency": "KRW" + }, + "withdraw_limit": { + "currency": "BTC", + "minimum": 0.001, + "onetime": 2.0, + "daily": 5.0, + "remaining_daily": 5.0, + "fixed": 0, + "can_withdraw": true, + "remaining_daily_krw": null + } + } +} +``` +""" \ No newline at end of file From 7aebc565fa62074b99bc8dd3f89e7f50a3f06aad Mon Sep 17 00:00:00 2001 From: Cors88 Date: Fri, 31 Jan 2025 16:32:53 +0300 Subject: [PATCH 10/30] added end --- src/Bithumb/Spot/API/WithdrawInfo.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Bithumb/Spot/API/WithdrawInfo.jl b/src/Bithumb/Spot/API/WithdrawInfo.jl index d51649b5..91778396 100644 --- a/src/Bithumb/Spot/API/WithdrawInfo.jl +++ b/src/Bithumb/Spot/API/WithdrawInfo.jl @@ -64,6 +64,8 @@ struct WithdrawInfo <: BithumbData withdraw_limit::WithdrawLimit end +end + """ withdraw_info(client::BithumbClient, query::WithdrawInfoQuery) withdraw_info(client::BithumbClient; kw...) From 81bd339a002a560918d8be29f08f4d37b5969a15 Mon Sep 17 00:00:00 2001 From: Evgenii Popov Date: Fri, 31 Jan 2025 17:11:18 +0300 Subject: [PATCH 11/30] fix --- src/Bithumb/Spot/API/WithdrawInfo.jl | 42 +++++++++++++++------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/src/Bithumb/Spot/API/WithdrawInfo.jl b/src/Bithumb/Spot/API/WithdrawInfo.jl index 91778396..2ed306fd 100644 --- a/src/Bithumb/Spot/API/WithdrawInfo.jl +++ b/src/Bithumb/Spot/API/WithdrawInfo.jl @@ -1,16 +1,12 @@ module WithdrawInfo -export WithdrawInfoQuery, -MemberLevel, - Currency, - Account, - WithdrawLimit, - WithdrawInfo, - withdraw_info - -using CryptoExchangeAPIs.Bithumb: BithumbPrivateQuery, BithumbData, Data +using CryptoExchangeAPIs.Bithumb +using CryptoExchangeAPIs.Bithumb: Data using CryptoExchangeAPIs: Maybe, APIsRequest -using Dates, NanoDates, TimeZones + +export WithdrawInfoQuery, + WithdrawInfoData, + withdraw_info Base.@kwdef mutable struct WithdrawInfoQuery <: BithumbPrivateQuery currency::String @@ -18,7 +14,7 @@ Base.@kwdef mutable struct WithdrawInfoQuery <: BithumbPrivateQuery signature::Maybe{String} = nothing end -struct MemberLevel +struct MemberLevel <: BithumbData security_level::Maybe{Int64} fee_level::Maybe{Int64} email_verified::Maybe{Bool} @@ -29,7 +25,7 @@ struct MemberLevel wallet_locked::Maybe{Bool} end -struct Currency +struct Currency <: BithumbData code::String withdraw_fee::Float64 is_coin::Bool @@ -37,7 +33,7 @@ struct Currency wallet_support::Vector{String} end -struct Account +struct Account <: BithumbData currency::String balance::Float64 locked::Float64 @@ -46,7 +42,7 @@ struct Account unit_currency::String end -struct WithdrawLimit +struct WithdrawLimit <: BithumbData currency::String minimum::Float64 onetime::Float64 @@ -57,15 +53,12 @@ struct WithdrawLimit remaining_daily_krw::Maybe{Float64} end -struct WithdrawInfo <: BithumbData +struct WithdrawInfoData <: BithumbData member_level::MemberLevel currency::Currency account::Account withdraw_limit::WithdrawLimit end - -end - """ withdraw_info(client::BithumbClient, query::WithdrawInfoQuery) withdraw_info(client::BithumbClient; kw...) @@ -145,4 +138,15 @@ to_pretty_json(result.result) } } ``` -""" \ No newline at end of file +""" +function withdraw_info(client::BithumbClient, query::WithdrawInfoQuery) + CryptoExchangeAPIs.request_sign!(client, query, "v1/withdraws/chance") + + return APIsRequest{Data{WithdrawInfoData}}("GET", "v1/withdraws/chance", query)(client) + end + + function withdraw_info(client::BithumbClient; kw...) + return withdraw_info(client, WithdrawInfoQuery(; kw...)) + end + + end \ No newline at end of file From 5b5b3acb0f488bb813447d58682ddcd510c660e0 Mon Sep 17 00:00:00 2001 From: Evgenii Popov Date: Fri, 31 Jan 2025 17:38:39 +0300 Subject: [PATCH 12/30] Add method WithdrawInfo for Bithumb --- src/Bithumb/Spot/API/WithdrawInfo.jl | 148 ++++++++++++++------------- 1 file changed, 76 insertions(+), 72 deletions(-) diff --git a/src/Bithumb/Spot/API/WithdrawInfo.jl b/src/Bithumb/Spot/API/WithdrawInfo.jl index 2ed306fd..8830911d 100644 --- a/src/Bithumb/Spot/API/WithdrawInfo.jl +++ b/src/Bithumb/Spot/API/WithdrawInfo.jl @@ -1,12 +1,17 @@ module WithdrawInfo +export WithdrawInfoQuery, + WithdrawInfoData, + withdraw_info + +using Serde +using Dates, NanoDates, TimeZones + using CryptoExchangeAPIs.Bithumb using CryptoExchangeAPIs.Bithumb: Data using CryptoExchangeAPIs: Maybe, APIsRequest -export WithdrawInfoQuery, - WithdrawInfoData, - withdraw_info + Base.@kwdef mutable struct WithdrawInfoQuery <: BithumbPrivateQuery currency::String @@ -15,49 +20,49 @@ Base.@kwdef mutable struct WithdrawInfoQuery <: BithumbPrivateQuery end struct MemberLevel <: BithumbData - security_level::Maybe{Int64} - fee_level::Maybe{Int64} - email_verified::Maybe{Bool} - identity_auth_verified::Maybe{Bool} - bank_account_verified::Maybe{Bool} - two_factor_auth_verified::Maybe{Bool} - locked::Maybe{Bool} - wallet_locked::Maybe{Bool} + security_level::Maybe{Int64} + fee_level::Maybe{Int64} + email_verified::Maybe{Bool} + identity_auth_verified::Maybe{Bool} + bank_account_verified::Maybe{Bool} + two_factor_auth_verified::Maybe{Bool} + locked::Maybe{Bool} + wallet_locked::Maybe{Bool} end struct Currency <: BithumbData - code::String - withdraw_fee::Float64 - is_coin::Bool - wallet_state::String - wallet_support::Vector{String} + code::String + withdraw_fee::Float64 + is_coin::Bool + wallet_state::String + wallet_support::Vector{String} end struct Account <: BithumbData - currency::String - balance::Float64 - locked::Float64 - avg_buy_price::Float64 - avg_buy_price_modified::Bool - unit_currency::String + currency::String + balance::Float64 + locked::Float64 + avg_buy_price::Float64 + avg_buy_price_modified::Bool + unit_currency::String end struct WithdrawLimit <: BithumbData - currency::String - minimum::Float64 - onetime::Float64 - daily::Float64 - remaining_daily::Float64 - fixed::Int64 - can_withdraw::Bool - remaining_daily_krw::Maybe{Float64} + currency::String + minimum::Float64 + onetime::Float64 + daily::Float64 + remaining_daily::Float64 + fixed::Int64 + can_withdraw::Bool + remaining_daily_krw::Maybe{Float64} end struct WithdrawInfoData <: BithumbData - member_level::MemberLevel - currency::Currency - account::Account - withdraw_limit::WithdrawLimit + member_level::MemberLevel + currency::Currency + account::Account + withdraw_limit::WithdrawLimit end """ withdraw_info(client::BithumbClient, query::WithdrawInfoQuery) @@ -82,14 +87,14 @@ using CryptoExchangeAPIs.Bithumb # Ensure that the environment variables BITHUMB_PUBLIC_KEY and BITHUMB_SECRET_KEY are set. bithumb_client = Bithumb.Client(; - base_url = "https://api.bithumb.com", - public_key = ENV["BITHUMB_PUBLIC_KEY"], - secret_key = ENV["BITHUMB_SECRET_KEY"], + base_url = "https://api.bithumb.com", + public_key = ENV["BITHUMB_PUBLIC_KEY"], + secret_key = ENV["BITHUMB_SECRET_KEY"], ) result = WithdrawInfo.withdraw_info( - bithumb_client; - currency = "BTC", - net_type = "BTC", + bithumb_client; + currency = "BTC", + net_type = "BTC", ) to_pretty_json(result.result) ``` @@ -101,39 +106,39 @@ to_pretty_json(result.result) "date": null, "data": { "member_level": { - "security_level": 3, - "fee_level": 1, - "email_verified": true, - "identity_auth_verified": true, - "bank_account_verified": true, - "two_factor_auth_verified": true, - "locked": false, - "wallet_locked": false + "security_level": 3, + "fee_level": 1, + "email_verified": true, + "identity_auth_verified": true, + "bank_account_verified": true, + "two_factor_auth_verified": true, + "locked": false, + "wallet_locked": false }, "currency": { - "code": "BTC", - "withdraw_fee": 0.0005, - "is_coin": true, - "wallet_state": "working", - "wallet_support": ["KRW", "BTC"] + "code": "BTC", + "withdraw_fee": 0.0005, + "is_coin": true, + "wallet_state": "working", + "wallet_support": ["KRW", "BTC"] }, "account": { - "currency": "BTC", - "balance": 1.0, - "locked": 0.0, - "avg_buy_price": 10000.0, - "avg_buy_price_modified": false, - "unit_currency": "KRW" + "currency": "BTC", + "balance": 1.0, + "locked": 0.0, + "avg_buy_price": 10000.0, + "avg_buy_price_modified": false, + "unit_currency": "KRW" }, "withdraw_limit": { - "currency": "BTC", - "minimum": 0.001, - "onetime": 2.0, - "daily": 5.0, - "remaining_daily": 5.0, - "fixed": 0, - "can_withdraw": true, - "remaining_daily_krw": null + "currency": "BTC", + "minimum": 0.001, + "onetime": 2.0, + "daily": 5.0, + "remaining_daily": 5.0, + "fixed": 0, + "can_withdraw": true, + "remaining_daily_krw": null } } } @@ -141,12 +146,11 @@ to_pretty_json(result.result) """ function withdraw_info(client::BithumbClient, query::WithdrawInfoQuery) CryptoExchangeAPIs.request_sign!(client, query, "v1/withdraws/chance") - return APIsRequest{Data{WithdrawInfoData}}("GET", "v1/withdraws/chance", query)(client) - end +end - function withdraw_info(client::BithumbClient; kw...) +function withdraw_info(client::BithumbClient; kw...) return withdraw_info(client, WithdrawInfoQuery(; kw...)) - end +end - end \ No newline at end of file +end \ No newline at end of file From 0743067370600ba27739d4d46383e2a04e33e6d0 Mon Sep 17 00:00:00 2001 From: Evgenii Popov Date: Fri, 31 Jan 2025 18:56:22 +0300 Subject: [PATCH 13/30] Add method WithdrawInfo for Bithumb --- src/Bithumb/Spot/API/WithdrawInfo.jl | 150 ++++++++++++++------------- 1 file changed, 77 insertions(+), 73 deletions(-) diff --git a/src/Bithumb/Spot/API/WithdrawInfo.jl b/src/Bithumb/Spot/API/WithdrawInfo.jl index 8830911d..e6d42e40 100644 --- a/src/Bithumb/Spot/API/WithdrawInfo.jl +++ b/src/Bithumb/Spot/API/WithdrawInfo.jl @@ -20,54 +20,55 @@ Base.@kwdef mutable struct WithdrawInfoQuery <: BithumbPrivateQuery end struct MemberLevel <: BithumbData - security_level::Maybe{Int64} - fee_level::Maybe{Int64} - email_verified::Maybe{Bool} - identity_auth_verified::Maybe{Bool} - bank_account_verified::Maybe{Bool} - two_factor_auth_verified::Maybe{Bool} - locked::Maybe{Bool} - wallet_locked::Maybe{Bool} + security_level::Maybe{Int64} + fee_level::Maybe{Int64} + email_verified::Maybe{Bool} + identity_auth_verified::Maybe{Bool} + bank_account_verified::Maybe{Bool} + two_factor_auth_verified::Maybe{Bool} + locked::Maybe{Bool} + wallet_locked::Maybe{Bool} end struct Currency <: BithumbData - code::String - withdraw_fee::Float64 - is_coin::Bool - wallet_state::String - wallet_support::Vector{String} + code::String + withdraw_fee::Float64 + is_coin::Bool + wallet_state::String + wallet_support::Vector{String} end struct Account <: BithumbData - currency::String - balance::Float64 - locked::Float64 - avg_buy_price::Float64 - avg_buy_price_modified::Bool - unit_currency::String + currency::String + balance::Float64 + locked::Float64 + avg_buy_price::Float64 + avg_buy_price_modified::Bool + unit_currency::String end struct WithdrawLimit <: BithumbData - currency::String - minimum::Float64 - onetime::Float64 - daily::Float64 - remaining_daily::Float64 - fixed::Int64 - can_withdraw::Bool - remaining_daily_krw::Maybe{Float64} + currency::String + minimum::Float64 + onetime::Float64 + daily::Float64 + remaining_daily::Float64 + fixed::Int64 + can_withdraw::Bool + remaining_daily_krw::Maybe{Float64} end struct WithdrawInfoData <: BithumbData - member_level::MemberLevel - currency::Currency - account::Account - withdraw_limit::WithdrawLimit + member_level::MemberLevel + currency::Currency + account::Account + withdraw_limit::WithdrawLimit end """ withdraw_info(client::BithumbClient, query::WithdrawInfoQuery) withdraw_info(client::BithumbClient; kw...) Retrieves detailed information about the withdrawal capabilities for a specific currency on the Bithumb exchange. + [`GET /v1/withdraws/chance`](https://apidocs.bithumb.com/reference/%EC%B6%9C%EA%B8%88-%EA%B0%80%EB%8A%A5-%EC%A0%95%EB%B3%B4) ## Description: @@ -87,14 +88,14 @@ using CryptoExchangeAPIs.Bithumb # Ensure that the environment variables BITHUMB_PUBLIC_KEY and BITHUMB_SECRET_KEY are set. bithumb_client = Bithumb.Client(; - base_url = "https://api.bithumb.com", - public_key = ENV["BITHUMB_PUBLIC_KEY"], - secret_key = ENV["BITHUMB_SECRET_KEY"], + base_url = "https://api.bithumb.com", + public_key = ENV["BITHUMB_PUBLIC_KEY"], + secret_key = ENV["BITHUMB_SECRET_KEY"], ) result = WithdrawInfo.withdraw_info( - bithumb_client; - currency = "BTC", - net_type = "BTC", + bithumb_client; + currency = "BTC", + net_type = "BTC", ) to_pretty_json(result.result) ``` @@ -104,53 +105,56 @@ to_pretty_json(result.result) { "status": "0000", "date": null, - "data": { - "member_level": { - "security_level": 3, - "fee_level": 1, - "email_verified": true, - "identity_auth_verified": true, - "bank_account_verified": true, - "two_factor_auth_verified": true, - "locked": false, - "wallet_locked": false + "data": + { + "member_level": { + "security_level": 3, + "fee_level": 1, + "email_verified": true, + "identity_auth_verified": true, + "bank_account_verified": true, + "two_factor_auth_verified": true, + "locked": false, + "wallet_locked": false }, - "currency": { - "code": "BTC", - "withdraw_fee": 0.0005, - "is_coin": true, - "wallet_state": "working", - "wallet_support": ["KRW", "BTC"] + "currency": + { + "code": "BTC", + "withdraw_fee": 0.0005, + "is_coin": true, + "wallet_state": "working", + "wallet_support": ["KRW", "BTC"] }, - "account": { - "currency": "BTC", - "balance": 1.0, - "locked": 0.0, - "avg_buy_price": 10000.0, - "avg_buy_price_modified": false, - "unit_currency": "KRW" + "account": + { + "currency": "BTC", + "balance": 1.0, + "locked": 0.0, + "avg_buy_price": 10000.0, + "avg_buy_price_modified": false, + "unit_currency": "KRW" }, - "withdraw_limit": { - "currency": "BTC", - "minimum": 0.001, - "onetime": 2.0, - "daily": 5.0, - "remaining_daily": 5.0, - "fixed": 0, - "can_withdraw": true, - "remaining_daily_krw": null + "withdraw_limit": { + "currency": "BTC", + "minimum": 0.001, + "onetime": 2.0, + "daily": 5.0, + "remaining_daily": 5.0, + "fixed": 0, + "can_withdraw": true, + "remaining_daily_krw": null } } } ``` """ function withdraw_info(client::BithumbClient, query::WithdrawInfoQuery) - CryptoExchangeAPIs.request_sign!(client, query, "v1/withdraws/chance") - return APIsRequest{Data{WithdrawInfoData}}("GET", "v1/withdraws/chance", query)(client) + CryptoExchangeAPIs.request_sign!(client, query, "v1/withdraws/chance") + return APIsRequest{Data{WithdrawInfoData}}("GET", "v1/withdraws/chance", query)(client) end function withdraw_info(client::BithumbClient; kw...) - return withdraw_info(client, WithdrawInfoQuery(; kw...)) + return withdraw_info(client, WithdrawInfoQuery(; kw...)) end - + end \ No newline at end of file From ab72f0bd9500bf2640ea246e462f164b26ddab09 Mon Sep 17 00:00:00 2001 From: Cors88 Date: Mon, 3 Feb 2025 14:34:12 +0300 Subject: [PATCH 14/30] Update Bithumb.md --- docs/src/pages/Bithumb.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/src/pages/Bithumb.md b/docs/src/pages/Bithumb.md index 5b5918e8..8208b39f 100644 --- a/docs/src/pages/Bithumb.md +++ b/docs/src/pages/Bithumb.md @@ -19,4 +19,5 @@ CryptoExchangeAPIs.Bithumb.Spot.market CryptoExchangeAPIs.Bithumb.Spot.order_book CryptoExchangeAPIs.Bithumb.Spot.ticker CryptoExchangeAPIs.Bithumb.Spot.user_transactions +CryptoExchangeAPIs.Bithumb.Spot.withdraw_info ``` From 99d39af8359bc1066dff0a17b1377905a6c8ff18 Mon Sep 17 00:00:00 2001 From: Evgenii Popov Date: Mon, 3 Feb 2025 17:06:19 +0300 Subject: [PATCH 15/30] Add method WithdrawInfo for Bithumb --- src/Bithumb/Bithumb.jl | 4 +- src/Bithumb/Spot/API/WithdrawInfo.jl | 87 +++++++++++++--------------- 2 files changed, 42 insertions(+), 49 deletions(-) diff --git a/src/Bithumb/Bithumb.jl b/src/Bithumb/Bithumb.jl index f1b1737e..dc6f9e02 100644 --- a/src/Bithumb/Bithumb.jl +++ b/src/Bithumb/Bithumb.jl @@ -94,7 +94,6 @@ function CryptoExchangeAPIs.request_sign!(::BithumbClient, query::Q, ::String):: end function CryptoExchangeAPIs.request_sign!(client::BithumbClient, query::Q, endpoint::String)::Q where {Q<:BithumbPrivateQuery} - query.signature = nothing body = Dict{String,Any}( "access_key" => client.public_key, @@ -111,8 +110,7 @@ function CryptoExchangeAPIs.request_sign!(client::BithumbClient, query::Q, endpo hs512 = JSONWebTokens.HS512(client.secret_key) token = JSONWebTokens.encode(hs512, body) query.signature = "Bearer $token" - return nothing - + return query end function CryptoExchangeAPIs.request_sign!(::BithumbClient, query::Q, ::String)::Q where {Q<:BithumbAccessQuery} diff --git a/src/Bithumb/Spot/API/WithdrawInfo.jl b/src/Bithumb/Spot/API/WithdrawInfo.jl index e6d42e40..5250cdc0 100644 --- a/src/Bithumb/Spot/API/WithdrawInfo.jl +++ b/src/Bithumb/Spot/API/WithdrawInfo.jl @@ -11,11 +11,10 @@ using CryptoExchangeAPIs.Bithumb using CryptoExchangeAPIs.Bithumb: Data using CryptoExchangeAPIs: Maybe, APIsRequest - - Base.@kwdef mutable struct WithdrawInfoQuery <: BithumbPrivateQuery currency::String net_type::String + signature::Maybe{String} = nothing end @@ -64,6 +63,7 @@ struct WithdrawInfoData <: BithumbData account::Account withdraw_limit::WithdrawLimit end + """ withdraw_info(client::BithumbClient, query::WithdrawInfoQuery) withdraw_info(client::BithumbClient; kw...) @@ -71,22 +71,18 @@ Retrieves detailed information about the withdrawal capabilities for a specific [`GET /v1/withdraws/chance`](https://apidocs.bithumb.com/reference/%EC%B6%9C%EA%B8%88-%EA%B0%80%EB%8A%A5-%EC%A0%95%EB%B3%B4) -## Description: -The `withdraw_info` function provides comprehensive details about the user's ability to withdraw a specific currency. -This includes information about the user's verification status, currency-specific details, account balances, and withdrawal limits. ## Parameters: | Parameter | Type | Required | Description | |-------------|-----------|----------|--------------------------------------| -| currency | String | Yes | The currency code (e.g., "BTC"). | -| net_type | String | Yes | The network type (e.g., "BTC"). | +| currency | String | true | The currency code (e.g., "BTC"). | +| net_type | String | true | The network type (e.g., "BTC"). | ## Code samples: ```julia using Serde using CryptoExchangeAPIs.Bithumb -# Ensure that the environment variables BITHUMB_PUBLIC_KEY and BITHUMB_SECRET_KEY are set. bithumb_client = Bithumb.Client(; base_url = "https://api.bithumb.com", public_key = ENV["BITHUMB_PUBLIC_KEY"], @@ -103,53 +99,52 @@ to_pretty_json(result.result) ```json { - "status": "0000", - "date": null, - "data": - { - "member_level": { - "security_level": 3, - "fee_level": 1, - "email_verified": true, - "identity_auth_verified": true, - "bank_account_verified": true, - "two_factor_auth_verified": true, - "locked": false, - "wallet_locked": false + "status":"0000", + "date":null, + "data":{ + "member_level":{ + "security_level":3, + "fee_level":1, + "email_verified":true, + "identity_auth_verified":true, + "bank_account_verified":true, + "two_factor_auth_verified":true, + "locked":false, + "wallet_locked":false }, - "currency": - { - "code": "BTC", - "withdraw_fee": 0.0005, - "is_coin": true, - "wallet_state": "working", - "wallet_support": ["KRW", "BTC"] + "currency":{ + "code":"BTC", + "withdraw_fee":0.0005, + "is_coin":true, + "wallet_state":"working", + "wallet_support":[ + "KRW", + "BTC" + ] }, - "account": - { - "currency": "BTC", - "balance": 1.0, - "locked": 0.0, - "avg_buy_price": 10000.0, - "avg_buy_price_modified": false, - "unit_currency": "KRW" + "account":{ + "currency":"BTC", + "balance":1.0, + "locked":0.0, + "avg_buy_price":10000.0, + "avg_buy_price_modified":false, + "unit_currency":"KRW" }, - "withdraw_limit": { - "currency": "BTC", - "minimum": 0.001, - "onetime": 2.0, - "daily": 5.0, - "remaining_daily": 5.0, - "fixed": 0, - "can_withdraw": true, - "remaining_daily_krw": null + "withdraw_limit":{ + "currency":"BTC", + "minimum":0.001, + "onetime":2.0, + "daily":5.0, + "remaining_daily":5.0, + "fixed":0, + "can_withdraw":true, + "remaining_daily_krw":null } } } ``` """ function withdraw_info(client::BithumbClient, query::WithdrawInfoQuery) - CryptoExchangeAPIs.request_sign!(client, query, "v1/withdraws/chance") return APIsRequest{Data{WithdrawInfoData}}("GET", "v1/withdraws/chance", query)(client) end From 6d18a363f6dd92b41a022b462498f0772d9abe7c Mon Sep 17 00:00:00 2001 From: Cors88 Date: Mon, 3 Feb 2025 17:40:38 +0300 Subject: [PATCH 16/30] Update src/Bithumb/Spot/API/WithdrawInfo.jl Co-authored-by: Artem Emelin <153018291+artememelin@users.noreply.github.com> --- src/Bithumb/Spot/API/WithdrawInfo.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bithumb/Spot/API/WithdrawInfo.jl b/src/Bithumb/Spot/API/WithdrawInfo.jl index 5250cdc0..7a89cdfc 100644 --- a/src/Bithumb/Spot/API/WithdrawInfo.jl +++ b/src/Bithumb/Spot/API/WithdrawInfo.jl @@ -152,4 +152,4 @@ function withdraw_info(client::BithumbClient; kw...) return withdraw_info(client, WithdrawInfoQuery(; kw...)) end -end \ No newline at end of file +end From 6d81b7a5f6ac3f963922354b0ad236426ab0a5cd Mon Sep 17 00:00:00 2001 From: Cors88 Date: Mon, 3 Feb 2025 17:40:53 +0300 Subject: [PATCH 17/30] Update src/Bithumb/Spot/API/WithdrawInfo.jl Co-authored-by: Artem Emelin <153018291+artememelin@users.noreply.github.com> --- src/Bithumb/Spot/API/WithdrawInfo.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Bithumb/Spot/API/WithdrawInfo.jl b/src/Bithumb/Spot/API/WithdrawInfo.jl index 7a89cdfc..d0099a2d 100644 --- a/src/Bithumb/Spot/API/WithdrawInfo.jl +++ b/src/Bithumb/Spot/API/WithdrawInfo.jl @@ -95,6 +95,7 @@ result = WithdrawInfo.withdraw_info( ) to_pretty_json(result.result) ``` + ## Result: ```json From 91acb77b9a5e8aa65eb513a4c4109ae1a3f4c61d Mon Sep 17 00:00:00 2001 From: Cors88 Date: Mon, 3 Feb 2025 17:41:08 +0300 Subject: [PATCH 18/30] Update src/Bithumb/Spot/API/WithdrawInfo.jl Co-authored-by: Artem Emelin <153018291+artememelin@users.noreply.github.com> --- src/Bithumb/Spot/API/WithdrawInfo.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Bithumb/Spot/API/WithdrawInfo.jl b/src/Bithumb/Spot/API/WithdrawInfo.jl index d0099a2d..b16ffda0 100644 --- a/src/Bithumb/Spot/API/WithdrawInfo.jl +++ b/src/Bithumb/Spot/API/WithdrawInfo.jl @@ -67,6 +67,7 @@ end """ withdraw_info(client::BithumbClient, query::WithdrawInfoQuery) withdraw_info(client::BithumbClient; kw...) + Retrieves detailed information about the withdrawal capabilities for a specific currency on the Bithumb exchange. [`GET /v1/withdraws/chance`](https://apidocs.bithumb.com/reference/%EC%B6%9C%EA%B8%88-%EA%B0%80%EB%8A%A5-%EC%A0%95%EB%B3%B4) From 18e392c5c66df1473f9f42aa3f9fc4008c816230 Mon Sep 17 00:00:00 2001 From: Evgenii Popov Date: Fri, 7 Feb 2025 13:56:11 +0300 Subject: [PATCH 19/30] Add method WithdrawInfo for Bithumb --- src/Bithumb/Bithumb.jl | 2 +- src/Bithumb/Spot/API/WithdrawInfo.jl | 91 ++++++++++++++-------------- src/Bithumb/Spot/Spot.jl | 2 +- 3 files changed, 47 insertions(+), 48 deletions(-) diff --git a/src/Bithumb/Bithumb.jl b/src/Bithumb/Bithumb.jl index dc6f9e02..0f20cda5 100644 --- a/src/Bithumb/Bithumb.jl +++ b/src/Bithumb/Bithumb.jl @@ -98,7 +98,7 @@ function CryptoExchangeAPIs.request_sign!(client::BithumbClient, query::Q, endpo body = Dict{String,Any}( "access_key" => client.public_key, "nonce" => string(UUIDs.uuid4()), - "timestamp" => string(time2unix(now(UTC))), + "timestamp" => string(datetime2unix(now(UTC))), ) if !isempty(Serde.to_query(query)) qstr = Serde.to_query(query) diff --git a/src/Bithumb/Spot/API/WithdrawInfo.jl b/src/Bithumb/Spot/API/WithdrawInfo.jl index b16ffda0..094cc230 100644 --- a/src/Bithumb/Spot/API/WithdrawInfo.jl +++ b/src/Bithumb/Spot/API/WithdrawInfo.jl @@ -101,57 +101,56 @@ to_pretty_json(result.result) ```json { - "status":"0000", - "date":null, - "data":{ - "member_level":{ - "security_level":3, - "fee_level":1, - "email_verified":true, - "identity_auth_verified":true, - "bank_account_verified":true, - "two_factor_auth_verified":true, - "locked":false, - "wallet_locked":false - }, - "currency":{ - "code":"BTC", - "withdraw_fee":0.0005, - "is_coin":true, - "wallet_state":"working", - "wallet_support":[ - "KRW", - "BTC" - ] - }, - "account":{ - "currency":"BTC", - "balance":1.0, - "locked":0.0, - "avg_buy_price":10000.0, - "avg_buy_price_modified":false, - "unit_currency":"KRW" - }, - "withdraw_limit":{ - "currency":"BTC", - "minimum":0.001, - "onetime":2.0, - "daily":5.0, - "remaining_daily":5.0, - "fixed":0, - "can_withdraw":true, - "remaining_daily_krw":null - } + "member_level": { + "security_level": null, + "fee_level": null, + "email_verified": null, + "identity_auth_verified": null, + "bank_account_verified": null, + "two_factor_auth_verified": null, + "locked": null, + "wallet_locked": null + }, + "currency": { + "code": "BTC", + "withdraw_fee": "0.000108", + "is_coin": true, + "wallet_state": "working", + "wallet_support": [ + "deposit", + "withdraw" + ] + }, + "account": { + "currency": "BTC", + "balance": "124.45282908", + "locked": "0", + "avg_buy_price": "36341011", + "avg_buy_price_modified": false, + "unit_currency": "KRW" + }, + "withdraw_limit": { + "currency": "BTC", + "onetime": "6.01", + "daily": "160", + "remaining_daily": "160.00000000", + "remaining_daily_fiat": null, + "fiat_currency": null, + "minimum": "0.0001", + "fixed": 8, + "withdraw_delayed_fiat": null, + "can_withdraw": true, + "remaining_daily_krw": null } } ``` """ function withdraw_info(client::BithumbClient, query::WithdrawInfoQuery) - return APIsRequest{Data{WithdrawInfoData}}("GET", "v1/withdraws/chance", query)(client) + return APIsRequest{WithdrawInfoData}("GET", "v1/withdraws/chance", query)(client) end - + function withdraw_info(client::BithumbClient; kw...) - return withdraw_info(client, WithdrawInfoQuery(; kw...)) -end - + return withdraw_info(client, WithdrawInfoQuery(; kw...)) end + +end \ No newline at end of file diff --git a/src/Bithumb/Spot/Spot.jl b/src/Bithumb/Spot/Spot.jl index 368b899d..6a0965f4 100644 --- a/src/Bithumb/Spot/Spot.jl +++ b/src/Bithumb/Spot/Spot.jl @@ -18,7 +18,7 @@ include("API/Market.jl") using .Market include("API/OrderBook.jl") -using .OrderBook +using .OrderBooktime2unix include("API/Ticker.jl") using .Ticker From 8bc14bcccb5c3f6400b94a540f35c8256bc6ee09 Mon Sep 17 00:00:00 2001 From: Evgenii Popov Date: Fri, 7 Feb 2025 14:01:42 +0300 Subject: [PATCH 20/30] Add method WithdrawInfo for Bithumb --- src/Bithumb/Bithumb.jl | 2 +- src/Bithumb/Spot/API/WithdrawInfo.jl | 91 ++++++++++++++-------------- 2 files changed, 46 insertions(+), 47 deletions(-) diff --git a/src/Bithumb/Bithumb.jl b/src/Bithumb/Bithumb.jl index dc6f9e02..0f20cda5 100644 --- a/src/Bithumb/Bithumb.jl +++ b/src/Bithumb/Bithumb.jl @@ -98,7 +98,7 @@ function CryptoExchangeAPIs.request_sign!(client::BithumbClient, query::Q, endpo body = Dict{String,Any}( "access_key" => client.public_key, "nonce" => string(UUIDs.uuid4()), - "timestamp" => string(time2unix(now(UTC))), + "timestamp" => string(datetime2unix(now(UTC))), ) if !isempty(Serde.to_query(query)) qstr = Serde.to_query(query) diff --git a/src/Bithumb/Spot/API/WithdrawInfo.jl b/src/Bithumb/Spot/API/WithdrawInfo.jl index b16ffda0..094cc230 100644 --- a/src/Bithumb/Spot/API/WithdrawInfo.jl +++ b/src/Bithumb/Spot/API/WithdrawInfo.jl @@ -101,57 +101,56 @@ to_pretty_json(result.result) ```json { - "status":"0000", - "date":null, - "data":{ - "member_level":{ - "security_level":3, - "fee_level":1, - "email_verified":true, - "identity_auth_verified":true, - "bank_account_verified":true, - "two_factor_auth_verified":true, - "locked":false, - "wallet_locked":false - }, - "currency":{ - "code":"BTC", - "withdraw_fee":0.0005, - "is_coin":true, - "wallet_state":"working", - "wallet_support":[ - "KRW", - "BTC" - ] - }, - "account":{ - "currency":"BTC", - "balance":1.0, - "locked":0.0, - "avg_buy_price":10000.0, - "avg_buy_price_modified":false, - "unit_currency":"KRW" - }, - "withdraw_limit":{ - "currency":"BTC", - "minimum":0.001, - "onetime":2.0, - "daily":5.0, - "remaining_daily":5.0, - "fixed":0, - "can_withdraw":true, - "remaining_daily_krw":null - } + "member_level": { + "security_level": null, + "fee_level": null, + "email_verified": null, + "identity_auth_verified": null, + "bank_account_verified": null, + "two_factor_auth_verified": null, + "locked": null, + "wallet_locked": null + }, + "currency": { + "code": "BTC", + "withdraw_fee": "0.000108", + "is_coin": true, + "wallet_state": "working", + "wallet_support": [ + "deposit", + "withdraw" + ] + }, + "account": { + "currency": "BTC", + "balance": "124.45282908", + "locked": "0", + "avg_buy_price": "36341011", + "avg_buy_price_modified": false, + "unit_currency": "KRW" + }, + "withdraw_limit": { + "currency": "BTC", + "onetime": "6.01", + "daily": "160", + "remaining_daily": "160.00000000", + "remaining_daily_fiat": null, + "fiat_currency": null, + "minimum": "0.0001", + "fixed": 8, + "withdraw_delayed_fiat": null, + "can_withdraw": true, + "remaining_daily_krw": null } } ``` """ function withdraw_info(client::BithumbClient, query::WithdrawInfoQuery) - return APIsRequest{Data{WithdrawInfoData}}("GET", "v1/withdraws/chance", query)(client) + return APIsRequest{WithdrawInfoData}("GET", "v1/withdraws/chance", query)(client) end - + function withdraw_info(client::BithumbClient; kw...) - return withdraw_info(client, WithdrawInfoQuery(; kw...)) -end - + return withdraw_info(client, WithdrawInfoQuery(; kw...)) end + +end \ No newline at end of file From ae824e4c350a95bd35d3d94cb5c16f99e65d885d Mon Sep 17 00:00:00 2001 From: Evgenii Popov Date: Mon, 10 Feb 2025 13:14:17 +0300 Subject: [PATCH 21/30] Add method WithdrawInfo for Bithumb --- src/Bithumb/Spot/API/WithdrawInfo.jl | 8 ++++---- src/Bithumb/Spot/Spot.jl | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Bithumb/Spot/API/WithdrawInfo.jl b/src/Bithumb/Spot/API/WithdrawInfo.jl index 094cc230..2e168bd8 100644 --- a/src/Bithumb/Spot/API/WithdrawInfo.jl +++ b/src/Bithumb/Spot/API/WithdrawInfo.jl @@ -87,8 +87,8 @@ using CryptoExchangeAPIs.Bithumb bithumb_client = Bithumb.Client(; base_url = "https://api.bithumb.com", public_key = ENV["BITHUMB_PUBLIC_KEY"], - secret_key = ENV["BITHUMB_SECRET_KEY"], -) +secret_key = ENV["BITHUMB_SECRET_KEY"], + ) result = WithdrawInfo.withdraw_info( bithumb_client; currency = "BTC", @@ -146,11 +146,11 @@ to_pretty_json(result.result) ``` """ function withdraw_info(client::BithumbClient, query::WithdrawInfoQuery) - return APIsRequest{WithdrawInfoData}("GET", "v1/withdraws/chance", query)(client) + return APIsRequest{WithdrawInfoData}("GET", "v1/withdraws/chance", query)(client) end function withdraw_info(client::BithumbClient; kw...) - return withdraw_info(client, WithdrawInfoQuery(; kw...)) + return withdraw_info(client, WithdrawInfoQuery(; kw...)) end end \ No newline at end of file diff --git a/src/Bithumb/Spot/Spot.jl b/src/Bithumb/Spot/Spot.jl index 6a0965f4..368b899d 100644 --- a/src/Bithumb/Spot/Spot.jl +++ b/src/Bithumb/Spot/Spot.jl @@ -18,7 +18,7 @@ include("API/Market.jl") using .Market include("API/OrderBook.jl") -using .OrderBooktime2unix +using .OrderBook include("API/Ticker.jl") using .Ticker From 7c4f36f5408c665c44febc2c10b38608161067e7 Mon Sep 17 00:00:00 2001 From: Evgenii Popov Date: Mon, 10 Feb 2025 13:28:37 +0300 Subject: [PATCH 22/30] Add method WithdrawInfo for Bithumb --- src/Bithumb/Spot/API/WithdrawInfo.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Bithumb/Spot/API/WithdrawInfo.jl b/src/Bithumb/Spot/API/WithdrawInfo.jl index 2e168bd8..0e478771 100644 --- a/src/Bithumb/Spot/API/WithdrawInfo.jl +++ b/src/Bithumb/Spot/API/WithdrawInfo.jl @@ -101,7 +101,7 @@ to_pretty_json(result.result) ```json { - "member_level": { + "member_level": { "security_level": null, "fee_level": null, "email_verified": null, @@ -110,7 +110,7 @@ to_pretty_json(result.result) "two_factor_auth_verified": null, "locked": null, "wallet_locked": null - }, +}, "currency": { "code": "BTC", "withdraw_fee": "0.000108", @@ -150,7 +150,7 @@ function withdraw_info(client::BithumbClient, query::WithdrawInfoQuery) end function withdraw_info(client::BithumbClient; kw...) - return withdraw_info(client, WithdrawInfoQuery(; kw...)) + return withdraw_info(client, WithdrawInfoQuery(; kw...)) end end \ No newline at end of file From 209d595ba72fc2acdfdf3b5dc777446cba6d374e Mon Sep 17 00:00:00 2001 From: Cors88 Date: Mon, 10 Feb 2025 23:24:55 +0300 Subject: [PATCH 23/30] Update src/Bithumb/Bithumb.jl Co-authored-by: Yuri Shadrin <53979055+yshadrin@users.noreply.github.com> --- src/Bithumb/Bithumb.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bithumb/Bithumb.jl b/src/Bithumb/Bithumb.jl index 0f20cda5..582e744c 100644 --- a/src/Bithumb/Bithumb.jl +++ b/src/Bithumb/Bithumb.jl @@ -98,7 +98,7 @@ function CryptoExchangeAPIs.request_sign!(client::BithumbClient, query::Q, endpo body = Dict{String,Any}( "access_key" => client.public_key, "nonce" => string(UUIDs.uuid4()), - "timestamp" => string(datetime2unix(now(UTC))), + "timestamp" => string(round(Int64, 1000 * datetime2unix(now(UTC)))), ) if !isempty(Serde.to_query(query)) qstr = Serde.to_query(query) From 4764c76b507e4c7a54f39402e5cc0c2431abf15c Mon Sep 17 00:00:00 2001 From: Evgenii Popov Date: Mon, 10 Feb 2025 23:28:00 +0300 Subject: [PATCH 24/30] Add method WithdrawInfo for Bithumb --- src/Bithumb/Spot/API/UserTransactions.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Bithumb/Spot/API/UserTransactions.jl b/src/Bithumb/Spot/API/UserTransactions.jl index 2e2158be..be4d1a2f 100644 --- a/src/Bithumb/Spot/API/UserTransactions.jl +++ b/src/Bithumb/Spot/API/UserTransactions.jl @@ -63,6 +63,7 @@ Provides information on member transaction completion details. [`POST /info/user_transactions`](https://apidocs.bithumb.com/reference/거래-체결내역-조회) + ## Parameters: | Parameter | Type | Required | Description | From 0cd01db2649fb1ff44e57183b06a34d5e8bb76d7 Mon Sep 17 00:00:00 2001 From: Cors88 Date: Mon, 10 Feb 2025 23:33:24 +0300 Subject: [PATCH 25/30] Update src/Bithumb/Spot/API/WithdrawInfo.jl Co-authored-by: Yuri Shadrin <53979055+yshadrin@users.noreply.github.com> --- src/Bithumb/Spot/API/WithdrawInfo.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bithumb/Spot/API/WithdrawInfo.jl b/src/Bithumb/Spot/API/WithdrawInfo.jl index 0e478771..f551607a 100644 --- a/src/Bithumb/Spot/API/WithdrawInfo.jl +++ b/src/Bithumb/Spot/API/WithdrawInfo.jl @@ -101,7 +101,7 @@ to_pretty_json(result.result) ```json { - "member_level": { + "member_level": { "security_level": null, "fee_level": null, "email_verified": null, @@ -110,7 +110,7 @@ to_pretty_json(result.result) "two_factor_auth_verified": null, "locked": null, "wallet_locked": null -}, + }, "currency": { "code": "BTC", "withdraw_fee": "0.000108", From 3fa1eb8258879733a178e573b0b69cdf1c69ecb2 Mon Sep 17 00:00:00 2001 From: Cors88 Date: Mon, 10 Feb 2025 23:33:48 +0300 Subject: [PATCH 26/30] Update src/Bithumb/Spot/API/WithdrawInfo.jl Co-authored-by: Yuri Shadrin <53979055+yshadrin@users.noreply.github.com> --- src/Bithumb/Spot/API/WithdrawInfo.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Bithumb/Spot/API/WithdrawInfo.jl b/src/Bithumb/Spot/API/WithdrawInfo.jl index f551607a..4e2c5a66 100644 --- a/src/Bithumb/Spot/API/WithdrawInfo.jl +++ b/src/Bithumb/Spot/API/WithdrawInfo.jl @@ -87,13 +87,15 @@ using CryptoExchangeAPIs.Bithumb bithumb_client = Bithumb.Client(; base_url = "https://api.bithumb.com", public_key = ENV["BITHUMB_PUBLIC_KEY"], -secret_key = ENV["BITHUMB_SECRET_KEY"], - ) + secret_key = ENV["BITHUMB_SECRET_KEY"], +) + result = WithdrawInfo.withdraw_info( bithumb_client; currency = "BTC", net_type = "BTC", ) + to_pretty_json(result.result) ``` From 464821b295fabb430453c9a0e1c7fdfd12e08bb8 Mon Sep 17 00:00:00 2001 From: Cors88 Date: Tue, 11 Feb 2025 13:40:20 +0300 Subject: [PATCH 27/30] Update src/Bithumb/Spot/API/UserTransactions.jl Co-authored-by: Artem Emelin <153018291+artememelin@users.noreply.github.com> --- src/Bithumb/Spot/API/UserTransactions.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Bithumb/Spot/API/UserTransactions.jl b/src/Bithumb/Spot/API/UserTransactions.jl index be4d1a2f..2e2158be 100644 --- a/src/Bithumb/Spot/API/UserTransactions.jl +++ b/src/Bithumb/Spot/API/UserTransactions.jl @@ -63,7 +63,6 @@ Provides information on member transaction completion details. [`POST /info/user_transactions`](https://apidocs.bithumb.com/reference/거래-체결내역-조회) - ## Parameters: | Parameter | Type | Required | Description | From 13dd2a7177092b67c40f9f2d45be4fa4a7a5584a Mon Sep 17 00:00:00 2001 From: Cors88 Date: Tue, 11 Feb 2025 13:40:29 +0300 Subject: [PATCH 28/30] Update src/Bithumb/Spot/API/WithdrawInfo.jl Co-authored-by: Artem Emelin <153018291+artememelin@users.noreply.github.com> --- src/Bithumb/Spot/API/WithdrawInfo.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bithumb/Spot/API/WithdrawInfo.jl b/src/Bithumb/Spot/API/WithdrawInfo.jl index 4e2c5a66..3fdc6b94 100644 --- a/src/Bithumb/Spot/API/WithdrawInfo.jl +++ b/src/Bithumb/Spot/API/WithdrawInfo.jl @@ -90,7 +90,7 @@ bithumb_client = Bithumb.Client(; secret_key = ENV["BITHUMB_SECRET_KEY"], ) -result = WithdrawInfo.withdraw_info( +result = Bithumb.Spot.withdraw_info( bithumb_client; currency = "BTC", net_type = "BTC", From a1c54275176a3b473347d47253726e3254861570 Mon Sep 17 00:00:00 2001 From: Cors88 Date: Tue, 11 Feb 2025 13:40:55 +0300 Subject: [PATCH 29/30] Update src/Bithumb/Spot/API/WithdrawInfo.jl Co-authored-by: Artem Emelin <153018291+artememelin@users.noreply.github.com> --- src/Bithumb/Spot/API/WithdrawInfo.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bithumb/Spot/API/WithdrawInfo.jl b/src/Bithumb/Spot/API/WithdrawInfo.jl index 3fdc6b94..7e1a3bf2 100644 --- a/src/Bithumb/Spot/API/WithdrawInfo.jl +++ b/src/Bithumb/Spot/API/WithdrawInfo.jl @@ -155,4 +155,4 @@ function withdraw_info(client::BithumbClient; kw...) return withdraw_info(client, WithdrawInfoQuery(; kw...)) end -end \ No newline at end of file +end From 08396bc1b32a0bcbf92d9172e3004c5ca86919e9 Mon Sep 17 00:00:00 2001 From: Cors88 Date: Tue, 11 Feb 2025 13:41:08 +0300 Subject: [PATCH 30/30] Update src/Bithumb/Spot/API/WithdrawInfo.jl Co-authored-by: Artem Emelin <153018291+artememelin@users.noreply.github.com> --- src/Bithumb/Spot/API/WithdrawInfo.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Bithumb/Spot/API/WithdrawInfo.jl b/src/Bithumb/Spot/API/WithdrawInfo.jl index 7e1a3bf2..d336415b 100644 --- a/src/Bithumb/Spot/API/WithdrawInfo.jl +++ b/src/Bithumb/Spot/API/WithdrawInfo.jl @@ -72,7 +72,6 @@ Retrieves detailed information about the withdrawal capabilities for a specific [`GET /v1/withdraws/chance`](https://apidocs.bithumb.com/reference/%EC%B6%9C%EA%B8%88-%EA%B0%80%EB%8A%A5-%EC%A0%95%EB%B3%B4) - ## Parameters: | Parameter | Type | Required | Description | |-------------|-----------|----------|--------------------------------------|