How do you debug when you encounter an order parameter error?

Author: bamsmen, Created: 2020-04-23 11:09:20, Updated: 2020-04-28 17:03:34

When I was reviewing my strategy for developing a digital currency contract, I found that only the first order was executed, and all subsequent buy, sell, closebuy, close-sell orders failed.

The only error message is: order parameter error

I've checked it myself and found nothing wrong, please help.

How can I debug?

I'm going to update it. After testing, it was found that the price of the order was too low, the problem has been solved, and hopefully the platform will provide more detailed error reports, now there is a gap in both documentation and debug.

I'm going to update it. 1. you can't set the balance when you retest, you can only set the stock balance, should you be able to set the balance?

2. After repeated testing, it was found that if 100 contracts were opened for the first time after a loss, then 100 contracts would be opened again after the loss, I checked, 100 contracts accounted for only about 50% of the total account funds, loss -11%, there were 3 coins at the beginning, and there were 2.87 after the loss, why is there a lack of funds?

I'll update it again in a few days.

1. I used the bitmex exchange for retesting, the remaining coins were set to 3, and then I used exchange.Sell.Sell ((10000, 100) for ordering. I tested it countless times, and the user funds were insufficient.

Then I finally found out to change the number of orders to exchange.Sell ((10000, 2), pass! but it shows the utilization of funds is 0, which is approximately equal to 0.

The confusion is here: The document is written like this: exchange.Buy ((10000, 2) represents the next single amount is 2 contracts, bitmex one contract is 1 dollar.

Is there a problem here?

2. bitmex contract retest, if the remaining currency is set to 3; exchange.Sell ((10000, 3) suggests insufficient funds, but exchange.Buy ((10000, 3) is okay, that is, exchange.Sell must be slightly smaller than the remaining funds to successfully place an order, why is this?

-------------- Discovering that the insufficient funds are related to the price of the order, if the price is too low at exchange.Sell, it will suggest insufficient funds, the order will fail, do not understand.


More

The grassThe order below matches the bitmex real disk, the parameters are the bill, a dollar bill, I tested it, and it doesn't report an underfunding error. What do you mean? What's up? /* backtest Start: 2020-01-29 end: 2020-04-27 00:00:00 This is the end of the story. period: 1d basePeriod: 1h [{"eid:"Futures_BitMEX","currency":"XBT_USD"}] */ function main (() { Exchange.SetContractType (("XBTUSD")) is a free exchange. exchange.SetDirection (sell) exchange.Sell ((10000,40)) is a exchange.Buy ((10000,400) I'm not sure. What's up?

bamsmenIs the available collateral obtained through the exchange.GetAccount (()) returns the object's stocks attribute, has been checked with getOrders no pending orders

The grass1. The futures have the currency as collateral, the USDT balance is meaningless. 2. check the available collateral, it has nothing to do with the funds. Having funds does not mean you can open unlimited positions. Also check if there are any pending orders.

bamsmenI also found out that if the exchange.sell price is too low, than the market price of 6,000, you sell the open position at 500, it will indicate that the order is not underfunded, the order fails, of course, why it is related to the price I still don't understand.

The grassThe remaining currency represents BTC, but the order parameter is Chang, which is consistent with the Bitmex website.

bamsmenThank you, if the timeout currency actually represents the number of contracts, is there a problem with the utilization of the funds?

bamsmenSo, if you look at the remaining coins in the reverse, is it the number of contracts or the number of BTC?