How to limit the price of a small number of digits when the disk is running

Author: Zayne, Created: 2019-11-02 15:00:19, Updated:

The question is, recently there have been a lot of errors in the real-world movements, maybe the exchange price I used is only a decimal, ask for a pointer.img


More

Inventors quantified https://www.fmz.com/api#setprecision

The grassDon't rush into running a strategy, just check out the tutorial on the top of the forum.

The grassDon't rush into running a strategy, just check out the tutorial on the top of the forum.

The grass exchange.Buy(_N(buyPrice,2),_N(buyAmount,3))

The grassThe public policy generally does not have any specific limitations on accuracy, so you can manually set_N for different currencies.

The grass _N(2.312,1)

ZayneBasically, many of the public strategies have this problem, and I've tried a few of them, the price just happens to be an integer of a fraction, and it will be done, it will often fail, the execution of the buy-sell will not be executed, the strategy will not achieve the desired effect at all.

ZayneThat's good.

ZayneWhere's the extra code? This is the case with the robbery strategy. function CancelPendingOrders ((orderType) {) is used while (true) { var orders = _C (exchange.GetOrders); var count = 0; if (typeof(orderType)!= 'undefined') { for (var i = 0; i < orders.length; i++) { if (orders[i].Type == orderType) { count++; I'm not sure. I'm not sure. } else { count = orders.length; I'm not sure. if (count == 0) { return; I'm not sure. for (var j = 0; j < orders.length; j++) { If (typeof(orderType) == 'undefined' exchange.CancelOrder ((orders[j].Id, orders[j]); if (j < (orders.length-1)) { Sleep (interval); I'm not sure. I'm not sure. I'm not sure. I'm not sure. I'm not sure. function updateProfit ((accountInit, accountNow, ticker) {) is a function that can be used to update a function. var netNow = accountNow.Balance + accountNow.FrozenBalance + ((accountNow.Stocks + accountNow.FrozenStocks) * ticker.Buy); var netInit = accountInit.Balance + accountInit.FrozenBalance + ((accountInit.Stocks + accountInit.FrozenStocks) * ticker.Buy)); and LogProfit ((netNow - netInit); I'm not sure. var InitAccount = null; var LastBuyPrice = 0; var LastSellPrice = 0; function is on Tick ((() { This is a list of all the different ways Var ticker is credited in the database. var BuyPrice = ticker.Buy + SlidePrice is used to select the ticker. Var SellPrice = ticker.Sell - SlidePrice is used for the following purposes: // Profit is gone If (SellPrice - BuyPrice) <= MaxDiff is equal to { Cancel Pending Orders ((); return; I'm not sure. What do you think? var cancelType = null; What do you think? if (LastBuyPrice > 0 && (ticker.Buy - LastBuyPrice) > SlidePrice) { The value of the last buyPrice is the value of the last buyPrice. If you want to change the order type, you can change the order type. I'm not sure. What do you think? if (LastSellPrice > 0 && (LastSellPrice - ticker.Sell) > SlidePrice) { is the value of the SlidePrice If (cancelType == null) { If you want to change the type of order, you can change the type of order. } else { CancelType = -1; I'm not sure. I'm not sure. What do you think? if (cancelType == -1) { Cancel Pending Orders ((); } else if (cancelType!= null) { CancelPendingOrders (cancelType); CancelPendingOrders (cancelType); CancelPendingOrders (cancelType); CancelPendingOrders (cancelType); CancelPendingOrders (cancelType); CancelPendingOrders (cancelType); CancelPendingOrders (cancelType); CancelPendingOrders (cancelType); CancelPendingOrders (cancelType); CancelPendingOrders (cancelType); CancelPendingOrders (cancelType) I'm not sure. var orders = _C (exchange.GetOrders); if (orders.length == 2) { return; I'm not sure. var account = _C (exchange.GetAccount); var amountBuy = _N ((Math.min ((account.Balance / BuyPrice, Lot)); var amountSell = Math.min ((account.Stocks, Lot); if (amountBuy >= MinStock) { if (orders.length == 0 ordres[0].Type == ORDER_TYPE_SELL) { If you want to buy a product, you can buy it from us. if (orders.length > 0) { UpdateProfit ((InitAccount, account, ticker)); and I'm not sure. exchange.Buy ((BuyPrice, amountBuy); LastBuyPrice = BuyPrice; and I'm not sure. I'm not sure. if (amountSell >= MinStock) { is the number of if (orders.length == 0 ordres[0].Type == ORDER_TYPE_BUY) { if (orders.length > 0) { UpdateProfit ((InitAccount, account, ticker)); and I'm not sure. exchange.Sell (SellPrice, amountSell); LastSellPrice = SellPrice, which is the last price sold. I'm not sure. I'm not sure. I'm not sure. function onexit ((() { Cancel Pending Orders ((); I'm not sure. function main (() { InitAccount = _C (exchange.GetAccount); Log (InitAccount); SetErrorFilter (("502: Add 503: Set unexpectedly by network timeout by WSARecv by Connect by GetAddr by no such reset by received by EOF"); exchange.SetRate ((1); LoopInterval = Math.max ((LoopInterval, 1)); LoopInterval is the number of times the loop is closed. Lot = Math.max ((MinStock, Lot)); and while (true) { This is the first time I've seen this. Sleep ((LoopInterval * 1000)); I'm not sure. I'm not sure.