upbit

package module
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

README

English | 한국어

Upbit Go API Library

Go Reference

The Upbit Go library provides convenient access to the Upbit REST API from applications written in Go. The library includes type definitions for all request params and response fields.

Installation

import (
	"github.com/upbit-official/upbit-sdk-go" // imported as upbit
)

Or to pin the version:

go get -u 'github.com/upbit-official/upbit-sdk-go@v0.9.0'

Requirements

This library requires Go 1.25+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/upbit-official/upbit-sdk-go"
	"github.com/upbit-official/upbit-sdk-go/option"
)

func main() {
	client := upbit.NewClient(
		option.WithAccessKey(os.Getenv("UPBIT_ACCESS_KEY")),
		option.WithSecretKey(os.Getenv("UPBIT_SECRET_KEY")),
		// option.WithEnvironmentSg(), // or WithEnvironmentKr() | WithEnvironmentId() | WithEnvironmentTh(); defaults to WithEnvironmentKr()
	)
	accounts, err := client.Accounts.List(context.TODO())
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", accounts)
}

For more runnable examples, see the scripts in examples/.

Request fields

The Upbit library uses the omitzero semantics from the encoding/json package for request fields.

Required primitive fields (int64, string, etc.) feature the tag `api:"required"`. These fields are always serialized, even their zero values.

Optional primitive types are wrapped in a param.Opt[T]. These fields can be set with the provided constructors, upbit.String(string), upbit.Int(int64), etc.

Any param.Opt[T], map, slice, struct or string enum uses the tag `json:"...,omitzero"`. Its zero value is considered omitted.

The param.IsOmitted(any) function can confirm the presence of any omitzero field.

p := upbit.ExampleParams{
	ID:   "id_xxx",            // required property
	Name: upbit.String("..."), // optional property

	Point: upbit.Point{
		X: 0,            // required field will serialize as 0
		Y: upbit.Int(1), // optional field will serialize as 1
		// ... omitted non-required fields will not be serialized
	},

	Origin: upbit.Origin{}, // the zero value of [Origin] is considered omitted
}

To send null instead of a param.Opt[T], use param.Null[T](). To send null instead of a struct T, use param.NullStruct[T]().

p.Name = param.Null[string]()       // 'null' instead of string
p.Point = param.NullStruct[Point]() // 'null' instead of struct

param.IsNull(p.Name)  // true
param.IsNull(p.Point) // true

Request structs contain a .SetExtraFields(map[string]any) method which can send non-conforming fields in the request body. Extra fields overwrite any struct fields with a matching key. For security reasons, only use SetExtraFields with trusted data.

To send a custom value instead of a struct, use param.Override[T](value).

// In cases where the API specifies a given type,
// but you want to send something else, use [SetExtraFields]:
p.SetExtraFields(map[string]any{
	"x": 0.01, // send "x" as a float instead of int
})

// Send a number instead of an object
custom := param.Override[upbit.FooParams](12)
Request unions

Unions are represented as a struct with fields prefixed by "Of" for each of its variants, only one field can be non-zero. The non-zero field will be serialized.

Sub-properties of the union can be accessed via methods on the union struct. These methods return a mutable pointer to the underlying data, if present.

// Only one field can be non-zero, use param.IsOmitted() to check if a field is set
type AnimalUnionParam struct {
	OfCat *Cat `json:",omitzero,inline"`
	OfDog *Dog `json:",omitzero,inline"`
}

animal := AnimalUnionParam{
	OfCat: &Cat{
		Name: "Whiskers",
		Owner: PersonParam{
			Address: AddressParam{Street: "3333 Coyote Hill Rd", Zip: 0},
		},
	},
}

// Mutating a field
if address := animal.GetOwner().GetAddress(); address != nil {
	address.ZipCode = 94304
}
Response objects

All fields in response structs are ordinary value types (not pointers or wrappers). Response structs also include a special JSON field containing metadata about each property.

type Animal struct {
	Name   string `json:"name,nullable"`
	Owners int    `json:"owners"`
	Age    int    `json:"age"`
	JSON   struct {
		Name        respjson.Field
		Owner       respjson.Field
		Age         respjson.Field
		ExtraFields map[string]respjson.Field
	} `json:"-"`
}

To handle optional data, use the .Valid() method on the JSON field. .Valid() returns false if a field is null, not present, or couldn't be marshaled.

If .Valid() is false, the corresponding field will simply be its zero value.

raw := `{"owners": 1, "name": null}`

var res Animal
json.Unmarshal([]byte(raw), &res)

// Accessing regular fields

res.Owners // 1
res.Name   // ""
res.Age    // 0

// Optional field checks

res.JSON.Owners.Valid() // true
res.JSON.Name.Valid()   // false
res.JSON.Age.Valid()    // false

// Raw JSON values

res.JSON.Owners.Raw()                  // "1"
res.JSON.Name.Raw() == "null"          // true
res.JSON.Name.Raw() == respjson.Null   // true
res.JSON.Age.Raw() == ""               // true
res.JSON.Age.Raw() == respjson.Omitted // true

These .JSON structs also include an ExtraFields map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
Response Unions

In responses, unions are represented by a flattened struct containing all possible fields from each of the object variants. To convert it to a variant use the .AsFooVariant() method or the .AsAny() method if present.

If a response value union contains primitive values, primitive fields will be alongside the properties but prefixed with Of and feature the tag json:"...,inline".

type AnimalUnion struct {
	// From variants [Dog], [Cat]
	Owner Person `json:"owner"`
	// From variant [Dog]
	DogBreed string `json:"dog_breed"`
	// From variant [Cat]
	CatBreed string `json:"cat_breed"`
	// ...

	JSON struct {
		Owner respjson.Field
		// ...
	} `json:"-"`
}

// If animal variant
if animal.Owner.Address.ZipCode == "" {
	panic("missing zip code")
}

// Switch on the variant
switch variant := animal.AsAny().(type) {
case Dog:
case Cat:
default:
	panic("unexpected type")
}
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := upbit.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.Accounts.List(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

The request option option.WithDebugLog(nil) may be helpful while debugging.

See the full list of request options.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

iter := client.Orders.ListOpenAutoPaging(context.TODO(), upbit.OrderListOpenParams{})
// Automatically fetches more pages as needed.
for iter.Next() {
	order := iter.Current()
	fmt.Printf("%+v\n", order)
}
if err := iter.Err(); err != nil {
	panic(err.Error())
}

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

page, err := client.Orders.ListOpen(context.TODO(), upbit.OrderListOpenParams{})
for page != nil {
	for _, order := range page.Items {
		fmt.Printf("%+v\n", order)
	}
	page, err = page.GetNextPage()
}
if err != nil {
	panic(err.Error())
}
Errors

When the API returns a non-success status code, we return an error with type *upbit.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.Accounts.List(context.TODO())
if err != nil {
	var apierr *upbit.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/v1/accounts": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.Accounts.List(
	ctx,
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)
File uploads

Request parameters that correspond to file uploads in multipart requests are typed as io.Reader. The contents of the io.Reader will by default be sent as a multipart form part with the file name of "anonymous_file" and content-type of "application/octet-stream".

The file name and content-type can be customized by implementing Name() string or ContentType() string on the run-time type of io.Reader. Note that os.File implements Name() string, so a file returned by os.Open will be sent with the file name on disk.

We also provide a helper upbit.File(reader io.Reader, filename string, contentType string) which can be used to wrap any io.Reader with the appropriate file name and content type.

Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := upbit.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Accounts.List(context.TODO(), option.WithMaxRetries(5))
Accessing raw response data (e.g. response headers)

You can access the raw HTTP response data by using the option.WithResponseInto() request option. This is useful when you need to examine response headers, status codes, or other details.

// Create a variable to store the HTTP response
var response *http.Response
accounts, err := client.Accounts.List(context.TODO(), option.WithResponseInto(&response))
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", accounts)

fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Undocumented endpoints

To make requests to undocumented endpoints, you can use client.Get, client.Post, and other HTTP verbs. RequestOptions on the client, such as retries, will be respected when making these requests.

var (
    // params can be an io.Reader, a []byte, an encoding/json serializable object,
    // or a "…Params" struct defined in this library.
    params map[string]any

    // result can be an []byte, *http.Response, a encoding/json deserializable object,
    // or a model defined in this library.
    result *http.Response
)
err := client.Post(context.Background(), "/unspecified", params, &result)
if err != nil {
    …
}
Undocumented request params

To make requests using undocumented parameters, you may use either the option.WithQuery() or the option.WithJSONSet() methods.

params := FooNewParams{
    ID:   "id_xxxx",
    Data: FooNewParamsData{
        FirstName: upbit.String("John"),
    },
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
Undocumented response properties

To access undocumented response properties, you may either access the raw JSON of the response as a string with result.JSON.RawJSON(), or get the raw JSON of a particular field on the result with result.JSON.Foo.Raw().

Any fields that are not present on the response struct will be saved and can be accessed by result.JSON.ExtraFields which returns the extra fields as a map[string]Field.

Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, end.Sub(start))

	return res, err
}

client := upbit.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use.
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please contact us at open-api@upbit.com with questions, bugs, or suggestions.

Contributing

The Upbit SDK is in its initial release phase, and public contributions (Issues/PRs) are currently closed. For bug reports and feedback, please email open-api@upbit.com. We are considering opening external contribution channels in phases as the SDK becomes more stable.

© 2026 Dunamu Inc. All rights reserved.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(b bool) param.Opt[bool]

func BoolPtr

func BoolPtr(v bool) *bool

func DefaultClientOptions

func DefaultClientOptions() []option.RequestOption

DefaultClientOptions read from the environment (UPBIT_ACCESS_KEY, UPBIT_SECRET_KEY, UPBIT_BASE_URL). This should be used to initialize new clients.

func File

func File(rdr io.Reader, filename string, contentType string) file

func Float

func Float(f float64) param.Opt[float64]

func FloatPtr

func FloatPtr(v float64) *float64

func Int

func Int(i int64) param.Opt[int64]

func IntPtr

func IntPtr(v int64) *int64

func Opt

func Opt[T comparable](v T) param.Opt[T]

func Ptr

func Ptr[T any](v T) *T

func String

func String(s string) param.Opt[string]

func StringPtr

func StringPtr(v string) *string

func Time

func Time(t time.Time) param.Opt[time.Time]

func TimePtr

func TimePtr(v time.Time) *time.Time

Types

type APIKeyListResponse

type APIKeyListResponse struct {
	// Access key of the API key.
	AccessKey string `json:"access_key" api:"required"`
	// Expiration timestamp of the access key.
	//
	// [Format] yyyy-MM-dd'T'HH:mm:ss+09:00
	ExpireAt string `json:"expire_at" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AccessKey   respjson.Field
		ExpireAt    respjson.Field
		ExtraFields map[string]respjson.Field
		Raw         string
	} `json:"-"`
}

func (APIKeyListResponse) RawJSON

func (r APIKeyListResponse) RawJSON() string

RawJSON returns the unmodified JSON received from the API.

func (*APIKeyListResponse) UnmarshalJSON

func (r *APIKeyListResponse) UnmarshalJSON(data []byte) error

type APIKeyService

type APIKeyService struct {
	// contains filtered or unexported fields
}

APIKeyService contains methods and other services that help with interacting with the upbit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAPIKeyService method instead.

func NewAPIKeyService

func NewAPIKeyService(opts ...option.RequestOption) (r APIKeyService)

NewAPIKeyService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*APIKeyService) List

func (r *APIKeyService) List(ctx context.Context, opts ...option.RequestOption) (res *[]APIKeyListResponse, err error)

List API Keys

GET /v1/api_keys

- docs(kr): https://docs.upbit.com/kr/reference/list-api-keys - docs(global): https://global-docs.upbit.com/reference/list-api-keys

type AccountListResponse

type AccountListResponse struct {
	// Average buy price of the asset.
	AvgBuyPrice string `json:"avg_buy_price" api:"required"`
	// Indicates whether the average buy price has been modified.
	AvgBuyPriceModified bool `json:"avg_buy_price_modified" api:"required"`
	// Available amount or volume for orders. For digital assets, this represents the
	// available quantity. For fiat currency, this represents the available amount.
	Balance string `json:"balance" api:"required"`
	// Currency code to be queried.
	Currency string `json:"currency" api:"required"`
	// Amount or quantity locked by pending orders or withdrawals.
	Locked string `json:"locked" api:"required"`
	// Currency unit used as the basis for avg_buy_price.
	UnitCurrency string `json:"unit_currency" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AvgBuyPrice         respjson.Field
		AvgBuyPriceModified respjson.Field
		Balance             respjson.Field
		Currency            respjson.Field
		Locked              respjson.Field
		UnitCurrency        respjson.Field
		ExtraFields         map[string]respjson.Field
		Raw                 string
	} `json:"-"`
}

func (AccountListResponse) RawJSON

func (r AccountListResponse) RawJSON() string

RawJSON returns the unmodified JSON received from the API.

func (*AccountListResponse) UnmarshalJSON

func (r *AccountListResponse) UnmarshalJSON(data []byte) error

type AccountService

type AccountService struct {
	// contains filtered or unexported fields
}

AccountService contains methods and other services that help with interacting with the upbit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAccountService method instead.

func NewAccountService

func NewAccountService(opts ...option.RequestOption) (r AccountService)

NewAccountService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*AccountService) List

func (r *AccountService) List(ctx context.Context, opts ...option.RequestOption) (res *[]AccountListResponse, err error)

Get Account Balances

GET /v1/accounts

- docs(kr): https://docs.upbit.com/kr/reference/get-balance - docs(global): https://global-docs.upbit.com/reference/get-balance

type BatchCancelResult

type BatchCancelResult struct {
	// Information about orders that failed to cancel.
	Failed BatchCancelResultFailed `json:"failed" api:"required"`
	// Information about successfully cancelled orders.
	Success BatchCancelResultSuccess `json:"success" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Failed      respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		Raw         string
	} `json:"-"`
}

func (BatchCancelResult) RawJSON

func (r BatchCancelResult) RawJSON() string

RawJSON returns the unmodified JSON received from the API.

func (*BatchCancelResult) UnmarshalJSON

func (r *BatchCancelResult) UnmarshalJSON(data []byte) error

type BatchCancelResultFailed

type BatchCancelResultFailed struct {
	// Number of orders that failed to cancel.
	Count int64 `json:"count" api:"required"`
	// List of orders that failed to cancel.
	Orders []BatchCancelResultFailedOrder `json:"orders" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count       respjson.Field
		Orders      respjson.Field
		ExtraFields map[string]respjson.Field
		Raw         string
	} `json:"-"`
}

Information about orders that failed to cancel.

func (BatchCancelResultFailed) RawJSON

func (r BatchCancelResultFailed) RawJSON() string

RawJSON returns the unmodified JSON received from the API.

func (*BatchCancelResultFailed) UnmarshalJSON

func (r *BatchCancelResultFailed) UnmarshalJSON(data []byte) error

type BatchCancelResultFailedOrder

type BatchCancelResultFailedOrder struct {
	// Trading pair code.
	Market string `json:"market" api:"required"`
	// Unique identifier of the order.
	Uuid string `json:"uuid" api:"required"`
	// Client-assigned order identifier.
	//
	// - Only available for orders created after October 18, 2024.
	Identifier string `json:"identifier"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Market      respjson.Field
		Uuid        respjson.Field
		Identifier  respjson.Field
		ExtraFields map[string]respjson.Field
		Raw         string
	} `json:"-"`
}

func (BatchCancelResultFailedOrder) RawJSON

RawJSON returns the unmodified JSON received from the API.

func (*BatchCancelResultFailedOrder) UnmarshalJSON

func (r *BatchCancelResultFailedOrder) UnmarshalJSON(data []byte) error

type BatchCancelResultSuccess

type BatchCancelResultSuccess struct {
	// Number of successfully cancelled orders.
	Count int64 `json:"count" api:"required"`
	// List of successfully cancelled orders.
	Orders []BatchCancelResultSuccessOrder `json:"orders" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Count       respjson.Field
		Orders      respjson.Field
		ExtraFields map[string]respjson.Field
		Raw         string
	} `json:"-"`
}

Information about successfully cancelled orders.

func (BatchCancelResultSuccess) RawJSON

func (r BatchCancelResultSuccess) RawJSON() string

RawJSON returns the unmodified JSON received from the API.

func (*BatchCancelResultSuccess) UnmarshalJSON

func (r *BatchCancelResultSuccess) UnmarshalJSON(data []byte) error

type BatchCancelResultSuccessOrder

type BatchCancelResultSuccessOrder struct {
	// Trading pair code.
	Market string `json:"market" api:"required"`
	// Unique identifier of the order.
	Uuid string `json:"uuid" api:"required"`
	// Client-assigned order identifier.
	//
	// - Only available for orders created after October 18, 2024.
	Identifier string `json:"identifier"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Market      respjson.Field
		Uuid        respjson.Field
		Identifier  respjson.Field
		ExtraFields map[string]respjson.Field
		Raw         string
	} `json:"-"`
}

func (BatchCancelResultSuccessOrder) RawJSON

RawJSON returns the unmodified JSON received from the API.

func (*BatchCancelResultSuccessOrder) UnmarshalJSON

func (r *BatchCancelResultSuccessOrder) UnmarshalJSON(data []byte) error

type Candle

type Candle struct {
	// The total trade amount (in the quoted currency) accumulated during the candle
	// period.
	CandleAccTradePrice string `json:"candle_acc_trade_price" api:"required"`
	// The total traded volume (in the base asset) accumulated during the candle
	// period.
	CandleAccTradeVolume string `json:"candle_acc_trade_volume" api:"required"`
	// Start time of the candle period in KST. Supported in KOREA only.
	//
	// [Format]: yyyy-MM-dd'T'HH:mm:ss
	CandleDateTimeKst string `json:"candle_date_time_kst" api:"required"`
	// Start time of the candle period in UTC.
	//
	// [Format]: yyyy-MM-dd'T'HH:mm:ss
	CandleDateTimeUtc string `json:"candle_date_time_utc" api:"required"`
	// The highest trading price, recorded during the candle period.
	HighPrice string `json:"high_price" api:"required"`
	// The lowest trading price, recorded during the candle period.
	LowPrice string `json:"low_price" api:"required"`
	// Trading pair code representing the market.
	//
	// [Example]: "SGD-BTC"
	Market string `json:"market" api:"required"`
	// The opening price of the candle, representing the first trading price during the
	// candle period.
	OpeningPrice string `json:"opening_price" api:"required"`
	// The timestamp (in milliseconds) when the last tick of the candle was recorded.
	Timestamp int64 `json:"timestamp" api:"required"`
	// The closing price of the candle, representing the last trading price during the
	// candle period.
	TradePrice string `json:"trade_price" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CandleAccTradePrice  respjson.Field
		CandleAccTradeVolume respjson.Field
		CandleDateTimeKst    respjson.Field
		CandleDateTimeUtc    respjson.Field
		HighPrice            respjson.Field
		LowPrice             respjson.Field
		Market               respjson.Field
		OpeningPrice         respjson.Field
		Timestamp            respjson.Field
		TradePrice           respjson.Field
		ExtraFields          map[string]respjson.Field
		Raw                  string
	} `json:"-"`
}

