Explained
1, cannot be exchanged for other leverage when holding.
2⁄4, cannot be switched to other position mode (full position/one position)3, exchange.CancelOrder (ID), where the cancellation must be switched to the corresponding contract (exchange.SetContractType switch) for which the ID order is compatible
4, exchange.GetAccount (()) transaction rate approximation for the call to access the account asset interface, full-stock mode: four API interfaces will be accessed, because the number of frozen coins is obtained separately from the interface ((3) transaction rate approximation)).The contract code (exchange.SetContractType) is divided into four types: this_week, next_week, quarter, and swap.6, When calling exchange.GetOrder ((ID), it must be in the contract state corresponding to the ID, otherwise it will return an error, the difference between the permanent contract ID and the transaction rate approximate ID is relatively large.7, exchange.GetPosition ((() When taking a position, the trade ratio is approximately full position mode, the Margin property is 0.
8, initial default 10x leverage, trading direction buy (one-stop/full-stop on the exchange, number of leverage, there may be multiple situations, is the user's own setting)
The error message is:
NO. | Error msg | description |
---|---|---|
1 | ContractType Invalid | No contract setup, or contract setup error. Checks whether the SetMarginLevel function is called to set the lever at the initial start of the bot without a contract setup |
2 | Calc contractType error! | Contract delivery date calculated incorrectly |
3 | response format error | GetRecords Interface is used to retrieve data and analyze it. |
4 | Invalid direction | SetDirection Error when setting the transaction direction. |
5 | the contractType not found: | Mapping contract code error when calling GetOrder / GetOrders. |
6 | MarginLevel can only be set in the direction for buy/sell , current settings: | When leverage is set, the current must be in the buy/sell direction, the other direction returns an error. |
7 | ||
8 | Margin Level Invalid | Leverage error, only 10 / 20 |
9 | the contractType not found | No this_week/next_week/quarter/swap contract code corresponding to the actual contract code was found when GetPosition was called |
10 | analysingOrderId error, the orderId: | The order IDs in the GetOrder, GetOrders, Buy, Sell function return messages are in the form of a contract code hash, mainly used for identification when withdrawing and querying orders, and are not the actual order IDs returned by the exchange interface, if the withdrawal is used in the form of an order ID in the form of a non-contract code hash, i.e. an error. |
11 | The contract for BTC (or other currency) Must be a positive integer between 1 and 100 (or other value)." | Permanent Contract Leverage is set to error, out of bounds, and must be an integer. |
The exchange reported a mistake
NO. | Error msg | description |
---|---|---|
1 | Futures_OP 0: 400: {“code”:32010,“message”:“You cannot adjust the leverage when you have open order(s) / position(s).”} | Whole-stock mode, cannot be modified to other leverage when pending or holding |
2 | GetOrder(65-9-44101ef02-0): 400: {“code”:30024,“message”:"“order_id” is an invalid parameter"} | GetOrder, CancelOrder, must be switched to the corresponding contract state of the ID, otherwise an error is reported. |
3 | {“code”:32007,“message”:“You cannot open short at 20x when you are holding short position(s) and/or open order(s) at 10x.”} | 逐仓时,如果当前方向的合约为10倍(网站上设置的),下单时使用的是20倍,即会报该错误,另外逐仓下设置杠杆时需要注意方向,逐仓有2个杠杆值,一个多仓杠杆,一个空仓杠杆。调用exchange.SetMarginLevel设置杠杆时,和当前的下单方向有关,即buy方向时为设置多仓杠杆值,sell方向时设置空仓杠杆值,closebuy/closesell方向时会报错。 |
… | … | … |
Summary of the problem
1, Withdrawal immediately after placing the order, order processing, withdrawal operation without error, returning the normal withdrawal success message. In a similar situation, the actual order has been fully settled, but the withdrawal operation has not reported any errors, and the withdrawal appears to be successful.
Configure the OKEX V3 API KEY, the spot futures configuration is the same.
Fill in the corresponding Access key, Secret key, Passphrase
Passphrase is saved after you set it up when you apply for the V3 API KEY.
# 注意:如果托管者版本比较旧,需要更新托管者。
# 注意:Futures_OP 4 错误,检查是不是 策略代码中使用了 exchange.IO 调用了 V1 接口(交易所配置API KEY 配置的V3 KEY)。
Updated by
2019.2.17 Updated the error limit on the range of permanent contract leverage settings, originally the limit of 1-40. In fact, each currency has a different range of leverage settings:
Contract currency | Leverage range |
---|---|
BTC | 1 ~ 100 |
LTC | 1 ~ 40 |
ETH | 1 ~ 100 |
ETC | 1 ~ 40 |
XRP | 1 ~ 40 |
EOS | 1 ~ 100 |
BCH | 1 ~ 40 |
BSV | 1 ~ 40 |
TRX | 1 ~ 20 |
The API KEY for the new account requested, when called exchange.GetAccount() error: GetAccount: type assertion to []interface{} failed
The reason is that the interface returned: {
Optimized by OKEX
4、获取单个/所有合约账户信息接口
GET /api/futures/v3/accounts//GET /api/futures/v3/accounts/{currency}:
原返回参数增加:挂单冻结保证金和持仓已用保证金(同逐仓);
The problem has been misunderstood.
In the case of a stock exchange, holdings information Profit attribute correction. Profit attribute problem, because: GET /api/futures/v3/position Interface Returns the position data, long_pnl_ratio, in the form of a fraction of the yield, not a fraction in the yield, i.e. long_pnl_ratio represents 10% when 0.1 and not 0.1%;
Updated quarterly contracts mapping issues. This article was last updated on 15/03/2019 at 19:30 The quarterly contract is correctly mapped to BTC-USD-190628 (BTC example).
Updates above require the latest host to be downloaded.
Expected updates Not yet
913804005@qq.com Error: GetTicker: Get https://www.okex.com/api/futures/v3/instruments/ETH-USD-190927/ticker: dial tcp 243.185.187.39:443: connect: connection refused GetDepth: Get https://www.okex.com/api/futures/v3/instruments/ETH-USD-190927/book?size=100: dial tcp 243.185.187.39:443: connect: connection refused GetRecords: Get https://www.okex.com/api/futures/v3/instruments/ETH-USD-190927/candles?granularity=86400&start=2019-06-02T07:51:42.000Z: dial tcp 243.185.187.39:443: connect: connection refused
913804005@qq.comI'm going to use okx, and that's it.
913804005@qq.com /upload/asset/12b85ef5183f25d1f8460.png
qazliruiboCan public administrators (USA) access the okx?
Flyingexchange.GetAccount (); var Account = exchange.GetRawJSON (); Account is empty {}
I'm not sure. Mark
Inventors quantify - small dreams Mark
Inventors quantify - small dreamsOKEX cannot be accessed domestically.
913804005@qq.comI was deployed in Tencent Cloud and Ali Cloud one in Hangzhou one in Beijing
913804005@qq.comWhy is it OK to use Bitcoin? I don't understand.
913804005@qq.comI've deployed on servers, on local computers, and on virtual machines, but none of them work.
Inventors quantify - small dreamsOvertime, no access to the exchange interface. Where is the server hosted?
Inventors quantify - small dreamsIt's best not to use it, remember that OKEX restricts US IP access.
FlyingSolved
Inventors quantify - small dreamsI tested it and it was normal. If you are out of time when accessing GetAccount (), then GetRawJSON is out of data.