import json

__author__ = 'sammoth'


def load(app):
    with open('exchange_config') as fp:
        config = json.load(fp)
        fp.close()

    app.config['exchanges'] = []
    for exchange in config:
        app.config['exchanges'].append(exchange)
        app.config['{}.units'.format(exchange)] = []
        for unit in config[exchange]:
            app.config['{}.units'.format(exchange)].append(unit)
            for side in config[exchange][unit]:
                app.config['{}.{}.{}.tolerance'.
                           format(exchange, unit, side)] = config[exchange][unit][side][
                    'tolerance']
                app.config['{}.{}.{}.reward'.
                           format(exchange, unit, side)] = config[exchange][unit][side][
                    'reward']
@@ -43,16 +43,29 @@
 load(app
+, config_file
 ):%0A    w
@@ -77,25 +77,19 @@
 pen(
-'exchange_
 config
-'
+_file
 ) as
@@ -542,38 +542,106 @@
 format(exchange,
- unit,
+%0A                                  unit,%0A                                 
  side)%5D = config
@@ -655,32 +655,44 @@
 ge%5D%5Bunit%5D%5Bside%5D%5B
+'tolerance'%5D
 %0A               
@@ -696,25 +696,46 @@
     
-    'tolerance'%5D%0A
+for tier in %5B'tier_1', 'tier_2'%5D:%0A    
     
@@ -767,16 +767,19 @@
 %7D.%7B%7D.%7B%7D.
+%7B%7D.
 reward'.
@@ -798,32 +798,36 @@
                 
+   
+ 
 format(exchange,
@@ -830,19 +830,139 @@
 nge,
- unit, side
+%0A                                      unit,%0A                                      side,%0A                                      tier
 )%5D =
@@ -991,37 +991,22 @@
 %5D%5Bside%5D%5B
-%0A                    
+tier%5D%5B
 'reward'
@@ -1006,8 +1006,10 @@
 reward'%5D
+%0A%0A

add file as parameter