Gateio

CryptoExchangeAPIs.Gateio.GateioClientType
GateioClient <: AbstractAPIsClient

Client info.

Required fields

  • base_url::String: Base URL for the client.

Optional fields

  • public_key::String: Public key for authentication.
  • secret_key::String: Secret key for authentication.
  • interface::String: Interface for the client.
  • proxy::String: Proxy information for the client.
  • account_name::String: Account name associated with the client.
  • description::String: Description of the client.
source

Spot

CryptoExchangeAPIs.Gateio.Spot.Candle.candleFunction
candle(client::GateioClient, query::CandleQuery)
candle(client::GateioClient = Gateio.Spot.public_client; kw...)

Market candlesticks.

GET api/v4/spot/candlesticks

Parameters:

ParameterTypeRequiredDescription
currency_pairStringtrue
fromDateTimefalse
intervalTimeIntervalfalses10 m1 m5 m15 m30 h1 h4 h8 d1 d7 d30
limitInt64false
_endDateTimefalse

Code samples:

using Serde
using CryptoExchangeAPIs.Gateio

result = Gateio.Spot.candle(;
    currency_pair = "BTC_USDT",
    interval = Gateio.Spot.Candle.d1,
)

to_pretty_json(result.result)

Result:

[
  {
    "timestamp":"2023-12-17T00:00:00",
    "quote_volume":2.43940917037979e8,
    "close_price":41378.4,
    "high_price":42421.6,
    "low_price":41240.1,
    "open_price":42275.6,
    "base_amount":5819.36674398
  },
  ...
]
source
CryptoExchangeAPIs.Gateio.Spot.Currency.currencyFunction
currency(client::GateioClient, query::CurrencyQuery)
currency(client::GateioClient = Gateio.Spot.public_client; kw...)

List all currencies' details.

GET api/v4/spot/currencies

Code samples:

using Serde
using CryptoExchangeAPIs.Gateio

result = Gateio.Spot.currency()

to_pretty_json(result.result)

Result:

[
  {
    "chain":"BSC",
    "currency":"100X",
    "delisted":false,
    "deposit_disabled":true,
    "fixed_rate":null,
    "trade_disabled":true,
    "withdraw_delayed":false,
    "withdraw_disabled":false
  },
  ...
]
source
CryptoExchangeAPIs.Gateio.Spot.CurrencyPairs.currency_pairFunction
currency_pair(client::GateioClient, query::CurrencyPairQuery)
currency_pair(client::GateioClient = Gateio.Spot.public_client; kw...)

Get details of a specifc currency pair.

GET /api/v4/spot/currency_pairs/{currency_pair}

Parameters:

ParameterTypeRequiredDescription
currency_pairStringtrue

Code samples:

using Serde
using CryptoExchangeAPIs.Gateio

result = Gateio.Spot.currency_pair(; 
    currency_pair = "ETH_BTC",
)

to_pretty_json(result.result)

Result:

{
  "id":"ETH_BTC",
  "base":"ETH",
  "quote":"BTC",
  "fee":0.2,
  "min_base_amount":0.001,
  "min_quote_amount":1.0e-5,
  "max_base_amount":1000.0,
  "max_quote_amount":100.0,
  "amount_precision":4,
  "precision":6,
  "trade_status":"tradable",
  "sell_start":"1970-01-01T00:00:00",
  "buy_start":"2016-03-09T00:00:00"
}
source
CryptoExchangeAPIs.Gateio.Spot.CurrencyPairs.currency_pairsFunction
currency_pairs(client::GateioClient, query::CurrencyPairsQuery)
currency_pairs(client::GateioClient = Gateio.Spot.public_client; kw...)

List all currency pairs supported.

GET /api/v4/spot/currency_pairs/

Code samples:

using Serde
using CryptoExchangeAPIs.Gateio

result = Gateio.Spot.currency_pairs()

to_pretty_json(result.result)

Result:

[
  {
    "id":"0DOG_USDT",
    "base":"0DOG",
    "quote":"USDT",
    "fee":0.2,
    "min_base_amount":0.01,
    "min_quote_amount":3.0,
    "max_base_amount":null,
    "max_quote_amount":5.0e6,
    "amount_precision":2,
    "precision":5,
    "trade_status":"tradable",
    "sell_start":"2020-12-07T04:00:00",
    "buy_start":"2024-08-21T11:00:00"
  },
  ...
]
source
CryptoExchangeAPIs.Gateio.Spot.Deposit.depositFunction
deposit(client::GateioClient, query::CandleQuery)
deposit(client::GateioClient; kw...)