func (Candle) RawJSON

func (r Candle) RawJSON() string

RawJSON returns the unmodified JSON received from the API.

func (*Candle) UnmarshalJSON

func (r *Candle) UnmarshalJSON(data []byte) error

type CandleListDaysParams

type CandleListDaysParams struct {
	// Trading pair code to query.
	Market string `query:"market" api:"required" json:"-"`
	// Currency to convert the closing price into. When specified, the response
	// includes a "converted_trade_price" field with the closing price converted to the
	// given currency.
	//
	// [Example] Specifying "KRW" returns the closing price converted to KRW.
	ConvertingPriceUnit param.Opt[string] `query:"converting_price_unit,omitzero" json:"-"`
	// Number of candles to retrieve.
	//
	// Up to 200 candles are supported. Default: 1.
	Count param.Opt[int64] `query:"count,omitzero" json:"-"`
	// End time of the query range. Retrieves candles before the specified time. If not
	// specified, the most recent candles are returned.
	//
	// Accepts ISO 8601 datetime format.
	To param.Opt[string] `query:"to,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (CandleListDaysParams) URLQuery

func (r CandleListDaysParams) URLQuery() (v url.Values, err error)

URLQuery serializes CandleListDaysParams's query parameters as `url.Values`.

type CandleListDaysResponse

type CandleListDaysResponse struct {
	// Price change = trade_price - prev_closing_price.
	ChangePrice string `json:"change_price" api:"required"`
	// Change rate = (trade_price - prev_closing_price) / prev_closing_price.
	ChangeRate string `json:"change_rate" api:"required"`
	// Previous day's closing price (UTC-based).
	PrevClosingPrice string `json:"prev_closing_price" api:"required"`
	// Closing price converted per converting_price_unit. Null for non-digital asset
	// markets.
	ConvertedTradePrice string `json:"converted_trade_price"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ChangePrice         respjson.Field
		ChangeRate          respjson.Field
		PrevClosingPrice    respjson.Field
		ConvertedTradePrice respjson.Field
		ExtraFields         map[string]respjson.Field
		Raw                 string
	} `json:"-"`
	Candle
}

func (CandleListDaysResponse) RawJSON

func (r CandleListDaysResponse) RawJSON() string

RawJSON returns the unmodified JSON received from the API.

func (*CandleListDaysResponse) UnmarshalJSON

func (r *CandleListDaysResponse) UnmarshalJSON(data []byte) error

type CandleListMinutesParams

type CandleListMinutesParams struct {
	// Trading pair code to query.
	Market string `query:"market" api:"required" json:"-"`
	// Number of candles to retrieve.
	//
	// Up to 200 candles are supported. Default: 1.
	Count param.Opt[int64] `query:"count,omitzero" json:"-"`
	// End time of the query range. Retrieves candles before the specified time. If not
	// specified, the most recent candles are returned.
	//
	// Accepts ISO 8601 datetime format.
	//
	// [Example] 2025-06-24T04:56:53Z 2025-06-24 04:56:53 2025-06-24T13:56:53+08:00
	To param.Opt[string] `query:"to,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (CandleListMinutesParams) URLQuery

func (r CandleListMinutesParams) URLQuery() (v url.Values, err error)

URLQuery serializes CandleListMinutesParams's query parameters as `url.Values`.

type CandleListMonthsParams

type CandleListMonthsParams struct {
	// Trading pair code to query.
	Market string `query:"market" api:"required" json:"-"`
	// Number of candles to retrieve. Up to 200, default: 1.
	Count param.Opt[int64] `query:"count,omitzero" json:"-"`
	// End time of the query range. If not specified, the most recent candles are
	// returned.
	//
	// Accepts ISO 8601 datetime format.
	To param.Opt[string] `query:"to,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (CandleListMonthsParams) URLQuery

func (r CandleListMonthsParams) URLQuery() (v url.Values, err error)

URLQuery serializes CandleListMonthsParams's query parameters as `url.Values`.

type CandleListSecondsParams

type CandleListSecondsParams struct {
	// Trading pair code to query.
	Market string `query:"market" api:"required" json:"-"`
	// Number of candles to retrieve.
	//
	// Up to 200 candles are supported. Default: 1.
	Count param.Opt[int64] `query:"count,omitzero" json:"-"`
	// End time of the query range. Retrieves candles before the specified time. If not
	// specified, the most recent candles are returned.
	//
	// Accepts ISO 8601 datetime format. URL encoding is required for spaces and
	// special characters.
	//
	// [Example] 2025-06-24T04:56:53Z 2025-06-24 04:56:53 2025-06-24T13:56:53+08:00
	//
	// Second candles only support data up to 3 months prior. An empty array is
	// returned for older times.
	To param.Opt[string] `query:"to,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (CandleListSecondsParams) URLQuery

func (r CandleListSecondsParams) URLQuery() (v url.Values, err error)

URLQuery serializes CandleListSecondsParams's query parameters as `url.Values`.

type CandleListWeeksParams

type CandleListWeeksParams struct {
	// Trading pair code to query.
	Market string `query:"market" api:"required" json:"-"`
	// Number of candles to retrieve. Up to 200, default: 1.
	Count param.Opt[int64] `query:"count,omitzero" json:"-"`
	// End time of the query range. Retrieves candles before the specified time. If not
	// specified, the most recent candles are returned.
	To param.Opt[string] `query:"to,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (CandleListWeeksParams) URLQuery

func (r CandleListWeeksParams) URLQuery() (v url.Values, err error)

URLQuery serializes CandleListWeeksParams's query parameters as `url.Values`.

type CandleListYearsParams

type CandleListYearsParams struct {
	// Trading pair code to query.
	Market string `query:"market" api:"required" json:"-"`
	// Number of candles to retrieve. Up to 200, default: 1.
	Count param.Opt[int64] `query:"count,omitzero" json:"-"`
	// End time of the query range. ISO 8601 format.
	To param.Opt[string] `query:"to,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (CandleListYearsParams) URLQuery

func (r CandleListYearsParams) URLQuery() (v url.Values, err error)

URLQuery serializes CandleListYearsParams's query parameters as `url.Values`.

type CandlePeriod

type CandlePeriod struct {
	// Start date of candle aggregation period (yyyy-MM-dd).
	FirstDayOfPeriod string `json:"first_day_of_period" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		FirstDayOfPeriod respjson.Field
		ExtraFields      map[string]respjson.Field
		Raw              string
	} `json:"-"`
	Candle
}

func (CandlePeriod) RawJSON

func (r CandlePeriod) RawJSON() string

RawJSON returns the unmodified JSON received from the API.

func (*CandlePeriod) UnmarshalJSON

func (r *CandlePeriod) UnmarshalJSON(data []byte) error

type CandleService

type CandleService struct {
	// contains filtered or unexported fields
}

CandleService contains methods and other services that help with interacting with the upbit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewCandleService method instead.

func NewCandleService

func NewCandleService(opts ...option.RequestOption) (r CandleService)

NewCandleService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*CandleService) ListDays

func (r *CandleService) ListDays(ctx context.Context, query CandleListDaysParams, opts ...option.RequestOption) (res *[]CandleListDaysResponse, err error)

List Day Candles

GET /v1/candles/days

- docs(kr): https://docs.upbit.com/kr/reference/list-candles-days - docs(global): https://global-docs.upbit.com/reference/list-candles-days

func (*CandleService) ListMinutes

func (r *CandleService) ListMinutes(ctx context.Context, unit int64, query CandleListMinutesParams, opts ...option.RequestOption) (res *[]Candle, err error)

List Minute Candles

GET /v1/candles/minutes/{unit}

- docs(kr): https://docs.upbit.com/kr/reference/list-candles-minutes - docs(global): https://global-docs.upbit.com/reference/list-candles-minutes

func (*CandleService) ListMonths

func (r *CandleService) ListMonths(ctx context.Context, query CandleListMonthsParams, opts ...option.RequestOption) (res *[]CandlePeriod, err error)

List Month Candles

GET /v1/candles/months

- docs(kr): https://docs.upbit.com/kr/reference/list-candles-months - docs(global): https://global-docs.upbit.com/reference/list-candles-months

func (*CandleService) ListSeconds

func (r *CandleService) ListSeconds(ctx context.Context, query CandleListSecondsParams, opts ...option.RequestOption) (res *[]Candle, err error)

List Second Candles

GET /v1/candles/seconds

- docs(kr): https://docs.upbit.com/kr/reference/list-candles-seconds - docs(global): https://global-docs.upbit.com/reference/list-candles-seconds

func (*CandleService) ListWeeks

func (r *CandleService) ListWeeks(ctx context.Context, query CandleListWeeksParams, opts ...option.RequestOption) (res *[]CandlePeriod, err error)

List Week Candles

GET /v1/candles/weeks

- docs(kr): https://docs.upbit.com/kr/reference/list-candles-weeks - docs(global): https://global-docs.upbit.com/reference/list-candles-weeks

func (*CandleService) ListYears

func (r *CandleService) ListYears(ctx context.Context, query CandleListYearsParams, opts ...option.RequestOption) (res *[]CandlePeriod, err error)

List Year Candles

GET /v1/candles/years

- docs(kr): https://docs.upbit.com/kr/reference/list-candles-years - docs(global): https://global-docs.upbit.com/reference/list-candles-years

type Client

type Client struct {
	Accounts     AccountService
	TravelRule   TravelRuleService
	WalletStatus WalletStatusService
	APIKeys      APIKeyService
	Orders       OrderService
	Withdraws    WithdrawService
	Deposits     DepositService
	TradingPairs TradingPairService
	Tickers      TickerService
	Orderbooks   OrderbookService
	Trades       TradeService
	Candles      CandleService
	// contains filtered or unexported fields
}

Client creates a struct with services and top level methods that help with interacting with the upbit API. You should not instantiate this client directly, and instead use the NewClient method instead.

func NewClient

func NewClient(opts ...option.RequestOption) (r Client)

