The resource loading... loading...

Dry goods - down-supply precision and price precision - applicable to all exchanges

Author: Skin that is old, Date: 2021-07-02 19:24:39
Tags: Tool


from collections import Counter
def GetAmountPrecision():
    depth = _C(exchange.GetDepth)    
    amountPrecisions = []
    for ask in depth["Asks"]:
        i = ask["Amount"]
        amountPrecision = 0
        if str(i).count('.') == 1:
            amountPrecision = len(str(i).split(".")[1])
        amountPrecisions.append(amountPrecision)
    amountPrecision = max(amountPrecisions)    
    return amountPrecision

def GetPricePrecision():
    depth = _C(exchange.GetDepth)    
    pricePrecisions = []
    for ask in depth["Asks"]:
        j = ask["Price"]
        pricePrecision = 0
        if str(j).count('.') == 1:
            pricePrecision = len(str(j).split(".")[1])
        pricePrecisions.append(pricePrecision)
    pricePrecision = Counter(pricePrecisions).most_common(1)[0][0]
    return pricePrecision

Related

More

czruiqIt took me more than an hour to make it, I didn't expect to go up and check it out, it was already ready...

77924998Is there a JS version?

77924998How to use it in strategy?

lcgs005Is there an example of a way to get a small number of digits from the hanging unit quantity data directly using the API to get the lowest price, the highest price, the step length data and then correct the order price in the real disk?

gg50933064Is this a new strategy for the exchange?

btcrobotThe function GetPrecision ((() { If ((IsVirtual)) return {price: 6, amount:6} is equal to I'm not sure. var precision = {price:0, amount:0} var depth = exchange.GetDepth If ((!depth) { 'Can't connect to the exchange market, need overseas custodian' I'm not sure. for ((var i=0; i -1? depth.Asks[i].Amount.toString (().split('.') [1] length: 0 Precision.amount = Math.max (precision.amount,amount is the maximum) var pricePrecision = depth.Asks[i].Price.toString (().indexOf('.') > -1? depth.Asks[i].Price.toString (().split('.') [1] length: 0 Precision.price = Math.max ((precision.price, pricePrecision) is a mathematical expression used to express the price of a product. I'm not sure. return precision I'm not sure.

Skin that is oldHa, more searches, more resources.

Skin that is oldYes, but the js code is longer, you add me, I'll send you the private

77924998Thank you.

Skin that is oldAnd we can do that directly with functions.

Skin that is oldThe lowest price and the highest price seem to have a fixed percentage, is it 10% or 5% of the current price?

Skin that is oldI'm sorry, there is no such thing. There is a spot strategy and a contract strategy.

gg50933064Is there a new strategy for the exchange?

Skin that is oldNo, the price precision function for the transaction pair and the lower unit precision function are often used in development strategies.

Difficult to quantifyBully