﻿AG.Data.StockExchange = {
    GetPutThroughByDate: function (floor, date, tradingType) {
        var startDate = date;
        var endDate = date.split(' ')[0] + ' 23:59:59';
        var requestName = 'StockExchangePutThroughByDate' + '_' + floor + '_' + date + '_' + tradingType;
        return AG.ClientAPI.createData(PutThroughDaily, requestName, [{ StockExchange: floor, StartDate: startDate, EndDate: endDate, Type: tradingType}], { static: ['Id', 'Code', 'Name', 'Price', 'Volume'] });
    },
    GetValueByDate: function (floor, date) {

        var requestName = 'ValueByDate' + '_' + floor + '_' + date + '_NoLanguage';
        return AG.ClientAPI.createData(StockExchangeDaily, requestName, [{ Code: floor }, { SessionDate: date}], { static: ['Id', 'Code', 'Name', 'ClosePrice', 'Diff', 'DiffPercent', 'TotalShare', 'TotalValue', 'TotalTrade'] });
    },
    GetListWorldIndex: function (region) {
        // Americas,europe-africa-middle-east,Asia-Pacific
        var requestName = 'GetListWorldIndex'  + '_NoLanguage';
        var data = [];
        if (typeof (region) != 'undefined') {
            for (var i = 0; i < region.length; i++) {
                requestName += '_' + region[i]['Code'];
                data.push({ Code: region[i]['Code'] });
            }
            var objRegion = AG.ClientAPI.createData(Region, requestName, data, { static: ['Id', 'Code', 'Name'] });
            data = [];
            for (var i = 0; i < objRegion.length; i++) {
                data.push({ ParentId: objRegion[i].Id });
            }
        }
        data.push({ Code: '<![CDATA[KOSPI INDEX]]>' });
        data.push({ Code: '<![CDATA[NASDAQ COMPOSITE INDEX]]>' });
        data.push({ Code: '<![CDATA[IBEX 35 INDEX]]>' });
        data.push({ Code: '<![CDATA[DAX INDEX]]>' });
        data.push({ Code: '<![CDATA[NZX 15 GROSS INDEX]]>' });
        data.push({ Code: '<![CDATA[STRAITS TIMES INDEX]]>' });
        data.push({ Code: '<![CDATA[FTSE 100 INDEX]]>' });
        data.push({ Code: '<![CDATA[CAC 40 INDEX]]>' });
        data.push({ Code: '<![CDATA[S&P 500 INDEX]]>' });
        data.push({ Code: '<![CDATA[AEX-Index]]>' });
        data.push({ Code: '<![CDATA[S&P/TSX COMPOSITE INDEX]]>' });
        data.push({ Code: '<![CDATA[SSE COMPONENT STOCK IX]]>' });
        data.push({ Code: '<![CDATA[S&P/ASX 200 INDEX]]>' });
        data.push({ Code: '<![CDATA[DOW JONES INDUS. AVG]]>' });
        data.push({ Code: '<![CDATA[NIKKEI 225]]>' });
        data.push({ Code: '<![CDATA[SWISS MARKET INDEX]]>' });
        data.push({ Code: '<![CDATA[HANG SENG INDEX]]>' });
        data.push({ Status: '00000000-0000-0000-0000-000000000002' });
        return AG.ClientAPI.createData(WorldIndex, requestName, data, { static: ['Id', 'Code', 'Name', 'Value', 'ChangeValue', 'ChangePercent', 'PublishDate'] });
    },
    GetIndexValue: function () {

        return AG.ClientAPI.createData(StockExchangeRealtime, 'StockExchangeIndexValue' + '_NoLanguage', [{ Code: 'HSX' }, { Code: 'HNX' }, { Code: 'UPCOM'}], { static: ['Id', 'Name', 'Code', 'ClosePrice', 'Diff', 'DiffPercent', 'Modified'] }, undefined, undefined, undefined, 0, 60000);
    },
    GetStatisticIndex: function (floor, startDate, endDate, startIndex, endIndex, orderBy, orderType) {

        var order = [];
        if (typeof (orderBy) != "undefined" && orderBy != '')
            order = [{ Field: orderBy, Direction: 'ASC'}];
        else
            order = [{ Field: 'ID', Direction: 'ASC'}];
        if (typeof (orderType) != "undefined" && orderType != '')
            order[0].Direction = orderType;
        if (orderBy != 'Code')
            order.push({ Field: 'Code', Direction: 'ASC' });
        var requestName = 'StatisticsIndex' + '_' + floor + '_' + startDate + '_' + endDate + '_' + startIndex + '_' + endIndex + '_' + orderBy + '_' + orderType + '_NoLanguage';
        return AG.ClientAPI.createData(StockExchangeDaily, requestName, [{ Code: floor }, { StartDate: startDate }, { EndDate: endDate }, { StartIndex: startIndex }, { EndIndex: endIndex}], { static: ['Id', 'SessionDate', 'ClosePrice', 'Diff', 'DiffPercent', 'TotalStockGainCount', 'TotalStockLossCount', 'TotalStockEqualCount', 'TotalShare', 'TotalValue'], dynamic: ['BidVolumeOrderSurplus'] }, order);

    },
    GetCountStatisticIndex: function (floor, startDate, endDate) {

        return StockExchangeDaily.getCount([{ Code: floor }, { StartDate: startDate }, { EndDate: endDate}]);
    },
    GetStatisticIndexToExcel: function (floor, startDate, endDate, orderBy, orderType) {

        var order = [];
        if (typeof (orderBy) != "undefined" && orderBy != '')
            order = [{ Field: orderBy, Direction: 'ASC'}];
        else
            order = [{ Field: 'ID', Direction: 'ASC'}];
        if (typeof (orderType) != "undefined" && orderType != '')
            order[0].Direction = orderType;
        if (orderBy != 'Code')
            order.push({ Field: 'Code', Direction: 'ASC' });
        StockExchangeDaily.toExcel('StatisticIndex', [{ Code: floor }, { StartDate: startDate }, { EndDate: endDate}], { static: ['Id', 'SessionDate', 'ClosePrice', 'Diff', 'DiffPercent', 'TotalStockGainCount', 'TotalStockLossCount', 'TotalShare', 'TotalValue'] }, order);
    },
    GetOverview: function (floor) {

        var requestName = 'StockExchangeOverview' + '_' + floor + '_NoLanguage';
        return AG.ClientAPI.createData(StockExchangeRealtime, requestName, [{ Code: floor}], { static: ['Id', 'Name', 'Code', 'ClosePrice', 'Diff', 'DiffPercent', 'OpenPrice', 'HighestPrice', 'LowestPrice', 'MarketCapitalization', 'Highest52Weeks', 'Lowest52Weeks', 'BidOrder', 'OfferOrder', 'BidVolume', 'OfferVolume', 'Modified'], dynamic: ['TotalShare', 'TotalValue'] }, undefined, undefined, undefined, 0, 60000);

    },
    GetStatisticByStockDiff: function (floor) {

        var requestName = 'StatisticByStockDiff' + '_' + floor + '_NoLanguage';
        return AG.ClientAPI.createData(StockExchangeRealtime, requestName, [{ Code: floor}], { static: ['Id', 'Name', 'Code', 'TotalStockGainCount', 'TotalStockGainVolume', 'TotalStockGainValue', 'TotalStockLossCount', 'TotalStockLossVolume', 'TotalStockLossValue', 'TotalStockEqualValue', 'TotalStockEqualShare', 'TotalStockEqualCount'], dynamic: ['Diff', 'Modified'] }, undefined, undefined, undefined, 0, 60000);

    },
    GetOrderDaily: function (floorId, stockCode, startDate, endDate, startIndex, endIndex, orderBy, orderType) {
        var data = [];
        if (stockCode == '')
            data = [{ StockExchange: floorId }, { StartDate: startDate }, { EndDate: endDate }, { StartIndex: startIndex }, { EndIndex: endIndex}];
        else
            data = [{ StockExchange: floorId }, { Code: stockCode }, { StartDate: startDate }, { EndDate: endDate }, { StartIndex: startIndex }, { EndIndex: endIndex}];
        var order = [];
        if (typeof (orderBy) != "undefined" && orderBy != '')
            order = [{ Field: orderBy, Direction: 'ASC'}];
        else
            order = [{ Field: 'ID', Direction: 'ASC'}];
        if (typeof (orderType) != "undefined" && orderType != '') {
            order[0].Direction = orderType;
        }
        if (orderBy != 'Code')
            order.push({ Field: 'Code', Direction: 'ASC' });
        var requestName = 'OrderDaily' + '_' + floorId + '_' + stockCode + '_' + startDate + '_' + endDate + '_' + startIndex + '_' + endIndex + '_' + orderBy + '_' + orderType + '_NoLanguage';
        return AG.ClientAPI.createData(CompanyDaily, requestName, data, { static: ['Id', 'Code', 'SessionDate', 'OpenPrice', 'ClosePrice', 'Diff', 'DiffPercent', 'BidCountOrder', 'BidVolumeOrder', 'OfferCountOrder', 'BidVolumeOrderSurplus', 'TotalShare', 'TotalValue'], dynamic: ['OfferVolumeOrder'] }, order);
    },
    GetCountOrderDaily: function (floorId, stockCode, startDate, endDate) {
        var data = [];
        if (stockCode == '')
            data = [{ StockExchange: floorId }, { StartDate: startDate }, { EndDate: endDate}];
        else
            data = [{ StockExchange: floorId }, { Code: stockCode }, { StartDate: startDate }, { EndDate: endDate}];
        return CompanyDaily.getCount(data);
    },
    GetOrderDailyToExcel: function (floorId, stockCode, startDate, endDate, orderBy, orderType) {
        var data = [];
        if (stockCode == '')
            data = [{ StockExchange: floorId }, { StartDate: startDate }, { EndDate: endDate}];
        else
            data = [{ StockExchange: floorId }, { Code: stockCode }, { StartDate: startDate }, { EndDate: endDate}];
        var order = [];
        if (typeof (orderBy) != "undefined" && orderBy != '')
            order = [{ Field: orderBy, Direction: 'ASC'}];
        else
            order = [{ Field: 'ID', Direction: 'ASC'}];
        if (typeof (orderType) != "undefined" && orderType != '')
            order[0].Direction = orderType;
        if (orderBy != 'Code')
            order.push({ Field: 'Code', Direction: 'ASC' });
        CompanyDaily.toExcel('OrderStatistics', data, { static: ['Id', 'Code', 'SessionDate', 'OpenPrice', 'ClosePrice', 'Diff', 'DiffPercent', 'BidCountOrder', 'BidVolumeOrder', 'OfferCountOrder', 'BidVolumeOrderSurplus', 'TotalShare', 'TotalValue'] }, order);
    },
    GetForeignTradeDaily: function (floorId, stockCode, startDate, endDate, startIndex, endIndex, orderBy, orderType) {
        var order = [];
        if (typeof (orderBy) != "undefined" && orderBy != '')
            order = [{ Field: orderBy, Direction: 'ASC'}];
        else
            order = [{ Field: 'ID', Direction: 'ASC'}];
        if (typeof (orderType) != "undefined" && orderType != '') {
            order[0].Direction = orderType;
        }
        if (orderBy != 'Code')
            order.push({ Field: 'Code', Direction: 'ASC' });
        var data;
        if (stockCode != '')
            data = [{ StockExchange: floorId }, { Code: stockCode }, { StartDate: startDate }, { EndDate: endDate }, { StartIndex: startIndex }, { EndIndex: endIndex}];
        else
            data = [{ StockExchange: floorId }, { StartDate: startDate }, { EndDate: endDate }, { StartIndex: startIndex }, { EndIndex: endIndex}];
        var requestName = 'ForeignTradeDaily' + '_' + floorId + '_' + stockCode + '_' + startDate + '_' + endDate + '_' + startIndex + '_' + endIndex + '_' + orderBy + '_' + orderType + '_NoLanguage';
        return AG.ClientAPI.createData(CompanyDaily, requestName, data, { static: ['Id', 'Code', 'SessionDate', 'ForeignOwnedVolume', 'ForeignOwnedRatio', 'ForeignCurrentRoom', 'ForeignBuyVolume', 'ForeignBuyVolumeRatio', 'ForeignSellVolume', 'ForeignSellVolumeRatio', 'ForeignBuyValue', 'ForeignBuyValueRatio', 'ForeignSellValue', 'ForeignSellValueRatio'], dynamic: ['ForeignMatchingBuyVolume', 'ForeignMatchingBuyVolumeRatio', 'ForeignMatchingSellVolume', 'ForeignMatchingSellVolumeRatio', 'ForeignMatchingBuyValue', 'ForeignMatchingBuyValueRatio', 'ForeignMatchingSellValue', 'ForeignMatchingSellValueRatio'] }, order);

    },
    GetCountForeignTradeDaily: function (floorId, stockCode, startDate, endDate) {
        var data;
        if (stockCode != '')
            data = [{ StockExchange: floorId }, { Code: stockCode }, { StartDate: startDate }, { EndDate: endDate}];
        else
            data = [{ StockExchange: floorId }, { StartDate: startDate }, { EndDate: endDate}];
        //var requestName = 'ForeignTradeDaily' + '_' + floorId  + '_' + stockCode +  '_' + startDate + '_' + endDate;
        return CompanyDaily.getCount(data);
    },
    GetPutThroughtForeign: function (floorId, stockCode, startDate, endDate, startIndex, endIndex, orderBy, orderType) {
        var order = [];
        if (typeof (orderBy) != "undefined" && orderBy != '')
            order = [{ Field: orderBy, Direction: 'ASC'}];
        else
            order = [{ Field: 'ID', Direction: 'ASC'}];
        if (typeof (orderType) != "undefined" && orderType != '') {
            order[0].Direction = orderType;
        }
        if (orderBy != 'Code')
            order.push({ Field: 'Code', Direction: 'ASC' });
        var data;
        if (stockCode != '')
            data = [{ StockExchange: floorId }, { Code: stockCode }, { StartDate: startDate }, { EndDate: endDate }, { StartIndex: startIndex }, { EndIndex: endIndex}];
        else
            data = [{ StockExchange: floorId }, { StartDate: startDate }, { EndDate: endDate }, { StartIndex: startIndex }, { EndIndex: endIndex}];
        var requestName = 'ForeignTradeDaily' + '_' + floorId + '_' + stockCode + '_' + startDate + '_' + endDate + '_' + startIndex + '_' + endIndex + '_' + orderBy + '_' + orderType + '_NoLanguage';
        return AG.ClientAPI.createData(CompanyDaily, requestName, data, { static: ['Code', 'SessionDate', 'ForeignOwnedVolume', 'ForeignOwnedRatio', 'ForeignCurrentRoom'], dynamic: ['ForeignPutThroughBuyVolume', 'ForeignPutThroughBuyVolumeRatio', 'ForeignPutThroughSellVolume', 'ForeignPutThroughSellVolumeRatio', 'ForeignPutThroughBuyValue', 'ForeignPutThroughBuyValueRatio', 'ForeignPutThroughSellValue', 'ForeignPutThroughSellValueRatio'] }, order);

    },
    GetCountPutThroughtForeign: function (floorId, stockCode, startDate, endDate) {
        var data;
        if (stockCode != '')
            data = [{ StockExchange: floorId }, { Code: stockCode }, { StartDate: startDate }, { EndDate: endDate}];
        else
            data = [{ StockExchange: floorId }, { StartDate: startDate }, { EndDate: endDate}];
        //var requestName = 'ForeignTradeDaily' + '_' + floorId  + '_' + stockCode +  '_' + startDate + '_' + endDate;
        return CompanyDaily.getCount(data);
    },
    GetForeignTradeDailyToExcel: function (floorId, stockCode, startDate, endDate, orderBy, orderType, header, column) {
        var order = [];
        if (typeof (orderBy) != "undefined" && orderBy != '')
            order = [{ Field: orderBy, Direction: 'ASC'}];
        else
            order = [{ Field: 'ID', Direction: 'ASC'}];
        if (typeof (orderType) != "undefined" && orderType != '') {
            order[0].Direction = orderType;
        }
        if (orderBy != 'Code')
            order.push({ Field: 'Code', Direction: 'ASC' });
        var data;
        if (stockCode != '')
            data = [{ StockExchange: floorId }, { Code: stockCode }, { StartDate: startDate }, { EndDate: endDate}];
        else
            data = [{ StockExchange: floorId }, { StartDate: startDate }, { EndDate: endDate}];
        CompanyDaily.toExcel('ForeignTradeDaily' + '_NoLanguage', data, { static: ['Code', 'SessionDate', 'ForeignOwnedVolume', 'ForeignOwnedRatio', 'ForeignCurrentRoom', 'ForeignBuyVolume', 'ForeignBuyVolumeRatio', 'ForeignSellVolume', 'ForeignSellVolumeRatio', 'ForeignBuyValue', 'ForeignBuyValueRatio', 'ForeignSellValue', 'ForeignSellValueRatio'], dynamic: ['ForeignMatchingBuyVolume', 'ForeignMatchingBuyVolumeRatio', 'ForeignMatchingSellVolume', 'ForeignMatchingSellVolumeRatio', 'ForeignMatchingBuyValue', 'ForeignMatchingBuyValueRatio', 'ForeignMatchingSellValue', 'ForeignMatchingSellValueRatio'] }, order);
    },
    GetPutThroughtForeignToExcel: function (floorId, stockCode, startDate, endDate, orderBy, orderType, header, column) {
        var order = [];
        if (typeof (orderBy) != "undefined" && orderBy != '')
            order = [{ Field: orderBy, Direction: 'ASC'}];
        else
            order = [{ Field: 'ID', Direction: 'ASC'}];
        if (typeof (orderType) != "undefined" && orderType != '') {
            order[0].Direction = orderType;
        }
        if (orderBy != 'Code')
            order.push({ Field: 'Code', Direction: 'ASC' });
        var data;
        if (stockCode != '')
            data = [{ StockExchange: floorId }, { Code: stockCode }, { StartDate: startDate }, { EndDate: endDate}];
        else
            data = [{ StockExchange: floorId }, { StartDate: startDate }, { EndDate: endDate}];
        CompanyDaily.toExcel('PutThroughtForeignTradeDaily' + '_NoLanguage', data, { static: ['Code', 'SessionDate', 'ForeignOwnedVolume', 'ForeignOwnedRatio', 'ForeignCurrentRoom'], dynamic: ['ForeignPutThroughBuyVolume', 'ForeignPutThroughBuyVolumeRatio', 'ForeignPutThroughSellVolume', 'ForeignPutThroughSellVolumeRatio', 'ForeignPutThroughBuyValue', 'ForeignPutThroughBuyValueRatio', 'ForeignPutThroughSellValue', 'ForeignPutThroughSellValueRatio'] }, order);
    },
    GetStockCodeByExchange: function (floorId) {

        return AG.ClientAPI.createData(CompanyRealtime, 'GetStockCodeByExchange' + '_NoLanguage', [{ StockExchange: floorId}], { static: ['Id', 'Code'] }, [{ Field: 'Code'}]);

    },
    GetGeneralInfo: function (floor, startIndex, endIndex, orderBy, orderType) {

        var order = [];
        if (typeof (orderBy) != "undefined" && orderBy != '')
            order = [{ Field: orderBy, Direction: 'ASC'}];
        else
            order = [{ Field: 'ID', Direction: 'ASC'}];
        if (typeof (orderType) != "undefined" && orderType != '') {
            order[0].Direction = orderType;
        }
        if (orderBy != 'Code')
            order.push({ Field: 'Code', Direction: 'ASC' });
        var requestName = 'StockExchangeGeneralInfo' + '_' + floor + '_' + startIndex + '_' + endIndex + '_' + orderBy + '_' + orderType + '_NoLanguage';
        return AG.ClientAPI.createData(StockExchangeDaily, requestName, [{ Code: floor }, { StartIndex: startIndex }, { EndIndex: endIndex}], { static: ['Id', 'SessionDate', 'FundShare', 'FundPutThroughShare', 'BondShare', 'TotalShare', 'ForeignBuyVolume', 'ForeignPutThroughBuyVolume', 'ForeignSellVolume', 'ForeignPutThroughSellVolume', 'ForeignBuyVolumeSurplus', 'TotalStockGainCount', 'CeilingStockGainCount', 'TotalStockLossCount', 'FloorStockLossCount', 'StockGainCountSurplus', 'BidOrder', 'OfferOrder', 'BidOrderSurplus', 'BidVolume', 'OfferVolume', 'BidVolumeSurplus'], dynamic: ['MatchTotalShare', 'PutThroughTotalShare'] }, order);

    },
    GetPriceQuery: function (floorId, stockCode, startDate, endDate, startIndex, endIndex, orderBy, orderType) {
        var data = [];
        if (stockCode == '')
            data = [{ StockExchange: floorId }, { StartDate: startDate }, { EndDate: endDate }, { StartIndex: startIndex }, { EndIndex: endIndex}];
        else
            data = [{ StockExchange: floorId }, { Code: stockCode }, { StartDate: startDate }, { EndDate: endDate }, { StartIndex: startIndex }, { EndIndex: endIndex}];
        var order = [];
        if (typeof (orderBy) != "undefined" && orderBy != '')
            order = [{ Field: orderBy, Direction: 'ASC'}];
        else
            order = [{ Field: 'ID', Direction: 'ASC'}];
        if (typeof (orderType) != "undefined" && orderType != '') {
            order[0].Direction = orderType;
        }
        if (orderBy != 'Code')
            order.push({ Field: 'Code', Direction: 'ASC' });
        var requestName = 'PriceQuery' + '_' + floorId + '_' + stockCode + '_' + startDate + '_' + endDate + '_' + startIndex + '_' + endIndex + '_' + orderBy + '_' + orderType;
        return AG.ClientAPI.createData(CompanyDaily, requestName, data, { static: ['Id', 'Code', 'SessionDate', 'OpenPrice', 'ClosePrice', 'Diff', 'DiffPercent', 'RefPrice', 'CeilingPrice', 'FloorPrice', 'AveragePrice', 'TotalShare'], dynamic: ['MatchTotalShare', 'PutThroughTotalShare'] }, order);

    },
    GetCountPriceQuery: function (floorId, stockCode, startDate, endDate) {
        var data = [];
        if (stockCode == '')
            data = [{ StockExchange: floorId }, { StartDate: startDate }, { EndDate: endDate}];
        else
            data = [{ StockExchange: floorId }, { Code: stockCode }, { StartDate: startDate }, { EndDate: endDate}];
        return CompanyDaily.getCount(data);
    },
    //    GetPriceQueryToExcel: function (floorId, stockCode, startDate, endDate, orderBy, orderType, header, column) {
    //        var data = [];
    //        if (stockCode == '')
    //            data = [{ StockExchange: floorId }, { StartDate: startDate }, { EndDate: endDate}];
    //        else
    //            data = [{ StockExchange: floorId }, { Code: stockCode }, { StartDate: startDate }, { EndDate: endDate}];
    //        var order = [];
    //        if (typeof (orderBy) != "undefined" && orderBy != '')
    //            order = [{ Field: orderBy, Direction: 'ASC'}];
    //        else
    //            order = [{ Field: 'ID', Direction: 'ASC'}];
    //        if (typeof (orderType) != "undefined" && orderType != '')
    //            order[0].Direction = orderType;
    //        if (orderBy != 'Code')
    //            order.push({ Field: 'Code', Direction: 'ASC' });
    //        CompanyDaily.toExcel('HistoryPrice', data, { static: ['Id', 'Code', 'SessionDate', 'OpenPrice', 'ClosePrice', 'Diff', 'DiffPercent', 'RefPrice', 'CeilingPrice', 'FloorPrice', 'AveragePrice', 'TotalShare'], dynamic: ['MatchTotalShare', 'PutThroughTotalShare'] }, order);
    //    },
    GetPriceQueryToExcel: function (floorId, stockCode, startDate, endDate) {
        var fileName = "HistoryPrice";
        document.location.href = '/Handler/StockReportToExcel/StockExchange.PriceQuery.aspx' + '?FileName=' + fileName + '&StockExchange=' + floorId + '&StartDate=' + startDate + '&EndDate=' + endDate + '&Language=' + agLanguageName;
    },
    GetLastSessionDate: function (floorId) {

        var order = [{ Field: 'SessionDate', Direction: 'DESC'}];
        var result = AG.ClientAPI.createData(CompanyDaily, 'StockExchangeLastSessionDate' + '_NoLanguage', [{ StockExchange: floorId }, { StartIndex: 1 }, { EndIndex: 1}], { static: ['Id', 'SessionDate'] }, order);
        if (result.length > 0)
            return result[0].SessionDate;
        else
            return '2000-01-01T00:00:00+07:00';

    },
    GetListStockExchange: function () {

        return AG.ClientAPI.createData(StockExchangeRealtime, 'List', [{ Code: 'HNX' }, { Code: 'HSX' }, { Code: 'UPCOM'}], { static: ['Id', 'Code', 'Name'] });
    },
    GetSliceStock: function (floorId, startIndex, endIndex) {

        var order = [];
        order.push({ Field: 'Code', Direction: 'ASC' });
        var requestName = 'SliceStock' + '_' + floorId + '_' + startIndex + '_' + endIndex + '_NoLanguage';
        return AG.ClientAPI.createData(CompanyRealtime, requestName, [{ StockExchange: floorId }, { StartIndex: startIndex }, { EndIndex: endIndex}], { static: ['Id', 'Code', 'ClosePrice', 'Diff', 'DiffPercent'] }, order);
    },
    GetCountSliceStock: function (floorId) {
        CompanyRealtime;
        return AG.ClientAPI.getCount([{ StockExchange: floorId}]);
    },
    GetExchangeRate: function () {

        return AG.ClientAPI.createData(ExchangeRate, 'GetExchangeRate' + '_NoLanguage', [{ Code: 'USD' }, { Code: 'EUR' }, { Code: 'KRW' }, { Status: '00000000-0000-0000-0000-000000000002'}], { static: ['Id', 'Code', 'Name', 'Buy', 'Sell'] });
    },
    GetCommodites: function () {
        return AG.ClientAPI.createData(ExchangeRate, 'GetCommodites' + '_NoLanguage', [{ ExchangeUnit: '4333A215-BD5F-4A91-912F-C4E79653B74B' }, { ExchangeUnit: '7011A7AA-54AA-4A5F-B6AB-779EF001AF46' }, { ExchangeUnit: 'DF6997A4-6A44-4B92-914A-C9C22208B83C' }, { Status: '00000000-0000-0000-0000-000000000002'}], { static: ['Id', 'Name', 'Buy'], dynamic: ['Price', 'Change', 'ChangePercent', 'TypeUnit'] });
    }
}