NewClient generates a new client with the default option read from the environment (UPBIT_ACCESS_KEY, UPBIT_SECRET_KEY, UPBIT_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.

func (*Client) Delete

func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Execute

func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error

Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.

If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.

The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.

If your params struct uses param.Opt, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Opt without specifying how it is serialized.

Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.

The response body will be deserialized into the res variable, depending on its type:

  • A pointer to a *http.Response is populated by the raw response.
  • A pointer to a byte array will be populated with the contents of the request body.
  • A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
  • A nil value will not read the response body.

For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.

func (*Client) Get

func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Patch

func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Post

func (r *Client) Post(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Put

func (r *Client) Put(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

type ClosedOrderState

type ClosedOrderState string

Closed order state.

- `done`: Fully executed - `cancel`: Cancelled

const (
	ClosedOrderStateDone   ClosedOrderState = "done"
	ClosedOrderStateCancel ClosedOrderState = "cancel"
)

type Deposit

type Deposit struct {
	// Deposit amount.
	Amount string `json:"amount" api:"required"`
	// Timestamp when the deposit was requested.
	//
	// [Format] yyyy-MM-ddTHH:mm:ss+00:00
	CreatedAt string `json:"created_at" api:"required"`
	// Currency code of the deposit.
	Currency string `json:"currency" api:"required"`
	// Timestamp when the deposit was completed.
	//
	// [Format] yyyy-MM-ddTHH:mm:ss+00:00
	DoneAt string `json:"done_at" api:"required"`
	// Deposit fee.
	Fee string `json:"fee" api:"required"`
	// Deposit status.
	//
	//   - `PROCESSING`: Deposit in progress (digital asset only)
	//   - `ACCEPTED`: Completed
	//   - `CANCELLED`: Cancelled
	//   - `REJECTED`: Rejected
	//   - `TRAVEL_RULE_SUSPECTED`: Awaiting additional Travel Rule verification (digital
	//     assets only)
	//   - `REFUNDING`: Refund in progress
	//   - `REFUNDED`: Refunded (digital asset only)
	//
	// Any of "PROCESSING", "ACCEPTED", "CANCELLED", "REJECTED",
	// "TRAVEL_RULE_SUSPECTED", "REFUNDING", "REFUNDED".
	State DepositState `json:"state" api:"required"`
	// Deposit transaction type.
	//
	// - `default`: Standard deposit
	// - `internal`: Internal deposit (between Upbit accounts)
	//
	// Any of "default", "internal".
	TransactionType DepositTransactionType `json:"transaction_type" api:"required"`
	// Deposit transaction ID.
	Txid string `json:"txid" api:"required"`
	// Transaction type.
	Type string `json:"type" api:"required"`
	// Unique identifier (UUID) of the deposit.
	Uuid string `json:"uuid" api:"required"`
	// Deposit network type. Returns null for fiat (KRW) deposits.
	//
	// [Example] ETH, TRX, SOL
	NetType string `json:"net_type" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Amount          respjson.Field
		CreatedAt       respjson.Field
		Currency        respjson.Field
		DoneAt          respjson.Field
		Fee             respjson.Field
		State           respjson.Field
		TransactionType respjson.Field
		Txid            respjson.Field
		Type            respjson.Field
		Uuid            respjson.Field
		NetType         respjson.Field
		ExtraFields     map[string]respjson.Field
		Raw             string
	} `json:"-"`
}

func (Deposit) RawJSON

func (r Deposit) RawJSON() string

RawJSON returns the unmodified JSON received from the API.

func (*Deposit) UnmarshalJSON

func (r *Deposit) UnmarshalJSON(data []byte) error

type DepositAddress

type DepositAddress struct {
	// Currency code for which the deposit address was created.
	Currency string `json:"currency" api:"required"`
	// Deposit address.
	DepositAddress string `json:"deposit_address" api:"required"`
	// Deposit network type.
	//
	// Blockchain network identifier used by Upbit.
	//
	// [Example] ETH, TRX, SOL
	NetType string `json:"net_type" api:"required"`
	// Secondary deposit address (Destination Tag, Memo, or Message).
	SecondaryAddress string `json:"secondary_address" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Currency         respjson.Field
		DepositAddress   respjson.Field
		NetType          respjson.Field
		SecondaryAddress respjson.Field
		ExtraFields      map[string]respjson.Field
		Raw              string
	} `json:"-"`
}

func (DepositAddress) RawJSON

func (r DepositAddress) RawJSON() string

RawJSON returns the unmodified JSON received from the API.

func (*DepositAddress) UnmarshalJSON

func (r *DepositAddress) UnmarshalJSON(data []byte) error

type DepositDepositKrwParams

type DepositDepositKrwParams struct {
	// KRW amount to deposit.
	Amount string `json:"amount" api:"required"`
	// Two-factor authentication method for KRW transactions.
	//
	// - `kakao`: Kakao authentication
	// - `naver`: Naver authentication
	// - `hana`: Hana certificate authentication
	//
	// Any of "kakao", "naver", "hana".
	TwoFactorType DepositDepositKrwParamsTwoFactorType `json:"two_factor_type,omitzero" api:"required"`
	// contains filtered or unexported fields
}

func (DepositDepositKrwParams) MarshalJSON

func (r DepositDepositKrwParams) MarshalJSON() (data []byte, err error)

func (*DepositDepositKrwParams) UnmarshalJSON

func (r *DepositDepositKrwParams) UnmarshalJSON(data []byte) error

type DepositDepositKrwParamsTwoFactorType

type DepositDepositKrwParamsTwoFactorType string

Two-factor authentication method for KRW transactions.

- `kakao`: Kakao authentication - `naver`: Naver authentication - `hana`: Hana certificate authentication

const (
	DepositDepositKrwParamsTwoFactorTypeKakao DepositDepositKrwParamsTwoFactorType = "kakao"
	DepositDepositKrwParamsTwoFactorTypeNaver DepositDepositKrwParamsTwoFactorType = "naver"
	DepositDepositKrwParamsTwoFactorTypeHana  DepositDepositKrwParamsTwoFactorType = "hana"
)

type DepositGetChanceParams

type DepositGetChanceParams struct {
	// Currency code to query deposit availability for.
	Currency string `query:"currency" api:"required" json:"-"`
	// Blockchain network identifier for digital asset deposit.
	//
	// Used to filter by network.
	NetType string `query:"net_type" api:"required" json:"-"`
	// contains filtered or unexported fields
}

func (DepositGetChanceParams) URLQuery

func (r DepositGetChanceParams) URLQuery() (v url.Values, err error)

URLQuery serializes DepositGetChanceParams's query parameters as `url.Values`.

type DepositGetChanceResponse

type DepositGetChanceResponse struct {
	// Currency code to be queried.
	Currency string `json:"currency" api:"required"`
	// Decimal precision applied to deposits.
	DecimalPrecision int64 `json:"decimal_precision" api:"required"`
	// Reason why deposits are not possible.
	//
	// ※ Provided when "is_deposit_possible" is "false".
	DepositImpossibleReason string `json:"deposit_impossible_reason" api:"required"`
	// Whether deposits are currently possible.
	IsDepositPossible bool `json:"is_deposit_possible" api:"required"`
	// Minimum deposit amount.
	MinimumDepositAmount string `json:"minimum_deposit_amount" api:"required"`
	// Minimum number of blockchain confirmations required for the deposit to be
	// credited.
	MinimumDepositConfirmations int64 `json:"minimum_deposit_confirmations" api:"required"`
	// Deposit network type.
	//
	// Blockchain network identifier used by Upbit.
	//
	// [Example] ETH, TRX, SOL
	NetType string `json:"net_type" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Currency                    respjson.Field
		DecimalPrecision            respjson.Field
		DepositImpossibleReason     respjson.Field
		IsDepositPossible           respjson.Field
		MinimumDepositAmount        respjson.Field
		MinimumDepositConfirmations respjson.Field
		NetType                     respjson.Field
		ExtraFields                 map[string]respjson.Field
		Raw                         string
	} `json:"-"`
}

func (DepositGetChanceResponse) RawJSON

func (r DepositGetChanceResponse) RawJSON() string

RawJSON returns the unmodified JSON received from the API.

func (*DepositGetChanceResponse) UnmarshalJSON

func (r *DepositGetChanceResponse) UnmarshalJSON(data []byte) error

type DepositGetCoinAddressParams

type DepositGetCoinAddressParams struct {
	// Currency code to query.
	Currency string `query:"currency" api:"required" json:"-"`
	// Blockchain network identifier.
	//
	// Used to filter by network.
	NetType string `query:"net_type" api:"required" json:"-"`
	// contains filtered or unexported fields
}

func (DepositGetCoinAddressParams) URLQuery

func (r DepositGetCoinAddressParams) URLQuery() (v url.Values, err error)

URLQuery serializes DepositGetCoinAddressParams's query parameters as `url.Values`.

type DepositGetParams

type DepositGetParams struct {
	// Currency code filter.
	Currency param.Opt[string] `query:"currency,omitzero" json:"-"`
	// Transaction ID of the deposit to query.
	//
	// If neither uuid nor txid is provided, the latest deposit is returned.
	Txid param.Opt[string] `query:"txid,omitzero" json:"-"`
	// UUID of the deposit to query.
	//
	// If neither uuid nor txid is provided, the latest deposit is returned.
	Uuid param.Opt[string] `query:"uuid,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (DepositGetParams) URLQuery

func (r DepositGetParams) URLQuery() (v url.Values, err error)

URLQuery serializes DepositGetParams's query parameters as `url.Values`.

type DepositListParams

type DepositListParams struct {
	// Currency code filter. If not specified, the latest deposits are returned.
	Currency param.Opt[string] `query:"currency,omitzero" json:"-"`
	// Cursor for pagination. Enter a "uuid" from the response to retrieve "limit"
	// deposits after that timestamp.
	From param.Opt[string] `query:"from,omitzero" json:"-"`
	// Number of results per request (default: 100, max: 100).
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Page number for pagination. Default is 1.
	Page param.Opt[int64] `query:"page,omitzero" json:"-"`
	// Cursor for pagination. Enter a "uuid" from the response to retrieve "limit"
	// deposits before that timestamp.
	To param.Opt[string] `query:"to,omitzero" json:"-"`
	// Sort order. "desc" (newest first) or "asc" (oldest first). Default is "desc".
	//
	// Any of "asc", "desc".
	OrderBy DepositListParamsOrderBy `query:"order_by,omitzero" json:"-"`
	// Deposit state filter.
	//
	// - `PROCESSING`: Processing
	// - `ACCEPTED`: Completed
	// - `CANCELLED`: Cancelled
	// - `REJECTED`: Rejected
	// - `TRAVEL_RULE_SUSPECTED`: Pending Travel Rule verification
	// - `REFUNDING`: Refund in progress
	// - `REFUNDED`: Refunded
	//
	// Any of "PROCESSING", "ACCEPTED", "CANCELLED", "REJECTED",
	// "TRAVEL_RULE_SUSPECTED", "REFUNDING", "REFUNDED".
	State DepositListParamsState `query:"state,omitzero" json:"-"`
	// List of transaction IDs to query.
	//
	// [Example] txids[]=txid1&txids[]=txid2
	Txids []string `query:"txids,omitzero" json:"-"`
	// List of UUIDs to query.
	//
	// [Example] uuids[]=uuid1&uuids[]=uuid2
	Uuids []string `query:"uuids,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (DepositListParams) URLQuery

func (r DepositListParams) URLQuery() (v url.Values, err error)

URLQuery serializes DepositListParams's query parameters as `url.Values`.

type DepositListParamsOrderBy

type DepositListParamsOrderBy string

Sort order. "desc" (newest first) or "asc" (oldest first). Default is "desc".

const (
	DepositListParamsOrderByAsc  DepositListParamsOrderBy = "asc"
	DepositListParamsOrderByDesc DepositListParamsOrderBy = "desc"
)

type DepositListParamsState

type DepositListParamsState string

Deposit state filter.

- `PROCESSING`: Processing - `ACCEPTED`: Completed - `CANCELLED`: Cancelled - `REJECTED`: Rejected - `TRAVEL_RULE_SUSPECTED`: Pending Travel Rule verification - `REFUNDING`: Refund in progress - `REFUNDED`: Refunded

const (
	DepositListParamsStateProcessing          DepositListParamsState = "PROCESSING"
	DepositListParamsStateAccepted            DepositListParamsState = "ACCEPTED"
	DepositListParamsStateCancelled           DepositListParamsState = "CANCELLED"
	DepositListParamsStateRejected            DepositListParamsState = "REJECTED"
	DepositListParamsStateTravelRuleSuspected DepositListParamsState = "TRAVEL_RULE_SUSPECTED"
	DepositListParamsStateRefunding           DepositListParamsState = "REFUNDING"
	DepositListParamsStateRefunded            DepositListParamsState = "REFUNDED"
)

type DepositNewCoinAddressParams

type DepositNewCoinAddressParams struct {
	// Currency code for which to create a deposit address.
	Currency string `json:"currency" api:"required"`
	// Network type.
	NetType string `json:"net_type" api:"required"`
	// contains filtered or unexported fields
}

func (DepositNewCoinAddressParams) MarshalJSON

func (r DepositNewCoinAddressParams) MarshalJSON() (data []byte, err error)

func (*DepositNewCoinAddressParams) UnmarshalJSON

func (r *DepositNewCoinAddressParams) UnmarshalJSON(data []byte) error

type DepositNewCoinAddressResponseGenerateCoinAddressResponse

type DepositNewCoinAddressResponseGenerateCoinAddressResponse struct {
	// Message about the deposit address creation request.
	Message string `json:"message" api:"required"`
	// Whether the deposit address creation request was accepted.
	Success bool `json:"success" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Message     respjson.Field
		Success     respjson.Field
		ExtraFields map[string]respjson.Field
		Raw         string
	} `json:"-"`
}

func (DepositNewCoinAddressResponseGenerateCoinAddressResponse) RawJSON

RawJSON returns the unmodified JSON received from the API.

func (*DepositNewCoinAddressResponseGenerateCoinAddressResponse) UnmarshalJSON

type DepositNewCoinAddressResponseUnion

type DepositNewCoinAddressResponseUnion struct {
	// This field is from variant [DepositAddress].
	Currency string `json:"currency"`
	// This field is from variant [DepositAddress].
	DepositAddress string `json:"deposit_address"`
	// This field is from variant [DepositAddress].
	NetType string `json:"net_type"`
	// This field is from variant [DepositAddress].
	SecondaryAddress string `json:"secondary_address"`
	// This field is from variant
	// [DepositNewCoinAddressResponseGenerateCoinAddressResponse].
	Message string `json:"message"`
	// This field is from variant
	// [DepositNewCoinAddressResponseGenerateCoinAddressResponse].
	Success bool `json:"success"`
	JSON    struct {
		Currency         respjson.Field
		DepositAddress   respjson.Field
		NetType          respjson.Field
		SecondaryAddress respjson.Field
		Message          respjson.Field
		Success          respjson.Field
		Raw              string
	} `json:"-"`
}

DepositNewCoinAddressResponseUnion contains all possible properties and values from DepositAddress, DepositNewCoinAddressResponseGenerateCoinAddressResponse.

Use the methods beginning with 'As' to cast the union to one of its variants.

func (DepositNewCoinAddressResponseUnion) AsDepositAddress

func (u DepositNewCoinAddressResponseUnion) AsDepositAddress() (v DepositAddress)

func (DepositNewCoinAddressResponseUnion) AsDepositNewCoinAddressResponseGenerateCoinAddressResponse

func (u DepositNewCoinAddressResponseUnion) AsDepositNewCoinAddressResponseGenerateCoinAddressResponse() (v DepositNewCoinAddressResponseGenerateCoinAddressResponse)

func (DepositNewCoinAddressResponseUnion) RawJSON

RawJSON returns the unmodified JSON received from the API.

func (*DepositNewCoinAddressResponseUnion) UnmarshalJSON

func (r *DepositNewCoinAddressResponseUnion) UnmarshalJSON(data []byte) error

type DepositService

type DepositService struct {
	// contains filtered or unexported fields
}

DepositService contains methods and other services that help with interacting with the upbit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewDepositService method instead.

func NewDepositService

func NewDepositService(opts ...option.RequestOption) (r DepositService)

NewDepositService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*DepositService) DepositKrw

func (r *DepositService) DepositKrw(ctx context.Context, body DepositDepositKrwParams, opts ...option.RequestOption) (res *Deposit, err error)

Deposit KRW

POST /v1/deposits/krw

- docs(kr): https://docs.upbit.com/kr/reference/deposit-krw - docs(global): https://global-docs.upbit.com/reference/deposit-krw

func (*DepositService) Get

func (r *DepositService) Get(ctx context.Context, query DepositGetParams, opts ...option.RequestOption) (res *Deposit, err error)

Get Deposit

GET /v1/deposit

- docs(kr): https://docs.upbit.com/kr/reference/get-deposit - docs(global): https://global-docs.upbit.com/reference/get-deposit

func (*DepositService) GetChance

Get Available Deposit Information

GET /v1/deposits/chance/coin

func (*DepositService) GetCoinAddress

func (r *DepositService) GetCoinAddress(ctx context.Context, query DepositGetCoinAddressParams, opts ...option.RequestOption) (res *DepositAddress, err error)

Get Deposit Address

GET /v1/deposits/coin_address

- docs(kr): https://docs.upbit.com/kr/reference/get-deposit-address - docs(global): https://global-docs.upbit.com/reference/get-deposit-address

func (*DepositService) List

List Deposits

GET /v1/deposits

- docs(kr): https://docs.upbit.com/kr/reference/list-deposits - docs(global): https://global-docs.upbit.com/reference/list-deposits

func (*DepositService) ListCoinAddresses

func (r *DepositService) ListCoinAddresses(ctx context.Context, opts ...option.RequestOption) (res *[]DepositAddress, err error)

List Deposit Addresses

GET /v1/deposits/coin_addresses

- docs(kr): https://docs.upbit.com/kr/reference/list-deposit-addresses - docs(global): https://global-docs.upbit.com/reference/list-deposit-addresses

func (*DepositService) NewCoinAddress

Create Deposit Address

POST /v1/deposits/generate_coin_address

- docs(kr): https://docs.upbit.com/kr/reference/create-deposit-address - docs(global): https://global-docs.upbit.com/reference/create-deposit-address

type DepositState

type DepositState string

Deposit status.

  • `PROCESSING`: Deposit in progress (digital asset only)
  • `ACCEPTED`: Completed
  • `CANCELLED`: Cancelled
  • `REJECTED`: Rejected
  • `TRAVEL_RULE_SUSPECTED`: Awaiting additional Travel Rule verification (digital assets only)
  • `REFUNDING`: Refund in progress
  • `REFUNDED`: Refunded (digital asset only)
const (
	DepositStateProcessing          DepositState = "PROCESSING"
	DepositStateAccepted            DepositState = "ACCEPTED"
	DepositStateCancelled           DepositState = "CANCELLED"
	DepositStateRejected            DepositState = "REJECTED"
	DepositStateTravelRuleSuspected DepositState = "TRAVEL_RULE_SUSPECTED"
	DepositStateRefunding           DepositState = "REFUNDING"
	DepositStateRefunded            DepositState = "REFUNDED"
)

type DepositTransactionType

type DepositTransactionType string

Deposit transaction type.

- `default`: Standard deposit - `internal`: Internal deposit (between Upbit accounts)

const (
	DepositTransactionTypeDefault  DepositTransactionType = "default"
	DepositTransactionTypeInternal DepositTransactionType = "internal"
)

type Error

type Error = apierror.Error

type OpenOrderState

type OpenOrderState string

Open order state.

- `wait`: Pending execution - `watch`: Pending reservation (stop order)

const (
	OpenOrderStateWait  OpenOrderState = "wait"
	OpenOrderStateWatch OpenOrderState = "watch"
)

type OrdTypeEnum

type OrdTypeEnum string

Order type.

- `limit`: Limit order - `price`: Market buy order (by total price) - `market`: Market sell order (by volume) - `best`: Best available price order

const (
	OrdTypeEnumLimit  OrdTypeEnum = "limit"
	OrdTypeEnumPrice  OrdTypeEnum = "price"
	OrdTypeEnumMarket OrdTypeEnum = "market"
	OrdTypeEnumBest   OrdTypeEnum = "best"
)

type Order

type Order struct {
	// Timestamp when the order was created.
	//
	// [Format] yyyy-MM-ddTHH:mm:ss+00:00
	CreatedAt string `json:"created_at" api:"required"`
	// Executed volume.
	ExecutedVolume string `json:"executed_volume" api:"required"`
	// Amount locked for this order.
	Locked string `json:"locked" api:"required"`
	// Trading pair code.
	Market string `json:"market" api:"required"`
	// Order type.
	//
	// Any of "limit", "price", "market", "best".
	OrdType OrderOrdType `json:"ord_type" api:"required"`
	// Fee paid so far.
	PaidFee string `json:"paid_fee" api:"required"`
	// Asset unlocked due to Self-Match Prevention cancellation.
	//
	// - For buy orders: cancelled amount
	// - For sell orders: cancelled volume
	PreventedLocked string `json:"prevented_locked" api:"required"`
	// Volume cancelled due to Self-Match Prevention.
	PreventedVolume string `json:"prevented_volume" api:"required"`
	// Remaining fee.
	RemainingFee string `json:"remaining_fee" api:"required"`
	// Remaining volume after execution.
	RemainingVolume string `json:"remaining_volume" api:"required"`
	// Fee reserved for this order.
	ReservedFee string `json:"reserved_fee" api:"required"`
	// Order direction (ask=sell, bid=buy).
	//
	// Any of "ask", "bid".
	Side OrderSide `json:"side" api:"required"`
	// Order state.
	//
	// - `wait`: Pending execution
	// - `watch`: Waiting for reservation order
	// - `done`: Fully executed
	// - `cancel`: Cancelled
	//
	// Any of "wait", "watch", "done", "cancel".
	State OrderState `json:"state" api:"required"`
	// Number of trades executed for this order.
	TradesCount int64 `json:"trades_count" api:"required"`
	// Unique identifier of the order.
	Uuid string `json:"uuid" api:"required"`
	// Client-assigned order identifier specified at order creation.
	//
	//   - The identifier field is only available for orders created after October
	//     18, 2024.
	Identifier string `json:"identifier"`
	// Order price or total amount. For limit orders, this is the unit price. For
	// market buy orders, this is the total buy amount.
	Price string `json:"price"`
	// Self-Match Prevention (SMP) mode.
	//
	// Any of "reduce", "cancel_maker", "cancel_taker".
	SmpType OrderSmpType `json:"smp_type"`
	// Time in force condition.
	//
	// Any of "fok", "ioc", "post_only".
	TimeInForce OrderTimeInForce `json:"time_in_force"`
	// List of trades executed for this order (returned in individual order query).
	Trades []OrderTrade `json:"trades"`
	// Requested order volume.
	Volume string `json:"volume"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt       respjson.Field
		ExecutedVolume  respjson.Field
		Locked          respjson.Field
		Market          respjson.Field
		OrdType         respjson.Field
		PaidFee         respjson.Field
		PreventedLocked respjson.Field
		PreventedVolume respjson.Field
		RemainingFee    respjson.Field
		RemainingVolume respjson.Field
		ReservedFee     respjson.Field
		Side            respjson.Field
		State           respjson.Field
		TradesCount     respjson.Field
		Uuid            respjson.Field
		Identifier      respjson.Field
		Price           respjson.Field
		SmpType         respjson.Field
		TimeInForce     respjson.Field
		Trades          respjson.Field
		Volume          respjson.Field
		ExtraFields     map[string]respjson.Field
		Raw             string
	} `json:"-"`
}

func (Order) RawJSON

func (r Order) RawJSON() string

RawJSON returns the unmodified JSON received from the API.

func (*Order) UnmarshalJSON

func (r *Order) UnmarshalJSON(data []byte) error

type OrderCancelAndNewParams

type OrderCancelAndNewParams struct {
	// Order type.
	//
	// - `limit`: Limit order
	// - `price`: Market buy order (by total price)
	// - `market`: Market sell order (by volume)
	// - `best`: Best available price order
	//
	// Any of "limit", "price", "market", "best".
	NewOrdType OrdTypeEnum `json:"new_ord_type,omitzero" api:"required"`
	// Client-assigned identifier for the new order.
	NewIdentifier param.Opt[string] `json:"new_identifier,omitzero"`
	// Price or total amount for the new order.
	NewPrice param.Opt[string] `json:"new_price,omitzero"`
	// Volume for the new order.
	NewVolume param.Opt[string] `json:"new_volume,omitzero"`
	// Client-assigned identifier of the order to cancel.
	PrevOrderIdentifier param.Opt[string] `json:"prev_order_identifier,omitzero"`
	// UUID of the order to cancel.
	PrevOrderUuid param.Opt[string] `json:"prev_order_uuid,omitzero"`
	// Self-Match Prevention (SMP) mode.
	//
	// - `cancel_maker`: Cancel maker order
	// - `cancel_taker`: Cancel taker order
	// - `reduce`: Reduce order quantity
	//
	// Any of "cancel_maker", "cancel_taker", "reduce".
	NewSmpType SmpTypeEnum `json:"new_smp_type,omitzero"`
	// Time in force condition.
	//
	// - `fok`: Fill or Kill
	// - `ioc`: Immediate or Cancel
	// - `post_only`: Post only (maker only)
	//
	// Any of "fok", "ioc", "post_only".
	NewTimeInForce TimeInForceEnum `json:"new_time_in_force,omitzero"`
	// contains filtered or unexported fields
}

func (OrderCancelAndNewParams) MarshalJSON

func (r OrderCancelAndNewParams) MarshalJSON() (data []byte, err error)

func (*OrderCancelAndNewParams) UnmarshalJSON

func (r *OrderCancelAndNewParams) UnmarshalJSON(data []byte) error

type OrderCancelAndNewResponse

type OrderCancelAndNewResponse struct {
	// Unique identifier of the newly created order.
	NewOrderUuid string `json:"new_order_uuid" api:"required"`
	// Client-assigned identifier of the newly created order.
	NewOrderIdentifier string `json:"new_order_identifier"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		NewOrderUuid       respjson.Field
		NewOrderIdentifier respjson.Field
		ExtraFields        map[string]respjson.Field
		Raw                string
	} `json:"-"`
	Order
}

