Code Monkey home page Code Monkey logo

rest-v2's Introduction

Rest API Introduction

Welcome to the Gate Rest API! You can use this API to get market data, trade, and manage your account.

Each API call is described in detail in the API2.0 English documentation

The API v2 version is no longer being updated and maintained, and we recommend that you use the latest API v4 version.

API Interface Address

https://data.gateapi.io

* Access via proxy is not recommended for reasons such as high latency and poor stability.

Rate Limit

10r/s

Create API Key

You can create the API Key at here.

API Keys includes the following two parts

Key : API key

Secret : The key used for signature authentication encryption

Write the requested API keys to the application configuration file.

// API settings, add your Key and Secret at here
$key = '';
$secret = '';


*When creating API Keys, you can choose to bind IPs, which can be set by IP whitelist (multiple IPs separated by half comma).
*Note: Using the API Keys above will allow you to perform account information inquiries and trading operations through the program, but not withdrawal operations. Do not disclose the API Keys to others.
*Create new API Keys: Generate new API Keys, the old ones will be invalidated immediately.

Request Format

All API requests are called as GET or POST. Getting market data is requested via GET, with all parameters in path parameters; for transaction and account data is requested via POST, and all parameters are sent in JSON format.

Return Format

All interface returns are in JSON format. The API2.0 document has JSON fields for request status and properties.

Error message

The system returns an error code corresponding to the description

Error Codes	       Details
1	               Invalid request
2	               Invalid version
3	               Invalid request
4	               Forbidden access
5,6	               Invalid sign
7	               Currency is not supported
8,9	               Currency is not supported
10	               Verified failed
11	               Obtaining address failed
12	               Empty params
13	               Internal error, please report to administrator
14	               Invalid user
15	               Cancel order too fast, please wait 1 min and try again
16	               Invalid order id or order is already closed
17	               Invalid orderid
18	               Invalid amount
19	               Not permitted or trade is disabled
20	               Your order size is too small
21	               You don't have enough fund
40	               Too many attempts

rest-v2's People

Contributors

5izena avatar datoufeixia avatar fangtingliu avatar freeape avatar gateio avatar hbasrc avatar jens-j avatar kefengxu avatar novruzove avatar revilwang avatar sarafarinya avatar yurisalesc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rest-v2's Issues

rate limits

Hello , I am a market maker and I want to start using your exchange and came up with an issue , I contacted your support team and they said I should ask my question here

I want to know your API rate limits for having open orders for each individual account and each individual symbol because It was not mentioned in your API documents and It is important to me

trade fees

Is there a way to get the fees paid on each trade?

签名错误

我最初通过elixir,发起获取账户balance的请求,服务端返回, invalid key or sign, please re-generate it from your account,然后我用提供的php 例子,修改了下host,返回的还是签名错误,错误都是一样的, invalid key or sign, please re-generate it from your account

How to check if deposit/withdraw are suspended?

Hello,

I'm wondering how I can check if deposit and withdraw are suspended from the API (using PHP).

The only thing I can think is to request a deposit address but that doesn't seem to work, it still says success. However it doesn't give me the address. Instead it just says success and gives a message to refresh the page, even for currencies that are suspended.

Thanks!

amount参数是什么意思?

买入接口中的(amount 最近30天交易量)是什么意思?限制自己最近30天的交易量吗?还是需要自己统计自己最近30天的交易量才可以交易成功?


下单交易买入API

API URL: https://api.gateio.co/api2/1/private/buy

参数数据提交方式:POST

返回数据格式:JSON

请求参数

参数名 参数类型 必填 描述 示例:
currencyPair String 交易币种对(如ltc_btc,ltc_btc) ltc_btc
rate String 价格 1000
amount String 最近30天交易量 800
orderType String 订单类型(“”:普通订单(默认);“ioc”:立即执行否则取消订单(Immediate-Or-Cancel,IOC)) ioc

API rate limits

Hi, I was told by Gateio support to direct my query here.

The documentation regarding rate limits is unfortunately not very clear.
All it says is:

