get10101 / 10101

10101 (Ten-Ten-One): Self-custodial derivative trading at your fingertips.
https://10101.finance
MIT License
128 stars 23 forks source link

feat: allow to configure coordinator leverage #2618

Closed bonomat closed 2 months ago

bonomat commented 3 months ago

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.