func (OrderCancelAndNewResponse) RawJSON

func (r OrderCancelAndNewResponse) RawJSON() string

RawJSON returns the unmodified JSON received from the API.

func (*OrderCancelAndNewResponse) UnmarshalJSON

func (r *OrderCancelAndNewResponse) UnmarshalJSON(data []byte) error

type OrderCancelByUuidsParams

type OrderCancelByUuidsParams struct {
	// List of client-assigned identifiers of orders to cancel. Maximum 20 orders.
	//
	// [Example] identifiers[]=id1&identifiers[]=id2…
	Identifiers []string `query:"identifiers,omitzero" json:"-"`
	// List of UUIDs of orders to cancel. Maximum 20 orders.
	//
	// [Example] uuids[]=uuid1&uuids[]=uuid2…
	Uuids []string `query:"uuids,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (OrderCancelByUuidsParams) URLQuery

func (r OrderCancelByUuidsParams) URLQuery() (v url.Values, err error)

URLQuery serializes OrderCancelByUuidsParams's query parameters as `url.Values`.

type OrderCancelOpenParams

type OrderCancelOpenParams struct {
	// Maximum number of orders to cancel. Max 300, default 20.
	Count param.Opt[int64] `query:"count,omitzero" json:"-"`
	// Trading pair exclusion filter. Cancels all open orders except those for the
	// specified pairs. Up to 20 pairs, comma-separated.
	//
	// [Example] excluded_pairs=KRW-BTC,KRW-ETH
	ExcludedPairs param.Opt[string] `query:"excluded_pairs,omitzero" json:"-"`
	// Trading pair filter. Cancels open orders only for the specified pairs. Up to 20
	// pairs, comma-separated.
	//
	// [Example] pairs=KRW-BTC,KRW-ETH
	Pairs param.Opt[string] `query:"pairs,omitzero" json:"-"`
	// Quote currency filter (KRW, BTC, USDT). Cancels all open orders in markets with
	// the specified quote currency.
	//
	// [Example] "KRW" cancels all open orders in the KRW market.
	QuoteCurrencies param.Opt[string] `query:"quote_currencies,omitzero" json:"-"`
	// Side filter. "all" (both), "ask" (sell only), "bid" (buy only).
	//
	// Any of "bid", "ask", "all".
	CancelSide OrderCancelOpenParamsCancelSide `query:"cancel_side,omitzero" json:"-"`
	// Sort order for determining which orders to cancel. "desc" (newest first) or
	// "asc" (oldest first). Default is "desc".
	//
	// Any of "asc", "desc".
	OrderBy OrderCancelOpenParamsOrderBy `query:"order_by,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (OrderCancelOpenParams) URLQuery

func (r OrderCancelOpenParams) URLQuery() (v url.Values, err error)

URLQuery serializes OrderCancelOpenParams's query parameters as `url.Values`.

type OrderCancelOpenParamsCancelSide

type OrderCancelOpenParamsCancelSide string

Side filter. "all" (both), "ask" (sell only), "bid" (buy only).

const (
	OrderCancelOpenParamsCancelSideBid OrderCancelOpenParamsCancelSide = "bid"
	OrderCancelOpenParamsCancelSideAsk OrderCancelOpenParamsCancelSide = "ask"
	OrderCancelOpenParamsCancelSideAll OrderCancelOpenParamsCancelSide = "all"
)

type OrderCancelOpenParamsOrderBy

type OrderCancelOpenParamsOrderBy string

Sort order for determining which orders to cancel. "desc" (newest first) or "asc" (oldest first). Default is "desc".

const (
	OrderCancelOpenParamsOrderByAsc  OrderCancelOpenParamsOrderBy = "asc"
	OrderCancelOpenParamsOrderByDesc OrderCancelOpenParamsOrderBy = "desc"
)

type OrderCancelParams

type OrderCancelParams struct {
	// Client-assigned identifier of the order to cancel.
	//
	// Used when cancelling by the identifier assigned at order creation.
	Identifier param.Opt[string] `query:"identifier,omitzero" json:"-"`
	// UUID of the order to cancel.
	Uuid param.Opt[string] `query:"uuid,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (OrderCancelParams) URLQuery

func (r OrderCancelParams) URLQuery() (v url.Values, err error)

URLQuery serializes OrderCancelParams's query parameters as `url.Values`.

type OrderGetChanceParams

type OrderGetChanceParams struct {
	// Trading pair to query.
	Market string `query:"market" api:"required" json:"-"`
	// contains filtered or unexported fields
}

func (OrderGetChanceParams) URLQuery

func (r OrderGetChanceParams) URLQuery() (v url.Values, err error)

URLQuery serializes OrderGetChanceParams's query parameters as `url.Values`.

type OrderGetChanceResponse

type OrderGetChanceResponse struct {
	// Base asset account information.
	AskAccount OrderGetChanceResponseAskAccount `json:"ask_account" api:"required"`
	// Fee rate applied when placing a sell order.
	AskFee string `json:"ask_fee" api:"required"`
	// Quote asset account information.
	BidAccount OrderGetChanceResponseBidAccount `json:"bid_account" api:"required"`
	// Fee rate applied when placing a buy order.
	BidFee string `json:"bid_fee" api:"required"`
	// Maker fee rate for sell orders.
	MakerAskFee string `json:"maker_ask_fee" api:"required"`
	// Maker fee rate for buy orders.
	MakerBidFee string                       `json:"maker_bid_fee" api:"required"`
	Market      OrderGetChanceResponseMarket `json:"market" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AskAccount  respjson.Field
		AskFee      respjson.Field
		BidAccount  respjson.Field
		BidFee      respjson.Field
		MakerAskFee respjson.Field
		MakerBidFee respjson.Field
		Market      respjson.Field
		ExtraFields map[string]respjson.Field
		Raw         string
	} `json:"-"`
}

func (OrderGetChanceResponse) RawJSON

func (r OrderGetChanceResponse) RawJSON() string

RawJSON returns the unmodified JSON received from the API.

func (*OrderGetChanceResponse) UnmarshalJSON

func (r *OrderGetChanceResponse) UnmarshalJSON(data []byte) error

type OrderGetChanceResponseAskAccount

type OrderGetChanceResponseAskAccount struct {
	// Average buy price of the asset.
	AvgBuyPrice string `json:"avg_buy_price" api:"required"`
	// Indicates whether the average buy price has been modified.
	AvgBuyPriceModified bool `json:"avg_buy_price_modified" api:"required"`
	// Available amount or volume for orders.
	Balance string `json:"balance" api:"required"`
	// Currency code to be queried.
	Currency string `json:"currency" api:"required"`
	// Amount or quantity locked by pending orders or withdrawals.
	Locked string `json:"locked" api:"required"`
	// Currency unit used as the basis for avg_buy_price.
	UnitCurrency string `json:"unit_currency"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AvgBuyPrice         respjson.Field
		AvgBuyPriceModified respjson.Field
		Balance             respjson.Field
		Currency            respjson.Field
		Locked              respjson.Field
		UnitCurrency        respjson.Field
		ExtraFields         map[string]respjson.Field
		Raw                 string
	} `json:"-"`
}

Base asset account information.

func (OrderGetChanceResponseAskAccount) RawJSON

RawJSON returns the unmodified JSON received from the API.

func (*OrderGetChanceResponseAskAccount) UnmarshalJSON

func (r *OrderGetChanceResponseAskAccount) UnmarshalJSON(data []byte) error

type OrderGetChanceResponseBidAccount

type OrderGetChanceResponseBidAccount struct {
	// Average buy price of the asset.
	AvgBuyPrice string `json:"avg_buy_price" api:"required"`
	// Indicates whether the average buy price has been modified.
	AvgBuyPriceModified bool `json:"avg_buy_price_modified" api:"required"`
	// Available amount or volume for orders.
	Balance string `json:"balance" api:"required"`
	// Currency code to be queried.
	Currency string `json:"currency" api:"required"`
	// Amount or quantity locked by pending orders or withdrawals.
	Locked string `json:"locked" api:"required"`
	// Currency unit used as the basis for avg_buy_price.
	UnitCurrency string `json:"unit_currency"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AvgBuyPrice         respjson.Field
		AvgBuyPriceModified respjson.Field
		Balance             respjson.Field
		Currency            respjson.Field
		Locked              respjson.Field
		UnitCurrency        respjson.Field
		ExtraFields         map[string]respjson.Field
		Raw                 string
	} `json:"-"`
}

Quote asset account information.

func (OrderGetChanceResponseBidAccount) RawJSON

RawJSON returns the unmodified JSON received from the API.

func (*OrderGetChanceResponseBidAccount) UnmarshalJSON

func (r *OrderGetChanceResponseBidAccount) UnmarshalJSON(data []byte) error

type OrderGetChanceResponseMarket

type OrderGetChanceResponseMarket struct {
	// Trading pair code.
	ID string `json:"id" api:"required"`
	// Sell order constraints.
	Ask OrderGetChanceResponseMarketAsk `json:"ask" api:"required"`
	// Supported sell order types.
	//
	// [Example] ["market", "limit", "best_fok", ...]
	AskTypes []string `json:"ask_types" api:"required"`
	// Buy order constraints.
	Bid OrderGetChanceResponseMarketBid `json:"bid" api:"required"`
	// Supported buy order types.
	//
	// [Example] ["limit", "price", "best_fok", ...]
	BidTypes []string `json:"bid_types" api:"required"`
	// Maximum order amount.
	MaxTotal string `json:"max_total" api:"required"`
	// Trading pair name (base asset / quote currency).
	Name string `json:"name" api:"required"`
	// Supported order sides.
	OrderSides []string `json:"order_sides" api:"required"`
	// Market operation state.
	//
	// Any of "active".
	State string `json:"state" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		Ask         respjson.Field
		AskTypes    respjson.Field
		Bid         respjson.Field
		BidTypes    respjson.Field
		MaxTotal    respjson.Field
		Name        respjson.Field
		OrderSides  respjson.Field
		State       respjson.Field
		ExtraFields map[string]respjson.Field
		Raw         string
	} `json:"-"`
}

func (OrderGetChanceResponseMarket) RawJSON

RawJSON returns the unmodified JSON received from the API.

func (*OrderGetChanceResponseMarket) UnmarshalJSON

func (r *OrderGetChanceResponseMarket) UnmarshalJSON(data []byte) error

type OrderGetChanceResponseMarketAsk

type OrderGetChanceResponseMarketAsk struct {
	// Currency of the asset being sold.
	//
	// [Example] "BTC", "ETH"
	Currency string `json:"currency" api:"required"`
	// Minimum order amount for sell orders (in quote currency).
	MinTotal string `json:"min_total" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Currency    respjson.Field
		MinTotal    respjson.Field
		ExtraFields map[string]respjson.Field
		Raw         string
	} `json:"-"`
}

Sell order constraints.

func (OrderGetChanceResponseMarketAsk) RawJSON

RawJSON returns the unmodified JSON received from the API.

func (*OrderGetChanceResponseMarketAsk) UnmarshalJSON

func (r *OrderGetChanceResponseMarketAsk) UnmarshalJSON(data []byte) error

type OrderGetChanceResponseMarketBid

