// Asset-wise Price Interval Configuration
const ASSET_CONFIGS = {
    'EUR/USD': {
        decimalPoints: 5,
        pipValue: 0.00001,
        baseInterval: 0.00010,
        priceInterval: [0.00010, 0.00020]
    },
    'EUR/JPY': {
        decimalPoints: 3,
        pipValue: 0.001,
        baseInterval: 0.010,
        priceInterval: [0.010, 0.020]
    },
    'AUD/JPY': {
        decimalPoints: 3,
        pipValue: 0.001,
        baseInterval: 0.020,
        priceInterval: [0.020, 0.050]
    }, 
    'CAD/JPY': {
        decimalPoints: 3,
        pipValue: 0.001,
        baseInterval: 0.010,
        priceInterval: [0.010, 0.020]
    }, 
    'USD/CHF': {
        decimalPoints: 5,
        pipValue: 0.00001,
        baseInterval: 0.00010,
        priceInterval: [0.00010, 0.00020]
    }, 
    'USD/JPY': {
        decimalPoints: 3,
        pipValue: 0.001,
        baseInterval: 0.020,
        priceInterval: [0.020, 0.050]
    }, 
    'USD/BRL (OTC)': {
        decimalPoints: 5,
        pipValue: 0.00001,
        baseInterval: 0.00020,
        priceInterval: [0.00020, 0.00050]
    },
    'USD/ARS (OTC)': {
        decimalPoints: 2,
        pipValue: 0.01,
        baseInterval: 0.20,
        priceInterval: [0.20, 0.50]
    },
    'USD/BDT (OTC)': {
        decimalPoints: 3,
        pipValue: 0.001,
        baseInterval: 0.050,
        priceInterval: [0.020, 0.050]
    },
    'USD/COP (OTC)': {
        decimalPoints: 2,
        pipValue: 0.01,
        baseInterval: 0.20,
        priceInterval: [0.20, 0.50, 1.00]
    },
    'USD/DZD (OTC)': {
        decimalPoints: 3,
        pipValue: 0.001,
        baseInterval: 0.020,
        priceInterval: [0.020, 0.050]
    },
    'USD/EGP (OTC)': {
        decimalPoints: 4,
        pipValue: 0.0001,
        baseInterval: 0.0020,
        priceInterval: [0.0020, 0.0050]
    },
    'USD/IDR (OTC)': {
        decimalPoints: 2,
        pipValue: 0.01,
        baseInterval: 1.00,
        priceInterval: [1.00, 2.00]
    },
    'USD/INR (OTC)': {
        decimalPoints: 4,
        pipValue: 0.0001,
        baseInterval: 0.0020,
        priceInterval: [0.0020, 0.0050]
    },
    'USD/MXN (OTC)': {
        decimalPoints: 5,
        pipValue: 0.00001,
        baseInterval: 0.00020,
        priceInterval: [0.00020, 0.0005]
    },
    'USD/PHP (OTC)': {
        decimalPoints: 3,
        pipValue: 0.001,
        baseInterval: 0.020,
        priceInterval: [0.020, 0.050]
    },
    'USD/PKR (OTC)': {
        decimalPoints: 3,
        pipValue: 0.001,
        baseInterval: 0.020,
        priceInterval: [0.020, 0.050, 0.100]
    },
    'USD/TRY (OTC)': {
        decimalPoints: 4,
        pipValue: 0.0001,
        baseInterval: 0.0020,
        priceInterval: [0.0020, 0.0050, 0.0100]
    },
    'USD/ZAR (OTC)': {
        decimalPoints: 5,
        pipValue: 0.00001,
        baseInterval: 0.00020,
        priceInterval: [0.00020, 0.00050, 0.00100]
    },
    'USD/NGN (OTC)': {
        decimalPoints: 3,
        pipValue: 0.001,
        baseInterval: 0.020,
        priceInterval: [0.020, 0.050]
    },
    'Johnson & Johnson (OTC)': {
        decimalPoints: 3,
        pipValue: 0.001,
        baseInterval: 0.020,
        priceInterval: [0.020, 0.050]
    },
    'Bitcoin (OTC)': {
        decimalPoints: 2,
        pipValue: 10.00,
        baseInterval: 10.00,
        priceInterval: [10.00, 20.00]
    },
    'Intel (OTC)': {
        decimalPoints: 3,
        pipValue: 0.001,
        baseInterval: 0.020,
        priceInterval: [0.020, 0.050]
    },
    'McDonald\'s (OTC)': {
        decimalPoints: 3,
        pipValue: 0.001,
        baseInterval: 0.020,
        priceInterval: [0.020, 0.050]
    },
    'American Express (OTC)': {
        decimalPoints: 3,
        pipValue: 0.001,
        baseInterval: 0.020,
        priceInterval: [0.020, 0.050]
    },
    'Pfizer Inc (OTC)': {
        decimalPoints: 3,
        pipValue: 0.001,
        baseInterval: 0.020,
        priceInterval: [0.020, 0.050]
    },
    'Microsoft (OTC)': {
        decimalPoints: 3,
        pipValue: 0.001,
        baseInterval: 0.020,
        priceInterval: [0.020, 0.050]
    },
    'FACEBOOK INC (OTC)': {
        decimalPoints: 2,
        pipValue: 0.01,
        baseInterval: 0.20,
        priceInterval: [0.20, 0.50]
    },
    'Boeing Company (OTC)': {
        decimalPoints: 2,
        pipValue: 0.01,
        baseInterval: 0.20,
        priceInterval: [0.10, 0.20, 0.50]
    },
    'USCrude (OTC)': {
        decimalPoints: 3,
        pipValue: 0.001,
        baseInterval: 0.020,
        priceInterval: [0.020, 0.050]
    },
    'UKBrent (OTC)': {
        decimalPoints: 3,
        pipValue: 0.001,
        baseInterval: 0.050,
        priceInterval: [0.050, 0.100]
    },
    
};

// Helper functions
function getAssetConfig(asset) {
    return ASSET_CONFIGS[asset];
}

function formatPrice(price, asset) {
    const config = getAssetConfig(asset);
    return parseFloat(price).toFixed(config.decimalPoints);
}

// Export for use in other modules
if (typeof module !== 'undefined' && module.exports) {
    module.exports = {
        ASSET_CONFIGS,
        getAssetConfig,
        formatPrice
    };
}