Strategies
干货-下单量精度和价格精度-适用各个交易所
陈皮 · python · Tools and Appendix · 2021-09-25 10:25:30
Unclassified: no terms matched. The source summary and parameters are still available.
Code summary Auto-extracted · not described by the author
Library / utility: 2 functions, 0 classes; no entry or exit calls detected.
Library / utility
Detected terms
None
Operation terms
None
Code comments
- No comments in English.
24 code lines · 2 functions · 0 classes · 0 parameters
Source code (24 lines)
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