type OrderGetChanceResponseMarketBid struct {
	// Quote currency used to purchase digital assets (SGD, BTC, USDT).
	Currency string `json:"currency" api:"required"`
	// Minimum order amount for buy orders (in quote currency).
	MinTotal string `json:"min_total" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Currency    respjson.Field
		MinTotal    respjson.Field
		ExtraFields map[string]respjson.Field
		Raw         string
	} `json:"-"`
}

Buy order constraints.

func (OrderGetChanceResponseMarketBid) RawJSON

RawJSON returns the unmodified JSON received from the API.

func (*OrderGetChanceResponseMarketBid) UnmarshalJSON

func (r *OrderGetChanceResponseMarketBid) UnmarshalJSON(data []byte) error

type OrderGetParams

type OrderGetParams struct {
	// Client-assigned identifier of the order to query.
	//
	// Used when querying by the identifier assigned at order creation.
	Identifier param.Opt[string] `query:"identifier,omitzero" json:"-"`
	// UUID of the order to query.
	Uuid param.Opt[string] `query:"uuid,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (OrderGetParams) URLQuery

func (r OrderGetParams) URLQuery() (v url.Values, err error)

URLQuery serializes OrderGetParams's query parameters as `url.Values`.

type OrderListByUuidsParams

type OrderListByUuidsParams struct {
	// Trading pair to filter by.
	Market param.Opt[string] `query:"market,omitzero" json:"-"`
	// List of client-assigned identifiers of orders to query. Maximum 100 orders.
	//
	// [Example] identifiers[]=id1&identifiers[]=id2…
	Identifiers []string `query:"identifiers,omitzero" json:"-"`
	// Sort order. "desc" (newest first) or "asc" (oldest first). Default is "desc".
	//
	// Any of "asc", "desc".
	OrderBy OrderListByUuidsParamsOrderBy `query:"order_by,omitzero" json:"-"`
	// List of UUIDs of orders to query. Maximum 100 orders.
	//
	// [Example] uuids[]=uuid1&uuids[]=uuid2…
	Uuids []string `query:"uuids,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (OrderListByUuidsParams) URLQuery

func (r OrderListByUuidsParams) URLQuery() (v url.Values, err error)

URLQuery serializes OrderListByUuidsParams's query parameters as `url.Values`.

type OrderListByUuidsParamsOrderBy

type OrderListByUuidsParamsOrderBy string

Sort order. "desc" (newest first) or "asc" (oldest first). Default is "desc".

const (
	OrderListByUuidsParamsOrderByAsc  OrderListByUuidsParamsOrderBy = "asc"
	OrderListByUuidsParamsOrderByDesc OrderListByUuidsParamsOrderBy = "desc"
)

type OrderListClosedParams

type OrderListClosedParams struct {
	// End time of the query range. Max range is 7 days.
	//
	// - If only "end_time" is given, the range is 7 days before it.
	//
	// Format: ISO 8601 (2025-06-24T13:56:53+09:00) or millisecond timestamp
	// (1750741013000)
	EndTime param.Opt[string] `query:"end_time,omitzero" json:"-"`
	// Number of results per request (default: 100, max: 1,000).
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Trading pair to filter by.
	Market param.Opt[string] `query:"market,omitzero" json:"-"`
	// Start time of the query range. Max range is 7 days.
	//
	// - If only "start_time" is given, the range is 7 days after it.
	// - If neither is given, the default is the past 7 days.
	//
	// Format: ISO 8601 (2025-06-24T13:56:53+09:00) or millisecond timestamp
	// (1750741013000)
	StartTime param.Opt[string] `query:"start_time,omitzero" json:"-"`
	// Sort order. "desc" (newest first) or "asc" (oldest first). Default is "desc".
	//
	// Any of "asc", "desc".
	OrderBy OrderListClosedParamsOrderBy `query:"order_by,omitzero" json:"-"`
	// Closed order state.
	//
	// - `done`: Fully executed
	// - `cancel`: Cancelled
	//
	// Any of "done", "cancel".
	State ClosedOrderState `query:"state,omitzero" json:"-"`
	// Order state filter (array form). "done" or "cancel". Default returns all states.
	//
	// [Example] states[]=done&states[]=cancel
	States []ClosedOrderState `query:"states,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (OrderListClosedParams) URLQuery

func (r OrderListClosedParams) URLQuery() (v url.Values, err error)

URLQuery serializes OrderListClosedParams's query parameters as `url.Values`.

type OrderListClosedParamsOrderBy

type OrderListClosedParamsOrderBy string

Sort order. "desc" (newest first) or "asc" (oldest first). Default is "desc".

const (
	OrderListClosedParamsOrderByAsc  OrderListClosedParamsOrderBy = "asc"
	OrderListClosedParamsOrderByDesc OrderListClosedParamsOrderBy = "desc"
)

type OrderListOpenParams

type OrderListOpenParams struct {
	// Number of results per request (default: 100, max: 100).
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Trading pair to filter by.
	Market param.Opt[string] `query:"market,omitzero" json:"-"`
	// Page number for pagination. Default is 1.
	Page param.Opt[int64] `query:"page,omitzero" json:"-"`
	// Sort order. "desc" (newest first) or "asc" (oldest first). Default is "desc".
	//
	// Any of "asc", "desc".
	OrderBy OrderListOpenParamsOrderBy `query:"order_by,omitzero" json:"-"`
	// Open order state.
	//
	// - `wait`: Pending execution
	// - `watch`: Pending reservation (stop order)
	//
	// Any of "wait", "watch".
	State OpenOrderState `query:"state,omitzero" json:"-"`
	// Order state filter (array form). "wait" or "watch". Default is ["wait"].
	//
	// [Example] states[]=wait&states[]=watch
	States []OpenOrderState `query:"states,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (OrderListOpenParams) URLQuery

func (r OrderListOpenParams) URLQuery() (v url.Values, err error)

URLQuery serializes OrderListOpenParams's query parameters as `url.Values`.

type OrderListOpenParamsOrderBy

type OrderListOpenParamsOrderBy string

Sort order. "desc" (newest first) or "asc" (oldest first). Default is "desc".

const (
	OrderListOpenParamsOrderByAsc  OrderListOpenParamsOrderBy = "asc"
	OrderListOpenParamsOrderByDesc OrderListOpenParamsOrderBy = "desc"
)

type OrderNewParams

type OrderNewParams struct {
	// Target trading pair for the order. (required)
	Market string `json:"market" api:"required"`
	// Order type.
	//
	// - `limit`: Limit order
	// - `price`: Market buy order (by total price)
	// - `market`: Market sell order (by volume)
	// - `best`: Best available price order
	//
	// Any of "limit", "price", "market", "best".
	OrdType OrdTypeEnum `json:"ord_type,omitzero" api:"required"`
	// Order direction (ask=sell, bid=buy)
	//
	// Any of "ask", "bid".
	Side SideEnum `json:"side,omitzero" api:"required"`
	// Client-assigned order identifier.
	Identifier param.Opt[string] `json:"identifier,omitzero"`
	// Order price or total amount.
	Price param.Opt[string] `json:"price,omitzero"`
	// Order volume.
	Volume param.Opt[string] `json:"volume,omitzero"`
	// Self-Match Prevention (SMP) mode.
	//
	// - `cancel_maker`: Cancel maker order
	// - `cancel_taker`: Cancel taker order
	// - `reduce`: Reduce order quantity
	//
	// Any of "cancel_maker", "cancel_taker", "reduce".
	SmpType SmpTypeEnum `json:"smp_type,omitzero"`
	// Time in force condition.
	//
	// - `fok`: Fill or Kill
	// - `ioc`: Immediate or Cancel
	// - `post_only`: Post only (maker only)
	//
	// Any of "fok", "ioc", "post_only".
	TimeInForce TimeInForceEnum `json:"time_in_force,omitzero"`
	// contains filtered or unexported fields
}

func (OrderNewParams) MarshalJSON

func (r OrderNewParams) MarshalJSON() (data []byte, err error)

func (*OrderNewParams) UnmarshalJSON

func (r *OrderNewParams) UnmarshalJSON(data []byte) error

type OrderOrdType

type OrderOrdType string

Order type.

const (
	OrderOrdTypeLimit  OrderOrdType = "limit"
	OrderOrdTypePrice  OrderOrdType = "price"
	OrderOrdTypeMarket OrderOrdType = "market"
	OrderOrdTypeBest   OrderOrdType = "best"
)

type OrderService

type OrderService struct {
	// contains filtered or unexported fields
}

OrderService contains methods and other services that help with interacting with the upbit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewOrderService method instead.

func NewOrderService

func NewOrderService(opts ...option.RequestOption) (r OrderService)

NewOrderService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*OrderService) Cancel

func (r *OrderService) Cancel(ctx context.Context, body OrderCancelParams, opts ...option.RequestOption) (res *Order, err error)

Cancel Order

DELETE /v1/order

- docs(kr): https://docs.upbit.com/kr/reference/cancel-order - docs(global): https://global-docs.upbit.com/reference/cancel-order

**Required (one of):** `uuid` or `identifier` must be provided.

func (*OrderService) CancelAndNew

Cancel and New Order

POST /v1/orders/cancel_and_new

- docs(kr): https://docs.upbit.com/kr/reference/cancel-and-new-order - docs(global): https://global-docs.upbit.com/reference/cancel-and-new-order

func (*OrderService) CancelByUuids

func (r *OrderService) CancelByUuids(ctx context.Context, body OrderCancelByUuidsParams, opts ...option.RequestOption) (res *BatchCancelResult, err error)

Cancel Orders by IDs

DELETE /v1/orders/uuids

- docs(kr): https://docs.upbit.com/kr/reference/cancel-orders-by-ids - docs(global): https://global-docs.upbit.com/reference/cancel-orders-by-ids

**Required (one of):** `uuids` or `identifiers` must be provided.

func (*OrderService) CancelOpen

func (r *OrderService) CancelOpen(ctx context.Context, body OrderCancelOpenParams, opts ...option.RequestOption) (res *BatchCancelResult, err error)

Batch Cancel Orders

DELETE /v1/orders/open

- docs(kr): https://docs.upbit.com/kr/reference/batch-cancel-orders - docs(global): https://global-docs.upbit.com/reference/batch-cancel-orders

func (*OrderService) Get

func (r *OrderService) Get(ctx context.Context, query OrderGetParams, opts ...option.RequestOption) (res *Order, err error)

Get Order

GET /v1/order

- docs(kr): https://docs.upbit.com/kr/reference/get-order - docs(global): https://global-docs.upbit.com/reference/get-order

**Required (one of):** `uuid` or `identifier` must be provided.

func (*OrderService) GetChance

func (r *OrderService) GetChance(ctx context.Context, query OrderGetChanceParams, opts ...option.RequestOption) (res *OrderGetChanceResponse, err error)

Get Available Order Info

GET /v1/orders/chance

func (*OrderService) ListByUuids

func (r *OrderService) ListByUuids(ctx context.Context, query OrderListByUuidsParams, opts ...option.RequestOption) (res *[]Order, err error)

List Orders by IDs

GET /v1/orders/uuids

- docs(kr): https://docs.upbit.com/kr/reference/list-orders-by-ids - docs(global): https://global-docs.upbit.com/reference/list-orders-by-ids

**Required (one of):** `uuids` or `identifiers` must be provided.

func (*OrderService) ListClosed

func (r *OrderService) ListClosed(ctx context.Context, query OrderListClosedParams, opts ...option.RequestOption) (res *[]Order, err error)

List Closed Orders

GET /v1/orders/closed

- docs(kr): https://docs.upbit.com/kr/reference/list-closed-orders - docs(global): https://global-docs.upbit.com/reference/list-closed-orders

func (*OrderService) ListOpen

List Open Orders

GET /v1/orders/open

- docs(kr): https://docs.upbit.com/kr/reference/list-open-orders - docs(global): https://global-docs.upbit.com/reference/list-open-orders

func (*OrderService) New

func (r *OrderService) New(ctx context.Context, body OrderNewParams, opts ...option.RequestOption) (res *Order, err error)

Create Order

POST /v1/orders

- docs(kr): https://docs.upbit.com/kr/reference/new-order - docs(global): https://global-docs.upbit.com/reference/new-order

Order parameter rules by `ord_type`:

  • `limit`: requires both `price` and `volume`. Optional: `time_in_force` (`ioc`, `fok`, `post_only`) and `smp_type`. Note: `post_only` cannot be used with `smp_type`.

- `price` (market buy): requires `price`, and `volume` must be omitted.

- `market` (market sell): requires `volume`, and `price` must be omitted.

- `best`: `time_in_force` is required (`ioc` or `fok`).

  • `side=bid`: requires `price`, and `volume` must be omitted.
  • `side=ask`: requires `volume`, and `price` must be omitted.

func (*OrderService) TestNew

func (r *OrderService) TestNew(ctx context.Context, body OrderTestNewParams, opts ...option.RequestOption) (res *Order, err error)

Test Order Creation

POST /v1/orders/test

- docs(kr): https://docs.upbit.com/kr/reference/test-order - docs(global): https://global-docs.upbit.com/reference/test-order

Order parameter rules by `ord_type`:

  • `limit`: requires both `price` and `volume`. Optional: `time_in_force` (`ioc`, `fok`, `post_only`) and `smp_type`. Note: `post_only` cannot be used with `smp_type`.

- `price` (market buy): requires `price`, and `volume` must be omitted.

- `market` (market sell): requires `volume`, and `price` must be omitted.

- `best`: `time_in_force` is required (`ioc` or `fok`).

  • `side=bid`: requires `price`, and `volume` must be omitted.
  • `side=ask`: requires `volume`, and `price` must be omitted.

type OrderSide

type OrderSide string

Order direction (ask=sell, bid=buy).

const (
	OrderSideAsk OrderSide = "ask"
	OrderSideBid OrderSide = "bid"
)

type OrderSmpType

type OrderSmpType string

Self-Match Prevention (SMP) mode.

const (
	OrderSmpTypeReduce      OrderSmpType = "reduce"
	OrderSmpTypeCancelMaker OrderSmpType = "cancel_maker"
	OrderSmpTypeCancelTaker OrderSmpType = "cancel_taker"
)

type OrderState

type OrderState string

Order state.

- `wait`: Pending execution - `watch`: Waiting for reservation order - `done`: Fully executed - `cancel`: Cancelled

const (
	OrderStateWait   OrderState = "wait"
	OrderStateWatch  OrderState = "watch"
	OrderStateDone   OrderState = "done"
	OrderStateCancel OrderState = "cancel"
)

type OrderTestNewParams

type OrderTestNewParams struct {
	// Target trading pair for the order. (required)
	Market string `json:"market" api:"required"`
	// Order type.
	//
	// - `limit`: Limit order
	// - `price`: Market buy order (by total price)
	// - `market`: Market sell order (by volume)
	// - `best`: Best available price order
	//
	// Any of "limit", "price", "market", "best".
	OrdType OrdTypeEnum `json:"ord_type,omitzero" api:"required"`
	// Order direction (ask=sell, bid=buy)
	//
	// Any of "ask", "bid".
	Side SideEnum `json:"side,omitzero" api:"required"`
	// Client-assigned order identifier.
	Identifier param.Opt[string] `json:"identifier,omitzero"`
	// Order price or total amount.
	Price param.Opt[string] `json:"price,omitzero"`
	// Order volume.
	Volume param.Opt[string] `json:"volume,omitzero"`
	// Self-Match Prevention (SMP) mode.
	//
	// - `cancel_maker`: Cancel maker order
	// - `cancel_taker`: Cancel taker order
	// - `reduce`: Reduce order quantity
	//
	// Any of "cancel_maker", "cancel_taker", "reduce".
	SmpType SmpTypeEnum `json:"smp_type,omitzero"`
	// Time in force condition.
	//
	// - `fok`: Fill or Kill
	// - `ioc`: Immediate or Cancel
	// - `post_only`: Post only (maker only)
	//
	// Any of "fok", "ioc", "post_only".
	TimeInForce TimeInForceEnum `json:"time_in_force,omitzero"`
	// contains filtered or unexported fields
}

func (OrderTestNewParams) MarshalJSON

func (r OrderTestNewParams) MarshalJSON() (data []byte, err error)

func (*OrderTestNewParams) UnmarshalJSON

func (r *OrderTestNewParams) UnmarshalJSON(data []byte) error

type OrderTimeInForce

type OrderTimeInForce string

Time in force condition.

const (
	OrderTimeInForceFok      OrderTimeInForce = "fok"
	OrderTimeInForceIoc      OrderTimeInForce = "ioc"
	OrderTimeInForcePostOnly OrderTimeInForce = "post_only"
)

type OrderTrade

type OrderTrade struct {
	// Timestamp of the trade.
	CreatedAt string `json:"created_at"`
	// Trade funds (price × volume).
	Funds string `json:"funds"`
	// Trading pair code.
	Market string `json:"market"`
	// Trade price.
	Price string `json:"price"`
	// Order side of the trade.
	Side string `json:"side"`
	// Price trend of the trade.
	Trend string `json:"trend"`
	// Unique identifier of the trade.
	Uuid string `json:"uuid"`
	// Trade volume.
	Volume string `json:"volume"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt   respjson.Field
		Funds       respjson.Field
		Market      respjson.Field
		Price       respjson.Field
		Side        respjson.Field
		Trend       respjson.Field
		Uuid        respjson.Field
		Volume      respjson.Field
		ExtraFields map[string]respjson.Field
		Raw         string
	} `json:"-"`
}

func (OrderTrade) RawJSON

func (r OrderTrade) RawJSON() string

RawJSON returns the unmodified JSON received from the API.

func (*OrderTrade) UnmarshalJSON

func (r *OrderTrade) UnmarshalJSON(data []byte) error

type OrderbookListInstrumentsParams

type OrderbookListInstrumentsParams struct {
	// List of trading pairs to query.
	//
	// For multiple pairs, use comma-separated format.
	Markets string `query:"markets" api:"required" json:"-"`
	// contains filtered or unexported fields
}

func (OrderbookListInstrumentsParams) URLQuery

func (r OrderbookListInstrumentsParams) URLQuery() (v url.Values, err error)

URLQuery serializes OrderbookListInstrumentsParams's query parameters as `url.Values`.

type OrderbookListInstrumentsResponse

type OrderbookListInstrumentsResponse struct {
	// Trading pair code.
	Market string `json:"market" api:"required"`
	// Quote currency code for the trading pair (e.g., SGD, BTC, USDT).
	QuoteCurrency string `json:"quote_currency" api:"required"`
	// Supported orderbook aggregation levels for this trading pair.
	//
	// - 0: Default unit
	// - Aggregation is only supported for KRW markets. (BTC, USDT markets only have 0)
	SupportedLevels []string `json:"supported_levels" api:"required"`
	// Price unit applied to the orderbook level.
	TickSize string `json:"tick_size" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Market          respjson.Field
		QuoteCurrency   respjson.Field
		SupportedLevels respjson.Field
		TickSize        respjson.Field
		ExtraFields     map[string]respjson.Field
		Raw             string
	} `json:"-"`
}

func (OrderbookListInstrumentsResponse) RawJSON

RawJSON returns the unmodified JSON received from the API.

func (*OrderbookListInstrumentsResponse) UnmarshalJSON

func (r *OrderbookListInstrumentsResponse) UnmarshalJSON(data []byte) error

type OrderbookListParams

type OrderbookListParams struct {
	// List of trading pairs to query.
	//
	// For multiple pairs, use comma-separated format.
	Markets string `query:"markets" api:"required" json:"-"`
	// Number of orderbook entries to retrieve.
	//
	// Based on the best bid-ask pair, returns the specified number of pairs.
	// Default: 30.
	Count param.Opt[int64] `query:"count,omitzero" json:"-"`
	// Orderbook aggregation level. Only supported for KRW markets. Groups ask/bid
	// price and size by the specified unit. Provide as a numeric string. Use an
	// integer string for units >= 1, or a double string for fractional units. Defaults
	// to 0 if not specified.
	Level param.Opt[string] `query:"level,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (OrderbookListParams) URLQuery

func (r OrderbookListParams) URLQuery() (v url.Values, err error)

URLQuery serializes OrderbookListParams's query parameters as `url.Values`.

type OrderbookListResponse

type OrderbookListResponse struct {
	// Price unit applied for this orderbook level.
	Level string `json:"level" api:"required"`
	// Trading pair code.
	Market string `json:"market" api:"required"`
	// List of orderbook entries ordered from level 1 to level 30.
	OrderbookUnits []OrderbookListResponseOrderbookUnit `json:"orderbook_units" api:"required"`
	// Timestamp of the query request (ms).
	Timestamp int64 `json:"timestamp" api:"required"`
	// Total ask volume in the current orderbook.
	TotalAskSize string `json:"total_ask_size" api:"required"`
	// Total bid volume in the current orderbook.
	TotalBidSize string `json:"total_bid_size" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Level          respjson.Field
		Market         respjson.Field
		OrderbookUnits respjson.Field
		Timestamp      respjson.Field
		TotalAskSize   respjson.Field
		TotalBidSize   respjson.Field
		ExtraFields    map[string]respjson.Field
		Raw            string
	} `json:"-"`
}

func (OrderbookListResponse) RawJSON

func (r OrderbookListResponse) RawJSON() string

RawJSON returns the unmodified JSON received from the API.

func (*OrderbookListResponse) UnmarshalJSON

func (r *OrderbookListResponse) UnmarshalJSON(data []byte) error

type OrderbookListResponseOrderbookUnit

type OrderbookListResponseOrderbookUnit struct {
	// Lowest sell (ask) price.
	AskPrice string `json:"ask_price" api:"required"`
	// Sell quantity at ask price.
	AskSize string `json:"ask_size" api:"required"`
	// Highest buy (bid) price.
	BidPrice string `json:"bid_price" api:"required"`
	// Buy quantity at bid price.
	BidSize string `json:"bid_size" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AskPrice    respjson.Field
		AskSize     respjson.Field
		BidPrice    respjson.Field
		BidSize     respjson.Field
		ExtraFields map[string]respjson.Field
		Raw         string
	} `json:"-"`
}

Individual orderbook entry.

func (OrderbookListResponseOrderbookUnit) RawJSON

RawJSON returns the unmodified JSON received from the API.

func (*OrderbookListResponseOrderbookUnit) UnmarshalJSON

func (r *OrderbookListResponseOrderbookUnit) UnmarshalJSON(data []byte) error

type OrderbookService

type OrderbookService struct {
	// contains filtered or unexported fields
}

OrderbookService contains methods and other services that help with interacting with the upbit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewOrderbookService method instead.

func NewOrderbookService

func NewOrderbookService(opts ...option.RequestOption) (r OrderbookService)

NewOrderbookService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*OrderbookService) List

Get Orderbook

GET /v1/orderbook

- docs(kr): https://docs.upbit.com/kr/reference/list-orderbooks - docs(global): https://global-docs.upbit.com/reference/list-orderbooks

func (*OrderbookService) ListInstruments

List Orderbook Instruments

GET /v1/orderbook/instruments

type SideEnum

type SideEnum string

Order direction (ask=sell, bid=buy)

const (
	SideEnumAsk SideEnum = "ask"
	SideEnumBid SideEnum = "bid"
)

type SmpTypeEnum

type SmpTypeEnum string

Self-Match Prevention (SMP) mode.

- `cancel_maker`: Cancel maker order - `cancel_taker`: Cancel taker order - `reduce`: Reduce order quantity

const (
	SmpTypeEnumCancelMaker SmpTypeEnum = "cancel_maker"
	SmpTypeEnumCancelTaker SmpTypeEnum = "cancel_taker"
	SmpTypeEnumReduce      SmpTypeEnum = "reduce"
)

type Ticker

