3
Follow
1513
Followers
Résolvez le problème de précision de la commande en obtenant la profondeur
Created 2020-03-20 09:10:52 Updated 2020-03-20 09:11:16
2
1869
En raison de l'inhomogénéité des échanges, FMZ n'a pas de fonction de retour de précision de commande uniforme. Si la stratégie est de ne faire qu'une seule monnaie, il est préférable d'utiliser la profondeur d'acquisition, qui permet de calculer automatiquement la précision de commande en fonction de l'information de profondeur.
La fonction est la suivante:
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
