Browse Source

Refactor buying banking licences

Eren Yilmaz 5 years ago
parent
commit
def71c1a7d
2 changed files with 13 additions and 8 deletions
  1. 12 8
      client_controller.py
  2. 1 0
      run_client.py

+ 12 - 8
client_controller.py

@@ -299,14 +299,7 @@ def buy_banking_license():
     success = 'data' in response
     if success:
         print('Success. You are now a bank.')
-        variables = _global_variables()
-        marginal_lending_facility = variables['marginal_lending_facility']
-        cash_reserve_free_amount = variables['cash_reserve_free_amount']
-        cash_reserve_ratio = variables['cash_reserve_ratio']
-        print(f'You are now allowed to borrow money from the central bank at the marginal '
-              f'lending facility (currently {marginal_lending_facility * 100}%).')
-        print(f'For every {CURRENCY_NAME} above {cash_reserve_free_amount} you have to '
-              f'deposit a cash reserve of {cash_reserve_ratio * 100}% at the central bank.')
+        summarize_banking_rules()
         # print('Remember that the goal is to be as rich as possible, not to be richer than other traders!')
     else:
         if 'error' in response:
@@ -315,6 +308,17 @@ def buy_banking_license():
             print('Banking license application access failed.')
 
 
+def summarize_banking_rules():
+    variables = _global_variables()
+    marginal_lending_facility = variables['marginal_lending_facility']
+    cash_reserve_free_amount = variables['cash_reserve_free_amount']
+    cash_reserve_ratio = variables['cash_reserve_ratio']
+    print(f'AS a bank, you are now allowed to borrow money from the central bank at the marginal '
+          f'lending facility (currently {marginal_lending_facility * 100}%).')
+    print(f'For every {CURRENCY_NAME} above {cash_reserve_free_amount} banks have to '
+          f'deposit a cash reserve of {cash_reserve_ratio * 100}% at the central bank.')
+
+
 def _global_variables():
     return client_request('global_variables')
 

+ 1 - 0
run_client.py

@@ -73,6 +73,7 @@ allowed_commands = ['help',
                     'leaderboard',
                     'activate_key',
                     'exit',
+                    'summarize_banking_rules',
                     'buy_banking_license']