type Ticker struct {
	// Accumulated trade amount since UTC midnight.
	AccTradePrice string `json:"acc_trade_price" api:"required"`
	// Accumulated trade amount over the past 24 hours.
	AccTradePrice24h string `json:"acc_trade_price_24h" api:"required"`
	// Accumulated trade volume since UTC midnight.
	AccTradeVolume string `json:"acc_trade_volume" api:"required"`
	// Accumulated trade volume over the past 24 hours.
	AccTradeVolume24h string `json:"acc_trade_volume_24h" api:"required"`
	// Price change status.
	//
	// - `EVEN`: No change
	// - `RISE`: Price rose
	// - `FALL`: Price fell
	//
	// Any of "EVEN", "RISE", "FALL".
	Change TickerChange `json:"change" api:"required"`
	// Absolute price change from previous day's closing price.
	//
	// Calculated as "trade_price" - "prev_closing_price".
	ChangePrice string `json:"change_price" api:"required"`
	// Absolute price change rate from previous day's closing price.
	//
	// Calculated as ("trade_price" - "prev_closing_price") / "prev_closing_price".
	ChangeRate string `json:"change_rate" api:"required"`
	// Highest trading price of the trading pair.
	HighPrice string `json:"high_price" api:"required"`
	// Date of 52-week highest price.
	//
	// [Format] yyyy-MM-dd
	Highest52WeekDate string `json:"highest_52_week_date" api:"required"`
	// 52-week highest price.
	Highest52WeekPrice string `json:"highest_52_week_price" api:"required"`
	// Lowest trading price of the trading pair.
	LowPrice string `json:"low_price" api:"required"`
	// Date of 52-week lowest price.
	//
	// [Format] yyyy-MM-dd
	Lowest52WeekDate string `json:"lowest_52_week_date" api:"required"`
	// 52-week lowest price.
	Lowest52WeekPrice string `json:"lowest_52_week_price" api:"required"`
	// Trading pair code.
	Market string `json:"market" api:"required"`
	// Opening price of the trading pair.
	OpeningPrice string `json:"opening_price" api:"required"`
	// Previous day's closing price (UTC-based).
	PrevClosingPrice string `json:"prev_closing_price" api:"required"`
	// Signed price change from previous day's closing price. Calculated as
	// "trade_price" - "prev_closing_price".
	//
	// - Positive(+): price rose
	// - Negative(-): price fell
	SignedChangePrice string `json:"signed_change_price" api:"required"`
	// Signed price change rate from previous day's closing price. Calculated as
	// ("trade_price" - "prev_closing_price") / "prev_closing_price".
	//
	// - Positive(+): price rose
	// - Negative(-): price fell
	//
	// [Example] 0.015 = 1.5% increase
	SignedChangeRate string `json:"signed_change_rate" api:"required"`
	// Timestamp (ms) when the ticker information was recorded.
	Timestamp int64 `json:"timestamp" api:"required"`
	// Most recent trade date (UTC-based).
	//
	// [Format] yyyyMMdd
	TradeDate string `json:"trade_date" api:"required"`
	// Most recent trade date (KST-based). Supported in KOREA only.
	//
	// [Format] yyyyMMdd
	TradeDateKst string `json:"trade_date_kst" api:"required"`
	// Current (closing) price of the trading pair.
	TradePrice string `json:"trade_price" api:"required"`
	// Most recent trade time (UTC-based).
	//
	// [Format] HHmmss
	TradeTime string `json:"trade_time" api:"required"`
	// Most recent trade time (KST-based). Supported in KOREA only.
	//
	// [Format] HHmmss
	TradeTimeKst string `json:"trade_time_kst" api:"required"`
	// Milliseconds timestamp when the trade was executed.
	TradeTimestamp int64 `json:"trade_timestamp" api:"required"`
	// Most recent trade volume.
	TradeVolume string `json:"trade_volume" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AccTradePrice      respjson.Field
		AccTradePrice24h   respjson.Field
		AccTradeVolume     respjson.Field
		AccTradeVolume24h  respjson.Field
		Change             respjson.Field
		ChangePrice        respjson.Field
		ChangeRate         respjson.Field
		HighPrice          respjson.Field
		Highest52WeekDate  respjson.Field
		Highest52WeekPrice respjson.Field
		LowPrice           respjson.Field
		Lowest52WeekDate   respjson.Field
		Lowest52WeekPrice  respjson.Field
		Market             respjson.Field
		OpeningPrice       respjson.Field
		PrevClosingPrice   respjson.Field
		SignedChangePrice  respjson.Field
		SignedChangeRate   respjson.Field
		Timestamp          respjson.Field
		TradeDate          respjson.Field
		TradeDateKst       respjson.Field
		TradePrice         respjson.Field
		TradeTime          respjson.Field
		TradeTimeKst       respjson.Field
		TradeTimestamp     respjson.Field
		TradeVolume        respjson.Field
		ExtraFields        map[string]respjson.Field
		Raw                string
	} `json:"-"`
}

func (Ticker) RawJSON

func (r Ticker) RawJSON() string

RawJSON returns the unmodified JSON received from the API.

func (*Ticker) UnmarshalJSON

func (r *Ticker) UnmarshalJSON(data []byte) error

type TickerChange

type TickerChange string

Price change status.

- `EVEN`: No change - `RISE`: Price rose - `FALL`: Price fell

const (
	TickerChangeEven TickerChange = "EVEN"
	TickerChangeRise TickerChange = "RISE"
	TickerChangeFall TickerChange = "FALL"
)

type TickerListByQuoteCurrenciesParams

type TickerListByQuoteCurrenciesParams struct {
	// List of quote currencies to query. For multiple markets, use comma-separated
	// format.
	//
	// [Example] SGD,BTC
	QuoteCurrencies string `query:"quote_currencies" api:"required" json:"-"`
	// contains filtered or unexported fields
}

func (TickerListByQuoteCurrenciesParams) URLQuery

func (r TickerListByQuoteCurrenciesParams) URLQuery() (v url.Values, err error)

URLQuery serializes TickerListByQuoteCurrenciesParams's query parameters as `url.Values`.

type TickerListByTradingPairsParams

type TickerListByTradingPairsParams struct {
	// List of trading pairs to query.
	//
	// For multiple pairs, use comma-separated format.
	//
	// [Example] SGD-BTC,SGD-ETH
	Markets string `query:"markets" api:"required" json:"-"`
	// contains filtered or unexported fields
}

func (TickerListByTradingPairsParams) URLQuery

func (r TickerListByTradingPairsParams) URLQuery() (v url.Values, err error)

URLQuery serializes TickerListByTradingPairsParams's query parameters as `url.Values`.

type TickerService

type TickerService struct {
	// contains filtered or unexported fields
}

TickerService contains methods and other services that help with interacting with the upbit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewTickerService method instead.

func NewTickerService

func NewTickerService(opts ...option.RequestOption) (r TickerService)

NewTickerService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*TickerService) ListByQuoteCurrencies

func (r *TickerService) ListByQuoteCurrencies(ctx context.Context, query TickerListByQuoteCurrenciesParams, opts ...option.RequestOption) (res *[]Ticker, err error)

List Tickers by Market

GET /v1/ticker/all

- docs(kr): https://docs.upbit.com/kr/reference/list-quote-tickers - docs(global): https://global-docs.upbit.com/reference/list-quote-tickers

func (*TickerService) ListByTradingPairs

func (r *TickerService) ListByTradingPairs(ctx context.Context, query TickerListByTradingPairsParams, opts ...option.RequestOption) (res *[]Ticker, err error)

List Tickers by Pairs

GET /v1/ticker

- docs(kr): https://docs.upbit.com/kr/reference/list-tickers - docs(global): https://global-docs.upbit.com/reference/list-tickers

type TimeInForceEnum

type TimeInForceEnum string

Time in force condition.

- `fok`: Fill or Kill - `ioc`: Immediate or Cancel - `post_only`: Post only (maker only)

const (
	TimeInForceEnumFok      TimeInForceEnum = "fok"
	TimeInForceEnumIoc      TimeInForceEnum = "ioc"
	TimeInForceEnumPostOnly TimeInForceEnum = "post_only"
)

type TradeListParams

type TradeListParams struct {
	// Trading pair code to query.
	Market string `query:"market" api:"required" json:"-"`
	// Number of trade records to retrieve.
	//
	// Up to 500 supported. Default: 1.
	Count param.Opt[int64] `query:"count,omitzero" json:"-"`
	// Cursor for pagination. Enter the "sequential_id" from the response to retrieve
	// the previous "count" trade records prior to that trade.
	Cursor param.Opt[string] `query:"cursor,omitzero" json:"-"`
	// Day offset between the query date and the request date. Must specify the target
	// date; up to 7 days of history is supported (UTC-based).
	//
	// Integer between 1 and 7. If omitted, returns trades for the current date. If 7,
	// returns trades from 7 days ago in reverse chronological order.
	DaysAgo param.Opt[int64] `query:"days_ago,omitzero" json:"-"`
	// End time within the query date range (UTC). Optional parameter to retrieve
	// trades within a specific time of the query date.
	//
	// Accepts HHmmss or HH:mm:ss format. Trade list is returned in reverse
	// chronological order from the specified time.
	To param.Opt[string] `query:"to,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (TradeListParams) URLQuery

func (r TradeListParams) URLQuery() (v url.Values, err error)

URLQuery serializes TradeListParams's query parameters as `url.Values`.

type TradeListResponse

type TradeListResponse struct {
	// Trade direction — ASK (sell) or BID (buy).
	//
	// Any of "ASK", "BID".
	AskBid TradeListResponseAskBid `json:"ask_bid" api:"required"`
	// Price change from previous day's closing price. Calculated as "trade_price" -
	// "prev_closing_price".
	//
	// - Positive(+): current price rose from previous closing
	// - Negative(-): current price fell from previous closing
	// - 0: no change from previous closing
	ChangePrice string `json:"change_price" api:"required"`
	// Trading pair code.
	Market string `json:"market" api:"required"`
	// Previous day's closing price (UTC-based).
	PrevClosingPrice string `json:"prev_closing_price" api:"required"`
	// Unique identifier for the trade.
	//
	// This field does not guarantee the sequence of trades.
	SequentialID int64 `json:"sequential_id" api:"required"`
	// Milliseconds timestamp when the trade was executed.
	Timestamp int64 `json:"timestamp" api:"required"`
	// Trade date (UTC-based).
	//
	// [Format] yyyy-MM-dd
	TradeDateUtc string `json:"trade_date_utc" api:"required"`
	// Most recent trade price.
	TradePrice string `json:"trade_price" api:"required"`
	// Trade time (UTC-based).
	//
	// [Format] HH:mm:ss
	TradeTimeUtc string `json:"trade_time_utc" api:"required"`
	// Most recent trade volume.
	TradeVolume string `json:"trade_volume" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AskBid           respjson.Field
		ChangePrice      respjson.Field
		Market           respjson.Field
		PrevClosingPrice respjson.Field
		SequentialID     respjson.Field
		Timestamp        respjson.Field
		TradeDateUtc     respjson.Field
		TradePrice       respjson.Field
		TradeTimeUtc     respjson.Field
		TradeVolume      respjson.Field
		ExtraFields      map[string]respjson.Field
		Raw              string
	} `json:"-"`
}

func (TradeListResponse) RawJSON

func (r TradeListResponse) RawJSON() string

RawJSON returns the unmodified JSON received from the API.

func (*TradeListResponse) UnmarshalJSON

func (r *TradeListResponse) UnmarshalJSON(data []byte) error

type TradeListResponseAskBid

type TradeListResponseAskBid string

Trade direction — ASK (sell) or BID (buy).

const (
	TradeListResponseAskBidAsk TradeListResponseAskBid = "ASK"
	TradeListResponseAskBidBid TradeListResponseAskBid = "BID"
)

type TradeService

type TradeService struct {
	// contains filtered or unexported fields
}

TradeService contains methods and other services that help with interacting with the upbit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewTradeService method instead.

func NewTradeService

func NewTradeService(opts ...option.RequestOption) (r TradeService)

NewTradeService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*TradeService) List

func (r *TradeService) List(ctx context.Context, query TradeListParams, opts ...option.RequestOption) (res *[]TradeListResponse, err error)

Recent Trades History

GET /v1/trades/ticks

- docs(kr): https://docs.upbit.com/kr/reference/recent-trades-history - docs(global): https://global-docs.upbit.com/reference/recent-trades-history

type TradingPairListParams

type TradingPairListParams struct {
	// Whether to include detailed information in the query. If true, the response
	// includes detail fields such as caution or warning designation. Default: false.
	IsDetails param.Opt[bool] `query:"is_details,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (TradingPairListParams) URLQuery

func (r TradingPairListParams) URLQuery() (v url.Values, err error)

URLQuery serializes TradingPairListParams's query parameters as `url.Values`.

type TradingPairListResponse

type TradingPairListResponse struct {
	// English name of the digital asset.
	EnglishName string `json:"english_name" api:"required"`
	// Korean name of the digital asset.
	KoreanName string `json:"korean_name" api:"required"`
	// Trading pair code representing the market.
	//
	// [Example]: "SGD-BTC"
	Market string `json:"market" api:"required"`
	// Market alert information.
	MarketEvent TradingPairListResponseMarketEvent `json:"market_event"`
	// Trading pair warning status.
	//
	// Any of "NONE", "CAUTION".
	MarketWarning TradingPairListResponseMarketWarning `json:"market_warning"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EnglishName   respjson.Field
		KoreanName    respjson.Field
		Market        respjson.Field
		MarketEvent   respjson.Field
		MarketWarning respjson.Field
		ExtraFields   map[string]respjson.Field
		Raw           string
	} `json:"-"`
}

func (TradingPairListResponse) RawJSON

func (r TradingPairListResponse) RawJSON() string

RawJSON returns the unmodified JSON received from the API.

func (*TradingPairListResponse) UnmarshalJSON

func (r *TradingPairListResponse) UnmarshalJSON(data []byte) error

type TradingPairListResponseMarketEvent

type TradingPairListResponseMarketEvent struct {
	// Caution item status. If flagged, one or more of the following alert types may
	// apply.
	Caution TradingPairListResponseMarketEventCaution `json:"caution"`
	// Whether the trading pair is flagged as a warning item.
	Warning bool `json:"warning"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Caution     respjson.Field
		Warning     respjson.Field
		ExtraFields map[string]respjson.Field
		Raw         string
	} `json:"-"`
}

Market alert information.

func (TradingPairListResponseMarketEvent) RawJSON

RawJSON returns the unmodified JSON received from the API.

func (*TradingPairListResponseMarketEvent) UnmarshalJSON

func (r *TradingPairListResponseMarketEvent) UnmarshalJSON(data []byte) error

type TradingPairListResponseMarketEventCaution

type TradingPairListResponseMarketEventCaution struct {
	// Concentration of small accounts alert.
	ConcentrationOfSmallAccounts bool `json:"CONCENTRATION_OF_SMALL_ACCOUNTS"`
	// Deposit amount surge alert.
	DepositAmountSoaring bool `json:"DEPOSIT_AMOUNT_SOARING"`
	// Global price difference alert.
	GlobalPriceDifferences bool `json:"GLOBAL_PRICE_DIFFERENCES"`
	// Price fluctuation alert.
	PriceFluctuations bool `json:"PRICE_FLUCTUATIONS"`
	// Trading volume surge alert.
	TradingVolumeSoaring bool `json:"TRADING_VOLUME_SOARING"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ConcentrationOfSmallAccounts respjson.Field
		DepositAmountSoaring         respjson.Field
		GlobalPriceDifferences       respjson.Field
		PriceFluctuations            respjson.Field
		TradingVolumeSoaring         respjson.Field
		ExtraFields                  map[string]respjson.Field
		Raw                          string
	} `json:"-"`
}

Caution item status. If flagged, one or more of the following alert types may apply.

func (TradingPairListResponseMarketEventCaution) RawJSON

RawJSON returns the unmodified JSON received from the API.

func (*TradingPairListResponseMarketEventCaution) UnmarshalJSON

func (r *TradingPairListResponseMarketEventCaution) UnmarshalJSON(data []byte) error

type TradingPairListResponseMarketWarning

type TradingPairListResponseMarketWarning string

Trading pair warning status.

const (
	TradingPairListResponseMarketWarningNone    TradingPairListResponseMarketWarning = "NONE"
	TradingPairListResponseMarketWarningCaution TradingPairListResponseMarketWarning = "CAUTION"
)

type TradingPairService

type TradingPairService struct {
	// contains filtered or unexported fields
}

TradingPairService contains methods and other services that help with interacting with the upbit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewTradingPairService method instead.

func NewTradingPairService

func NewTradingPairService(opts ...option.RequestOption) (r TradingPairService)

NewTradingPairService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*TradingPairService) List

List Trading Pairs

GET /v1/market/all

- docs(kr): https://docs.upbit.com/kr/reference/list-trading-pairs - docs(global): https://global-docs.upbit.com/reference/list-trading-pairs

type TravelRuleListVaspsResponse

type TravelRuleListVaspsResponse struct {
	// Indicates whether deposits are available from the VASP.
	Depositable bool `json:"depositable" api:"required"`
	// Exchange name. Name of the VASP (Virtual Asset Service Provider).
	VaspName string `json:"vasp_name" api:"required"`
	// Unique identifier (UUID) of the exchange. Uniquely assigned VASP identifier for
	// the transfer.
	VaspUuid string `json:"vasp_uuid" api:"required"`
	// Indicates whether withdrawals are available to the VASP.
	Withdrawable bool `json:"withdrawable" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Depositable  respjson.Field
		VaspName     respjson.Field
		VaspUuid     respjson.Field
		Withdrawable respjson.Field
		ExtraFields  map[string]respjson.Field
		Raw          string
	} `json:"-"`
}

func (TravelRuleListVaspsResponse) RawJSON

func (r TravelRuleListVaspsResponse) RawJSON() string

RawJSON returns the unmodified JSON received from the API.

func (*TravelRuleListVaspsResponse) UnmarshalJSON

func (r *TravelRuleListVaspsResponse) UnmarshalJSON(data []byte) error

type TravelRuleService

type TravelRuleService struct {
	// contains filtered or unexported fields
}

TravelRuleService contains methods and other services that help with interacting with the upbit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewTravelRuleService method instead.

func NewTravelRuleService

func NewTravelRuleService(opts ...option.RequestOption) (r TravelRuleService)

NewTravelRuleService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*TravelRuleService) ListVasps

func (r *TravelRuleService) ListVasps(ctx context.Context, opts ...option.RequestOption) (res *[]TravelRuleListVaspsResponse, err error)

List Travel Rule Supporting VASPs

GET /v1/travel_rule/vasps

- docs(kr): https://docs.upbit.com/kr/reference/list-travelrule-vasps - docs(global): https://global-docs.upbit.com/reference/list-travelrule-vasps

func (*TravelRuleService) VerifyDepositByTxid

Verify Travel Rule by Deposit TxID

POST /v1/travel_rule/deposit/txid

func (*TravelRuleService) VerifyDepositByUuid

Verify Travel Rule by Deposit UUID

POST /v1/travel_rule/deposit/uuid

type TravelRuleVerifyDepositByTxidParams

type TravelRuleVerifyDepositByTxidParams struct {
	// Currency code to be queried.
	Currency string `json:"currency" api:"required"`
	// Blockchain network identifier for deposit/withdrawal of digital assets. Used as
	// a filter parameter to specify the network.
	NetType string `json:"net_type" api:"required"`
	// Transaction ID of the deposit to be verified.
	Txid string `json:"txid" api:"required"`
	// Unique identifier (UUID) of the counterparty exchange from which the asset was
	// withdrawn.
	VaspUuid string `json:"vasp_uuid" api:"required"`
	// contains filtered or unexported fields
}

func (TravelRuleVerifyDepositByTxidParams) MarshalJSON

func (r TravelRuleVerifyDepositByTxidParams) MarshalJSON() (data []byte, err error)

func (*TravelRuleVerifyDepositByTxidParams) UnmarshalJSON

func (r *TravelRuleVerifyDepositByTxidParams) UnmarshalJSON(data []byte) error

type TravelRuleVerifyDepositByUuidParams

type TravelRuleVerifyDepositByUuidParams struct {
	// Unique identifier (UUID) for the deposit to verify.
	DepositUuid string `json:"deposit_uuid" api:"required"`
	// Unique identifier (UUID) of the counterparty exchange from which the asset was
	// withdrawn.
	VaspUuid string `json:"vasp_uuid" api:"required"`
	// contains filtered or unexported fields
}

