3
Follow
1513
Followers
各取引所が統一されていないため,FMZには統一された下令精度返却関数はありません. 策略が1つの通貨だけであればよいが,複数の取引ペアと互換性がある場合も複数の取引所と互換性があるので,ここでは深度情報に基づいて下令精度を自動的に推算する取得深度を使用することを推奨する. もちろん,複数の通貨を取引する場合は,HttpQueryを使用して原始APIインターフェースにアクセスすることも推奨する.
この関数は次のとおりです.
function GetPrecision(){
var precision = {price:0, amount:0}
var depth = exchange.GetDepth()
for(var i=0;i<exchange.GetDepth().Asks.length;i++){
var amountPrecision = exchange.GetDepth().Asks[i].Amount.toString().indexOf('.') > -1 ? exchange.GetDepth().Asks[i].Amount.toString().split('.')[1].length : 0
precision.amount = Math.max(precision.amount,amountPrecision)
var pricePrecision = exchange.GetDepth().Asks[i].Price.toString().indexOf('.') > -1 ? exchange.GetDepth().Asks[i].Price.toString().split('.')[1].length : 0
precision.price = Math.max(precision.price,pricePrecision)
}
return precision
}
Related Recommendations
Advanced Tutorial for FMZ Quant platform Strategy WritingElementary Tutorial for FMZ Quant platform Strategy WritingGet Started with FMZ Quant PlatformSECURITY BUGI keep getting error: Exchange_GetAccount: Invalid ContractTypeWe have an incredibly profitable market making algorithm for sideways markets on Bitmex - but need expert to help eliminate wait times during downward volatility in the marketError with deribitLimitations of the backtesting engineHow to install ta-lib on linux docker?5.5 Trading strategy optimization
