-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #254 from InjectiveLabs/dev
#PRMaster
- Loading branch information
Showing
154 changed files
with
4,607 additions
and
2,063 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Calculations | ||
|
||
Here are some formula formatting values between the chain and UI human-readable. | ||
|
||
### Bridges Supported | ||
|
||
| Topic | Description | | ||
| ------------------------------------------------------- | --------------------------------------- | | ||
| [Market min price tick size](minPriceTickSize.md) | Minimum market order price tick size | | ||
| [Market min quantity tick size](minQuantityTickSzie.md) | Minimum market order quantity tick size | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Market min price tick size | ||
|
||
The min market price tick size for an order price - if a market has an minPriceTickSick of `0.001` and order submission with the price of `0.0011` will be rejected. | ||
|
||
Note that calculating the formula for calculating a spot and quote market price tick size are different. | ||
|
||
### Spot market | ||
|
||
1. UI human readable to chain format: | ||
Using INJ/USDT market which has 18 base decimals and 6 quote decimals as an example, here's how we convert the value to the chain format: | ||
|
||
```js | ||
const chainFormat = new BigNumberInBase(10) | ||
.pow(quoteDecimal - baseDecimal) | ||
.times(value) | ||
.toFixed() | ||
``` | ||
|
||
1. Chain format to UI human readable format: | ||
Using INJ/USDT market which has 18 base decimals and 6 quote decimals as an example, here's how we convert the value to the UI human readable format: | ||
|
||
```js | ||
const humanReadableFormat = new BigNumber(value) | ||
.shiftedBy(baseDecimals - quoteDecimals) | ||
.toFixed() | ||
``` | ||
|
||
### Derivative market | ||
|
||
1. UI human readable to chain format: | ||
Using INJ/USDT perp market which has 6 quote decimals as an example, here's how we convert the value to the chain format: | ||
|
||
```js | ||
const chainFormat = new BigNumberInBase(10) | ||
.pow(-quoteDecimal) | ||
.times(value) | ||
.toFixed() | ||
``` | ||
|
||
1. Chain format to UI human readable format: | ||
Using INJ/USDT perp market which has 6 quote decimals as an example, here's how we convert the value to the UI human readable format: | ||
|
||
```js | ||
const humanReadableFormat = new BigNumber(value) | ||
.shiftedBy(-quoteDecimals) | ||
.toFixed() | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Market min quantity tick size | ||
|
||
The min market quantity tick size for an order price - if a market has an minQuantityTickSize of `0.001` and order submission with the quantity of `0.0011` will be rejected. | ||
|
||
Note that derivate markets shares the same format for minQuantityTickSize between UI and the chain, so no formatting is required. | ||
|
||
### Spot market | ||
|
||
1. UI human readable to chain format: | ||
Using on a INJ/USDT market which has 18 base decimals and 6 quote decimals as an example, here's how we convert the value to the chain format: | ||
|
||
```js | ||
const chainFormat = new BigNumberInWei(value).toBase(baseDecimals) | ||
``` | ||
|
||
1. Chain format to UI human readable format: | ||
Using INJ/USDT market which has 18 base decimals and 6 quote decimals as an example, here's how we convert the value to the UI human readable format: | ||
|
||
```js | ||
const humanReadableFormat = new BigNumber(minQuantityTickSize) | ||
.shiftedBy(-baseDecimals) | ||
.toFixed() | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.