-
Notifications
You must be signed in to change notification settings - Fork 15
/
generate_keys.py
39 lines (30 loc) · 1.79 KB
/
generate_keys.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
32
33
34
35
36
37
38
39
import sys
import os.path
def add_quotes(a):
return '"{0}"'.format(a)
MSG = "(press enter to leave blank for later, or CTRL-C to abort):"
KEYDEFS_FILE = "daemon/keydefs.h"
if not os.path.exists( KEYDEFS_FILE ):
print( "NOTE: If you don't want to hardcode these values, leave them blank and you can use 'setkeyandsecret <key> <secret>' in the bot upon startup. Alternately, if you don't want to use this script, but still want to hardcode your keys, CTRL-C and 'cp daemon/keydefs.h.example daemon/keydefs.h' and paste your keys in there." )
print( "Generating keydefs.h..." )
polo_key = add_quotes( raw_input( "Enter Poloniex API Key" + MSG ) )
polo_secret = add_quotes( raw_input( "Enter Poloniex API Secret" + MSG ) )
trex_key = add_quotes( raw_input( "Enter Bittrex API Key" + MSG ) )
trex_secret = add_quotes( raw_input( "Enter Bittrex API Secret" + MSG ) )
bnc_key = add_quotes( raw_input( "Enter Binance API Key" + MSG ) )
bnc_secret = add_quotes( raw_input( "Enter Binance API Secret" + MSG ) )
waves_secret = add_quotes( raw_input( "Enter Waves API Secret (Base58)" + MSG ) )
file = open( KEYDEFS_FILE, "w" )
file.write( "#ifndef KEYDEFS_H\n" )
file.write( "#define KEYDEFS_H\n\n" )
file.write( "#define POLONIEX_KEY " + polo_key + "\n" )
file.write( "#define POLONIEX_SECRET " + polo_secret + "\n" )
file.write( "#define BITTREX_KEY " + trex_key + "\n" )
file.write( "#define BITTREX_SECRET " + trex_secret + "\n" )
file.write( "#define BINANCE_KEY " + bnc_key + "\n" )
file.write( "#define BINANCE_SECRET " + bnc_secret + "\n" )
file.write( "#define WAVES_SECRET " + waves_secret + "\n\n" )
file.write( "#endif // KEYDEFS_H\n" )
file.close();
else:
print( "keydefs.h already exists, exiting.. (if you meant to overwrite it, remove/move the file and re-run this script.)" )