0
Follow
2
Followers
एफएमजेड के साथ लगभग 2 महीने, कुछ रणनीतियों से अच्छी कमाई हुई है, मुझे लगता है कि समुदाय के लिए थोड़ा सा योगदान करना आवश्यक है, अब वेबसॉकेट के उदाहरणों को देखते हुए बहुत कुछ नहीं है, एक उदाहरण के लिए योगदान करें जो बहु-मुद्रा वेबसॉकेट प्रथाओं को प्राप्त करने के लिए एक मल्टीस्ट्रीम सदस्यता लेता है, यह सरल है, प्रथाओं को प्राप्त करें, प्रथाओं को लूप में प्रिंट करें।
यदि आप एक ही समय में कई सिक्कों का व्यापार करते हैं, तो अंतर काफी बड़ा है, उम्मीद है कि यह मदद कर सकता है।
python
#websocket 更新 行情
# {
# "e":"bookTicker", // 事件类型
# "u":400900217, // 更新ID
# "E": 1568014460893, // 事件推送时间
# "T": 1568014460891, // 撮合时间
# "s":"BNBUSDT", // 交易对
# "b":"25.35190000", // 买单最优挂单价格
# "B":"31.21000000", // 买单最优挂单数量
# "a":"25.36520000", // 卖单最优挂单价格
# "A":"40.66000000" // 卖单最优挂单数量
# }
def on_msg(msg) : #更新行情
if msg is not None and len(msg)>0:
bookTicker = json.loads(msg)
else:
# Log('book tick msg is none')
return
Log(bookTicker)
def main():
SetErrorFilter("502:|503:|tcp|character|unexpected|network|timeout|WSARecv|Connect|GetAddr|no such|reset|http|received|EOF|reused|Unknown")
trade_symbols = 'TRX,ZEC,DENT,BLZ,ENJ,ZIL,MANA,ONT,XMR,ICX,SC,THETA,CVC,BAT,STMX,VET,IOST,NEO,MTL,DASH,KNC,ZRX,IOTA'.split(',')
ary_symbol_streams = []
for i in range(len(trade_symbols)):
symbol = trade_symbols[i].lower()
stream_client = Dial(f"wss://fstream.binance.com/ws/{symbol}usdt@bookTicker|reconnect=true")
ary_symbol_streams.append(stream_client)
while (true):
for item in ary_symbol_streams:
#-2读取最新数据
msg = item.read(-2)
on_msg(msg)
Related Recommendations
How to Specify Different Versions of Data for the Rented Strategy by Its Rental Code MetadataAdvanced 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?
Comment
All comments (4)
Dial("wss://stream.binance.com:9443/stream?streams=btcusdt@aggTrade/ethusdt@aggTrade/axsusdt@aggTrade/ltcusdt@aggTrade/dogeusdt@aggTrade|reconnect=true");
5 years ago
- 1