func (TravelRuleVerifyDepositByUuidParams) MarshalJSON

func (r TravelRuleVerifyDepositByUuidParams) MarshalJSON() (data []byte, err error)

func (*TravelRuleVerifyDepositByUuidParams) UnmarshalJSON

func (r *TravelRuleVerifyDepositByUuidParams) UnmarshalJSON(data []byte) error

type VerificationResult

type VerificationResult struct {
	// Deposit status.
	//
	//   - `PROCESSING`: Deposit in progress (digital asset only)
	//   - `ACCEPTED`: Completed
	//   - `CANCELLED`: Cancelled
	//   - `REJECTED`: Rejected
	//   - `TRAVEL_RULE_SUSPECTED`: Awaiting additional Travel Rule verification (digital
	//     assets only)
	//   - `REFUNDING`: Refund in progress
	//   - `REFUNDED`: Refunded (digital asset only)
	//
	// Any of "PROCESSING", "ACCEPTED", "CANCELLED", "REJECTED",
	// "TRAVEL_RULE_SUSPECTED", "REFUNDING", "REFUNDED".
	DepositState VerificationResultDepositState `json:"deposit_state" api:"required"`
	// Unique identifier (UUID) for the deposit to verify.
	DepositUuid string `json:"deposit_uuid" api:"required"`
	// Result of the account verification process.
	VerificationResult string `json:"verification_result" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DepositState       respjson.Field
		DepositUuid        respjson.Field
		VerificationResult respjson.Field
		ExtraFields        map[string]respjson.Field
		Raw                string
	} `json:"-"`
}

func (VerificationResult) RawJSON

func (r VerificationResult) RawJSON() string

RawJSON returns the unmodified JSON received from the API.

func (*VerificationResult) UnmarshalJSON

func (r *VerificationResult) UnmarshalJSON(data []byte) error

type VerificationResultDepositState

type VerificationResultDepositState string

Deposit status.

  • `PROCESSING`: Deposit in progress (digital asset only)
  • `ACCEPTED`: Completed
  • `CANCELLED`: Cancelled
  • `REJECTED`: Rejected
  • `TRAVEL_RULE_SUSPECTED`: Awaiting additional Travel Rule verification (digital assets only)
  • `REFUNDING`: Refund in progress
  • `REFUNDED`: Refunded (digital asset only)
const (
	VerificationResultDepositStateProcessing          VerificationResultDepositState = "PROCESSING"
	VerificationResultDepositStateAccepted            VerificationResultDepositState = "ACCEPTED"
	VerificationResultDepositStateCancelled           VerificationResultDepositState = "CANCELLED"
	VerificationResultDepositStateRejected            VerificationResultDepositState = "REJECTED"
	VerificationResultDepositStateTravelRuleSuspected VerificationResultDepositState = "TRAVEL_RULE_SUSPECTED"
	VerificationResultDepositStateRefunding           VerificationResultDepositState = "REFUNDING"
	VerificationResultDepositStateRefunded            VerificationResultDepositState = "REFUNDED"
)

type WalletStatusListResponse

type WalletStatusListResponse struct {
	// Minutes elapsed since the last block update. May return null.
	BlockElapsedMinutes int64 `json:"block_elapsed_minutes" api:"required"`
	// Currency code to be queried.
	Currency string `json:"currency" api:"required"`
	// Deposit/withdrawal network type.
	//
	// Blockchain network identifier used by Upbit.
	//
	// [Example] "ETH", "TRX", "SOL"
	NetType string `json:"net_type" api:"required"`
	// Deposit/withdrawal network name displayed to users.
	//
	// [Example] "Ethereum", "Bitcoin", "Tron", "Solana"
	NetworkName string `json:"network_name" api:"required"`
	// Deposit/withdrawal status.
	//
	// - `working`: Both available
	// - `withdraw_only`: Withdrawal only
	// - `deposit_only`: Deposit only
	// - `paused`: Both suspended
	// - `unsupported`: Not supported
	//
	// Any of "working", "withdraw_only", "deposit_only", "paused", "unsupported".
	WalletState WalletStatusListResponseWalletState `json:"wallet_state" api:"required"`
	// Current confirmed block height. May return null.
	BlockHeight int64 `json:"block_height"`
	// Blockchain network state. May return null depending on wallet or exchange
	// status.
	//
	// - `normal`: Normal
	// - `delayed`: Delayed
	// - `inactive`: Inactive
	//
	// Any of "normal", "delayed", "inactive".
	BlockState WalletStatusListResponseBlockState `json:"block_state"`
	// Timestamp when the block height was last updated (UTC). May return null.
	//
	// [Format] yyyy-MM-dd'T'HH:mm:sss+00:00
	BlockUpdatedAt string `json:"block_updated_at"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BlockElapsedMinutes respjson.Field
		Currency            respjson.Field
		NetType             respjson.Field
		NetworkName         respjson.Field
		WalletState         respjson.Field
		BlockHeight         respjson.Field
		BlockState          respjson.Field
		BlockUpdatedAt      respjson.Field
		ExtraFields         map[string]respjson.Field
		Raw                 string
	} `json:"-"`
}

func (WalletStatusListResponse) RawJSON

func (r WalletStatusListResponse) RawJSON() string

RawJSON returns the unmodified JSON received from the API.

func (*WalletStatusListResponse) UnmarshalJSON

func (r *WalletStatusListResponse) UnmarshalJSON(data []byte) error

type WalletStatusListResponseBlockState

type WalletStatusListResponseBlockState string

Blockchain network state. May return null depending on wallet or exchange status.

- `normal`: Normal - `delayed`: Delayed - `inactive`: Inactive

const (
	WalletStatusListResponseBlockStateNormal   WalletStatusListResponseBlockState = "normal"
	WalletStatusListResponseBlockStateDelayed  WalletStatusListResponseBlockState = "delayed"
	WalletStatusListResponseBlockStateInactive WalletStatusListResponseBlockState = "inactive"
)

type WalletStatusListResponseWalletState

type WalletStatusListResponseWalletState string

Deposit/withdrawal status.

- `working`: Both available - `withdraw_only`: Withdrawal only - `deposit_only`: Deposit only - `paused`: Both suspended - `unsupported`: Not supported

const (
	WalletStatusListResponseWalletStateWorking      WalletStatusListResponseWalletState = "working"
	WalletStatusListResponseWalletStateWithdrawOnly WalletStatusListResponseWalletState = "withdraw_only"
	WalletStatusListResponseWalletStateDepositOnly  WalletStatusListResponseWalletState = "deposit_only"
	WalletStatusListResponseWalletStatePaused       WalletStatusListResponseWalletState = "paused"
	WalletStatusListResponseWalletStateUnsupported  WalletStatusListResponseWalletState = "unsupported"
)

type WalletStatusService

type WalletStatusService struct {
	// contains filtered or unexported fields
}

WalletStatusService contains methods and other services that help with interacting with the upbit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewWalletStatusService method instead.

func NewWalletStatusService

func NewWalletStatusService(opts ...option.RequestOption) (r WalletStatusService)

NewWalletStatusService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*WalletStatusService) List

Get Deposit/Withdrawal Service Status

GET /v1/status/wallet

- docs(kr): https://docs.upbit.com/kr/reference/get-service-status - docs(global): https://global-docs.upbit.com/reference/get-service-status

type Withdraw

type Withdraw struct {
	// Amount of the asset to withdraw.
	Amount string `json:"amount" api:"required"`
	// Timestamp when the withdrawal was created.
	CreatedAt string `json:"created_at" api:"required"`
	// Currency code to be queried.
	Currency string `json:"currency" api:"required"`
	// Withdrawal fee.
	Fee string `json:"fee" api:"required"`
	// Whether the withdrawal can be cancelled.
	IsCancelable bool `json:"is_cancelable" api:"required"`
	// Withdrawal network type.
	//
	// Blockchain network identifier used by Upbit.
	//
	// [Example] "ETH", "TRX", "SOL"
	NetType string `json:"net_type" api:"required"`
	// Withdrawal processing state.
	//
	// - `WAITING`: Waiting
	// - `PROCESSING`: Processing
	// - `DONE`: Completed
	// - `FAILED`: Failed
	// - `CANCELLED`: Cancelled
	// - `REJECTED`: Rejected
	//
	// Any of "WAITING", "PROCESSING", "DONE", "FAILED", "CANCELLED", "REJECTED".
	State WithdrawState `json:"state" api:"required"`
	// Withdrawal transaction type.
	//
	// - `default`: Standard withdrawal
	// - `internal`: Internal (instant) withdrawal
	//
	// Any of "default", "internal".
	TransactionType WithdrawTransactionType `json:"transaction_type" api:"required"`
	// Transaction ID.
	Txid string `json:"txid" api:"required"`
	// Transaction type.
	Type string `json:"type" api:"required"`
	// Unique identifier of the withdrawal.
	Uuid string `json:"uuid" api:"required"`
	// Timestamp when the withdrawal was completed. Returns null if not yet completed.
	DoneAt string `json:"done_at" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Amount          respjson.Field
		CreatedAt       respjson.Field
		Currency        respjson.Field
		Fee             respjson.Field
		IsCancelable    respjson.Field
		NetType         respjson.Field
		State           respjson.Field
		TransactionType respjson.Field
		Txid            respjson.Field
		Type            respjson.Field
		Uuid            respjson.Field
		DoneAt          respjson.Field
		ExtraFields     map[string]respjson.Field
		Raw             string
	} `json:"-"`
}

func (Withdraw) RawJSON

func (r Withdraw) RawJSON() string

RawJSON returns the unmodified JSON received from the API.

func (*Withdraw) UnmarshalJSON

func (r *Withdraw) UnmarshalJSON(data []byte) error

type WithdrawCancelWithdrawalParams

type WithdrawCancelWithdrawalParams struct {
	// UUID of the withdrawal to cancel.
	Uuid string `query:"uuid" api:"required" json:"-"`
	// contains filtered or unexported fields
}

func (WithdrawCancelWithdrawalParams) URLQuery

func (r WithdrawCancelWithdrawalParams) URLQuery() (v url.Values, err error)

URLQuery serializes WithdrawCancelWithdrawalParams's query parameters as `url.Values`.

type WithdrawGetChanceParams

type WithdrawGetChanceParams struct {
	// Currency code to query withdrawal availability for.
	Currency string `query:"currency" api:"required" json:"-"`
	// Blockchain network identifier for digital asset withdrawal. Required for digital
	// assets.
	NetType string `query:"net_type" api:"required" json:"-"`
	// contains filtered or unexported fields
}

func (WithdrawGetChanceParams) URLQuery

func (r WithdrawGetChanceParams) URLQuery() (v url.Values, err error)

URLQuery serializes WithdrawGetChanceParams's query parameters as `url.Values`.

type WithdrawGetChanceResponse

type WithdrawGetChanceResponse struct {
	// Asset balance information.
	Account WithdrawGetChanceResponseAccount `json:"account" api:"required"`
	// Currency information.
	Currency WithdrawGetChanceResponseCurrency `json:"currency" api:"required"`
	// User security level information.
	MemberLevel WithdrawGetChanceResponseMemberLevel `json:"member_level" api:"required"`
	// Withdrawal limit information.
	WithdrawLimit WithdrawGetChanceResponseWithdrawLimit `json:"withdraw_limit" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Account       respjson.Field
		Currency      respjson.Field
		MemberLevel   respjson.Field
		WithdrawLimit respjson.Field
		ExtraFields   map[string]respjson.Field
		Raw           string
	} `json:"-"`
}

func (WithdrawGetChanceResponse) RawJSON

func (r WithdrawGetChanceResponse) RawJSON() string

RawJSON returns the unmodified JSON received from the API.

func (*WithdrawGetChanceResponse) UnmarshalJSON

func (r *WithdrawGetChanceResponse) UnmarshalJSON(data []byte) error

type WithdrawGetChanceResponseAccount

type WithdrawGetChanceResponseAccount struct {
	// Average buy price of the asset.
	AvgBuyPrice string `json:"avg_buy_price" api:"required"`
	// Indicates whether the average buy price has been modified.
	AvgBuyPriceModified bool `json:"avg_buy_price_modified" api:"required"`
	// Available amount or volume for orders.
	Balance string `json:"balance" api:"required"`
	// Currency code to be queried.
	Currency string `json:"currency" api:"required"`
	// Amount or quantity locked by pending orders or withdrawals.
	Locked string `json:"locked" api:"required"`
	// Currency unit used as the basis for avg_buy_price.
	UnitCurrency string `json:"unit_currency" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AvgBuyPrice         respjson.Field
		AvgBuyPriceModified respjson.Field
		Balance             respjson.Field
		Currency            respjson.Field
		Locked              respjson.Field
		UnitCurrency        respjson.Field
		ExtraFields         map[string]respjson.Field
		Raw                 string
	} `json:"-"`
}

Asset balance information.

func (WithdrawGetChanceResponseAccount) RawJSON

RawJSON returns the unmodified JSON received from the API.

func (*WithdrawGetChanceResponseAccount) UnmarshalJSON

func (r *WithdrawGetChanceResponseAccount) UnmarshalJSON(data []byte) error

type WithdrawGetChanceResponseCurrency

type WithdrawGetChanceResponseCurrency struct {
	// Currency code.
	Code string `json:"code" api:"required"`
	// Whether this is a digital asset.
	IsCoin bool `json:"is_coin" api:"required"`
	// Whether deposit/withdrawal has been supported for this asset.
	//
	// - `working`: Has been supported
	// - `unsupported`: Never supported
	//
	// Any of "working", "unsupported".
	WalletState string `json:"wallet_state" api:"required"`
	// Current deposit/withdrawal availability. 'deposit' if deposits are available,
	// 'withdraw' if withdrawals are available. Empty list means neither is available.
	WalletSupport []string `json:"wallet_support" api:"required"`
	// Withdrawal fee.
	WithdrawFee string `json:"withdraw_fee" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Code          respjson.Field
		IsCoin        respjson.Field
		WalletState   respjson.Field
		WalletSupport respjson.Field
		WithdrawFee   respjson.Field
		ExtraFields   map[string]respjson.Field
		Raw           string
	} `json:"-"`
}

Currency information.

func (WithdrawGetChanceResponseCurrency) RawJSON

RawJSON returns the unmodified JSON received from the API.

func (*WithdrawGetChanceResponseCurrency) UnmarshalJSON

func (r *WithdrawGetChanceResponseCurrency) UnmarshalJSON(data []byte) error

type WithdrawGetChanceResponseMemberLevel

type WithdrawGetChanceResponseMemberLevel struct {
	// Whether bank account is verified.
	BankAccountVerified bool `json:"bank_account_verified" api:"required"`
	// Whether email is verified.
	EmailVerified bool `json:"email_verified" api:"required"`
	// Fee level.
	FeeLevel int64 `json:"fee_level" api:"required"`
	// Whether identity is verified.
	IdentityAuthVerified bool `json:"identity_auth_verified" api:"required"`
	// Whether the account is locked.
	Locked bool `json:"locked" api:"required"`
	// Security level.
	SecurityLevel int64 `json:"security_level" api:"required"`
	// Whether two-factor authentication is enabled.
	TwoFactorAuthVerified bool `json:"two_factor_auth_verified" api:"required"`
	// Whether the wallet (withdrawal) is locked.
	WalletLocked bool `json:"wallet_locked" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		BankAccountVerified   respjson.Field
		EmailVerified         respjson.Field
		FeeLevel              respjson.Field
		IdentityAuthVerified  respjson.Field
		Locked                respjson.Field
		SecurityLevel         respjson.Field
		TwoFactorAuthVerified respjson.Field
		WalletLocked          respjson.Field
		ExtraFields           map[string]respjson.Field
		Raw                   string
	} `json:"-"`
}

User security level information.

func (WithdrawGetChanceResponseMemberLevel) RawJSON

RawJSON returns the unmodified JSON received from the API.

func (*WithdrawGetChanceResponseMemberLevel) UnmarshalJSON

func (r *WithdrawGetChanceResponseMemberLevel) UnmarshalJSON(data []byte) error

type WithdrawGetChanceResponseWithdrawLimit

type WithdrawGetChanceResponseWithdrawLimit struct {
	// Currency code to be queried.
	Currency string `json:"currency" api:"required"`
	// Reference fiat currency.
	FiatCurrency string `json:"fiat_currency" api:"required"`
	// Integrated remaining daily withdrawal limit (in fiat currency).
	RemainingDailyFiat string `json:"remaining_daily_fiat" api:"required"`
	// Whether withdrawal is currently supported.
	//
	//   - To check current availability, refer to currency.wallet_support for the
	//     'withdraw' value.
	CanWithdraw bool `json:"can_withdraw"`
	// Decimal precision for withdrawal amount/volume.
	Fixed int64 `json:"fixed"`
	// Minimum withdrawal amount or volume.
	Minimum string `json:"minimum"`
	// Amount restricted due to the withdrawal delay policy.
	WithdrawDelayedFiat string `json:"withdraw_delayed_fiat"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Currency            respjson.Field
		FiatCurrency        respjson.Field
		RemainingDailyFiat  respjson.Field
		CanWithdraw         respjson.Field
		Fixed               respjson.Field
		Minimum             respjson.Field
		WithdrawDelayedFiat respjson.Field
		ExtraFields         map[string]respjson.Field
		Raw                 string
	} `json:"-"`
}

Withdrawal limit information.

func (WithdrawGetChanceResponseWithdrawLimit) RawJSON

RawJSON returns the unmodified JSON received from the API.

func (*WithdrawGetChanceResponseWithdrawLimit) UnmarshalJSON

func (r *WithdrawGetChanceResponseWithdrawLimit) UnmarshalJSON(data []byte) error

type WithdrawGetParams