"
Spot:

300 read operations per IP per second

Futures:

200 requests/second each user for private operations
"

Questions:

  1. So for SPOT, for reads (only) it is 300, per second, per IP. There is no limit per user, or per sub-account? i.e. if I had 100 IPs, I can read 30000 per second?

  2. For SPOT, there is no limit whatsoever for writes?

  3. For SPOT, it does not matter the difference between private/public endpoints? Both are limited as per above?

  4. For FUTURES, private endpoints: 200 per second, regardless of read/write. This is across ALL sub-accounts? Or per sub-account?

  5. For FUTURES, public endpoints there is no limit?

  6. Does using a different API key make any difference to the above?

Thank you.

ClientOrderId support

下单应该支持带入ClientOrderId,作为后续撤单和成交的字段带回。
不然在websocket成交推送早于REST响应到达时客户无法匹配成交与委托。
Bitmex和Okex都已支持。

Listing request for BitcoinZ [BTCZ]

Hello
Coin: BitcoinZ
Ticker: BTCZ
Algorithm: Equihash
Type: Proof of Work (PoW)
Current Block Reward: 12,500 BTCZ 2.5minute

BitcoinTalk ANN: https://bitcointalk.org/index.php?topic=2166510.0

Primary Web:
https://bitcoinz.global
https://bitcoinz.link
https://btcz.tech (russian)
https://bitcoinz.site
https://btcz.rocks

More to come

Community Paper: https://drive.google.com/file/d/19eJ09gwba5Ix9k3Y8Kk7NqdTbnUTFXDj

Progress Board: https://info.btcz.rocks

Coin Market Cap ($120,000 - 500,000 USD volume per day)

https://coinmarketcap.com/currencies/bitcoinz

Githubs

Primary Node Wallet: https://github.com/bitcoinz-pod/bitcoinz

Sites repos: https://github.com/bitcoinz-sites

Wallets repos: https://github.com/bitcoinz-wallets

Android Wallet: https://play.google.com/store/apps/details?id=com.btczcom.btcz

COINOMI Mobile:
Wallet https://play.google.com/store/apps/details?id=com.coinomi.wallet

Coinomi IOS coming soon

Explorers

https://bitcoinz.ph
https://explorer.btcz.rocks
https://btczexplorer.blockhub.info

Social Media

Discord - https://discordapp.com/invite/u3dkbFs ;

Facebook Page - https://www.facebook.com/BTCZCommunity/ ;

Facebook Group - https://www.facebook.com/groups/bitcoinz.community/ ;

Reddit - https://www.reddit.com/r/BTCZCommunity/ ;

Rocket Chat - https://bitcoinzcommunity.com/ ;
Slack - http://slack.bitcoinz.global%20/;
Telegram - https://t.me/joinchat/CDzlaRGMvBm4P2Z76sNclQ

Twitter - https://twitter.com/BitcoinZTeam ;

WhatsApp Brazil Community: https://chat.whatsapp.com/LV2frpF0LfPIBEICGRvoWe

Kind regards,

BitcoinZ Community Team

[email protected]

order ->status code:200 result:false code:6 message:Error:invalid data

I send a sell order,param like : currencyPair : eos_usdt , rate : 4.2900 , amount : 1

use https request to post this order, and server return me status code 200,and some reponse like :

result : false , code 6 , message:Error:invalid data.

I check the api document ,code 6 mean my key or sign not right , but my "getBalance" api still all right.

How to solve this? by thw way ,I use nodejs api

Error: you don\'t have enough fund","code":21

in nodejs / lib / gate.js fix Buy and Sell endpoints
from:
const BUY_URL = 'api2/1/private/sell';
const SELL_URL = 'api2/1/private/sell';
to:
const BUY_URL = 'api2/1/private/buy';
const SELL_URL = 'api2/1/private/sell';

下单被拒绝,如何设置代理?

python3环境:
调用:
gate_trade.sell
or
gate_trade.buy

异常信息:Connection refused
应该是云服务不能访问api服务器,想设置代理。
比如想设置post代理请求,该如何修改一下代码?

def httpPost(url, resource, params, apiKey, secretKey):
headers = {
"Content-type" : "application/x-www-form-urlencoded",
"KEY":apiKey,
"SIGN":getSign(params, secretKey)
}

 conn = http.client.HTTPSConnection(url, timeout=10)

 tempParams = urllib.parse.urlencode(params) if params else ''
 print(tempParams)

 conn.request("POST", resource, tempParams, headers)
 response = conn.getresponse()
 data = response.read().decode('utf-8')
 params.clear()
 conn.close()
 return data

API price is wrong

Hi. why is your API providing false information? https://data.gateapi.io/api2/1/marketlist/ This can be seen if you refresh the page several times. For example, I just got the following data: [127]=> array(18) { ["no"]=> int(128) ["symbol"]=> string(3) "AXS" ["name"]=> string(13) "Axie Infinity" ["name_en"]=> string(13) "Axie Infinity" ["name_cn"]=> string(13) "Axie Infinity" ["pair"]=> string(8) "axs_usdt" ["rate"]=> string(4) "6.23" ["vol_a"]=> string(14) "27691.46350218" ["vol_b"]=> string(7) "161,135" ["curr_a"]=> string(3) "AXS" ["curr_b"]=> string(4) "USDT" ["curr_suffix"]=> string(5) " USDT" ["rate_percent"]=> string(5) "19.33" ["trend"]=> string(2) "up" ["supply"]=> int(55260010) ["marketcap"]=> string(11) "344,104,082" ["lq"]=> string(1) "0" ["p_rate"]=> int(3)

["rate"]=> string(4) "6.23" - this is the current price of the coin. it can't be $ 6.23 now! Real price for axs_usdt ~$124 now.

ssl.CertificateError: hostname 'data.gateio.io' doesn't match either of 'gateio.io', 'www.gateio.io'

python3
urllib3-1.22
原来代码中data.gate.io访问超时,改成data.gateio.io就是下面这个异常。
Traceback (most recent call last): File "D:\workcode\ai\code\python3\mytest\src\com\triangle-arbitrage-master\exchangeConnection\gateio\Client.py", line 30, in <module> print(gate_query.pairs()) File "D:\workcode\ai\code\python3\mytest\src\com\triangle-arbitrage-master\exchangeConnection\gateio\gateAPI.py", line 22, in pairs return httpGet(self.__url, URL, params) File "D:\workcode\ai\code\python3\mytest\src\com\triangle-arbitrage-master\exchangeConnection\gateio\HttpUtil.py", line 24, in httpGet conn.request("GET", resource + '/' + params) File "D:\Program Files\Python\Python35\lib\http\client.py", line 1107, in request self._send_request(method, url, body, headers) File "D:\Program Files\Python\Python35\lib\http\client.py", line 1152, in _send_request self.endheaders(body) File "D:\Program Files\Python\Python35\lib\http\client.py", line 1103, in endheaders self._send_output(message_body) File "D:\Program Files\Python\Python35\lib\http\client.py", line 934, in _send_output self.send(msg) File "D:\Program Files\Python\Python35\lib\http\client.py", line 877, in send self.connect() File "D:\Program Files\Python\Python35\lib\http\client.py", line 1261, in connect server_hostname=server_hostname) File "D:\Program Files\Python\Python35\lib\ssl.py", line 385, in wrap_socket _context=self) File "D:\Program Files\Python\Python35\lib\ssl.py", line 760, in __init__ self.do_handshake() File "D:\Program Files\Python\Python35\lib\ssl.py", line 996, in do_handshake self._sslobj.do_handshake() File "D:\Program Files\Python\Python35\lib\ssl.py", line 646, in do_handshake match_hostname(self.getpeercert(), self.server_hostname) File "D:\Program Files\Python\Python35\lib\ssl.py", line 305, in match_hostname % (hostname, ', '.join(map(repr, dnsnames)))) ssl.CertificateError: hostname 'data.gateio.io' doesn't match either of 'gateio.io', 'www.gateio.io'

Missing trades in trade history /api/v4/spot/my_trades

The Gate.io Support Jerome sent me here to create an issue, so I hope you can help me and fix the bug in your API

I am fetching the full trade history from Gate.io. But I am missing OMI/USDT and BTC/USDT trade from 2021-09-11.
I can see them in the frontend, but not via API.

This is the API request I do:

GET https://api.gateio.ws/api/v4/spot/my_trades?currency_pair=OMI_USDT&limit=1000&page=1&from=1630454400&to=1633046400
Timerange from 2021-09-01 till 2021-10-01 => so there must be the trade from 2021-09-11 in.
Response: []

The red marked txs are missing in the API:
image

Only used addresses or verified addresses are allowed for api withdrawal

I have a problem using rest v2 API withdrawal endpoint, it keeps saying "only used addresses or verified addresses are allowed for api withdrawal" even though I already used to withdraw tokens to the address many times successfully using the website interface. This seems to happen to only new addresses recently.

API挂单不能成交

api请求挂单,盘口显示有挂单价格的单子好几秒 不能成交,你们盘口信息是假的吗

where is api doc?

where is api doc?

so in gate , I only found code .not found any doc .

Met error in python 2.7

I met error "ImportError: No module named http.client" in Python 2.7. There is no http module in Python 2.7 but 3. How can I make it work in 2.7?

Cannot get the sell() function to work

Hello,

pretty much all the functions included in your API are working but for the sell() I simply cannot get it to work:

I tried:
sell('lym_usdt', 0.0346, 1);

No luck. I also get no errors.

My ip has been whitelisted and the API keys are set.
I can see my wallet balance which proves that the API is communicating correctly with the keys.

Any idea if there is a bug in your api?

Thank you.

how to cancel spot orders

Documentation states that "DELETE /spot/price_orders" end point can cancel all open orders without any additional parameters, and also "DELETE /spot/orders" endpoint can cancel open orders in the specified currency pairs, so currency pairs is a required parameter in the second call.
Unfortunately this is not how it works when being tested. The first endpoint(DELETE /spot/price_orders) does not cancel any open order and second endpoint works in the way that s described in the documentation but it can also cancel all open order if no parameter is given .
DELETE /spot/orders with no parameters should be used instead of DELETE /spot/price_orders to cancel all open orders as opposed to what the documentation says?

A wrong undocumented FEE was taken

By some reason one of request was charged with 0.3% Fee instead of 0.165% in accordance to my VIP4 level. Could you please explain why it happened so?? According to marketInfo BBANK_ETH should be at most 0.2% but not 0.3! Here is log of server response:

{"result":"true","message":"Success","code":0,"ctime":1634396229.3023,"side":2,"orderNumber":85406874133,"rate":"0.000040305","leftAmount":"0.00000000","filledAmount":"2306.58485202","market":"BBANK_ETH","iceberg":"0","filledRate":"0.000040305","feePercentage":0.003,"feeValue":"6.91975455606","feeCurrency":"BBANK","fee":"6.91975455606 BBANK"}

{"method": "order.update", "params": [3, {"amount": "2306.58485202", "ctime": 1634396229.3022571, "deal_fee_rebate": "0", "deal_gt_fee": "0", "deal_point_fee": "0", "event": 3, "gt_discount": "3", "gt_maker_fee": "0", "gt_taker_fee": "0", "iceberg": "0", "id": 85406874133, "is_finished": true, "lastFilledAmount": "2306.58485202", "lastFilledTotal": "0.0929669024606661", "left": "0", "market": "BBANK_ETH", "money": "ETH", "mtime": 1634396229.3022621, "price": "0.000040305", "stock": "BBANK", "tif": 2, "time": "2021-10-16T14:57:09.302462+0000", "user": 2337791, "orderType": 1, "type": 2, "dealFee": "6.91975455606", "filledAmount": "2306.58485202", "filledTotal": "0.0929669024606661"}], "id": null}

I'm really confused.

Problem with error return on order cancel

Hello,

Please try your cancel_order('120969098747', 'lym_usd') function.

If you do not add an order number you receive an error but if the wrong order number is added(or the order number does not exist), the same response is showing:

Array
(
    [result] => 1
    [code] => 0
    [message] => Success
)

It should show something like:

Array
(
    [result] => 0(or false)
    [code] => 0
    [message] => Error
)

多次出现错误代码13(系统错误,联系管理员)

今晚8点左右,多次出现长时间错误代码13的情况,每次将近10分钟,大概3-5次左右。
请问是真的系统服务器错误还是其他原因导致(如访问过频繁等)?
因为实际交易中比较致命,如果是代码问题想避免一下。

withdraw_fix_on_chains returns None since today

Based on my issue here a very useful data was added to list_withdraw_status() method. But since today it returns None, i.e. got broken:

Example return (see withdraw_fix_on_chains - should be not None, but return real data)

{
 'currency': 'USDT',
 'deposit': '0',
 'name': 'Tether',
 'name_cn': 'Tether',
 'withdraw_amount_mini': '50',
 'withdraw_day_limit': '300000',
 'withdraw_day_limit_remain': '284999.706',
 'withdraw_eachtime_limit': '284999.706',
 'withdraw_fix': '40',
 'withdraw_fix_on_chains': None,
 'withdraw_percent': '0%'
}

ASTREVM deposits are always credited with 22 minutes delay

Hello, I am doing some HFT trading through API where fast deposits & withdrawals are crucial. For one single network, in particular ASTREVM every single deposit I send (I request address through API and send deposit), no matter of what coin, is stuck in "Pending" state for 22 minutes (!). Any way to adjust/fix this? Seriously it causes me trouble.

See a screenshot for example.

image

Server Response 405 for OPTIONS

Server Response 405 for OPTIONS

环境
Windows 10
Chrome 66

问题:
服务端对OPTIONS返回了405。
在浏览器进行跨域访问的时候会进行 preflight 访问,如果preflight失败了就无法继续进行CROS。
所以为了兼容浏览器使用这个接口就需要返回对OPTIONS访问做出正确的回应,不然就没法继续了。

C# API

Do U have an C# example?

get_order获取订单信息报错

通过get_order方法获取订单信息,全部报 "The order 订单号 cancelled or not found"。之前是正常的,从上周五开始就不行了。PHP SDK

关于api服务器访问的几个问题。

几个问题请教一下。谢谢。
1、前几天有发marketlist使用时服务器timeout问题(timeout时间设置再大都报错),今天还是出现了。
报错信息如下:
Traceback (most recent call last):
File "D:/python_PJ/autoTradSys/Client.py", line 37, in
print(gate_query.marketlist())
File "D:\python_PJ\autoTradSys\gateAPI.py", line 45, in marketlist
return httpGet(self.__url, URL, params)
File "D:\python_PJ\autoTradSys\HttpUtil.py", line 28, in httpGet
data = response.read().decode('utf-8')
File "C:\Python38\lib\http\client.py", line 461, in read
return self._readall_chunked()
File "C:\Python38\lib\http\client.py", line 571, in _readall_chunked
value.append(self._safe_read(chunk_left))
File "C:\Python38\lib\http\client.py", line 608, in _safe_read
data = self.fp.read(amt)
File "C:\Python38\lib\socket.py", line 669, in readinto
return self._sock.recv_into(b)
File "C:\Python38\lib\ssl.py", line 1241, in recv_into
return self.read(nbytes, buffer)
File "C:\Python38\lib\ssl.py", line 1099, in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

Process finished with exit code 1

但是,如果我直接在浏览器中输入https://data.gateio.life/api2/1/marketlist,是可以正常响应的。
tickers的api也是同样问题。

2、同api服务器get或者post交互时,是否有显示服务器访问频率?如有的话,哪里可以看?

以上问题麻烦帮忙看一下,谢谢。

聊天室api

能不能提供聊天室的api,聊天室能喊起来好多交易量

API Key

Hi, I was asked by gateio support to send a message to retrieve my API Key

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.