Retrieve deposit records.

GET api/v4/wallet/deposits

Parameters:

ParameterTypeRequiredDescription
currencyStringfalse
fromDateTimefalse
limitInt64false
offsetInt64false
toDateTimefalse
signStringfalse
signTimestampDateTimefalse

Code samples:

using Serde
using CryptoExchangeAPIs.Gateio

gateio_client = GateioClient(;
    base_url = "https://api.Gateio.ws",
    public_key = ENV["GATEIO_PUBLIC_KEY"],
    secret_key = ENV["GATEIO_SECRET_KEY"],
)

result = Gateio.Spot.deposit(gateio_client)

to_pretty_json(result.result)

Result:

[
  {
    "address": "1HkxtBAMrA3tP5EYY2CZortjZvFDH5Cs",
    "amount": 222.61,
    "chain": "TRX"
    "currency": "USDT",
    "fee": null,
    "id": 210496,
    "memo": null,
    "status": "DONE",
    "timestamp": "2018-11-12T05:20:00",
    "txid": 128988928203223323290,
    "withdraw_order_id": "order_123456",
  },
  ...
]
source
CryptoExchangeAPIs.Gateio.Spot.Ticker.tickerFunction
ticker(client::GateioClient, query::TickerQuery)
ticker(client::GateioClient = Gateio.Spot.public_client; kw...)

Retrieve ticker information.

GET api/v4/spot/tickers

Parameters:

ParameterTypeRequiredDescription
currency_pairStringfalse
timezoneStringfalse

Code samples:

using Serde
using CryptoExchangeAPIs.Gateio

result = Gateio.Spot.ticker(;
    currency_pair = "ADA_USDT",
)

to_pretty_json(result.result)

Result:

[
  {
    "currency_pair":"ADA_USDT",
    "base_volume":2.0167711540647e7,
    "change_percentage":-4.77,
    "change_utc0":null,
    "change_utc8":null,
    "etf_leverage":null,
    "etf_net_value":null,
    "etf_pre_net_value":null,
    "etf_pre_timestamp":null,
    "high_24h":0.623,
    "highest_bid":0.5869,
    "last":0.5869,
    "low_24h":0.5721,
    "lowest_ask":0.587,
    "quote_volume":1.1922473751288e7
  }
]
source

Futures

CryptoExchangeAPIs.Gateio.Futures.Candle.candleFunction
candle(client::GateioClient, query::CandleQuery)
candle(client::GateioClient = Gateio.Futures.public_client; kw...)

Get futures candlesticks.

GET api/v4/futures/{settle}/candlesticks

Parameters:

ParameterTypeRequiredDescription
contractStringtrue
settleSettletruebtc usdt usd
intervalTimeIntervalfalses10 m1 m5 m15 m30 h1 h4 h8 d1 d7 d30
fromDateTimefalse
toDateTimefalse
limitInt64false

Code samples:

using Serde
using CryptoExchangeAPIs.Gateio

result = Gateio.Futures.candle(; 
    type = Gateio.Futures.Candle.mark,
    name = "BTC_USDT",
    settle = Gateio.Futures.Candle.usdt,
    interval = Gateio.Futures.Candle.d30,
)

to_pretty_json(result.result)

Result:

[
  {
    "t":"2024-03-01T00:00:00",
    "v":5932942626,
    "c":71360.4,
    "h":73879.3,
    "l":59059.0,
    "o":62415.7,
    "sum":4.003183751397624e10
  },
  ...
]
source
CryptoExchangeAPIs.Gateio.Futures.Contract.contractFunction
contract(client::GateioClient, query::ContractQuery)
contract(client::GateioClient = Gateio.Futures.public_client; kw...)

List all futures contracts.

GET api/v4/futures/{settle}/contracts

Parameters:

ParameterTypeRequiredDescription
settleSettletruebtc usdt usd
limitInt64false
offsetInt64false

Code samples:

using Serde
using CryptoExchangeAPIs.Gateio

result = Gateio.Futures.contract(; settle = Gateio.Futures.Contract.btc)

to_pretty_json(result.result)

Result:

