Re-testing the token data, as well as trading on the Wexapp analogue disk, results in similar results:
If the currency being traded is BTC_USDT, then:
The price of the exchange.Buy ((6840, 5) is 5 BTC at 6840 price. Buy at market price, exchange.Buy (−1, 5) is a btc purchased at market price worth 5 usdt.Note that this is the only exceptional place in the four cases.)
Sell ((7350, 3) is to sell 3 BTC at 7350. Selling at the market price, exchange. Selling ((-1, 3) is selling 3 BTC at the market price.
This is the code of the strategy:https://www.fmz.com/m/edit-strategy/191349
April 5, 2020
===== I'm the low-key divider =====
A good trading platform can make your strategy swing straight up to 90,000 miles, and you can get two months of VIP5 deals by signing up with this link: (Temporarily: 0%, on-demand 0.07%; contracts: 0%, on-demand 0.04%)https://www.kucoin.cc/ucenter/signup?rcode=1wxJ2fQ&lang=zh_CN&utmsource=VIP_TF
/*backtest start: 2020-01-01 00:00:00 end: 2020-04-01 00:00:00 period: 1d exchanges: [{"eid":"Huobi","currency":"BTC_USD","balance":1000000,"stocks":0}] */ var id, order, buyAmount, lastPrice; function main() { Log(exchange.GetAccount()); lastPrice = parseInt(exchange.GetTicker().Last); id = exchange.Buy(lastPrice + 50, 5); // 限价买入5个BTC,买入价是当前最新价格+50 Log(order = exchange.GetOrder(id)); buyAmount = parseFloat(order.DealAmount); Log(exchange.GetAccount()); Sleep(1000); last_price = parseInt(exchange.GetTicker().Last); id = exchange.Sell(lastPrice - 50, buyAmount); // 限价卖出5个BTC,卖出价是当前最新价格-50 Log(order = exchange.GetOrder(id)); Log(exchange.GetAccount()); Sleep(1000); id = exchange.Buy(-1, 5); // 市价买入BTC,成交量是5个usdt Sleep(1000); Log(order = exchange.GetOrder(id)); buyAmount = parseFloat(order.DealAmount); Log(exchange.GetAccount()); Sleep(1000); id = exchange.Sell(-1, buyAmount); // 市价卖出BTC,成交量是刚才买入的BTC Sleep(1000); Log(order = exchange.GetOrder(id)); Log(exchange.GetAccount()); }