With this patch we introduce a new table: coordinator_leverages.
It contains two fields:
trader_leverage
coordinator_leverage
i.e. we can define a coordinator leverage for each possible trader_leverage. For simplcitiy reasons we only have round numbers in the database and no floating points, hence, when looking up a coordinator leverage for a trader leverage, we need to round. If no match is found, we fall back and take the max allowed leverage of the coordinator. This allows us to not have an entry from 1 - 100 but stop at e.g. 10 with a max coordinator leverage of 10. If a user then goes a 100x, we still pick leverage 10.
There is one downside of this patch: The coordinator's reserve now depends on the trader's leverage which we might not want.
With this patch we introduce a new table:
coordinator_leverages
. It contains two fields:i.e. we can define a coordinator leverage for each possible trader_leverage. For simplcitiy reasons we only have round numbers in the database and no floating points, hence, when looking up a coordinator leverage for a trader leverage, we need to round. If no match is found, we fall back and take the max allowed leverage of the coordinator. This allows us to not have an entry from 1 - 100 but stop at e.g. 10 with a max coordinator leverage of 10. If a user then goes a 100x, we still pick leverage 10.
There is one downside of this patch: The coordinator's reserve now depends on the trader's leverage which we might not want.