import { CurrencyResponseVM, getCapitalV1PublicCurrencyAll, getExchangeV1PublicAlltickers24hr, getExchangeV1PublicMarkets, getWalletV1PrivateUserassetSpotDefaultAll, MarketSymbolResponseVM, MarketTickerPriceResponseVM, UserAssetResponseVM, } from "../../services"; import { MarketResponse } from "../types"; import { getMockAdapter } from "./mockAdapter"; const MarketResponseFilters: MarketSymbolResponseVM["filters"] = [ { filterType: "MIN_NOTIONAL" as const, minNotional: 2000000, applyToMarket: true, avgPriceMins: 5, }, { filterType: "PRICE_FILTER" as const, maxPrice: 250000000000, minPrice: 0.0001, tickSize: 10000, }, { filterType: "LOT_SIZE" as const, maxQty: 9000, minQty: 0.00001, stepSize: 0.00001, }, { filterType: "MARKET_LOT_SIZE" as const, maxQty: 196.94887934, minQty: 0, stepSize: 0, }, { filterType: "MAX_NUM_ALGO_ORDERS" as const, maxNumAlgoOrders: 200, }, { filterType: "MAX_NUM_ORDERS" as const, maxNumOrders: 200, }, ]; const marketsResponse: MarketResponse = { timeZone: "UTC", serverTime: 1653212584679, rateLimits: [ { interval: "Minute", type: "REQUEST_WEIGHT", intervalNumber: 1, limit: 1200, }, { interval: "Second", type: "ORDERS", intervalNumber: 10, limit: 50, }, { interval: "Day", type: "ORDERS", intervalNumber: 1, limit: 1600, }, { interval: "Minute", type: "RAW_REQUESTS", intervalNumber: 5, limit: 6100, }, ], symbols: [ { name: "BTCUSDT", status: "PRE_DELIVERING", baseAsset: "BTC", baseAssetPrecision: 8, quoteAsset: "USDT", quoteAssetPrecision: 8, orderTypes: [ "LIMIT", "LIMIT_MAKER", "MARKET", "STOP_LOSS_LIMIT", "TAKE_PROFIT_LIMIT", ], iceBergAllowed: false, isSpotTradingAllowed: true, isMarginTradingAllowed: false, ocoAllowed: false, quoteOrderQuantityMarketAllowed: true, baseCommissionPrecision: 8, quoteCommissionPrecision: 8, permissions: ["SPOT"], filters: [ { filterType: "MIN_NOTIONAL" as const, minNotional: 10, applyToMarket: true, avgPriceMins: 5, }, { filterType: "PRICE_FILTER" as const, maxPrice: 1000000, minPrice: 0.01, tickSize: 0.01, }, { filterType: "LOT_SIZE" as const, maxQty: 9000, minQty: 0.000001, stepSize: 0.00001, }, { filterType: "MARKET_LOT_SIZE" as const, maxQty: 196.94887934, minQty: 0, stepSize: 0, }, { filterType: "MAX_NUM_ALGO_ORDERS" as const, maxNumAlgoOrders: 200, }, { filterType: "MAX_NUM_ORDERS" as const, maxNumOrders: 200, }, ], }, { name: "BTCIRR", status: "PRE_DELIVERING", baseAsset: "BTC", baseAssetPrecision: 8, quoteAsset: "IRR", quoteAssetPrecision: 0, orderTypes: [ "LIMIT", "LIMIT_MAKER", "MARKET", "STOP_LOSS_LIMIT", "TAKE_PROFIT_LIMIT", ], iceBergAllowed: false, isSpotTradingAllowed: true, isMarginTradingAllowed: false, ocoAllowed: false, quoteOrderQuantityMarketAllowed: true, baseCommissionPrecision: 8, quoteCommissionPrecision: 0, permissions: ["SPOT"], filters: MarketResponseFilters, }, { name: "ETHIRR", status: "PRE_DELIVERING", baseAsset: "ETH", baseAssetPrecision: 8, quoteAsset: "IRR", quoteAssetPrecision: 0, orderTypes: [ "LIMIT", "LIMIT_MAKER", "MARKET", "STOP_LOSS_LIMIT", "TAKE_PROFIT_LIMIT", ], iceBergAllowed: false, isSpotTradingAllowed: true, isMarginTradingAllowed: false, ocoAllowed: false, quoteOrderQuantityMarketAllowed: true, baseCommissionPrecision: 8, quoteCommissionPrecision: 0, permissions: ["SPOT"], filters: [ { filterType: "MIN_NOTIONAL" as const, minNotional: 3200000, applyToMarket: true, avgPriceMins: 5, }, { filterType: "PRICE_FILTER" as const, maxPrice: 250000000000, minPrice: 10000, tickSize: 10, }, { filterType: "LOT_SIZE" as const, maxQty: 92233, minQty: 0.00001, stepSize: 0.0001, }, { filterType: "MARKET_LOT_SIZE" as const, maxQty: 50.06534534, minQty: 0, stepSize: 0, }, { filterType: "MAX_NUM_ALGO_ORDERS" as const, maxNumAlgoOrders: 200, }, { filterType: "MAX_NUM_ORDERS" as const, maxNumOrders: 200, }, ], }, { name: "TRXIRR", status: "PRE_DELIVERING", baseAsset: "TRX", baseAssetPrecision: 8, quoteAsset: "IRR", quoteAssetPrecision: 0, orderTypes: [ "LIMIT", "LIMIT_MAKER", "MARKET", "STOP_LOSS_LIMIT", "TAKE_PROFIT_LIMIT", ], iceBergAllowed: false, isSpotTradingAllowed: true, isMarginTradingAllowed: false, ocoAllowed: false, quoteOrderQuantityMarketAllowed: true, baseCommissionPrecision: 8, quoteCommissionPrecision: 0, permissions: ["SPOT"], filters: [ { filterType: "MIN_NOTIONAL" as const, minNotional: 3200000, applyToMarket: true, avgPriceMins: 5, }, { filterType: "PRICE_FILTER" as const, maxPrice: 250000000000, minPrice: 100, tickSize: 10, }, { filterType: "LOT_SIZE" as const, maxQty: 9000000, minQty: 0.1, stepSize: 0.1, }, { filterType: "MARKET_LOT_SIZE" as const, maxQty: 2187535.21923611, minQty: 0, stepSize: 0, }, { filterType: "MAX_NUM_ALGO_ORDERS" as const, maxNumAlgoOrders: 200, }, { filterType: "MAX_NUM_ORDERS" as const, maxNumOrders: 200, }, ], }, ], exchangeFilters: [], }; export const marketTickerResponse: MarketTickerPriceResponseVM[] = [ { symbol: "BTCUSDT", baseCurrencySymbol: "BTC", quoteCurrencySymbol: "USDT", symbolPublicOfferingDate: 1647156633053, isHighlight: false, priceChange: 0, priceChangePercent: 0, weightedAveragePrice: 0, lastPrice: 0, lastQuantity: 0, openPrice: 0, highPrice: 0, lowPrice: 0, openTime: 1647153959119, closeTime: 1647240359119, firstTradeId: 0, lastTradeId: 0, totalTrades: 0, prevDayClosePrice: 0, bidPrice: 0, bidQuantity: 0, askPrice: 0, askQuantity: 0, baseVolume: 0, quoteVolume: 0, smartTradeEngine: false, lastMarketInfoChangeDate: 1647153959119, }, { symbol: "BTCIRR", baseCurrencySymbol: "BTC", quoteCurrencySymbol: "IRR", symbolPublicOfferingDate: 1647156633053, isHighlight: false, priceChange: 0, priceChangePercent: 0, weightedAveragePrice: 200000000000, lastPrice: 10_000_000_000, lastQuantity: 0.00001, openPrice: 200000000000, highPrice: 200000000000, lowPrice: 200000000000, openTime: 1647153959811, closeTime: 1647240359811, firstTradeId: 25, lastTradeId: 25, totalTrades: 1, prevDayClosePrice: 0, bidPrice: 0, bidQuantity: 0, askPrice: 0, askQuantity: 0, baseVolume: 0.00001, quoteVolume: 2000000, smartTradeEngine: false, lastMarketInfoChangeDate: 1647153959119, }, { symbol: "ETHIRR", baseCurrencySymbol: "ETH", quoteCurrencySymbol: "IRR", symbolPublicOfferingDate: 1647156633053, isHighlight: false, priceChange: 0, priceChangePercent: 0, weightedAveragePrice: 0, lastPrice: 0, lastQuantity: 0, openPrice: 0, highPrice: 0, lowPrice: 0, openTime: 1647153960169, closeTime: 1647240360169, firstTradeId: 0, lastTradeId: 0, totalTrades: 0, prevDayClosePrice: 0, bidPrice: 0, bidQuantity: 0, askPrice: 0, askQuantity: 0, baseVolume: 0, quoteVolume: 0, smartTradeEngine: false, lastMarketInfoChangeDate: 1647153959119, }, { symbol: "TRXIRR", baseCurrencySymbol: "TRX", quoteCurrencySymbol: "IRR", symbolPublicOfferingDate: 1647156633053, isHighlight: false, priceChange: 0, priceChangePercent: 0, weightedAveragePrice: 0, lastPrice: 0, lastQuantity: 0, openPrice: 0, highPrice: 0, lowPrice: 0, openTime: 1647153960248, closeTime: 1647240360248, firstTradeId: 0, lastTradeId: 0, totalTrades: 0, prevDayClosePrice: 0, bidPrice: 0, bidQuantity: 0, askPrice: 0, askQuantity: 0, baseVolume: 0, quoteVolume: 0, smartTradeEngine: false, lastMarketInfoChangeDate: 1647153959119, }, ]; const currencyResponse: CurrencyResponseVM[] = [ { name: "Rial", symbol: "IRR", decimalDigits: 0, displayDecimalDigits: 0, currencyType: "Fiat", isDefaultFiat: false, isDefaultCrypto: false, logoAddress: "currency\\IRR.jpg?v=1647178074683", canBuy: false, canWithdraw: false, canDeposit: false, canTrade: true, canSettlement: false, canCharge: false, specialTips: undefined, enabled: false, domainCurrencyClassFeeRate: 1, }, { name: "Bitcoin", symbol: "BTC", decimalDigits: 8, displayDecimalDigits: 8, currencyType: "Crypto", isDefaultFiat: false, isDefaultCrypto: false, logoAddress: "currency\\BTC.png?v=1647177396090", canBuy: true, canWithdraw: false, canDeposit: false, canTrade: true, canSettlement: false, canCharge: false, specialTips: undefined, enabled: false, domainCurrencyClassFeeRate: 1, }, { name: "Ethereum", symbol: "ETH", decimalDigits: 8, displayDecimalDigits: 8, currencyType: "Crypto", isDefaultFiat: false, isDefaultCrypto: false, logoAddress: "currency\\ETH.png?v=1647177822502", canBuy: true, canWithdraw: false, canDeposit: false, canTrade: true, canSettlement: false, canCharge: false, specialTips: undefined, enabled: false, domainCurrencyClassFeeRate: 1, }, { name: "TRON", symbol: "TRX", decimalDigits: 8, displayDecimalDigits: 8, currencyType: "Crypto", isDefaultFiat: false, isDefaultCrypto: false, logoAddress: "currency\\TRX.png?v=1647177584286", canBuy: true, canWithdraw: false, canDeposit: false, canTrade: true, canSettlement: false, canCharge: false, specialTips: undefined, enabled: false, domainCurrencyClassFeeRate: 1, }, ]; const userAssetResponse: UserAssetResponseVM[] = [ { availableRemain: 1_000_000_0, inUseRemain: 0, symbol: "IRR", totalRemain: 10_000_000, walletName: "IRR-1-9010066-1", walletNumber: "IRR-1-9010066-1", }, { inUseRemain: 0, symbol: "BTC", walletName: "BTC-1-9010066-1", walletNumber: "BTC-1-9010066-1", totalRemain: 0.5, availableRemain: 0.5, }, ]; // Mock any GET request to /users // arguments for reply are (status, data, headers) export const applyMarketMock = () => { const mock = getMockAdapter(); mock.onGet(getExchangeV1PublicMarkets.key).reply(200, marketsResponse); mock .onGet(getExchangeV1PublicAlltickers24hr.key) .reply(200, marketTickerResponse); mock.onGet(getCapitalV1PublicCurrencyAll.key).reply(200, currencyResponse); mock .onGet(getWalletV1PrivateUserassetSpotDefaultAll.key) .reply(200, userAssetResponse); };