text: import { request } from './utils.js';
  
  export default (apiKey) => ({
    us: {
      lastQuote: async (options) => {
        const { params = {}, queries = {} } = options;
        return await request({ path: 'last/stock', apiKey, params, queries });
      },
  
      lastQuoteMulti: async (options) => {
        const { params = {}, queries = {} } = options;
        return await request({ path: 'last/stocks', apiKey, params, queries });
      },
  
      lastTrade: async (options) => {
        const { params = {}, queries = {} } = options;
        return await request({ path: 'last/trade/stock', apiKey, params, queries });
      },
  
      lastTradeMulti: async (options) => {
        const { params = {}, queries = {} } = options;
        return await request({ path: 'last/trade/stocks', apiKey, params, queries });
      },
  
      endOfDay: async (options) => {
        const { params = {}, queries = {} } = options;
        return await request({ path: 'history/stock/open-close', apiKey, params, queries });
      },
  
      orderBook: async (options) => {
        const { params = {}, queries = {} } = options;
        return await request({ path: 'history/stock/all', apiKey, params, queries });
      },
  
      aggregates: async (options) => {
        const { params = {}, queries = {} } = options;
        return await request({ path: 'agg/stock', apiKey, params, queries });
      },
  
      prevClose: async (options) => {
        const { params = {}, queries = {} } = options;
        return await request({ path: 'agg/stock/prev-close', apiKey, params, queries });
      },
    },
  
    // London stock market exchange
    lse: {
      lastPrice: async (options) => {
        const { params = {}, queries = {} } = options;
        return await request({ path: 'last/stock/uk', apiKey, params, queries });
      },
      aggregates: async (options) => {
        const { params = {}, queries = {} } = options;
        return await request({ path: 'agg/stock/global/uk', apiKey, params, queries });
      },
    },
  
    // Canada market
    canada: {
      lastPrice: async (options) => {
        const { params = {}, queries = {} } = options;
        return await request({ path: 'last/stock/canada', apiKey, params, queries });
      },
      aggregates: async (options) => {
        const { params = {}, queries = {} } = options;
        return await request({ path: 'agg/stock/ca', apiKey, params, queries });
      },
    },
  
    // Moscow stock market exchange
    moex: {
      lastPrice: async (options) => {
        const { params = {}, queries = {} } = options;
        return await request({ path: 'last/stock/moex', apiKey, params, queries });
      },
      aggregates: async (options) => {
        const { params = {}, queries = {} } = options;
        return await request({ path: 'agg/stock/moex', apiKey, params, queries });
      },
    },
  });
  