python生成部署脚本
#!/usr/bin/env python
# coding=utf-8
import os
import sys
appYml = '''#!/bin/bash
ymlName1="docker-compose.yml"
build_compose_yml(){
cat>"${ymlName1}"<<EOF
version: "3"
services:
gateway:
image: xxx/ait0/gm_subscribe:\${TAG}
container_name: "gm_subscribe"
restart: always
volumes:
- ./logs:/app/logs
networks:
- network
environment:
MQ_URL: ${MQ_URL}
GM_ADDRESS: ${GM_ADDRESS}
GM_TOKEN: ${GM_TOKEN}
GM_SYMBOLS: ${GM_SYMBOLS}
USE_FAKE: ${USE_FAKE}
entrypoint: python3 ./gm_subscribe.py
networks:
network:
driver: bridge
EOF
}
'''
aitoolsappYml = '''#!/bin/bash
ymlName1="docker-compose.yml"
build_compose_yml(){
cat>"${ymlName1}"<<EOF
version: "3"
services:
gateway:
image: xxx/ait0/python_aitools:%s
container_name: "python_aitools"
restart: always
volumes:
- ./config.json:/app/config/config.json
networks:
- network
networks:
network:
driver: bridge
EOF
}
'''
aitoolsEnvScript = '''
envName1="config.json"
build_env(){
cat>"${envName1}"<<EOF
{
"mysql_param": {
"quote_db":{
"host": "172.16.30.194",
"port": 13307,
"user": "dev",
"passwd": "dev_pwd",
"db": "quote"
},
"sync_db":{
"host": "172.16.30.221",
"port": 13306,
"user": "root",
"passwd": "xxx",
"db": "quote_test"
},
"nano_db":{
"host": "xxx",
"port": 3306,
"user": "readonly",
"passwd": "xxxx",
"db": "marketdata"
},
"ait0_db":{
"host": "172.16.30.194",
"port": 13307,
"user": "dev",
"passwd": "dev_pwd",
"db": "ai_server"
}
},
"process_threads": 4,
"timer_param": {
"gm_stock_time": "15:30",
"gm_future_time": "16:30",
"nano_time": "09:30",
"code_time": "08:30",
"price_time": 5
},
"redis_param": {
"host": "172.16.30.194",
"port": 16379,
"password": "xxx"
},
"check_code_count" : [
{
"exchange": "SZSE",
"min_count": 2000
},
{
"exchange": "SHSE",
"min_count": 2000
}
],
"check_price": [
{
"exchange": "SZSE",
"symbol": "000001"
},
{
"exchange": "SHSE",
"symbol": "600000"
}
],
"other_param" : {
"ding_token": "xxx",
"quote_url": "http://172.16.30.194:8888/",
"quant_token":"xxxx",
"quant_addr": "127.0.0.1:7001"
}
}
EOF
}
'''
EnvScript = '''
envName1=".env"
build_env(){
cat>"${envName1}"<<EOF
TAG=%s
MQ_URL=%s
GM_ADDRESS=%s
GM_TOKEN=%s
GM_SYMBOLS=%s
USE_FAKE=%s
EOF
}
'''
aitoolsrunScript = '''
build_deploy(){
docker-compose up -d
}
init(){
docker-compose down -v
docker rmi xxx/ait0/python_aitools:%s
}
main(){
init
build_compose_yml
build_env
build_deploy
}
main
'''
runScript = '''
build_deploy(){
docker-compose up -d
}
init(){
docker-compose down -v
docker rmi xxx/ait0/gm_subscribe:%s
}
main(){
init
build_compose_yml
build_env
build_deploy
}
main
'''
def ait0_python_deploy():
env_dist = os.environ
MQ_URL = env_dist.get("MQ_URL", "amqp://guest:guest@172.16.50.24:15672/quote?heartbeat=0")
GM_ADDRESS = env_dist.get("GM_ADDRESS", "172.16.50.23:7001")
GM_TOKEN = env_dist.get("GM_TOKEN", "xxx")
GM_SYMBOLS = env_dist.get("GM_SYMBOLS", "SZSE.300890,SZSE.300409,SHSE.688700,SHSE.603738,SHSE.688689,SHSE.688668,SZSE.300428,SZSE.002011,SZSE.300416,SZSE.300065,SZSE.300447,SZSE.002897,SZSE.002837,SZSE.300648,SZSE.002518,SHSE.603912,SZSE.002567,SHSE.688556,SHSE.603396,SHSE.603477,SHSE.603596,SZSE.002906,SZSE.002466,SHSE.600563,SZSE.002484,SZSE.002812,SZSE.300274,SZSE.300316,SHSE.688598,SHSE.603806,SHSE.605117,SHSE.603606,SZSE.300850,SZSE.002531,SZSE.300327,SZSE.300633,SZSE.002335,SHSE.601636,SZSE.000959,SZSE.000932,SHSE.600782,SHSE.600985,SHSE.600188,SHSE.601088,SHSE.601600,SZSE.000807,SHSE.601899,SHSE.600362,SZSE.002714,SZSE.000977,SHSE.600845,SZSE.002271,SHSE.603208,SZSE.002572,SZSE.000400,SZSE.002028,SZSE.000733,SHSE.600765,SZSE.002179,SZSE.300394,SZSE.300504,SHSE.600702,SHSE.603198,SHSE.603589,SHSE.600559,SHSE.600197,SHSE.601800,SHSE.601669,SHSE.600426,SHSE.600309,SHSE.600230,SZSE.002241,SZSE.000672,SHSE.600585")
USE_FAKE = env_dist.get("USE_FAKE", "0")
version = env_dist["version_number"]
# 替换字符串.
yml = appYml
env1 = EnvScript % (version, MQ_URL, GM_ADDRESS, GM_TOKEN, GM_SYMBOLS, USE_FAKE)
run1 = runScript % (version)
script = yml + env1 + run1
# 生成脚本文件.
fp = open("ait0_python.sh", "w")
fp.write(script)
fp.close()
def aitools_python_deploy():
env_dist = os.environ
# MQ_URL = env_dist.get("MQ_URL", "amqp://guest:guest@172.16.50.24:15672/quote?heartbeat=0")
# GM_ADDRESS = env_dist.get("GM_ADDRESS", "172.16.50.23:7001")
# GM_TOKEN = env_dist.get("GM_TOKEN", "xxx")
# GM_SYMBOLS = env_dist.get("GM_SYMBOLS", "SZSE.300890,SZSE.300409,SHSE.688700,SHSE.603738,SHSE.688689,SHSE.688668,SZSE.300428,SZSE.002011,SZSE.300416,SZSE.300065,SZSE.300447,SZSE.002897,SZSE.002837,SZSE.300648,SZSE.002518,SHSE.603912,SZSE.002567,SHSE.688556,SHSE.603396,SHSE.603477,SHSE.603596,SZSE.002906,SZSE.002466,SHSE.600563,SZSE.002484,SZSE.002812,SZSE.300274,SZSE.300316,SHSE.688598,SHSE.603806,SHSE.605117,SHSE.603606,SZSE.300850,SZSE.002531,SZSE.300327,SZSE.300633,SZSE.002335,SHSE.601636,SZSE.000959,SZSE.000932,SHSE.600782,SHSE.600985,SHSE.600188,SHSE.601088,SHSE.601600,SZSE.000807,SHSE.601899,SHSE.600362,SZSE.002714,SZSE.000977,SHSE.600845,SZSE.002271,SHSE.603208,SZSE.002572,SZSE.000400,SZSE.002028,SZSE.000733,SHSE.600765,SZSE.002179,SZSE.300394,SZSE.300504,SHSE.600702,SHSE.603198,SHSE.603589,SHSE.600559,SHSE.600197,SHSE.601800,SHSE.601669,SHSE.600426,SHSE.600309,SHSE.600230,SZSE.002241,SZSE.000672,SHSE.600585")
# USE_FAKE = env_dist.get("USE_FAKE", "0")
version = env_dist["version_number"]
# 替换字符串.
yml = aitoolsappYml % (version)
env1 = aitoolsEnvScript
run1 = aitoolsrunScript % (version)
script = yml + env1 + run1
# 生成脚本文件.
fp = open("aitools_python.sh", "w")
fp.write(script)
fp.close()
if __name__ == "__main__":
param = sys.argv[1]
names = param.split(".")
n = names[len(names)-1]
if n == "ait0_python":
ait0_python_deploy()
elif n == "aitools":
aitools_python_deploy()
else:
print param
#!/usr/bin/env python
# coding=utf-8
import os
yml = '''#!/bin/bash
ymlName="docker-compose.yml"
build_compose_yml(){
cat>"${ymlName}"<<EOF
version: "3"
services:
gateway:
image: xxx/quote/gateway:\${TAG}
container_name: "gateway"
restart: always
ports:
- 8888:8888
- 39101:9101
volumes:
- ./logs:/app/logs
networks:
- network
depends_on:
- query
environment:
QUERY_ADDRESS: \${QUERY_ADDRESS}
TRACING_URL: \${TRACING_URL}
TRACING_SAMPLER: \${TRACING_SAMPLER}
QUERY_TABLES_ADDRESS: \${QUERY_TABLES_ADDRESS}
query:
image: xxx/quote/query:\${TAG}
container_name: "query"
restart: always
ports:
- 39102:9102
- 8081:8081
volumes:
- ./logs:/app/logs
networks:
- network
environment:
MARKET_TYPE: \${MARKET_TYPE}
MYSQL_SOURCE: \${MYSQL_SOURCE}
REDIS_ADDRESS: \${REDIS_ADDRESS}
REDIS_PASS: \${REDIS_PASS}
TRACING_URL: \${TRACING_URL}
TRACING_SAMPLER: \${TRACING_SAMPLER}
storage:
image: xxx/quote/storage:\${TAG}
container_name: "storage"
restart: always
volumes:
- ./logs:/app/logs
networks:
- network
environment:
MYSQL_SOURCE: \${MYSQL_SOURCE}
STORAGE_MODE: \${STORAGE_MODE}
REDIS_ADDRESS: \${REDIS_ADDRESS}
REDIS_PASS: \${REDIS_PASS}
RABBIT_ADDRESS: \${RABBIT_ADDRESS}
PROC_THREADS: \${PROC_THREADS}
TICKS_WRITE_FLAG: \${TICKS_WRITE_FLAG}
TICK_SAVE_SYMBOLS: \${TICK_SAVE_SYMBOLS}
STORAGE_SERVICE_NAME: \${STORAGE_SERVICE_NAME}
STORAGE_SERVICE_PORT: \${STORAGE_SERVICE_PORT}
STORAGE_LOG_PATH: \${STORAGE_LOG_PATH}
probe:
image: xxx/probe/probe:v0.7.0
container_name: "probe"
restart: always
networks:
- network
ports:
- 15888:5888
command:
- -http=gateway:8888,storage:10001
- -grpc=query.rpc:query:8081
gm:
image: xxx/quote/gm:\${TAG}
container_name: "gm"
restart: always
volumes:
- ./logs:/app/logs
ports:
- 9159:9159
networks:
- network
environment:
RABBIT_ADDRESS: \${RABBIT_ADDRESS}
GM_OPEN_TIME: \${GM_OPEN_TIME}
GM_SYNC_FLAG: \${GM_SYNC_FLAG}
GM_EXCHANGE_PREFIX_FLAG: \${GM_EXCHANGE_PREFIX_FLAG}
GM_QUOTE_COMMODITY: \${GM_QUOTE_COMMODITY}
GM_EXCHANGE_NO: \${GM_EXCHANGE_NO}
GM_TOKEN: \${GM_TOKEN}
GM_STRATEGY_ID: \${GM_STRATEGY_ID}
GM_SERV_ADDR: \${GM_SERV_ADDR}
TRACING_URL: \${TRACING_URL}
TRACING_SAMPLER: \${TRACING_SAMPLER}
TRANFER_ADDRESS: \${TRANFER_ADDRESS}
GM_SERVICE_NAME: \${GM_SERVICE_NAME_STOCK}
SOURCE_GM_PORT: \${SOURCE_GM_PORT_STOCK}
GM_SERVICE_LOG_PATH: \${GM_SERVICE_LOG_PATH_STOCK}
SOURCE_GM_PROM_PORT: \${SOURCE_GM_PROM_PORT_STOCK}
GM_SEC_TYPES: \${GM_SEC_TYPES_STOCK}
querytables:
image: xxx/quote/querytables:\${TAG}
container_name: "querytables"
restart: always
volumes:
- ./logs:/app/logs
ports:
- 9104:9104
networks:
- network
environment:
MYSQL_SOURCE_TABLES: \${MYSQL_SOURCE_TABLES}
TRACING_URL: \${TRACING_URL}
TRACING_SAMPLER: \${TRACING_SAMPLER}
transfer:
image: xxx/quote/transfer:\${TAG}
container_name: "transfer"
restart: always
volumes:
- ./logs:/app/logs
ports:
- 8082:8082
- 19103:9103
networks:
- network
environment:
RABBIT_ADDRESS: \${RABBIT_ADDRESS}
TRACING_URL: \${TRACING_URL}
TRACING_SAMPLER: \${TRACING_SAMPLER}
push:
image: xxx/quote/push:\${TAG}
container_name: "push"
restart: always
volumes:
- ./logs:/app/logs
networks:
- network
environment:
RABBIT_ADDRESS: \${RABBIT_ADDRESS}
TRACING_URL: \${TRACING_URL}
TRACING_SAMPLER: \${TRACING_SAMPLER}
websocketv1:
image: xxx/quote/websocketv1:\${TAG}
container_name: "websocketv1"
restart: always
ports:
- 8889:8889
volumes:
- ./logs:/app/logs
networks:
- network
depends_on:
- push
environment:
STORAGE_MODE: \${STORAGE_MODE}
PUSH_ADDRESS: \${PUSH_ADDRESS}
TRACING_URL: \${TRACING_URL}
TRACING_SAMPLER: \${TRACING_SAMPLER}
tap:
image: xxx/quote/tap:\${TAG}
container_name: "tap"
restart: always
volumes:
- ./logs:/app/logs
networks:
- network
environment:
ESUNNY_QUOTE_IP: \${ESUNNY_QUOTE_IP}
ESUNNY_QUOTE_PORT: \${ESUNNY_QUOTE_PORT}
ESUNNY_QUOTE_AUTHCODE: \${ESUNNY_QUOTE_AUTHCODE}
ESUNNY_QUOTE_USERNAME: \${ESUNNY_QUOTE_USERNAME}
ESUNNY_QUOTE_PASSWD: \${ESUNNY_QUOTE_PASSWD}
ESUNNY_QUOTE_COMMODITY: \${ESUNNY_QUOTE_COMMODITY}
ESUNNY_TRADE_IP: \${ESUNNY_TRADE_IP}
ESUNNY_TRADE_PORT: \${ESUNNY_TRADE_PORT}
ESUNNY_TRADE_AUTHCODE: \${ESUNNY_TRADE_AUTHCODE}
ESUNNY_TRADE_USERNAME: \${ESUNNY_TRADE_USERNAME}
ESUNNY_TRADE_PASSWD: \${ESUNNY_TRADE_PASSWD}
ESUNNY_COMMODITYNO: \${ESUNNY_COMMODITYNO}
ESUNNY_OPEN_TIME: \${ESUNNY_OPEN_TIME}
ESUNNY_SYNC_FLAG: \${ESUNNY_SYNC_FLAG}
ESUNNY_EXCHANGE_PREFIX_FLAG: \${ESUNNY_EXCHANGE_PREFIX_FLAG}
ESUNNY_LOG_PATH: \${ESUNNY_LOG_PATH}
ESUNNY_QUOTE_FLAG: \${ESUNNY_QUOTE_FLAG}
ESUNNY_EXCHANGE_NO: \${ESUNNY_EXCHANGE_NO}
RABBIT_ADDRESS: \${RABBIT_ADDRESS}
TRACING_URL: \${TRACING_URL}
TRACING_SAMPLER: \${TRACING_SAMPLER}
TRANFER_ADDRESS: \${TRANFER_ADDRESS}
ths:
image: xxx/quote/ths:\${TAG}
container_name: "ths"
restart: always
volumes:
- ./logs:/app/logs
ports:
- 9162:9162
networks:
- network
environment:
THS_SERVICE_NAME: \${THS_SERVICE_NAME}
SOURCE_THS_PORT: \${SOURCE_THS_PORT}
SOURCE_THS_PROM_PORT: \${SOURCE_THS_PROM_PORT}
RABBIT_ADDRESS: \${RABBIT_ADDRESS}
TRANFER_ADDRESS: \${TRANFER_ADDRESS}
TRACING_URL: \${TRACING_URL}
TRACING_SAMPLER: \${TRACING_SAMPLER}
THS_ACCESS_TOKEN: \${THS_ACCESS_TOKEN}
futu:
image: xxx/quote/futu:\${TAG}
container_name: "futu"
restart: always
volumes:
- ./logs:/app/logs
networks:
- network
environment:
FUTU_SERVICE_NAME: \${FUTU_SERVICE_NAME}
SOURCE_FUTU_PORT: \${SOURCE_FUTU_PORT}
RABBIT_ADDRESS: \${RABBIT_ADDRESS}
FUTU_OPEN_TIME: \${FUTU_OPEN_TIME}
FUTU_SYNC_FLAG: \${FUTU_SYNC_FLAG}
FUTU_EXCHANGE_PREFIX_FLAG: \${FUTU_EXCHANGE_PREFIX_FLAG}
FUTU_QUOTE_SYMBOLS: \${FUTU_QUOTE_SYMBOLS}
FUTU_ADDRESS: \${FUTU_ADDRESS}
FUTU_PORT: \${FUTU_PORT}
FUTU_SERVICE_NAME: \${FUTU_SERVICE_NAME}
FUTU_SERVICE_LOG_PATH: \${FUTU_SERVICE_LOG_PATH}
SOURCE_FUTU_PROM_PORT: \${SOURCE_FUTU_PROM_PORT}
TRACING_URL: \${TRACING_URL}
TRACING_SAMPLER: \${TRACING_SAMPLER}
TRANFER_ADDRESS: \${TRANFER_ADDRESS}
networks:
network:
driver: bridge
EOF
}
'''
envScript = '''
envName=".env"
build_env(){
cat>"${envName}"<<EOF
TAG=%s
MYSQL_SOURCE="%s:%s@tcp(%s)/quote?charset=utf8mb4&parseTime=true&loc=Local"
REDIS_ADDRESS="%s"
REDIS_PASS="%s"
RABBIT_ADDRESS="amqp://guest:guest@%s/quote"
QUERY_ADDRESS="query:8081"
TRACING_URL="%s"
TRACING_SAMPLER=0.01
MARKET_TYPE=%s
STORAGE_MODE=%s
PROC_THREADS=8
GTA_MYSQL_SOURCE="xx:xx@tcp(xx:3306)/RCWALGOPRD1?charset=utf8mb4&parseTime=true&loc=Local"
GTA_REDIS_ADDRESS="xx:7788"
GTA_REDIS_PASS="xx"
TICKS_WRITE_FLAG=0
GM_OPEN_TIME="06:10"
GM_SYNC_FLAG=1
GM_EXCHANGE_PREFIX_FLAG=1
GM_QUOTE_COMMODITY=""
GM_EXCHANGE_NO=""
GM_TOKEN="%s"
GM_STRATEGY_ID="xx"
GM_SERV_ADDR="%s"
MYSQL_SOURCE_TABLES="xx:123456@tcp(xx:3306)/xx?charset=utf8mb4&parseTime=true&loc=Local"
QUERY_TABLES_ADDRESS="querytables:8083"
TRANFER_ADDRESS="transfer:8082"
PUSH_ADDRESS="push:8080"
GM_SERVICE_NAME_STOCK=%s
SOURCE_GM_PORT_STOCK=10010
GM_SERVICE_LOG_PATH_STOCK=%s
SOURCE_GM_PROM_PORT_STOCK=9159
GM_SEC_TYPES_STOCK=%s
ESUNNY_QUOTE_IP=%s
ESUNNY_QUOTE_PORT=%s
ESUNNY_QUOTE_AUTHCODE=%s
ESUNNY_QUOTE_USERNAME=%s
ESUNNY_QUOTE_PASSWD=%s
ESUNNY_TRADE_IP=%s
ESUNNY_TRADE_PORT=%s
ESUNNY_TRADE_AUTHCODE=%s
ESUNNY_TRADE_USERNAME=%s
ESUNNY_TRADE_PASSWD=%s
ESUNNY_COMMODITYNO=%s
ESUNNY_OPEN_TIME=%s
ESUNNY_SYNC_FLAG=%s
ESUNNY_QUOTE_COMMODITY=%s
ESUNNY_EXCHANGE_PREFIX_FLAG=%s
ESUNNY_LOG_PATH=%s
ESUNNY_QUOTE_FLAG=%s
ESUNNY_EXCHANGE_NO=%s
TICK_SAVE_SYMBOLS="SZSE_000001,SHSE_600000"
THS_SERVICE_NAME="ths"
FUTU_SERVICE_NAME="futu_source"
SOURCE_FUTU_PORT="10014"
FUTU_OPEN_TIME="09:00"
FUTU_SYNC_FLAG=1
FUTU_EXCHANGE_PREFIX_FLAG=1
FUTU_QUOTE_SYMBOLS="00001,00002,00003,00004,00005,00006,00011,00012,00016,00017,00019,00023,00027,00066,00083,00101,00135"
FUTU_ADDRESS="172.16.60.223"
FUTU_PORT="11111"
FUTU_SERVICE_LOG_PATH="logs/futu"
SOURCE_FUTU_PROM_PORT="9159"
SOURCE_THS_PORT=10013
SOURCE_THS_PROM_PORT=9162
THS_ACCESS_TOKEN="xxx=.eyJ1aWQiOiI2MzMxNDMwNjQifQ==.CA9BA90A3C7259037D07FC3ACDADBD67F3BB61B2DE62DDC6630370F200FEB833"
STORAGE_SERVICE_NAME="quote_storage"
STORAGE_SERVICE_PORT=10001
STORAGE_LOG_PATH="logs/storage"
EOF
}
build_deploy(){
docker-compose up -d
}
init(){
docker-compose down -v
docker images | grep xxx/quote | grep %s | awk '{print $1 ":" $2}' | xargs docker rmi
}
main(){
init
build_compose_yml
build_env
build_deploy
}
main
'''
def build_trade_deploy():
env_dist = os.environ
es_quote_addr = env_dist.get("ESUNNY_QUOTE_ADDR", "xxx")
q_addr = es_quote_addr.split(":")
q_ip = q_addr[0]
q_port = q_addr[1]
es_trade_addr = env_dist.get("ESUNNY_TRADE_ADDR", "xxx")
t_addr = es_trade_addr.split(":")
t_ip = t_addr[0]
t_port = t_addr[1]
# 替换字符串.
env1 = envScript % (env_dist["version_number"], env_dist.get("DATABASE_USER", "dev"), env_dist.get("DATABASE_PWD", "dev_pwd"), env_dist.get("DATABASE_HOST", "172.16.30.194:13306"),
env_dist.get("REDIS_HOST", "172.16.30.193:16379"), env_dist.get("REDIS_PWD", "Gg@xx!!!"),
env_dist.get("RABBITMQ_HOST", "172.16.30.193:15672"),
env_dist.get("TRACING_URL", "http://172.16.30.196:14368/api/traces"),
env_dist.get("MARKET_TYPE", "stock"),
env_dist.get("STORAGE_MODE", "test"), env_dist.get("GM_TOKEN", "xx"), env_dist.get("GM_SERV_ADDR", "172.16.60.223:7001"),
env_dist.get("GM_SERVICE_NAME_STOCK", "gm_stock"),
env_dist.get("GM_SERVICE_LOG_PATH_STOCK", "logs/gm_stock"),
env_dist.get("GM_SEC_TYPES_STOCK", "stock"),
q_ip, q_port,
env_dist.get("ESUNNY_QUOTE_AUTHCODE", "xx"),
env_dist.get("ESUNNY_QUOTE_USERNAME", "ES"),
env_dist.get("ESUNNY_QUOTE_PASSWD", "xx"),
t_ip, t_port,
env_dist.get("ESUNNY_TRADE_AUTHCODE", "xx"),
env_dist.get("ESUNNY_TRADE_USERNAME", "Q576288330"),
env_dist.get("ESUNNY_TRADE_PASSWD", "xx"),
env_dist.get("ESUNNY_COMMODITYNO", "xx"),
env_dist.get("ESUNNY_OPEN_TIME", "04:55"),
env_dist.get("ESUNNY_SYNC_FLAG", "1"),
env_dist.get("ESUNNY_QUOTE_COMMODITY", "HIS,NQ,BO,BP,CL,SV"),
env_dist.get("ESUNNY_EXCHANGE_PREFIX_FLAG", "1"),
env_dist.get("ESUNNY_LOG_PATH", "logs/tap"),
env_dist.get("ESUNNY_QUOTE_FLAG", "0"),
env_dist.get("ESUNNY_EXCHANGE_NO", "x"),
env_dist["version_number"])
script = yml + env1
# 生成脚本文件.
fp = open("quote_deploy.sh", "w")
fp.write(script)
fp.close()
if __name__ == "__main__":
build_trade_deploy()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
上次更新: 2023/01/09, 15:50:06