예제 #1
0
 /// <remarks/>
 public void getAllMarketsAsync(GetAllMarketsReq request, object userState) {
     if ((this.getAllMarketsOperationCompleted == null)) {
         this.getAllMarketsOperationCompleted = new System.Threading.SendOrPostCallback(this.OngetAllMarketsOperationCompleted);
     }
     this.InvokeAsync("getAllMarkets", new object[] {
                 request}, this.getAllMarketsOperationCompleted, userState);
 }
예제 #2
0
 public GetAllMarketsResp getAllMarkets(GetAllMarketsReq request) {
     object[] results = this.Invoke("getAllMarkets", new object[] {
                 request});
     return ((GetAllMarketsResp)(results[0]));
 }
예제 #3
0
 /// <remarks/>
 public void getAllMarketsAsync(GetAllMarketsReq request) {
     this.getAllMarketsAsync(request, null);
 }
예제 #4
0
        /// <summary>
        /// The API GetAllMarkets service allows you to retrieve information about all 
        /// of the markets that are currently active or suspended on the 
        /// given exchange. You can use this service to quickly analyse the 
        /// available markets on the exchange, or use the response to build a local 
        /// copy of the Betfair.com navigation menu. You can limit the response to 
        /// a particular time period, country where the event is taking place, and 
        /// event type. Otherwise, the service returns all active and suspended markets.
        /// </summary>
        /// <param name="exchangeId"></param>
        /// <param name="countries"></param>
        /// <param name="eventTypeIds"></param>
        /// <param name="DateToMilliseconds"></param>
        /// <param name="DateFromMilliseconds"></param>
        /// <returns></returns>
        public string GetAllMarkets(int exchangeId, string[] countries, int?[] eventTypeIds, int DateToMilliseconds,
                                    int DateFromMilliseconds)
        {
            const string serviceName = "GetAllMarkets";
            Console.WriteLine("{0}$ API_SERVICE {1}", DateTime.Now, serviceName);

            var request = new GetAllMarketsReq {countries = countries};
            if (eventTypeIds != null)
            {
                request.eventTypeIds = new int?[eventTypeIds.Length];
                int count = 0;
                foreach (var i in eventTypeIds)
                {
                    request.eventTypeIds[count] = (int) i;
                    count++;
                }
            }
            request.fromDate = DateTime.Now.AddMilliseconds(DateFromMilliseconds);
            request.toDate = DateTime.Now.AddMilliseconds(DateToMilliseconds);
            request.header = (BetfairExchangeAPI.APIRequestHeader) GetHeader(false);

            GetAllMarketsResp response = _bfExchangeService[exchangeId].getAllMarkets(request);
            ValidateAPIResponse(serviceName, Convert.ToString(response.header.errorCode),
                                Convert.ToString(response.errorCode), response.header.sessionToken);

            return response.marketData;
        }