forked from tntwist/binance-trade-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
database_warmup.py
31 lines (26 loc) · 1007 Bytes
/
database_warmup.py
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
import os, sys, getopt
from binance_trade_bot import warmup_database
def OK():
if os.name == 'nt':
return 0
return os.EX_OK
if __name__ == "__main__":
db_path = "data/crypto_trading.db"
coin_list = None
try:
opts, args = getopt.getopt(sys.argv[1:],"hd:c:",["dbpath=","coinlist="])
except getopt.GetoptError:
pass
for opt, arg in opts:
if opt == '-h':
print('database_warmup.py - Script to farm up a db with some coins')
print('parameters:')
print('-d, --dbpath <optional, path to db, if not given the default db path will be used>')
print('-c, --coinlist <optional, list of coins, e.g \'ADA BTC ETH ...\', if not given all coins available for bridge will be used>')
os._exit(OK())
elif opt in ("-d", "--dbpath"):
db_path = arg
elif opt in ("-c", "--coinlist"):
coin_list = arg.split()
warmup_database(coin_list, db_path)
os._exit(OK())