def calculate_rates(base_currency, counter_currency, forward_rate=None, fwd_points=None, spot_reference=None):
if base_currency not in DIVISOR_TABLE:<EOL><INDENT>divisor = DIVISOR_TABLE.get(counter_currency, DEFAULT_DIVISOR)<EOL>if forward_rate is None and fwd_points is not None and spot_reference is not None:<EOL><INDENT>forward_rate = spot_reference + fwd_points / divisor<EOL><DEDENT>elif forward_rate is not None and fwd_points is None and spot_reference is not None:<EOL><INDENT>fwd_points = (forward_rate - spot_reference) * divisor<EOL><DEDENT>elif forward_rate is not None and fwd_points is not None and spot_reference is None:<EOL><INDENT>spot_reference = forward_rate - fwd_points / divisor<EOL><DEDENT><DEDENT>rates = {}<EOL>if forward_rate is not None:<EOL><INDENT>rates['<STR_LIT>'] = forward_rate<EOL><DEDENT>if fwd_points is not None:<EOL><INDENT>rates['<STR_LIT>'] = fwd_points<EOL><DEDENT>if spot_reference is not None:<EOL><INDENT>rates['<STR_LIT>'] = spot_reference<EOL><DEDENT>return rates<EOL>
Calculate rates for Fx Forward based on others.