admin
2025-01-15 f84dcf456dbfa318f490d6cf878be5d5d5262718
1
2
3
4
5
6
7
8
9
10
11
12
13
14
B
_­NfW
ã@szdZddlZddlmZdZdZeefdd„Zdd    „Zd
d „Zd d „Z    dd„Z
dd„Z dd„Z dd„Z dd„Zdd„ZdS)u#
与中间服务器的通信协议
éN)Ú socket_utilz 43.138.167.68i'cCsŠt|ƒtkrt|ƒ}t t |¡ d¡¡}t ||¡}zD|     |¡t 
|¡\}}t  |¡}|ddkrrt |dƒ‚|  d¡S| ¡XdS)Nzutf-8ÚcoderÚmsgÚdata)ÚtypeÚsetÚlistrZ load_headerÚjsonÚdumpsÚencodeZ create_socketÚsendallZ    recv_dataÚloadsÚ    ExceptionÚgetÚclose)Ú    data_jsonÚhostÚportZ
data_bytesÚskZ
result_strZ
header_strZ result_json©rõ;D:\量化低吸\low_suction_hx\trade\middle_api_protocol.pyÚrequest s  
 
 
rcCsdd|dœdœ}|S)NÚredisÚcmd)Úctyper)rrr)rÚfdatarrrÚload_redis_cmdsrcCsdd|dœdœ}|S)NrZcmds)rr)rrr)ÚdatasrrrrÚload_redis_cmds"srcCsdd|dœdœ}|S)NÚmysqlr)rr)rrr)rrrrrÚload_mysql_cmd(sr cCsdd||dœdœdœ}|S)NÚjuejin)ÚpathÚparams)rr)rrr)Zpath_rrrrrÚ load_juejin/sr$cCsdd|||dœdœdœ}|S)NÚkpl)ÚurlrÚtimeout)rr)rrr)r&rr'rrrrÚload_kpl5sr(cCsddd|idœdœ}|S)NÚkp_msgr)rr)rrr)rrrrrÚ load_kp_msg;sr*cCsdd|dœdœ}|S)NZl2_position_subscript_codes)rr)rrr)rrrrrÚ load_l2_position_subscript_codesAsr+cCsdd|dœdœ}|S)NZpush_msg)rr)rrr)rrrrrÚ load_push_msgGsr,cCsd||dœdœ}|S)NZsimulation_trade)rr)rrr)rrrrrrÚload_simulation_tradeMsr-)Ú__doc__r    ÚutilsrZ SERVER_HOSTZ SERVER_PORTrrrr r$r(r*r+r,r-rrrrÚ<module>s