[
  {
    "name":"BTC_USD",
    "type":"inverse",
    "quanto_multiplier":0.0,
    "ref_discount_rate":0.0,
    "order_price_deviate":0.5,
    "maintenance_rate":0.005,
    "mark_type":"index",
    "last_price":62583.8,
    "mark_price":62646.43,
    "index_price":62642.32,
    "funding_rate_indicative":7.5e-5,
    "mark_price_round":0.01,
    "funding_offset":0,
    "in_delisting":false,
    "risk_limit_base":100.0,
    "interest_rate":0.0003,
    "order_price_round":0.1,
    "order_size_min":1,
    "ref_rebate_rate":0.2,
    "funding_interval":28800,
    "risk_limit_step":100.0,
    "leverage_min":1.0,
    "leverage_max":100.0,
    "risk_limit_max":800.0,
    "maker_fee_rate":-0.0002,
    "taker_fee_rate":0.00075,
    "funding_rate":7.5e-5,
    "order_size_max":1000000,
    "funding_next_apply":"2024-04-17T00:00:00",
    "short_users":163,
    "config_change_time":"2023-08-18T02:49:39",
    "trade_size":57555397672,
    "position_size":12785272,
    "long_users":544,
    "funding_impact_value":1.0,
    "orders_limit":50,
    "trade_id":42816960,
    "orderbook_id":4467223346,
    "enable_bonus":false,
    "enable_credit":true,
    "create_time":"1970-01-01T00:00:00",
    "funding_cap_ratio":0.75
  }
]
source
CryptoExchangeAPIs.Gateio.Futures.FundingRate.funding_rateFunction
funding_rate(client::GateioClient, query::FundingRateQuery)
funding_rate(client::GateioClient = Gateio.Futures.public_client; kw...)

Funding rate history.

GET api/v4/futures/{settle}/funding_rate

Parameters:

ParameterTypeRequiredDescription
settleSettletruebtc usdt usd
contractStringtrue
limitInt64false

Code samples:

using Serde
using CryptoExchangeAPIs.Gateio

result = Gateio.Futures.funding_rate(; 
    settle = Gateio.Futures.FundingRate.usdt,
    contract = "BTC_USDT",
)

to_pretty_json(result.result)

Result:

[
  {
    "t":"2024-04-16T08:00:00",
    "r":0.0001
  },
  ...
]
source
CryptoExchangeAPIs.Gateio.Futures.OrderBook.order_bookFunction
order_book(client::GateioClient, query::OrderBookQuery)
order_book(client::GateioClient = Gateio.Futures.public_client; kw...)

Futures order book.

GET api/v4/futures/{settle}/order_book

Parameters:

ParameterTypeRequiredDescription
contractStringtrue
settleSettletruebtc usdt usd
intervalStringfalse
limitInt64false
with_idBoolfalse

Code samples:

using Serde
using CryptoExchangeAPIs.Gateio

result = Gateio.Futures.order_book(; 
    settle = Gateio.Futures.OrderBook.usdt,
    contract = "BTC_USDT",
)

to_pretty_json(result.result)

Result:

{
  "id":null,
  "current":1.713214908609e9,
  "update":1.713214908589e9,
  "asks":[
    {
      "p":"63167.4",
      "s":1903
    },
    ...
  ],
  "bids":[
    {
      "p":"63167.3",
      "s":10650
    },
    ...
  ]
}
source
CryptoExchangeAPIs.Gateio.Futures.Ticker.tickerFunction
ticker(client::GateioClient, query::TickerQuery)
ticker(client::GateioClient = Gateio.Futures.public_client; kw...)

List futures tickers.

GET api/v4/futures/{settle}/tickers

Parameters:

ParameterTypeRequiredDescription
settleSettletruebtc usdt usd
contractStringfalse

Code samples:

using Serde
using CryptoExchangeAPIs.Gateio

result = Gateio.Futures.ticker(; settle = Gateio.Futures.Ticker.btc)

to_pretty_json(result.result)

Result:

[
  {
    "contract":"BTC_USD",
    "last":62157.4,
    "low_24h":61568.7,
    "high_24h":64746.7,
    "change_percentage":-3.12,
    "total_size":12791802,
    "volume_24h":21362145,
    "volume_24h_btc":343,
    "volume_24h_usd":21362145,
    "volume_24h_base":343,
    "volume_24h_quote":21362145,
    "volume_24h_settle":343,
    "mark_price":62221.82,
    "funding_rate":0.0001,
    "funding_rate_indicative":0.0001,
    "index_price":62216.21,
    "highest_bid":62129.9,
    "lowest_ask":62133.1
  }
]
source