GMX v2 - Trading (#7)

* Move PrivateKeys.cs

* Update gitignore

* Update gitignore

* updt

* Extract GmxServiceTests.cs

* Refact

* update todo

* Update code

* Fix hashdata

* Replace static token hashed datas

* Set allowance

* Add get orders

* Add get orders tests

* Add ignore

* add close orders

* revert

* Add get gas limit

* Start increasePosition. Todo: Finish GetExecutionFee and estimateGas

* little refact

* Update gitignore

* Fix namespaces and clean repo

* Add tests samples

* Add execution fee

* Add increase position

* Handle backtest on the frontend

* Add tests

* Update increase

* Test increase

* fix increase

* Fix size

* Start get position

* Update get positions

* Fix get position

* Update rpc and trade mappers

* Finish close position

* Fix leverage
This commit is contained in:
Oda
2025-01-30 23:06:22 +07:00
committed by GitHub
parent ecaa89c67b
commit 65bdb8e34f
156 changed files with 11253 additions and 4073 deletions

View File

@@ -1,6 +1,7 @@
using Managing.Common;
using Nethereum.Util;
namespace Managing.Infrastructure.Evm.Models.Gmx.v2;
namespace Managing.Infrastructure.Evm.Services.Gmx;
public static class TokenV2Service
{
@@ -11,7 +12,8 @@ public static class TokenV2Service
Name = "Ethereum",
Symbol = "ETH",
Decimals = 18,
Address = Nethereum.Util.AddressUtil.ZERO_ADDRESS,
PriceDecimals = 12,
Address = AddressUtil.ZERO_ADDRESS,
IsNative = true,
IsShortable = true,
ImageUrl = "https://assets.coingecko.com/coins/images/279/small/ethereum.png?1595348880",
@@ -23,6 +25,7 @@ public static class TokenV2Service
Name = "Wrapped Ethereum",
Symbol = "WETH",
Decimals = 18,
PriceDecimals = 12,
Address = Constants.GMX.TokenAddress.WETH,
IsWrapped = true,
BaseSymbol = "ETH",
@@ -35,6 +38,7 @@ public static class TokenV2Service
Name = "Wrapped Stacked Ethereum",
Symbol = "WSTETH",
Decimals = 18,
PriceDecimals = 12,
Address = Constants.GMX.TokenAddress.WSTETH,
IsWrapped = true,
BaseSymbol = "wstETH",
@@ -47,6 +51,7 @@ public static class TokenV2Service
Symbol = "BTC",
AssetSymbol = "WBTC",
Decimals = 8,
PriceDecimals = 22,
Address = Constants.GMX.TokenAddress.WBTC,
IsShortable = true,
ImageUrl = "https://assets.coingecko.com/coins/images/26115/thumb/btcb.png?1655921693",
@@ -423,6 +428,11 @@ public static class TokenV2Service
return $"{longToken}-{shortToken}";
}
public static GmxToken GetByTicker(Enums.Ticker ticker)
{
return TOKENS.FirstOrDefault(t => t.Symbol == ticker.ToString()) ?? throw new InvalidOperationException();
}
}
public class GmxToken