Michael Yuan commited on
Commit ·
9c0dd93
1
Parent(s): 03939ed
Add data
Browse filesSigned-off-by: Michael Yuan <michael@michaelyuan.com>
README.md
CHANGED
|
@@ -1,3 +1,81 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
---
|
| 4 |
+
|
| 5 |
+
Prepare Qdrant:
|
| 6 |
+
|
| 7 |
+
```
|
| 8 |
+
mkdir qdrant_storage
|
| 9 |
+
mkdir qdrant_snapshots
|
| 10 |
+
```
|
| 11 |
+
|
| 12 |
+
Start Qdrant:
|
| 13 |
+
|
| 14 |
+
```
|
| 15 |
+
docker run -d -p 6333:6333 -p 6334:6334 \
|
| 16 |
+
-v $(pwd)/qdrant_storage:/qdrant/storage:z \
|
| 17 |
+
-v $(pwd)/qdrant_snapshots:/qdrant/snapshots:z \
|
| 18 |
+
qdrant/qdrant
|
| 19 |
+
```
|
| 20 |
+
|
| 21 |
+
Create collection:
|
| 22 |
+
|
| 23 |
+
```
|
| 24 |
+
curl -X PUT 'http://localhost:6333/collections/ktx.finance' \
|
| 25 |
+
-H 'Content-Type: application/json' \
|
| 26 |
+
--data-raw '{
|
| 27 |
+
"vectors": {
|
| 28 |
+
"size": 384,
|
| 29 |
+
"distance": "Cosine",
|
| 30 |
+
"on_disk": true
|
| 31 |
+
}
|
| 32 |
+
}'
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
Query collection:
|
| 36 |
+
|
| 37 |
+
```
|
| 38 |
+
curl 'http://localhost:6333/collections/ktx.finance'
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
Optional: delete collection
|
| 42 |
+
|
| 43 |
+
```
|
| 44 |
+
curl -X DELETE 'http://localhost:6333/collections/ktx.finance'
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
Get embedding model:
|
| 48 |
+
|
| 49 |
+
```
|
| 50 |
+
curl -LO https://huggingface.co/second-state/All-MiniLM-L6-v2-Embedding-GGUF/resolve/main/all-MiniLM-L6-v2-ggml-model-f16.gguf
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
Get the embedding app:
|
| 54 |
+
|
| 55 |
+
```
|
| 56 |
+
curl -LO https://raw.githubusercontent.com/YuanTony/chemistry-assistant/main/rag-embeddings/create_embeddings.wasm
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
Create and save the generated embeddings:
|
| 60 |
+
|
| 61 |
+
```
|
| 62 |
+
wasmedge --dir .:. --nn-preload default:GGML:AUTO:all-MiniLM-L6-v2-ggml-model-f16.gguf create_embeddings.wasm default ktx.finance 384 ktx_docs_20240322.txt
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
Check the results:
|
| 66 |
+
|
| 67 |
+
```
|
| 68 |
+
curl 'http://localhost:6333/collections/ktx.finance'
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
Create snapshot:
|
| 72 |
+
|
| 73 |
+
```
|
| 74 |
+
curl -X POST 'http://localhost:6333/collections/ktx.finance/snapshots'
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
Access the snapshots:
|
| 78 |
+
|
| 79 |
+
```
|
| 80 |
+
ls qdrant_snapshots/ktx.finance/
|
| 81 |
+
```
|
ktx.finance_384_all-minilm-l6-v2_f16.snapshot
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7ccbfe946e501ca5e5726be72e8eb5bef449cd3654de50dee05a4bfcbcd5fbe4
|
| 3 |
+
size 205881344
|
ktx.finance_384_all-minilm-l6-v2_f16.snapshot.checksum
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
7ccbfe946e501ca5e5726be72e8eb5bef449cd3654de50dee05a4bfcbcd5fbe4
|
ktx_docs_20240322.txt
CHANGED
|
@@ -58,6 +58,7 @@ Learn how to deposit liquidity into KLP here https://docs.ktx.finance/tutorials/
|
|
| 58 |
|
| 59 |
Market Making with KLP
|
| 60 |
Depositors of KLP provide liquidity and acts as a market maker for perpetuals trading / spot swaps on KTX.Finance. As the counterparty to trades, the different sides of the pool caters to different directions of trading.
|
|
|
|
| 61 |
Long Trades: On KTX.Finance, long trades, such as long BTC positions, are physically settled. Trade settlement occurs in the respective trading pair. Profits or losses from long positions are realized in the underlying asset itself.
|
| 62 |
Parameters:
|
| 63 |
Entry Price: $10,000
|
|
@@ -72,6 +73,7 @@ Result: The trader profits 50%, and 0.5 BTC from the Reserved Amount is paid out
|
|
| 72 |
Exit Price = $9,900 (-1% price movement)
|
| 73 |
Loss Calculation: -1% * 50x = -50%
|
| 74 |
Result: The trader incurs a 50% loss, and 0.5 BTC will be added to the KLP pool.
|
|
|
|
| 75 |
Short Trades: In contrast, short trades on KTX.Finance are cash settled. This implies that the settlement for short positions is in USDT.
|
| 76 |
Parameters:
|
| 77 |
Entry Price: $10,000
|
|
@@ -93,6 +95,7 @@ LPs within the KLP pool are exposed to price movements in the underlying assets
|
|
| 93 |
The value of LPs' holdings are sensitive to fluctuations in the prices of the pool's assets, reflecting the inherent volatility in the cryptocurrency market. A decline in the prices of the underlying assets may result in a negative impact on LPs' holdings.
|
| 94 |
LPs inherently possess long exposure to the assets within the KLP pool by depositing into it. To mitigate and manage their exposure to asset price changes, LPs can short the relevant assets in their respective weightages within the pool. Creating a delta-neutral environment helps LPs balance their portfolio, offsetting the impact of price fluctuations in the underlying assets.
|
| 95 |
KTX is working with several institutional trading houses and protocols to provide LPs with strategies to achieve market neutral returns.
|
|
|
|
| 96 |
2. LPs Exposure to Trading Skew
|
| 97 |
As KLP assumes the role of the counterparty to trades on KTX, the pool's performance is inversely linked to the success of trading activity.
|
| 98 |
In strongly trending markets (bull/bear), where there may be a notable Open Interest (OI) skew, traders might unilaterally enter either long or short positions, especially in markets with a strong trend (e.g., a bull market where most traders prefer long positions).
|
|
@@ -269,6 +272,7 @@ KLP Borrowing Rate Annualized
|
|
| 269 |
KTX Trade Page Position Tab
|
| 270 |
Liquidation Fee
|
| 271 |
Liquidation Fee: 2 USDT
|
|
|
|
| 272 |
A liquidation process is triggered if the asset prices move adversely against the user. In this process, the liquidation contract will automatically close (liquidate) the user's position to prevent further losses.
|
| 273 |
Calculation of liquidation price is shown here.
|
| 274 |
Handling of Fees and Remaining collateral:
|
|
@@ -514,6 +518,7 @@ RewardRouter: "0x207D39314707001Ae36f12335dD8b1F65cD688CA"
|
|
| 514 |
ReferralStorage: "0xbf0D05e5A3D34A428D02c07abE3dE0a2aA2D4937"
|
| 515 |
KtxVester: "0x2E4f63C3ffDF457ff210a29EF10CE3b12c132f0c"
|
| 516 |
ComplexOrderRouter: "0x6154dce92267af35C733dBa5D20E36Ee3F8eD3d8"
|
|
|
|
| 517 |
Arbitrum Contract Addresses
|
| 518 |
KlpManager: "0xfF0255c564F810a5108F00be199600cF520507Ca"
|
| 519 |
KTC: "0x487f6baB6DEC7815dcd7Dfa2C44a8a17bd3dEd27"
|
|
@@ -526,6 +531,7 @@ RewardRouter: "0x9d4c701A5D06a1cd73853ebd3F8d4b32C153bD9A"
|
|
| 526 |
ReferralStorage: "0xdda7BB775fB98cb50345bd7771ae9a5c8A8Db575"
|
| 527 |
KtxVester: "0x04F3Da526671b596b10Ab4A74437d8637d899BF1"
|
| 528 |
ComplexOrderRouter: "0xf399f6d0a6151E77B0f0E9FBbFeb56A21e535e05"
|
|
|
|
| 529 |
BNB Chain Contract Addresses
|
| 530 |
KlpManager: "0xfE824703DF7E6F9A71e8d44c78ba24Ded1F631F30"
|
| 531 |
KTC: "0x545356d4d69d8cD1213Ee7e339867574738751CA"
|
|
@@ -1115,4 +1121,4 @@ B. Oracle Manipulation
|
|
| 1115 |
Given that GNS had the flexibility to list exotic assets - the reliability of these assets in terms of liquidity depth and CEX price reliability is still yet to be tested.
|
| 1116 |
C. Single Stablecoin Risk
|
| 1117 |
This risk only came to light due to the $USDC saga. The $USDC saga posed a big risk to $DAI and could have potentially brought GNS to its knees.
|
| 1118 |
-
Such a big dependency on a single asset was a risk that our team wasn’t ready to take.
|
|
|
|
| 58 |
|
| 59 |
Market Making with KLP
|
| 60 |
Depositors of KLP provide liquidity and acts as a market maker for perpetuals trading / spot swaps on KTX.Finance. As the counterparty to trades, the different sides of the pool caters to different directions of trading.
|
| 61 |
+
|
| 62 |
Long Trades: On KTX.Finance, long trades, such as long BTC positions, are physically settled. Trade settlement occurs in the respective trading pair. Profits or losses from long positions are realized in the underlying asset itself.
|
| 63 |
Parameters:
|
| 64 |
Entry Price: $10,000
|
|
|
|
| 73 |
Exit Price = $9,900 (-1% price movement)
|
| 74 |
Loss Calculation: -1% * 50x = -50%
|
| 75 |
Result: The trader incurs a 50% loss, and 0.5 BTC will be added to the KLP pool.
|
| 76 |
+
|
| 77 |
Short Trades: In contrast, short trades on KTX.Finance are cash settled. This implies that the settlement for short positions is in USDT.
|
| 78 |
Parameters:
|
| 79 |
Entry Price: $10,000
|
|
|
|
| 95 |
The value of LPs' holdings are sensitive to fluctuations in the prices of the pool's assets, reflecting the inherent volatility in the cryptocurrency market. A decline in the prices of the underlying assets may result in a negative impact on LPs' holdings.
|
| 96 |
LPs inherently possess long exposure to the assets within the KLP pool by depositing into it. To mitigate and manage their exposure to asset price changes, LPs can short the relevant assets in their respective weightages within the pool. Creating a delta-neutral environment helps LPs balance their portfolio, offsetting the impact of price fluctuations in the underlying assets.
|
| 97 |
KTX is working with several institutional trading houses and protocols to provide LPs with strategies to achieve market neutral returns.
|
| 98 |
+
|
| 99 |
2. LPs Exposure to Trading Skew
|
| 100 |
As KLP assumes the role of the counterparty to trades on KTX, the pool's performance is inversely linked to the success of trading activity.
|
| 101 |
In strongly trending markets (bull/bear), where there may be a notable Open Interest (OI) skew, traders might unilaterally enter either long or short positions, especially in markets with a strong trend (e.g., a bull market where most traders prefer long positions).
|
|
|
|
| 272 |
KTX Trade Page Position Tab
|
| 273 |
Liquidation Fee
|
| 274 |
Liquidation Fee: 2 USDT
|
| 275 |
+
|
| 276 |
A liquidation process is triggered if the asset prices move adversely against the user. In this process, the liquidation contract will automatically close (liquidate) the user's position to prevent further losses.
|
| 277 |
Calculation of liquidation price is shown here.
|
| 278 |
Handling of Fees and Remaining collateral:
|
|
|
|
| 518 |
ReferralStorage: "0xbf0D05e5A3D34A428D02c07abE3dE0a2aA2D4937"
|
| 519 |
KtxVester: "0x2E4f63C3ffDF457ff210a29EF10CE3b12c132f0c"
|
| 520 |
ComplexOrderRouter: "0x6154dce92267af35C733dBa5D20E36Ee3F8eD3d8"
|
| 521 |
+
|
| 522 |
Arbitrum Contract Addresses
|
| 523 |
KlpManager: "0xfF0255c564F810a5108F00be199600cF520507Ca"
|
| 524 |
KTC: "0x487f6baB6DEC7815dcd7Dfa2C44a8a17bd3dEd27"
|
|
|
|
| 531 |
ReferralStorage: "0xdda7BB775fB98cb50345bd7771ae9a5c8A8Db575"
|
| 532 |
KtxVester: "0x04F3Da526671b596b10Ab4A74437d8637d899BF1"
|
| 533 |
ComplexOrderRouter: "0xf399f6d0a6151E77B0f0E9FBbFeb56A21e535e05"
|
| 534 |
+
|
| 535 |
BNB Chain Contract Addresses
|
| 536 |
KlpManager: "0xfE824703DF7E6F9A71e8d44c78ba24Ded1F631F30"
|
| 537 |
KTC: "0x545356d4d69d8cD1213Ee7e339867574738751CA"
|
|
|
|
| 1121 |
Given that GNS had the flexibility to list exotic assets - the reliability of these assets in terms of liquidity depth and CEX price reliability is still yet to be tested.
|
| 1122 |
C. Single Stablecoin Risk
|
| 1123 |
This risk only came to light due to the $USDC saga. The $USDC saga posed a big risk to $DAI and could have potentially brought GNS to its knees.
|
| 1124 |
+
Such a big dependency on a single asset was a risk that our team wasn’t ready to take.
|