type WithdrawGetParams struct {
	// Currency code filter. If not specified, the latest withdrawal is returned.
	Currency param.Opt[string] `query:"currency,omitzero" json:"-"`
	// Transaction ID of the withdrawal to query.
	//
	// If neither uuid nor txid is provided, the latest withdrawal is returned.
	Txid param.Opt[string] `query:"txid,omitzero" json:"-"`
	// UUID of the withdrawal to query.
	//
	// If neither uuid nor txid is provided, the latest withdrawal is returned.
	Uuid param.Opt[string] `query:"uuid,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (WithdrawGetParams) URLQuery

func (r WithdrawGetParams) URLQuery() (v url.Values, err error)

URLQuery serializes WithdrawGetParams's query parameters as `url.Values`.

type WithdrawListCoinAddressesResponse

type WithdrawListCoinAddressesResponse struct {
	// Currency code of the digital asset to withdraw.
	Currency string `json:"currency" api:"required"`
	// Withdrawal network type.
	//
	// Blockchain network identifier used by Upbit. The `net_type` parameter in
	// withdrawal requests must match this value.
	//
	// [Example] "ETH", "TRX", "SOL"
	NetType string `json:"net_type" api:"required"`
	// Withdrawal network name displayed to users.
	//
	// [Example] "Ethereum", "Bitcoin", "Tron", "Solana"
	NetworkName string `json:"network_name" api:"required"`
	// Recipient address for digital asset withdrawal.
	//
	// Only addresses registered in the allowed withdrawal address list can be used.
	WithdrawAddress string `json:"withdraw_address" api:"required"`
	// Company name of the entity receiving the withdrawn assets.
	BeneficiaryCompanyName string `json:"beneficiary_company_name" api:"nullable"`
	// Name of the wallet owner.
	//
	// Name of the individual or corporate representative receiving the withdrawn
	// assets. Returned only for exchange wallets; null for personal wallets.
	BeneficiaryName string `json:"beneficiary_name"`
	// Account holder type.
	//
	// - `individual`: Personal wallet
	// - `corporate`: Corporate wallet
	BeneficiaryType string `json:"beneficiary_type" api:"nullable"`
	// Name of the exchange where the withdrawal address is registered.
	//
	// [Example] "Binance", "Bybit"
	ExchangeName string `json:"exchange_name" api:"nullable"`
	// Secondary withdrawal address (Destination Tag, Memo, or Message). Some digital
	// assets require a secondary address along with the primary address.
	SecondaryAddress string `json:"secondary_address" api:"nullable"`
	// Personal wallet type.
	//
	// [Example] "MetaMask"
	WalletType string `json:"wallet_type" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Currency               respjson.Field
		NetType                respjson.Field
		NetworkName            respjson.Field
		WithdrawAddress        respjson.Field
		BeneficiaryCompanyName respjson.Field
		BeneficiaryName        respjson.Field
		BeneficiaryType        respjson.Field
		ExchangeName           respjson.Field
		SecondaryAddress       respjson.Field
		WalletType             respjson.Field
		ExtraFields            map[string]respjson.Field
		Raw                    string
	} `json:"-"`
}

func (WithdrawListCoinAddressesResponse) RawJSON

RawJSON returns the unmodified JSON received from the API.

func (*WithdrawListCoinAddressesResponse) UnmarshalJSON

func (r *WithdrawListCoinAddressesResponse) UnmarshalJSON(data []byte) error

type WithdrawListParams

type WithdrawListParams struct {
	// Currency code filter. If not specified, all currencies are returned.
	Currency param.Opt[string] `query:"currency,omitzero" json:"-"`
	// Cursor for pagination. Enter a "uuid" from the response to retrieve "limit"
	// withdrawals after that timestamp.
	From param.Opt[string] `query:"from,omitzero" json:"-"`
	// Number of results per request (default: 100, max: 100).
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// Page number for pagination. Default is 1.
	Page param.Opt[int64] `query:"page,omitzero" json:"-"`
	// Cursor for pagination. Enter a "uuid" from the response to retrieve "limit"
	// withdrawals before that timestamp.
	To param.Opt[string] `query:"to,omitzero" json:"-"`
	// Sort order. "desc" (newest first) or "asc" (oldest first). Default is "desc".
	//
	// Any of "asc", "desc".
	OrderBy WithdrawListParamsOrderBy `query:"order_by,omitzero" json:"-"`
	// Withdrawal state filter.
	//
	// - `WAITING`: Waiting
	// - `PROCESSING`: Processing
	// - `DONE`: Completed
	// - `FAILED`: Failed
	// - `CANCELLED`: Cancelled
	// - `REJECTED`: Rejected
	//
	// Any of "WAITING", "PROCESSING", "DONE", "FAILED", "CANCELLED", "REJECTED".
	State WithdrawListParamsState `query:"state,omitzero" json:"-"`
	// List of transaction IDs to query. Maximum 100. Cannot be used together with
	// uuids.
	//
	// [Example] txids[]=txid1&txids[]=txid2
	Txids []string `query:"txids,omitzero" json:"-"`
	// List of UUIDs to query. Maximum 100. Cannot be used together with txids.
	//
	// [Example] uuids[]=uuid1&uuids[]=uuid2
	Uuids []string `query:"uuids,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (WithdrawListParams) URLQuery

func (r WithdrawListParams) URLQuery() (v url.Values, err error)

URLQuery serializes WithdrawListParams's query parameters as `url.Values`.

type WithdrawListParamsOrderBy

type WithdrawListParamsOrderBy string

Sort order. "desc" (newest first) or "asc" (oldest first). Default is "desc".

const (
	WithdrawListParamsOrderByAsc  WithdrawListParamsOrderBy = "asc"
	WithdrawListParamsOrderByDesc WithdrawListParamsOrderBy = "desc"
)

type WithdrawListParamsState

type WithdrawListParamsState string

Withdrawal state filter.

- `WAITING`: Waiting - `PROCESSING`: Processing - `DONE`: Completed - `FAILED`: Failed - `CANCELLED`: Cancelled - `REJECTED`: Rejected

const (
	WithdrawListParamsStateWaiting    WithdrawListParamsState = "WAITING"
	WithdrawListParamsStateProcessing WithdrawListParamsState = "PROCESSING"
	WithdrawListParamsStateDone       WithdrawListParamsState = "DONE"
	WithdrawListParamsStateFailed     WithdrawListParamsState = "FAILED"
	WithdrawListParamsStateCancelled  WithdrawListParamsState = "CANCELLED"
	WithdrawListParamsStateRejected   WithdrawListParamsState = "REJECTED"
)

type WithdrawNewKrwWithdrawalParams

type WithdrawNewKrwWithdrawalParams struct {
	// KRW amount to withdraw.
	//
	// Must be a numeric string.
	Amount string `json:"amount" api:"required"`
	// Two-factor authentication method for KRW transactions.
	//
	// - `kakao`: Kakao authentication
	// - `naver`: Naver authentication
	// - `hana`: Hana certificate authentication
	//
	// Any of "kakao", "naver", "hana".
	TwoFactorType WithdrawNewKrwWithdrawalParamsTwoFactorType `json:"two_factor_type,omitzero" api:"required"`
	// contains filtered or unexported fields
}

func (WithdrawNewKrwWithdrawalParams) MarshalJSON

func (r WithdrawNewKrwWithdrawalParams) MarshalJSON() (data []byte, err error)

func (*WithdrawNewKrwWithdrawalParams) UnmarshalJSON

func (r *WithdrawNewKrwWithdrawalParams) UnmarshalJSON(data []byte) error

type WithdrawNewKrwWithdrawalParamsTwoFactorType

type WithdrawNewKrwWithdrawalParamsTwoFactorType string

Two-factor authentication method for KRW transactions.

- `kakao`: Kakao authentication - `naver`: Naver authentication - `hana`: Hana certificate authentication

const (
	WithdrawNewKrwWithdrawalParamsTwoFactorTypeKakao WithdrawNewKrwWithdrawalParamsTwoFactorType = "kakao"
	WithdrawNewKrwWithdrawalParamsTwoFactorTypeNaver WithdrawNewKrwWithdrawalParamsTwoFactorType = "naver"
	WithdrawNewKrwWithdrawalParamsTwoFactorTypeHana  WithdrawNewKrwWithdrawalParamsTwoFactorType = "hana"
)

type WithdrawNewKrwWithdrawalResponse

type WithdrawNewKrwWithdrawalResponse struct {
	// Amount of the asset to withdraw.
	Amount string `json:"amount" api:"required"`
	// Timestamp when the withdrawal was created.
	CreatedAt string `json:"created_at" api:"required"`
	// Currency code to be queried.
	Currency string `json:"currency" api:"required"`
	// Withdrawal fee.
	Fee string `json:"fee" api:"required"`
	// Whether the withdrawal can be cancelled.
	IsCancelable bool `json:"is_cancelable" api:"required"`
	// Withdrawal network type.
	//
	// Blockchain network identifier used by Upbit.
	//
	// [Example] "ETH", "TRX", "SOL"
	NetType string `json:"net_type" api:"required"`
	// Withdrawal processing state.
	//
	// - `waiting`: Waiting
	// - `processing`: Processing
	// - `done`: Completed
	// - `failed`: Failed
	// - `cancelled`: Cancelled
	// - `rejected`: Rejected
	//
	// Any of "waiting", "processing", "done", "failed", "cancelled", "rejected".
	State WithdrawNewKrwWithdrawalResponseState `json:"state" api:"required"`
	// Withdrawal transaction type.
	//
	// - `default`: Standard withdrawal
	// - `internal`: Internal (instant) withdrawal
	//
	// Any of "default", "internal".
	TransactionType WithdrawNewKrwWithdrawalResponseTransactionType `json:"transaction_type" api:"required"`
	// Transaction ID.
	Txid string `json:"txid" api:"required"`
	// Transaction type.
	Type string `json:"type" api:"required"`
	// Unique identifier of the withdrawal.
	Uuid string `json:"uuid" api:"required"`
	// Timestamp when the withdrawal was completed. Returns null if not yet completed.
	DoneAt string `json:"done_at" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Amount          respjson.Field
		CreatedAt       respjson.Field
		Currency        respjson.Field
		Fee             respjson.Field
		IsCancelable    respjson.Field
		NetType         respjson.Field
		State           respjson.Field
		TransactionType respjson.Field
		Txid            respjson.Field
		Type            respjson.Field
		Uuid            respjson.Field
		DoneAt          respjson.Field
		ExtraFields     map[string]respjson.Field
		Raw             string
	} `json:"-"`
}

func (WithdrawNewKrwWithdrawalResponse) RawJSON

RawJSON returns the unmodified JSON received from the API.

func (*WithdrawNewKrwWithdrawalResponse) UnmarshalJSON

func (r *WithdrawNewKrwWithdrawalResponse) UnmarshalJSON(data []byte) error

type WithdrawNewKrwWithdrawalResponseState

type WithdrawNewKrwWithdrawalResponseState string

Withdrawal processing state.

- `waiting`: Waiting - `processing`: Processing - `done`: Completed - `failed`: Failed - `cancelled`: Cancelled - `rejected`: Rejected

const (
	WithdrawNewKrwWithdrawalResponseStateWaiting    WithdrawNewKrwWithdrawalResponseState = "waiting"
	WithdrawNewKrwWithdrawalResponseStateProcessing WithdrawNewKrwWithdrawalResponseState = "processing"
	WithdrawNewKrwWithdrawalResponseStateDone       WithdrawNewKrwWithdrawalResponseState = "done"
	WithdrawNewKrwWithdrawalResponseStateFailed     WithdrawNewKrwWithdrawalResponseState = "failed"
	WithdrawNewKrwWithdrawalResponseStateCancelled  WithdrawNewKrwWithdrawalResponseState = "cancelled"
	WithdrawNewKrwWithdrawalResponseStateRejected   WithdrawNewKrwWithdrawalResponseState = "rejected"
)

type WithdrawNewKrwWithdrawalResponseTransactionType

type WithdrawNewKrwWithdrawalResponseTransactionType string

Withdrawal transaction type.

- `default`: Standard withdrawal - `internal`: Internal (instant) withdrawal

const (
	WithdrawNewKrwWithdrawalResponseTransactionTypeDefault  WithdrawNewKrwWithdrawalResponseTransactionType = "default"
	WithdrawNewKrwWithdrawalResponseTransactionTypeInternal WithdrawNewKrwWithdrawalResponseTransactionType = "internal"
)

type WithdrawNewWithdrawalParams

type WithdrawNewWithdrawalParams struct {
	// Recipient address for digital asset withdrawal.
	//
	// Only addresses registered in the allowed withdrawal address list can be used.
	Address string `json:"address" api:"required"`
	// Amount of the asset to withdraw.
	//
	// Must be a numeric string.
	Amount string `json:"amount" api:"required"`
	// Currency code of the digital asset to withdraw.
	Currency string `json:"currency" api:"required"`
	// Check the allowed withdrawal addresses API response to find the available
	// "net_type" value for each address.
	NetType string `json:"net_type" api:"required"`
	// Secondary withdrawal address (Destination Tag, Memo, or Message). If the
	// recipient address includes a secondary address, this field must be included.
	SecondaryAddress param.Opt[string] `json:"secondary_address,omitzero"`
	// Withdrawal transaction type.
	//
	// - `default`: Standard withdrawal
	// - `internal`: Internal (instant) withdrawal
	//
	// Any of "default", "internal".
	TransactionType WithdrawNewWithdrawalParamsTransactionType `json:"transaction_type,omitzero"`
	// contains filtered or unexported fields
}

func (WithdrawNewWithdrawalParams) MarshalJSON

func (r WithdrawNewWithdrawalParams) MarshalJSON() (data []byte, err error)

func (*WithdrawNewWithdrawalParams) UnmarshalJSON

func (r *WithdrawNewWithdrawalParams) UnmarshalJSON(data []byte) error

type WithdrawNewWithdrawalParamsTransactionType

type WithdrawNewWithdrawalParamsTransactionType string

Withdrawal transaction type.

- `default`: Standard withdrawal - `internal`: Internal (instant) withdrawal

const (
	WithdrawNewWithdrawalParamsTransactionTypeDefault  WithdrawNewWithdrawalParamsTransactionType = "default"
	WithdrawNewWithdrawalParamsTransactionTypeInternal WithdrawNewWithdrawalParamsTransactionType = "internal"
)

type WithdrawService

type WithdrawService struct {
	// contains filtered or unexported fields
}

WithdrawService contains methods and other services that help with interacting with the upbit API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewWithdrawService method instead.

func NewWithdrawService

func NewWithdrawService(opts ...option.RequestOption) (r WithdrawService)

NewWithdrawService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*WithdrawService) CancelWithdrawal

func (r *WithdrawService) CancelWithdrawal(ctx context.Context, body WithdrawCancelWithdrawalParams, opts ...option.RequestOption) (res *Withdraw, err error)

Cancel Withdrawal

DELETE /v1/withdraws/coin

- docs(kr): https://docs.upbit.com/kr/reference/cancel-withdrawal - docs(global): https://global-docs.upbit.com/reference/cancel-withdrawal

func (*WithdrawService) Get

func (r *WithdrawService) Get(ctx context.Context, query WithdrawGetParams, opts ...option.RequestOption) (res *Withdraw, err error)

Get Withdrawal

GET /v1/withdraw

- docs(kr): https://docs.upbit.com/kr/reference/get-withdrawal - docs(global): https://global-docs.upbit.com/reference/get-withdrawal

func (*WithdrawService) GetChance

Get Available Withdrawal Information

GET /v1/withdraws/chance

func (*WithdrawService) List

List Withdrawals

GET /v1/withdraws

- docs(kr): https://docs.upbit.com/kr/reference/list-withdrawals - docs(global): https://global-docs.upbit.com/reference/list-withdrawals

func (*WithdrawService) ListCoinAddresses

func (r *WithdrawService) ListCoinAddresses(ctx context.Context, opts ...option.RequestOption) (res *[]WithdrawListCoinAddressesResponse, err error)

List Withdrawal Allowed Addresses

GET /v1/withdraws/coin_addresses

func (*WithdrawService) NewKrwWithdrawal

Withdraw KRW

POST /v1/withdraws/krw

- docs(kr): https://docs.upbit.com/kr/reference/withdraw-krw - docs(global): https://global-docs.upbit.com/reference/withdraw-krw

func (*WithdrawService) NewWithdrawal

func (r *WithdrawService) NewWithdrawal(ctx context.Context, body WithdrawNewWithdrawalParams, opts ...option.RequestOption) (res *Withdraw, err error)

Withdraw Digital Asset

POST /v1/withdraws/coin

- docs(kr): https://docs.upbit.com/kr/reference/withdraw - docs(global): https://global-docs.upbit.com/reference/withdraw

type WithdrawState

type WithdrawState string

Withdrawal processing state.

- `WAITING`: Waiting - `PROCESSING`: Processing - `DONE`: Completed - `FAILED`: Failed - `CANCELLED`: Cancelled - `REJECTED`: Rejected

const (
	WithdrawStateWaiting    WithdrawState = "WAITING"
	WithdrawStateProcessing WithdrawState = "PROCESSING"
	WithdrawStateDone       WithdrawState = "DONE"
	WithdrawStateFailed     WithdrawState = "FAILED"
	WithdrawStateCancelled  WithdrawState = "CANCELLED"
	WithdrawStateRejected   WithdrawState = "REJECTED"
)

type WithdrawTransactionType

type WithdrawTransactionType string

Withdrawal transaction type.

- `default`: Standard withdrawal - `internal`: Internal (instant) withdrawal

const (
	WithdrawTransactionTypeDefault  WithdrawTransactionType = "default"
	WithdrawTransactionTypeInternal WithdrawTransactionType = "internal"
)

Directories

Path Synopsis
DCA (recurring buy) automated market-buy scenario.
DCA (recurring buy) automated market-buy scenario.
accounts command
Auto-generated example — do not edit manually.
Auto-generated example — do not edit manually.
api_keys command
Auto-generated example — do not edit manually.
Auto-generated example — do not edit manually.
candles command
Auto-generated example — do not edit manually.
Auto-generated example — do not edit manually.
deposits command
Auto-generated example — do not edit manually.
Auto-generated example — do not edit manually.
orderbooks command
Auto-generated example — do not edit manually.
Auto-generated example — do not edit manually.
orders command
Auto-generated example — do not edit manually.
Auto-generated example — do not edit manually.
tickers command
Auto-generated example — do not edit manually.
Auto-generated example — do not edit manually.
trades command
Auto-generated example — do not edit manually.
Auto-generated example — do not edit manually.
trading_pairs command
Auto-generated example — do not edit manually.
Auto-generated example — do not edit manually.
travel_rule command
Auto-generated example — do not edit manually.
Auto-generated example — do not edit manually.
wallet_status command
Auto-generated example — do not edit manually.
Auto-generated example — do not edit manually.
withdraws command
Auto-generated example — do not edit manually.
Auto-generated example — do not edit manually.
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
Package json implements encoding and decoding of JSON as defined in RFC 7159.
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
packages
shared

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL