gate_futures note
1, Currently GateIO only has perpetual contracts, and the exchange.SetContractType function on the inventor's quantified trading platform sets the contract to swap, not to swap by default.
2, a contract is worth $ 1.
3, the settlement currency is BTC and the invoice currency is USD
4. Under a contract, only one position can be held and no more than one position can be held at the same time.
5, depending on the leverage, there is a full-stock/one-stock mode, with the leverage set to 0, i.e. full-stock mode
exchange.SetMarginLevel(0) // 设置杠杆接口会调用 交易所API,不设置杠杆,默认交易所网页上设置的杠杆值。
6 Some interfaces:
The exchange rate changes interface, exchange rate changes, returns new contract holding information. POST /futures/positions/{contract}/margin is not available
Modified lever interface POST /futures/positions/{contract}/leverage is used
Modify risk, restrict, and interface POST /futures/positions/{contract}/risk_limit This is a list of all the different ways Futures/positions/{contract}/risk_limit is credited in the database.
If you need to call the exchange interface directly, useexchange.IO
For example:
var ret = exchange.IO("api", "POST", "/api/v4/futures/price_orders", 'initial={"contract":"ETH_USD","size":1,"price":"100","close":false,"tif":"gtc","text":"web"}&trigger={"strategy_type":0,"price_type":0,"price":"3000","rule":1,"expiration":86400}' )
See the API documentation for details on how to use exchange.IO:https://www.fmz.com/api#IO
7, The GATE IO futures API can only query pending orders, no cancellation queries can be made. Cancellation in the cell at the bottom of the web page, can be queried in GET / futures / orders status=finished.
The order status in the raw data returned by the exchange interface is divided into open and finished, and only the order in the finished state has the other two properties, finish_as, finish_time.
When no current holdings are returned from the query hold interface, the hold froze the amount of hold. The call to get hold information interface gets the number of holds, and the number of holds can exceed the number of holds. Therefore, when Calling GetPosition, the query interface for the hold and the query interface for the current pending list are called to calculate the FrozenAmount value. Note the call frequency of this interface.
10, Inventor Quantitative Trading Platform Default The trading direction is set to multiple positions, i.e. the default is exchange.SetDirection (
exchange.SetDirection("buy")
var id = exchange.Sell(-1, 1)
This will not open more positions, it will open empty positions, or even more positions. The reason is that GateIO contracts transactions, which are designed to be similar to spot, so the actual call is in the direction of exchange.Sell / exchange.Buy. The number of holdings can exceed the number of positions held, which is partly the reverse position.
17732164739orderId = exchange.IO (("api", "POST","/api/v4/futures/btc/orders", {) is a command-line utility that is used to execute commands. "contract": "BTC_USD", "BTC_USD", "BTC_USD", "BTC_USD", "BTC_USD" and "BTC_USD" are also included. "price": price2, "size": 1, // add the size parameter "amount": n, "direction": "short", "offset": "open", and "offset": "lever_rate": 100, "order_type": "conditional", "Trigger_price": price 2, the price of the product is the same as the price of the product. "order_price_type": "limit", "time_in_force": "gtc" }); this gate.io's conditional assignment code right, I wrote the empty list, how is the real disk a simple general assignment?
Inventors quantify - small dreamsThis is described in the documentation of the exchange.
17732164739ret = exchange.IO (("api", "POST", "/api/v4/futures/price_orders", 'initial={"contract":"ETH_USD","size":1, "price":"100","close:"false", "tif":"gtc","text":"web"}&trigger={"strategy_type":0,"price_type":0,"price":"3000","rule":1,"expiration:"86400}')) Dream, why is this condition code that you entrusted, only to trigger the price has to be greater than the latest price?
Inventors quantify - small dreamsThis interface should be the usual order interface, for example price trigger orders are this interface: POST /futures/{settle}/price_orders You can check the documentation of the exchange: https://www.gate.tv/docs/developers/apiv4/zh_CN/#%E5%88%9B%E5%BB%BA%E4%BB%B7%E6%A0%BC%E8%A7%A6%E5%8F%91%E8%AE%A2%E5%8D%95-2
17732164739I don't know why this is a general assignment and not a conditional assignment.
Inventors quantify - small dreamsThe negative amount, seen in the GATE documentation below, should be set to empty by this negative number.