Backend Types

gTrade's backend return types

TradeContainerBackend
type TradeContainerBackend {
  trade: TradeBackend;
  tradeInfo: TradeInfoBackend;
  initialAccFees: TradeInitialAccFeesBackend;
  liquidationParams: LiquidationParamsBackend;
}
TradeBackend
type TradeBackend {
  user: string;
  index: string;
  pairIndex: string;
  leverage: string; // 1e3
  long: boolean;
  isOpen: boolean;
  collateralIndex: string;
  tradeType: string;
  collateralAmount: string; // collat decimals
  openPrice: string; // 1e10
  tp: string; // 1e10
  sl: string; // 1e10
}
TradeInfoBackend
type TradeInfoBackend {
  createdBlock: string;
  tpLastUpdatedBlock: string;
  slLastUpdatedBlock: string;
  maxSlippageP: string; // 1e3
  lastOiUpdateTs: number;
  collateralPriceUsd: string; // 1e8
  contractsVersion: string;
  lastPosIncreaseBlock: string;
}
TradeInitialAccFeesBackend
type TradeInitialAccFeesBackend {
  accPairFee: string; // 1e10
  accGroupFee: string; // 1e10
  block: string;
}
LiquidationParamsBackend
type LiquidationParamsBackend {
  maxLiqSpreadP: string; // 1e12
  startLiqThresholdP: string; // 1e12
  endLiqThresholdP: string; // 1e12
  startLeverage: string; // 1e3
  endLeverage: string; // 1e3
}
TradingGroupBackend
type TradingGroupBackend {
  name: string;
  minLeverage: string;
  maxLeverage: string;
}
FeeBackend
type FeeBackend {
  openFeeP: string; // 1e12
  closeFeeP: string; // 1e12
  oracleFeeP: string; // 1e12
  triggerOrderFeeP: string; // 1e12
  minPositionSizeUsd: string; // 1e18
}
PairDepthBackend
type PairDepthBackend {
  onePercentDepthAboveUsd: string;
  onePercentDepthBelowUsd: string;
}
PairParamsBorrowingFeesBackend
type PairParamsBorrowingFeesBackend {
  pairs: PairBorrowingFeesBackendPair[];
  groups: PairBorrowingFeesBackendGroup[];
}
PairBackend
type PairBackend {
  from: string;
  to: string;
  spreadP: string; // 1e12
  groupIndex: string;
  feeIndex: string;
}
GlobalTradingVariablesBackend
type GlobalTradingVariablesBackend {
  lastRefreshed: string;
  refreshId: number;
  tradingState: number;
  maxGainP: number;
  marketOrdersTimeoutBlocks: number;
  pairs: PairBackend[];
  groups: TradingGroupBackend[];
  fees: FeeBackend[];
  pairInfos: PairInfosBackend;
  collaterals: CollateralBackend[];
  sssTokenBalance: string;
  sssLegacyTokenBalance: string;
  sssRewardTokens: string[];
  vaultClosingFeeP: string;
  maxNegativePnlOnOpenP: number;
  blockConfirmations: number;
  oiWindowsSettings: OiWindowsSettingsBackend;
  oiWindows: OiWindowsBackend[];
  feeTiers: FeeTiersBackend;
  allTrades: TradeContainerBackend[];
  currentBlock: number;
  currentL1Block: number;
  isForexOpen: boolean;
  isStocksOpen: boolean;
  isIndicesOpen: boolean;
  isCommoditiesOpen: boolean;
  liquidationParams: {
    groups: LiquidationParamsBackend[];
    pairs: LiquidationParamsBackend[];
  };
}
PairInfosBackend
type PairInfosBackend {
  maxLeverages: number[];
  pairDepths: PairDepthBackend[];
  pairFactors: PairFactorBackend[];
}
TraderInfoBackend
type TraderInfoBackend = {
  lastDayUpdated: number;
  trailingPoints: string;
}
UserTradingVariablesBackend
type UserTradingVariablesBackend {
  pendingMarketOrdersIds: number[];
  pendingMarketOrders: number[];
  feeTiers: TraderFeeTiersBackend;
  collaterals: Array<{ balance: string; allowance: string; decimals: number }>;
}
PairOiBackend
type PairOiBackend = {
  oiLongUsd: string; // 1e18
  oiShortUsd: string; // 1e18
}
OiWindowsBackend
type OiWindowsBackend = {
  [key: string]: PairOiBackend;
}
OiWindowsSettingsBackend
type OiWindowsSettingsBackend = {
  startTs: number;
  windowsDuration: number;
  windowsCount: number;
}
CollateralConfigBackend
type CollateralConfigBackend = {
  precision: string;
  precisionDelta: string;
  decimals: number;
}
FeeTiersBackend
type FeeTiersBackend = {
  tiers: Array<{ feeMultiplier: string; pointsThreshold: string }>; // 1e3, 1
  multipliers: string[]; // 1e3
  currentDay: number;
}
TraderFeeTiersBackend
type TraderFeeTiersBackend = {
  traderInfo: TraderInfoBackend;
  lastDayUpdatedPoints: string;
  inboundPoints: string; // 1e18
  outboundPoints: string; // 1e18
  expiredPoints: string[]; // 1e18
}
PairFactorBackend
type PairFactorBackend = {
  cumulativeFactor: string; // 1e10
  protectionCloseFactor: string; // 1e10
  protectionCloseFactorBlocks: string;
}
OpenInterestBackend
type OpenInterestBackend {
  long: string; // 1e10
  short: string; // 1e10
  max: string; // 1e10
}
CollateralBackend
type CollateralBackend {
  collateralIndex: number;
  collateral: string;
  symbol: string;
  isActive: boolean;
  prices: TokenPrices;
  collateralConfig: CollateralConfigBackend;
  gToken: {
    address: string;
    currentBalanceCollateral: string;
    maxBalanceCollateral: string;
    marketCap: string;
  };
  borrowingFees: PairParamsBorrowingFeesBackend;
}
CollateralConfigBackend
type CollateralConfigBackend = {
  precision: string;
  precisionDelta: string;
  decimals: number;
}
PairBorrowingFeesBackendPair
type PairBorrowingFeesBackendPair {
  oi: OpenInterestBackend;
  feePerBlock: string; // 1e10
  accFeeLong: string; // 1e10
  accFeeShort: string; // 1e10
  accLastUpdatedBlock: string;
  feeExponent: string;
  groups: PairBorrowingFeesBackendPairGroup[];
}
PairBorrowingFeesBackendPairGroup
type PairBorrowingFeesBackendPairGroup {
  groupIndex: string;
  block: string;
  initialAccFeeLong: string; // 1e10
  initialAccFeeShort: string; // 1e10
  prevGroupAccFeeLong: string; // 1e10
  prevGroupAccFeeShort: string; // 1e10
  pairAccFeeLong: string; // 1e10
  pairAccFeeShort: string; // 1e10
}
PairBorrowingFeesBackendGroup
type PairBorrowingFeesBackendGroup {
  oi: OpenInterestBackend;
  feePerBlock: string; // 1e10
  accFeeLong: string; // 1e10
  accFeeShort: string; // 1e10
  accLastUpdatedBlock: string;
  feeExponent: string;
}

Last updated