-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
38 lines (35 loc) · 1.41 KB
/
main.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
# coding=UTF-8
def get_corridor_lut():
# Console version
CORRIDOR_LUT = {'usd_ntd' : True,
'usd_thb' : True,
'usd_khr' : True,
'usd_cny' : True,
'usd_php' : True,
'usd_inr' : True,
'usd_idr' : True,
'usd_jpy' : True,
'usd_vnd' : True,
'sgd_php' : True}
return CORRIDOR_LUT
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(description='Process arguments.')
parser.add_argument('-l', action='store_true', dest='list', help='List all corridors')
parser.add_argument('-s', default='usd', dest='src', help='Source currency, default:usd')
parser.add_argument('-d', default='ntd', dest='dst', help='Destination currency, default:ntd')
parser.add_argument('-app', default=False, type=bool, dest='app', help='Run as web app')
args = parser.parse_args()
corridorName = args.src + '_' + args.dst
if args.list:
lut = get_corridor_lut()
for corridor in lut.keys():
print('Corridor: {}'.format(corridor.upper()))
elif args.app:
from app import start_app
start_app()
else:
lut = get_corridor_lut()
if lut.get(corridorName, False):
corridor = __import__(corridorName)
corridor.get_current_forex_price()