diff --git a/BetfairApi.Tests/BetfairApi.Tests.csproj b/BetfairApi.Tests/BetfairApi.Tests.csproj
new file mode 100644
index 0000000..b87a18e
--- /dev/null
+++ b/BetfairApi.Tests/BetfairApi.Tests.csproj
@@ -0,0 +1,20 @@
+
+
+
+ netcoreapp3.0
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BetfairApi.Tests/BetfairClientLoginTests.cs b/BetfairApi.Tests/BetfairClientLoginTests.cs
new file mode 100644
index 0000000..53befa1
--- /dev/null
+++ b/BetfairApi.Tests/BetfairClientLoginTests.cs
@@ -0,0 +1,89 @@
+using BetfairApi;
+using BetfairApi.BettingModels.Enums;
+using BetfairApi.Tests;
+using Xunit;
+using static BetfairApi.Authentication;
+
+namespace AutoBet.Core.Tests
+{
+ public class BetfairClientLoginTests
+ {
+ [Theory]
+ [InlineData(TestSettings.Username, TestSettings.Password, TestSettings.AppKey, LoginStatus.Success)]
+ public void TestLogin(string username, string password, string appKey, LoginStatus expectedStatus)
+ {
+ //Arrange
+ var client = new Authentication(username, password, appKey);
+
+ //Act
+ var loginResponse = client.Authenticate().GetAwaiter().GetResult();
+
+ //Assert
+ Assert.NotNull(loginResponse);
+ Assert.Equal(expectedStatus, loginResponse.Status);
+ }
+
+ [Theory]
+ [InlineData(TestSettings.Username, TestSettings.Password, TestSettings.AppKey)]
+ public void TestAccountFunds(string username, string password, string appKey)
+ {
+ //Arrange
+ var auth = new Authentication(username, password, appKey);
+ var client = new AccountApiClient(auth);
+
+ //Act
+ var accountFunds = client.GetAccountFunds().GetAwaiter().GetResult();
+
+ //Assert
+ Assert.NotNull(accountFunds);
+ Assert.True(accountFunds.AvailableToBetBalance > 0);
+ }
+
+ [Theory]
+ [InlineData(TestSettings.Username, TestSettings.Password, TestSettings.AppKey)]
+ public void TestAccountStatement(string username, string password, string appKey)
+ {
+ //Arrange
+ var auth = new Authentication(username, password, appKey);
+ var client = new AccountApiClient(auth);
+
+ //Act
+ var accountStatement = client.GetAccountStatement().GetAwaiter().GetResult();
+
+ //Assert
+ Assert.NotNull(accountStatement);
+ }
+
+ [Theory]
+ [InlineData(TestSettings.Username, TestSettings.Password, TestSettings.AppKey)]
+ public void TestCurrentBets(string username, string password, string appKey)
+ {
+ //Arrange
+ var auth = new Authentication(username, password, appKey);
+ var client = new BettingApiClient(auth);
+
+ //Act
+ var currentOrders = client.ListCurrentOrders().GetAwaiter().GetResult();
+
+ //Assert
+ Assert.NotNull(currentOrders);
+ Assert.True(currentOrders.CurrentOrders.Length > -1);
+ }
+
+
+ [Theory]
+ [InlineData(TestSettings.Username, TestSettings.Password, TestSettings.AppKey)]
+ public void TestPreviousOrders(string username, string password, string appKey)
+ {
+ //Arrange
+ var auth = new Authentication(username, password, appKey);
+ var client = new BettingApiClient(auth);
+
+ //Act
+ var currentOrders = client.ListClearedOrders(BetStatus.Settled).GetAwaiter().GetResult();
+
+ //Assert
+ Assert.NotNull(currentOrders);
+ }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi.Tests/EventsTests.cs b/BetfairApi.Tests/EventsTests.cs
new file mode 100644
index 0000000..af153ed
--- /dev/null
+++ b/BetfairApi.Tests/EventsTests.cs
@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Xunit;
+using System.Linq;
+using static BetfairApi.Authentication;
+using BetfairApi.BettingModels;
+
+namespace BetfairApi.Tests
+{
+ public class EventsTests
+ {
+ [Theory]
+ [InlineData(TestSettings.Username, TestSettings.Password, TestSettings.AppKey)]
+ public void TestGetEventsTypes(string username, string password, string appKey)
+ {
+ //Arrange
+ var auth = new Authentication(username, password, appKey);
+ var client = new BettingApiClient(auth);
+
+ //Act
+ var eventsTypes = client.ListEventTypes(new BettingModels.MarketFilter()).Result;
+
+ //Assert
+ Assert.True(eventsTypes.Length > 0);
+ }
+
+ [Theory]
+ [InlineData(TestSettings.Username, TestSettings.Password, TestSettings.AppKey)]
+ public void TestGetEvents(string username, string password, string appKey)
+ {
+ //Arrange
+ var auth = new Authentication(username, password, appKey);
+ var client = new BettingApiClient(auth);
+ var eventTypes = client.ListEventTypes(new MarketFilter()).Result;
+ var horseRacingEventType = eventTypes.FirstOrDefault(e => e.EventType.Name == "Horse Racing");
+ var filter = new MarketFilter()
+ {
+ EventTypeIds = new[] { horseRacingEventType.EventType.Id },
+ MarketCountries = new[] { "IE", "US" }
+ };
+
+ //Act
+ var horseRacingEvents = client.ListEvents(filter).Result;
+
+ //Assert
+ Assert.True(horseRacingEvents.Length > 0);
+ }
+ }
+}
diff --git a/BetfairApi.Tests/MarketTests.cs b/BetfairApi.Tests/MarketTests.cs
new file mode 100644
index 0000000..748b73c
--- /dev/null
+++ b/BetfairApi.Tests/MarketTests.cs
@@ -0,0 +1,77 @@
+using BetfairApi.BettingModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Xunit;
+
+namespace BetfairApi.Tests
+{
+ public class MarketTests
+ {
+ [Theory]
+ [InlineData(TestSettings.Username, TestSettings.Password, TestSettings.AppKey)]
+ public void ListMarketTypes(string username, string password, string appKey)
+ {
+ //Arrange
+ var auth = new Authentication(username, password, appKey);
+ var client = new BettingApiClient(auth);
+
+ //Act
+ var results = client.ListMarketTypes(new MarketFilter() { EventTypeIds = new[] { "7" } }).Result;
+
+ //Assert
+ Assert.True(results.Length > 0);
+ }
+
+ [Theory]
+ [InlineData(TestSettings.Username, TestSettings.Password, TestSettings.AppKey)]
+ public void GetHorseWinMarkets(string username, string password, string appKey)
+ {
+ //Arrange
+ var auth = new Authentication(username, password, appKey);
+ var client = new BettingApiClient(auth);
+ var horseRacingQueries = new BetfairHorseRacingQueries(client);
+
+ //Act
+ var horseWins = horseRacingQueries.GetHorseWinCatalogue(DateTime.UtcNow, DateTime.UtcNow.AddDays(20), "GB").Result;
+
+ //Assert
+ Assert.True(horseWins.Length > 0);
+ }
+
+ [Theory]
+ [InlineData(TestSettings.Username, TestSettings.Password, TestSettings.AppKey)]
+ public void GetHorseMarketBook(string username, string password, string appKey)
+ {
+ //Arrange
+ var auth = new Authentication(username, password, appKey);
+ var client = new BettingApiClient(auth);
+ var horseRacingQueries = new BetfairHorseRacingQueries(client);
+ var horseWins = horseRacingQueries.GetHorseWinCatalogue(DateTime.UtcNow, DateTime.UtcNow.AddDays(1), "GB").Result;
+
+ //Act
+ var prices = horseRacingQueries.GetBestPrices(horseWins[0].MarketId).Result;
+
+ //Assert
+ Assert.True(horseWins.Length > 0);
+ }
+
+ [Theory]
+ [InlineData(TestSettings.Username, TestSettings.Password, TestSettings.AppKey)]
+ public void GetSpecificBook(string username, string password, string appKey)
+ {
+ //Arrange
+ var auth = new Authentication(username, password, appKey);
+ var client = new BettingApiClient(auth);
+ var horseRacingQueries = new BetfairHorseRacingQueries(client);
+
+
+ //Act
+ var books = client.ListMarketBook(new[] { "1.166887988" }).Result;
+
+ //Assert
+ Assert.True(books.Length > 0);
+ }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi.Tests/TestSettings.cs b/BetfairApi.Tests/TestSettings.cs
new file mode 100644
index 0000000..0a7de22
--- /dev/null
+++ b/BetfairApi.Tests/TestSettings.cs
@@ -0,0 +1,9 @@
+namespace BetfairApi.Tests
+{
+ public static class TestSettings
+ {
+ public const string Username = "TheRocker1987";
+ public const string Password = "reSharper1036!";
+ public const string AppKey = "H5TT4zKqOlRCpNOr";
+ }
+}
diff --git a/BetfairApi.sln b/BetfairApi.sln
new file mode 100644
index 0000000..aed5815
--- /dev/null
+++ b/BetfairApi.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29424.173
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BetfairApi", "BetfairApi\BetfairApi.csproj", "{AD1B8F57-D311-40AC-B828-BD5A67CFEFCD}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BetfairApi.Tests", "BetfairApi.Tests\BetfairApi.Tests.csproj", "{999FDCEB-F0EF-42CD-8350-3757FD2D9C89}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {AD1B8F57-D311-40AC-B828-BD5A67CFEFCD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AD1B8F57-D311-40AC-B828-BD5A67CFEFCD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AD1B8F57-D311-40AC-B828-BD5A67CFEFCD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AD1B8F57-D311-40AC-B828-BD5A67CFEFCD}.Release|Any CPU.Build.0 = Release|Any CPU
+ {999FDCEB-F0EF-42CD-8350-3757FD2D9C89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {999FDCEB-F0EF-42CD-8350-3757FD2D9C89}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {999FDCEB-F0EF-42CD-8350-3757FD2D9C89}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {999FDCEB-F0EF-42CD-8350-3757FD2D9C89}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {70D33D7C-F59C-4E96-890D-B95C3E2F2762}
+ EndGlobalSection
+EndGlobal
diff --git a/BetfairApi/AccountApiClient.cs b/BetfairApi/AccountApiClient.cs
new file mode 100644
index 0000000..80a3699
--- /dev/null
+++ b/BetfairApi/AccountApiClient.cs
@@ -0,0 +1,307 @@
+using System.Net.Http;
+using System.Threading.Tasks;
+using BetfairApi.AccountModels;
+using BetfairApi.AccountModels.Enums;
+
+namespace BetfairApi
+{
+ public class AccountApiClient
+ {
+ private readonly HttpClient _client;
+ private Authentication _authentication;
+ private const string _endpoint = "https://api.betfair.com/exchange/account/rest/v1.0/";
+
+ public AccountApiClient(Authentication authentication)
+ {
+ _client = new HttpClient();
+ _authentication = authentication;
+ }
+
+
+ ///
+ /// Create 2 application keys for given user; one active and the other delayed
+ ///
+ public async Task CreateDeveloperAppKeys(string appName)
+ {
+ var request = new
+ {
+ appName
+ };
+ var result = await ExecuteRequest(_endpoint + "createDeveloperAppKeys/", request);
+ return result;
+ }
+
+ ///
+ /// Get all application keys owned by the given developer/vendor
+ ///
+ public async Task GetDeveloperAppKeys()
+ {
+ var result = await ExecuteRequest(_endpoint + "getDeveloperAppKeys/");
+ return result;
+ }
+
+ ///
+ /// Get available to bet amount.
+ ///
+ public async Task GetAccountFunds(Wallet? wallet = null)
+ {
+ var request = new
+ {
+ wallet
+ };
+ var result = await ExecuteRequest(_endpoint + "getAccountFunds/", request);
+ return result;
+ }
+
+ ///
+ /// Transfer funds between wallets
+ ///
+ public async Task TransferFunds(Wallet from, Wallet to, double amount)
+ {
+ var request = new
+ {
+ from,
+ to,
+ amount
+ };
+ var result = await ExecuteRequest(_endpoint + "transferFunds/", request);
+ return result;
+ }
+
+ ///
+ /// Get Account details.
+ ///
+ public async Task GetAccountDetails()
+ {
+ var result = await ExecuteRequest(_endpoint + "getAccountDetails/");
+ return result;
+ }
+
+ ///
+ /// Get vendor client id for customer account.
+ ///
+ public async Task GetVendorClientId()
+ {
+ var result = await ExecuteRequest(_endpoint + "getVendorClientId/");
+ return result;
+ }
+
+ ///
+ /// Returns the newly generate subscription token
+ ///
+ public async Task GetApplicationSubscriptionToken(int? subscriptionLength = null, string clientReference = null)
+ {
+ var request = new
+ {
+ subscriptionLength,
+ clientReference
+ };
+ var result = await ExecuteRequest(_endpoint + "getApplicationSubscriptionToken/", request);
+ return result;
+ }
+
+ ///
+ /// Activate the subscription token for the customer
+ ///
+ public async Task ActivateApplicationSubscription(string subscriptionToken)
+ {
+ var request = new
+ {
+ subscriptionToken
+ };
+ var result = await ExecuteRequest(_endpoint + "activateApplicationSubscription/", request);
+ return result;
+ }
+
+ ///
+ /// Cancel application subscription
+ ///
+ public async Task CancelApplicationSubscription(string subscriptionToken)
+ {
+ var request = new
+ {
+ subscriptionToken
+ };
+ var result = await ExecuteRequest(_endpoint + "cancelApplicationSubscription/", request);
+ return result;
+ }
+
+ ///
+ /// Update an application subscription with a new expiry date
+ ///
+ public async Task UpdateApplicationSubscription(string vendorClientId, int subscriptionLength)
+ {
+ var request = new
+ {
+ vendorClientId,
+ subscriptionLength
+ };
+ var result = await ExecuteRequest(_endpoint + "updateApplicationSubscription/", request);
+ return result;
+ }
+
+ ///
+ /// List of subscription tokens for an application
+ ///
+ public async Task ListApplicationSubscriptionTokens(SubscriptionStatus? subscriptionStatus = null)
+ {
+ var request = new
+ {
+ subscriptionStatus
+ };
+ var result = await ExecuteRequest(_endpoint + "listApplicationSubscriptionTokens/", request);
+ return result;
+ }
+
+ ///
+ /// List of subscription tokens associated with the account
+ ///
+ public async Task ListAccountSubscriptionTokens()
+ {
+ var result = await ExecuteRequest(_endpoint + "listAccountSubscriptionTokens/");
+ return result;
+ }
+
+ ///
+ /// Identify all subscriptions, regardless of status, for a single client for a single application key.
+ /// The operation may be called by either the application key owner or a client.
+ ///
+ public async Task GetApplicationSubscriptionHistory(string vendorClientId = null, string applicationKey = null)
+ {
+ var request = new
+ {
+ vendorClientId,
+ applicationKey
+ };
+ var result = await ExecuteRequest(_endpoint + "getApplicationSubscriptionHistory/", request);
+ return result;
+ }
+
+ ///
+ /// Get account statement
+ ///
+ public async Task GetAccountStatement(string locale = null, int? fromRecord = null, int? recordCount = null, TimeRange itemDateRange = null, IncludeItem? includeItem = null, Wallet? wallet = null)
+ {
+ var request = new
+ {
+ locale,
+ fromRecord,
+ recordCount,
+ itemDateRange,
+ includeItem,
+ wallet
+ };
+ var result = await ExecuteRequest(_endpoint + "getAccountStatement/", request);
+ return result;
+ }
+
+ ///
+ /// Returns a list of currency rates based on given currency
+ ///
+ public async Task ListCurrencyRates(string fromCurrency = null)
+ {
+ var request = new
+ {
+ fromCurrency
+ };
+ var result = await ExecuteRequest(_endpoint + "listCurrencyRates/", request);
+ return result;
+ }
+
+ ///
+ /// Generate auth code for web vendor, used to get vendor session
+ ///
+ public async Task GetAuthorisationCode(string vendorId)
+ {
+ var request = new
+ {
+ vendorId
+ };
+ var result = await ExecuteRequest(_endpoint + "getAuthorisationCode/", request);
+ return result;
+ }
+
+ ///
+ /// Generate web vendor session based on a standard session identifiable by auth code, vendor secret and app key
+ ///
+ public async Task Token(string client_id, string client_secret, GrantType grant_type, string code = null, string refresh_token = null)
+ {
+ var request = new
+ {
+ client_id,
+ grant_type,
+ code,
+ client_secret,
+ refresh_token
+ };
+ var result = await ExecuteRequest(_endpoint + "token/", request);
+ return result;
+ }
+
+ ///
+ /// Return details about a vendor from its identifier. Response includes Vendor Name and URL.
+ ///
+ public async Task GetVendorDetails(string vendorId)
+ {
+ var request = new
+ {
+ vendorId
+ };
+ var result = await ExecuteRequest(_endpoint + "getVendorDetails/", request);
+ return result;
+ }
+
+ ///
+ /// Remove the link between an account and a vendor web app. This will remove the refreshToken for this user-vendor pair subscription.
+ ///
+ public async Task RevokeAccessToWebApp(long vendorId)
+ {
+ var request = new
+ {
+ vendorId
+ };
+ var result = await ExecuteRequest(_endpoint + "revokeAccessToWebApp/", request);
+ return result;
+ }
+
+ ///
+ /// Retrieve all vendors applications currently subscribed to by the user making the request
+ ///
+ public async Task ListAuthorizedWebApps()
+ {
+ var result = await ExecuteRequest(_endpoint + "listAuthorizedWebApps/");
+ return result;
+ }
+
+ ///
+ /// Return whether an account has authorised a web app.
+ ///
+ public async Task IsAccountSubscribedToWebApp(string vendorId)
+ {
+ var request = new
+ {
+ vendorId
+ };
+ var result = await ExecuteRequest(_endpoint + "isAccountSubscribedToWebApp/", request);
+ return result;
+ }
+
+ ///
+ /// Return relation between a list of users and an affiliate
+ ///
+ public async Task GetAffiliateRelation(string[] vendorClientIds)
+ {
+ var request = new
+ {
+ vendorClientIds
+ };
+ var result = await ExecuteRequest(_endpoint + "getAffiliateRelation/", request);
+ return result;
+ }
+
+ private Task ExecuteRequest(string endpoint, object request = null)
+ {
+ return _authentication.ExecuteRequest(endpoint, request);
+ }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/AccountDetailsResponse.cs b/BetfairApi/AccountModels/AccountDetailsResponse.cs
new file mode 100644
index 0000000..41f465e
--- /dev/null
+++ b/BetfairApi/AccountModels/AccountDetailsResponse.cs
@@ -0,0 +1,21 @@
+using System;
+using BetfairApi.AccountModels.Enums;
+
+namespace BetfairApi.AccountModels
+{
+ ///
+ /// Response for Account details.
+ ///
+ public class AccountDetailsResponse
+ {
+ public string CurrencyCode { get; set; }
+ public string FirstName { get; set; }
+ public string LastName { get; set; }
+ public string LocaleCode { get; set; }
+ public string Region { get; set; }
+ public string Timezone { get; set; }
+ public double DiscountRate { get; set; }
+ public int PointsBalance { get; set; }
+ public string CountryCode { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/AccountFundsResponse.cs b/BetfairApi/AccountModels/AccountFundsResponse.cs
new file mode 100644
index 0000000..483fd6a
--- /dev/null
+++ b/BetfairApi/AccountModels/AccountFundsResponse.cs
@@ -0,0 +1,19 @@
+using System;
+using BetfairApi.AccountModels.Enums;
+
+namespace BetfairApi.AccountModels
+{
+ ///
+ /// Response for retrieving available to bet.
+ ///
+ public class AccountFundsResponse
+ {
+ public double AvailableToBetBalance { get; set; }
+ public double Exposure { get; set; }
+ public double RetainedCommission { get; set; }
+ public double ExposureLimit { get; set; }
+ public double DiscountRate { get; set; }
+ public int PointsBalance { get; set; }
+ public string Wallet { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/AccountStatementReport.cs b/BetfairApi/AccountModels/AccountStatementReport.cs
new file mode 100644
index 0000000..061de50
--- /dev/null
+++ b/BetfairApi/AccountModels/AccountStatementReport.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.AccountModels.Enums;
+
+namespace BetfairApi.AccountModels
+{
+ ///
+ /// A container representing search results.
+ ///
+ public class AccountStatementReport
+ {
+ public StatementItem[] AccountStatement { get; set; }
+ public bool MoreAvailable { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/AccountSubscription.cs b/BetfairApi/AccountModels/AccountSubscription.cs
new file mode 100644
index 0000000..41ff8b4
--- /dev/null
+++ b/BetfairApi/AccountModels/AccountSubscription.cs
@@ -0,0 +1,15 @@
+using System;
+using BetfairApi.AccountModels.Enums;
+
+namespace BetfairApi.AccountModels
+{
+ ///
+ /// Application subscription details
+ ///
+ public class AccountSubscription
+ {
+ public SubscriptionTokenInfo[] SubscriptionTokens { get; set; }
+ public string ApplicationName { get; set; }
+ public string ApplicationVersionId { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/AffiliateRelation.cs b/BetfairApi/AccountModels/AffiliateRelation.cs
new file mode 100644
index 0000000..38393a4
--- /dev/null
+++ b/BetfairApi/AccountModels/AffiliateRelation.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.AccountModels.Enums;
+
+namespace BetfairApi.AccountModels
+{
+ ///
+ /// Wrapper object containing affiliate relation details
+ ///
+ public class AffiliateRelation
+ {
+ public string VendorClientId { get; set; }
+ public AffiliateRelationStatus Status { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/ApplicationSubscription.cs b/BetfairApi/AccountModels/ApplicationSubscription.cs
new file mode 100644
index 0000000..33bb972
--- /dev/null
+++ b/BetfairApi/AccountModels/ApplicationSubscription.cs
@@ -0,0 +1,21 @@
+using System;
+using BetfairApi.AccountModels.Enums;
+
+namespace BetfairApi.AccountModels
+{
+ ///
+ /// Application subscription details
+ ///
+ public class ApplicationSubscription
+ {
+ public string SubscriptionToken { get; set; }
+ public DateTime ExpiryDateTime { get; set; }
+ public DateTime ExpiredDateTime { get; set; }
+ public DateTime CreatedDateTime { get; set; }
+ public DateTime ActivationDateTime { get; set; }
+ public DateTime CancellationDateTime { get; set; }
+ public string SubscriptionStatus { get; set; }
+ public string ClientReference { get; set; }
+ public string VendorClientId { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/AuthorisationResponse.cs b/BetfairApi/AccountModels/AuthorisationResponse.cs
new file mode 100644
index 0000000..11e0e64
--- /dev/null
+++ b/BetfairApi/AccountModels/AuthorisationResponse.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.AccountModels.Enums;
+
+namespace BetfairApi.AccountModels
+{
+ ///
+ /// Wrapper object containing authorisation code and redirect URL for web vendors
+ ///
+ public class AuthorisationResponse
+ {
+ public string AuthorisationCode { get; set; }
+ public string RedirectUrl { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/CurrencyRate.cs b/BetfairApi/AccountModels/CurrencyRate.cs
new file mode 100644
index 0000000..bbfd656
--- /dev/null
+++ b/BetfairApi/AccountModels/CurrencyRate.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.AccountModels.Enums;
+
+namespace BetfairApi.AccountModels
+{
+ ///
+ /// Currency rate
+ ///
+ public class CurrencyRate
+ {
+ public string CurrencyCode { get; set; }
+ public double Rate { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/DeveloperApp.cs b/BetfairApi/AccountModels/DeveloperApp.cs
new file mode 100644
index 0000000..9a55716
--- /dev/null
+++ b/BetfairApi/AccountModels/DeveloperApp.cs
@@ -0,0 +1,15 @@
+using System;
+using BetfairApi.AccountModels.Enums;
+
+namespace BetfairApi.AccountModels
+{
+ ///
+ /// Describes developer/vendor specific application
+ ///
+ public class DeveloperApp
+ {
+ public string AppName { get; set; }
+ public long AppId { get; set; }
+ public DeveloperAppVersion[] AppVersions { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/DeveloperAppVersion.cs b/BetfairApi/AccountModels/DeveloperAppVersion.cs
new file mode 100644
index 0000000..e3613f4
--- /dev/null
+++ b/BetfairApi/AccountModels/DeveloperAppVersion.cs
@@ -0,0 +1,22 @@
+using System;
+using BetfairApi.AccountModels.Enums;
+
+namespace BetfairApi.AccountModels
+{
+ ///
+ /// Describes a version of an external application
+ ///
+ public class DeveloperAppVersion
+ {
+ public string Owner { get; set; }
+ public long VersionId { get; set; }
+ public string Version { get; set; }
+ public string ApplicationKey { get; set; }
+ public bool DelayData { get; set; }
+ public bool SubscriptionRequired { get; set; }
+ public bool OwnerManaged { get; set; }
+ public bool Active { get; set; }
+ public string VendorId { get; set; }
+ public string VendorSecret { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/Enums/AffiliateRelationStatus.cs b/BetfairApi/AccountModels/Enums/AffiliateRelationStatus.cs
new file mode 100644
index 0000000..cb9f9e6
--- /dev/null
+++ b/BetfairApi/AccountModels/Enums/AffiliateRelationStatus.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.AccountModels.Enums
+{
+ public enum AffiliateRelationStatus
+ {
+ [EnumMember(Value = "INVALID_USER")]
+ InvalidUser,
+ [EnumMember(Value = "AFFILIATED")]
+ Affiliated,
+ [EnumMember(Value = "NOT_AFFILIATED")]
+ NotAffiliated
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/Enums/GrantType.cs b/BetfairApi/AccountModels/Enums/GrantType.cs
new file mode 100644
index 0000000..62fdc9b
--- /dev/null
+++ b/BetfairApi/AccountModels/Enums/GrantType.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.AccountModels.Enums
+{
+ public enum GrantType
+ {
+ [EnumMember(Value = "AUTHORIZATION_CODE")]
+ AuthorizationCode,
+ [EnumMember(Value = "REFRESH_TOKEN")]
+ RefreshToken
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/Enums/IncludeItem.cs b/BetfairApi/AccountModels/Enums/IncludeItem.cs
new file mode 100644
index 0000000..ec62b12
--- /dev/null
+++ b/BetfairApi/AccountModels/Enums/IncludeItem.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.AccountModels.Enums
+{
+ public enum IncludeItem
+ {
+ [EnumMember(Value = "ALL")]
+ All,
+ [EnumMember(Value = "EXCHANGE")]
+ Exchange,
+ [EnumMember(Value = "POKER_ROOM")]
+ PokerRoom,
+ [EnumMember(Value = "DEPOSITS_WITHDRAWALS")]
+ DepositsWithdrawals
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/Enums/ItemClass.cs b/BetfairApi/AccountModels/Enums/ItemClass.cs
new file mode 100644
index 0000000..0851c76
--- /dev/null
+++ b/BetfairApi/AccountModels/Enums/ItemClass.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.AccountModels.Enums
+{
+ public enum ItemClass
+ {
+ [EnumMember(Value = "UNKNOWN")]
+ Unknown
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/Enums/Status.cs b/BetfairApi/AccountModels/Enums/Status.cs
new file mode 100644
index 0000000..abf9b55
--- /dev/null
+++ b/BetfairApi/AccountModels/Enums/Status.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.AccountModels.Enums
+{
+ public enum Status
+ {
+ [EnumMember(Value = "SUCCESS")]
+ Success
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/Enums/SubscriptionStatus.cs b/BetfairApi/AccountModels/Enums/SubscriptionStatus.cs
new file mode 100644
index 0000000..0b9402e
--- /dev/null
+++ b/BetfairApi/AccountModels/Enums/SubscriptionStatus.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.AccountModels.Enums
+{
+ public enum SubscriptionStatus
+ {
+ [EnumMember(Value = "ALL")]
+ All,
+ [EnumMember(Value = "ACTIVATED")]
+ Activated,
+ [EnumMember(Value = "UNACTIVATED")]
+ Unactivated,
+ [EnumMember(Value = "CANCELLED")]
+ Cancelled,
+ [EnumMember(Value = "EXPIRED")]
+ Expired
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/Enums/TokenType.cs b/BetfairApi/AccountModels/Enums/TokenType.cs
new file mode 100644
index 0000000..9d5a0eb
--- /dev/null
+++ b/BetfairApi/AccountModels/Enums/TokenType.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.AccountModels.Enums
+{
+ public enum TokenType
+ {
+ [EnumMember(Value = "BEARER")]
+ Bearer
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/Enums/Wallet.cs b/BetfairApi/AccountModels/Enums/Wallet.cs
new file mode 100644
index 0000000..4f48f44
--- /dev/null
+++ b/BetfairApi/AccountModels/Enums/Wallet.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.AccountModels.Enums
+{
+ public enum Wallet
+ {
+ [EnumMember(Value = "UK")]
+ Uk,
+ [EnumMember(Value = "AUSTRALIAN")]
+ Australian
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/StatementItem.cs b/BetfairApi/AccountModels/StatementItem.cs
new file mode 100644
index 0000000..1d9f8e6
--- /dev/null
+++ b/BetfairApi/AccountModels/StatementItem.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using BetfairApi.AccountModels.Enums;
+
+namespace BetfairApi.AccountModels
+{
+ ///
+ /// Summary of a cleared order.
+ ///
+ public class StatementItem
+ {
+ public string RefId { get; set; }
+ public DateTime ItemDate { get; set; }
+ public double Amount { get; set; }
+ public double Balance { get; set; }
+ public ItemClass ItemClass { get; set; }
+ public Dictionary ItemClassData { get; set; }
+ public StatementLegacyData LegacyData { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/StatementLegacyData.cs b/BetfairApi/AccountModels/StatementLegacyData.cs
new file mode 100644
index 0000000..ce53457
--- /dev/null
+++ b/BetfairApi/AccountModels/StatementLegacyData.cs
@@ -0,0 +1,30 @@
+using System;
+using BetfairApi.AccountModels.Enums;
+
+namespace BetfairApi.AccountModels
+{
+ ///
+ /// Summary of a cleared order.
+ ///
+ public class StatementLegacyData
+ {
+ public double AvgPrice { get; set; }
+ public double BetSize { get; set; }
+ public string BetType { get; set; }
+ public string BetCategoryType { get; set; }
+ public string CommissionRate { get; set; }
+ public long EventId { get; set; }
+ public long EventTypeId { get; set; }
+ public string FullMarketName { get; set; }
+ public double GrossBetAmount { get; set; }
+ public string MarketName { get; set; }
+ public string MarketType { get; set; }
+ public DateTime PlacedDate { get; set; }
+ public long SelectionId { get; set; }
+ public string SelectionName { get; set; }
+ public DateTime StartDate { get; set; }
+ public string TransactionType { get; set; }
+ public long TransactionId { get; set; }
+ public string WinLose { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/SubscriptionHistory.cs b/BetfairApi/AccountModels/SubscriptionHistory.cs
new file mode 100644
index 0000000..fecfc22
--- /dev/null
+++ b/BetfairApi/AccountModels/SubscriptionHistory.cs
@@ -0,0 +1,20 @@
+using System;
+using BetfairApi.AccountModels.Enums;
+
+namespace BetfairApi.AccountModels
+{
+ ///
+ /// Application subscription history details
+ ///
+ public class SubscriptionHistory
+ {
+ public string SubscriptionToken { get; set; }
+ public DateTime ExpiryDateTime { get; set; }
+ public DateTime ExpiredDateTime { get; set; }
+ public DateTime CreatedDateTime { get; set; }
+ public DateTime ActivationDateTime { get; set; }
+ public DateTime CancellationDateTime { get; set; }
+ public string SubscriptionStatus { get; set; }
+ public string ClientReference { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/SubscriptionOptions.cs b/BetfairApi/AccountModels/SubscriptionOptions.cs
new file mode 100644
index 0000000..9e06dc0
--- /dev/null
+++ b/BetfairApi/AccountModels/SubscriptionOptions.cs
@@ -0,0 +1,15 @@
+using System;
+using BetfairApi.AccountModels.Enums;
+
+namespace BetfairApi.AccountModels
+{
+ ///
+ /// Wrapper object containing details of how a subscription should be created
+ ///
+ public class SubscriptionOptions
+ {
+ public int Subscription_length { get; set; }
+ public string Subscription_token { get; set; }
+ public string Client_reference { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/SubscriptionTokenInfo.cs b/BetfairApi/AccountModels/SubscriptionTokenInfo.cs
new file mode 100644
index 0000000..a869540
--- /dev/null
+++ b/BetfairApi/AccountModels/SubscriptionTokenInfo.cs
@@ -0,0 +1,18 @@
+using System;
+using BetfairApi.AccountModels.Enums;
+
+namespace BetfairApi.AccountModels
+{
+ ///
+ /// Subscription token information
+ ///
+ public class SubscriptionTokenInfo
+ {
+ public string SubscriptionToken { get; set; }
+ public DateTime ActivatedDateTime { get; set; }
+ public DateTime ExpiryDateTime { get; set; }
+ public DateTime ExpiredDateTime { get; set; }
+ public DateTime CancellationDateTime { get; set; }
+ public string SubscriptionStatus { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/TimeRange.cs b/BetfairApi/AccountModels/TimeRange.cs
new file mode 100644
index 0000000..fda1bd9
--- /dev/null
+++ b/BetfairApi/AccountModels/TimeRange.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.AccountModels.Enums;
+
+namespace BetfairApi.AccountModels
+{
+ ///
+ /// TimeRange
+ ///
+ public class TimeRange
+ {
+ public DateTime From { get; set; }
+ public DateTime To { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/TransferResponse.cs b/BetfairApi/AccountModels/TransferResponse.cs
new file mode 100644
index 0000000..5fae2ea
--- /dev/null
+++ b/BetfairApi/AccountModels/TransferResponse.cs
@@ -0,0 +1,13 @@
+using System;
+using BetfairApi.AccountModels.Enums;
+
+namespace BetfairApi.AccountModels
+{
+ ///
+ /// Transfer operation response
+ ///
+ public class TransferResponse
+ {
+ public string TransactionId { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/VendorAccessTokenInfo.cs b/BetfairApi/AccountModels/VendorAccessTokenInfo.cs
new file mode 100644
index 0000000..98f086d
--- /dev/null
+++ b/BetfairApi/AccountModels/VendorAccessTokenInfo.cs
@@ -0,0 +1,17 @@
+using System;
+using BetfairApi.AccountModels.Enums;
+
+namespace BetfairApi.AccountModels
+{
+ ///
+ /// Wrapper object containing UserVendorSessionToken, RefreshToken and optionally a Subscription Token if one was created
+ ///
+ public class VendorAccessTokenInfo
+ {
+ public string Access_token { get; set; }
+ public TokenType Token_type { get; set; }
+ public long Expires_in { get; set; }
+ public string Refresh_token { get; set; }
+ public ApplicationSubscription Application_subscription { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/AccountModels/VendorDetails.cs b/BetfairApi/AccountModels/VendorDetails.cs
new file mode 100644
index 0000000..74e6297
--- /dev/null
+++ b/BetfairApi/AccountModels/VendorDetails.cs
@@ -0,0 +1,15 @@
+using System;
+using BetfairApi.AccountModels.Enums;
+
+namespace BetfairApi.AccountModels
+{
+ ///
+ /// Wrapper object containing vendor name and redirect url
+ ///
+ public class VendorDetails
+ {
+ public long AppVersionId { get; set; }
+ public string VendorName { get; set; }
+ public string RedirectUrl { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/Authentication.cs b/BetfairApi/Authentication.cs
new file mode 100644
index 0000000..29c661d
--- /dev/null
+++ b/BetfairApi/Authentication.cs
@@ -0,0 +1,114 @@
+using SuccessfulCodeTools;
+using SuccessfulCodeTools.Extensions;
+using System;
+using System.Collections.Generic;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BetfairApi
+{
+ public class Authentication
+ {
+ private readonly string _username;
+ private readonly string _password;
+ private readonly string _applicationKey;
+ private readonly HttpClient _client;
+ private Login _loginResponse;
+
+ public Authentication(string username, string password, string applicationKey)
+ {
+ _username = username;
+ _password = password;
+ _applicationKey = applicationKey;
+ _client = new HttpClient();
+ }
+
+ private bool Authenticated()
+ {
+ return _loginResponse != null && String.IsNullOrWhiteSpace(_loginResponse.Token);
+ }
+
+ public async Task Authenticate()
+ {
+ var message = new HttpRequestMessage(HttpMethod.Post, "https://identitysso.betfair.com/api/login")
+ {
+ Content = new FormUrlEncodedContent(new Dictionary()
+ {
+ { "username", _username },
+ { "password", _password }
+ })
+ };
+ message.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
+ message.Headers.Add("X-Application", _applicationKey);
+
+ var requestResponse = await _client.SendAsync(message);
+ var content = await requestResponse.Content.ReadAsStringAsync();
+
+ if (!requestResponse.IsSuccessStatusCode)
+ {
+ throw new NotImplementedException(content);
+ }
+
+ _loginResponse = content.DeserializeJson();
+ return _loginResponse;
+ }
+
+
+ public async Task ExecuteRequest(string endpoint, object objectToSend = null)
+ {
+ if (!Authenticated())
+ {
+ await Authenticate();
+ }
+
+ if (_loginResponse == null || String.IsNullOrWhiteSpace(_loginResponse.Token))
+ {
+ throw new Exception("Login succeeded but login credentials empty");
+ }
+
+ var objectJson = objectToSend == null ? String.Empty : objectToSend.ToJson();
+
+ var message = new HttpRequestMessage(HttpMethod.Post, endpoint)
+ {
+ Content = new StringContent(objectJson, Encoding.UTF8, "application/json")
+ };
+
+ message.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
+ message.Headers.Add("X-Application", _applicationKey);
+ message.Headers.Add("X-Authentication", _loginResponse.Token);
+
+ var requestResponse = await _client.SendAsync(message);
+ var content = await requestResponse.Content.ReadAsStringAsync();
+
+ if (!requestResponse.IsSuccessStatusCode)
+ {
+ throw new Exception(content);
+ }
+
+ var result = content.DeserializeJson();
+ return result;
+ }
+
+ public class Login
+ {
+ public string Token { get; set; }
+ public string Product { get; set; }
+ public LoginStatus Status { get; set; }
+ }
+
+ public enum LoginStatus
+ {
+ [EnumMember(Value = "SUCCESS")]
+ Success,
+ [EnumMember(Value = "LIMITED_ACCESS")]
+ LimitedAccess,
+ [EnumMember(Value = "LOGIN_RESTRICTED")]
+ LoginRestricted,
+ [EnumMember(Value = "FAIL")]
+ Fail
+ }
+ }
+}
diff --git a/BetfairApi/BetfairApi.csproj b/BetfairApi/BetfairApi.csproj
new file mode 100644
index 0000000..bc4bf1f
--- /dev/null
+++ b/BetfairApi/BetfairApi.csproj
@@ -0,0 +1,12 @@
+
+
+
+ netstandard2.0
+
+
+
+
+
+
+
+
diff --git a/BetfairApi/BetfairHorseRacingQueries.cs b/BetfairApi/BetfairHorseRacingQueries.cs
new file mode 100644
index 0000000..25435fb
--- /dev/null
+++ b/BetfairApi/BetfairHorseRacingQueries.cs
@@ -0,0 +1,93 @@
+using BetfairApi.BettingModels;
+using BetfairApi.BettingModels.Enums;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BetfairApi
+{
+ public class BetfairHorseRacingQueries
+ {
+ private readonly BettingApiClient _client;
+ private string _horseRacingId;
+
+ public BetfairHorseRacingQueries(BettingApiClient client)
+ {
+ _client = client;
+ }
+
+ public async Task GetHorseWinCatalogue(DateTime from, DateTime to, params string[] countries)
+ {
+ await EnsureHorseRacingIdFound();
+
+ var horseRacingMarket = new MarketFilter()
+ {
+ EventTypeIds = new[] { _horseRacingId },
+ MarketStartTime = new TimeRange()
+ {
+ From = from,
+ To = to,
+ },
+ MarketTypeCodes = new[] { "WIN" },
+ MarketCountries = countries,
+ };
+
+ var events = await _client.ListMarketCatalogue(horseRacingMarket,
+ marketProjection:
+ new[]
+ {
+ MarketProjection.MarketStartTime,
+ MarketProjection.Event,
+ MarketProjection.RunnerDescription,
+ MarketProjection.RunnerMetadata
+ },
+ maxResults: 10,
+ sort: MarketSort.FirstToStart
+ );
+
+ return events;
+ }
+
+ public async Task GetHorseRacingMarketTypes()
+ {
+ var horseRacingMarket = new MarketFilter()
+ {
+ EventTypeIds = new[] { _horseRacingId }
+ };
+ var eventTypes = await _client.ListEventTypes(horseRacingMarket);
+ return eventTypes;
+ }
+ public async Task GetMarketBookPrices(MarketCatalogue[] catalogue)
+ {
+ var marketsFound = await _client.ListMarketBook(catalogue.Select(e => e.MarketId).ToArray(),
+ new PriceProjection()
+ {
+ PriceData = new[]
+ {
+ PriceData.ExBestOffers,
+ PriceData.ExTraded,
+ },
+ Virtualise = true
+ });
+
+ return marketsFound;
+ }
+
+ public async Task GetBestPrices(params string[] marketId)
+ {
+ var result = await _client.ListMarketBook(marketId, new PriceProjection() { PriceData = new[] { PriceData.ExBestOffers } });
+ return result;
+ }
+
+ private async Task EnsureHorseRacingIdFound()
+ {
+ if (_horseRacingId == null)
+ {
+ var eventTypes = await _client.ListEventTypes(new MarketFilter());
+ _horseRacingId = eventTypes.First(e => e.EventType.Name.Equals("Horse racing", StringComparison.InvariantCultureIgnoreCase)).EventType.Id;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingApiClient.cs b/BetfairApi/BettingApiClient.cs
new file mode 100644
index 0000000..28894ba
--- /dev/null
+++ b/BetfairApi/BettingApiClient.cs
@@ -0,0 +1,481 @@
+using System;
+using System.Collections.Generic;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Text;
+using System.Threading.Tasks;
+using BetfairApi.BettingModels;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi
+{
+ public class BettingApiClient
+ {
+ private readonly HttpClient _client;
+ private Authentication _authentication;
+ private const string _endpoint = "https://api.betfair.com/exchange/betting/rest/v1.0/";
+
+ public BettingApiClient(Authentication authentication)
+ {
+ _client = new HttpClient();
+ _authentication = authentication;
+ }
+
+ private Task ExecuteRequest(string endpoint, object request = null)
+ {
+ return _authentication.ExecuteRequest(endpoint, request);
+ }
+
+ ///
+ /// Returns a list of Event Types (i.e. Sports) associated with the markets selected by the
+ /// MarketFilter.
+ ///
+ public async Task ListEventTypes(MarketFilter filter, string locale = null)
+ {
+ var request = new
+ {
+ filter,
+ locale
+ };
+ var result = await ExecuteRequest(_endpoint + "listEventTypes/", request);
+ return result;
+ }
+
+ ///
+ /// Returns a list of Competitions (i.e., World Cup 2013) associated with the markets selected by the
+ /// MarketFilter. Currently only Football markets have an associated competition.
+ ///
+ public async Task ListCompetitions(MarketFilter filter, string locale = null)
+ {
+ var request = new
+ {
+ filter,
+ locale
+ };
+ var result = await ExecuteRequest(_endpoint + "listCompetitions/", request);
+ return result;
+ }
+
+ ///
+ /// Returns a list of time ranges in the granularity specified in the request (i.e. 3PM to 4PM, Aug
+ /// 14th to Aug 15th) associated with the markets selected by the MarketFilter.
+ ///
+ public async Task ListTimeRanges(MarketFilter filter, TimeGranularity granularity)
+ {
+ var request = new
+ {
+ filter,
+ granularity
+ };
+ var result = await ExecuteRequest(_endpoint + "listTimeRanges/", request);
+ return result;
+ }
+
+ ///
+ /// Returns a list of Events (i.e, Reading vs. Man United) associated with the markets selected by the
+ /// MarketFilter.
+ ///
+ public async Task ListEvents(MarketFilter filter, string locale = null)
+ {
+ var request = new
+ {
+ filter,
+ locale
+ };
+ var result = await ExecuteRequest(_endpoint + "listEvents/", request);
+ return result;
+ }
+
+ ///
+ /// Returns a list of market types (i.e. MATCH_ODDS, NEXT_GOAL) associated with the markets selected by
+ /// the MarketFilter. The market types are always the same, regardless of locale.
+ ///
+ public async Task ListMarketTypes(MarketFilter filter, string locale = null)
+ {
+ var request = new
+ {
+ filter,
+ locale
+ };
+ var result = await ExecuteRequest(_endpoint + "listMarketTypes/", request);
+ return result;
+ }
+
+ ///
+ /// Returns a list of Countries associated with the markets selected by the MarketFilter.
+ ///
+ public async Task ListCountries(MarketFilter filter, string locale = null)
+ {
+ var request = new
+ {
+ filter,
+ locale
+ };
+ var result = await ExecuteRequest(_endpoint + "listCountries/", request);
+ return result;
+ }
+
+ ///
+ /// Returns a list of Venues (i.e. Cheltenham, Ascot) associated with the markets selected by the
+ /// MarketFilter. Currently, only Horse Racing markets are associated with a Venue.
+ ///
+ public async Task ListVenues(MarketFilter filter, string locale = null)
+ {
+ var request = new
+ {
+ filter,
+ locale
+ };
+ var result = await ExecuteRequest(_endpoint + "listVenues/", request);
+ return result;
+ }
+
+ ///
+ /// Returns a list of information about markets that does not change (or changes very rarely). You use
+ /// listMarketCatalogue to retrieve the name of the market, the names of selections and other information about
+ /// markets.
+ ///
+ public async Task ListMarketCatalogue(MarketFilter filter, MarketProjection[] marketProjection = null, int? maxResults = null, MarketSort? sort = null, string locale = null)
+ {
+ var request = new
+ {
+ filter,
+ marketProjection,
+ sort,
+ maxResults,
+ locale
+ };
+ var result = await ExecuteRequest(_endpoint + "listMarketCatalogue/", request);
+ return result;
+ }
+
+ ///
+ /// Returns a list of dynamic data about markets. Dynamic data includes prices, the status of the
+ /// market, the status of selections, the traded volume, and the status of any orders you have placed in the
+ /// market.
+ ///
+ public async Task ListMarketBook(string[] marketIds, PriceProjection priceProjection = null, OrderProjection? orderProjection = null, MatchProjection? matchProjection = null, bool? includeOverallPosition = null, bool? partitionMatchedByStrategyRef = null, string[] customerStrategyRefs = null, string currencyCode = null, string locale = null, DateTime? matchedSince = null, string[] betIds = null)
+ {
+ var request = new
+ {
+ marketIds,
+ priceProjection,
+ orderProjection,
+ matchProjection,
+ includeOverallPosition,
+ partitionMatchedByStrategyRef,
+ customerStrategyRefs,
+ currencyCode,
+ locale,
+ matchedSince,
+ betIds
+ };
+ var result = await ExecuteRequest(_endpoint + "listMarketBook/", request);
+ return result;
+ }
+
+ ///
+ /// Returns a list of dynamic data about a market and a specified runner. Dynamic data includes prices, the status of the
+ /// market, the status of selections, the traded volume, and the status of any orders you have placed in the
+ /// market.
+ ///
+ public async Task ListRunnerBook(string marketId,long selectionId, double? handicap = null, PriceProjection priceProjection = null, OrderProjection? orderProjection = null, MatchProjection? matchProjection = null, bool? includeOverallPosition = null, bool? partitionMatchedByStrategyRef = null, string[] customerStrategyRefs = null, string currencyCode = null, string locale = null, DateTime? matchedSince = null, string[] betIds = null)
+ {
+ var request = new
+ {
+ marketId,
+ selectionId,
+ handicap,
+ priceProjection,
+ orderProjection,
+ matchProjection,
+ includeOverallPosition,
+ partitionMatchedByStrategyRef,
+ customerStrategyRefs,
+ currencyCode,
+ locale,
+ matchedSince,
+ betIds
+ };
+ var result = await ExecuteRequest(_endpoint + "listRunnerBook/", request);
+ return result;
+ }
+
+ ///
+ /// Returns a list of your current orders. Optionally you can filter and sort your current orders using
+ /// the
+ /// various parameters, setting none of the parameters will return all of your current orders, up to a maximum
+ /// of 1000 bets, ordered BY_BET and sorted
+ /// EARLIEST_TO_LATEST. To retrieve more than 1000 orders, you need to make use of the fromRecord and
+ /// recordCount parameters.
+ ///
+ public async Task ListCurrentOrders(string[] betIds = null, string[] marketIds = null, OrderProjection? orderProjection = null, string[] customerOrderRefs = null, string[] customerStrategyRefs = null, TimeRange placedDateRange = null, TimeRange dateRange = null, OrderBy? orderBy = null, SortDir? sortDir = null, int? fromRecord = null, int? recordCount = null)
+ {
+ var request = new
+ {
+ betIds,
+ marketIds,
+ orderProjection,
+ customerOrderRefs,
+ customerStrategyRefs,
+ placedDateRange,
+ dateRange,
+ orderBy,
+ sortDir,
+ fromRecord,
+ recordCount
+ };
+ var result = await ExecuteRequest(_endpoint + "listCurrentOrders/", request);
+ return result;
+ }
+
+ ///
+ /// Returns a List of bets based on the bet status, ordered by settled date
+ ///
+ public async Task ListClearedOrders(BetStatus betStatus, string[] eventTypeIds = null, string[] eventIds = null, string[] marketIds = null, RunnerId[] runnerIds = null, string[] betIds = null, string[] customerOrderRefs = null, string[] customerStrategyRefs = null, Side? side = null, TimeRange settledDateRange = null, GroupBy? groupBy = null, bool? includeItemDescription = null, string locale = null, int? fromRecord = null, int? recordCount = null)
+ {
+ var request = new
+ {
+ betStatus,
+ eventTypeIds,
+ eventIds,
+ marketIds,
+ runnerIds,
+ betIds,
+ customerOrderRefs,
+ customerStrategyRefs,
+ side,
+ settledDateRange,
+ groupBy,
+ includeItemDescription,
+ locale,
+ fromRecord,
+ recordCount
+ };
+ var result = await ExecuteRequest(_endpoint + "listClearedOrders/", request);
+ return result;
+ }
+
+ ///
+ /// Place new orders into market. LIMIT orders below the minimum bet size are allowed if
+ /// there is an unmatched bet at the same price in the market. This operation is atomic in that
+ /// all orders will be placed or none will be placed.
+ ///
+ public async Task PlaceOrders(string marketId, PlaceInstruction[] instructions, string customerRef = null, MarketVersion marketVersion = null, string customerStrategyRef = null, bool? async = null)
+ {
+ var request = new
+ {
+ marketId,
+ instructions,
+ customerRef,
+ marketVersion,
+ customerStrategyRef,
+ async
+ };
+ var result = await ExecuteRequest(_endpoint + "placeOrders/", request);
+ return result;
+ }
+
+ ///
+ /// Cancel all bets OR cancel all bets on a market OR fully or partially cancel particular orders on a
+ /// market. Only LIMIT orders an be cancelled or partially cancelled once placed.
+ ///
+ public async Task CancelOrders(string marketId = null, CancelInstruction[] instructions = null, string customerRef = null)
+ {
+ var request = new
+ {
+ marketId,
+ instructions,
+ customerRef
+ };
+ var result = await ExecuteRequest(_endpoint + "cancelOrders/", request);
+ return result;
+ }
+
+ ///
+ /// This operation is logically a bulk cancel followed by a bulk place. The cancel is completed first then
+ /// the new orders are placed. The new orders will be placed atomically in that they will all be placed or none
+ /// will be placed.
+ /// In the case where the new orders cannot be placed the cancellations will not be rolled back.
+ /// See ReplaceInstruction.
+ ///
+ public async Task ReplaceOrders(string marketId, ReplaceInstruction[] instructions, string customerRef = null, MarketVersion marketVersion = null, bool? async = null)
+ {
+ var request = new
+ {
+ marketId,
+ instructions,
+ customerRef,
+ marketVersion,
+ async
+ };
+ var result = await ExecuteRequest(_endpoint + "replaceOrders/", request);
+ return result;
+ }
+
+ ///
+ /// Update non-exposure changing fields
+ ///
+ public async Task UpdateOrders(string marketId, UpdateInstruction[] instructions, string customerRef = null)
+ {
+ var request = new
+ {
+ marketId,
+ instructions,
+ customerRef
+ };
+ var result = await ExecuteRequest(_endpoint + "updateOrders/", request);
+ return result;
+ }
+
+ ///
+ /// Retrieve profit and loss for a given list of markets. The values are calculated using matched bets and optionally settled bets.
+ /// Only odds markets are implemented, markets of other types are silently ignored.
+ ///
+ public async Task ListMarketProfitAndLoss(string[] marketIds, bool? includeSettledBets = null, bool? includeBspBets = null, bool? netOfCommission = null)
+ {
+ var request = new
+ {
+ marketIds,
+ includeSettledBets,
+ includeBspBets,
+ netOfCommission
+ };
+ var result = await ExecuteRequest(_endpoint + "listMarketProfitAndLoss/", request);
+ return result;
+ }
+
+ ///
+ /// Create/update default exposure limit for market groups of given type.
+ /// New value and breach action will be immediately applied to existing instances of this type (unless overridden using setExposureLimitForMarketGroup).
+ /// If default values are overridden for market groups (using setExposureLimitForMarketGroup), overrides will NOT be
+ /// touched.
+ /// In order to clear this limit "removeDefaultExposureLimitForMarketGroups" operation should be used. It's not allowed to set default limit to an
+ /// empty limit (see type ExposureLimit).
+ ///
+ public async Task SetDefaultExposureLimitForMarketGroups(MarketGroupType marketGroupType, ExposureLimit limit)
+ {
+ var request = new
+ {
+ marketGroupType,
+ limit
+ };
+ var result = await ExecuteRequest(_endpoint + "setDefaultExposureLimitForMarketGroups/", request);
+ return result;
+ }
+
+ ///
+ /// Create/update exposure limit for a market group.
+ /// New limit will be applied immediately (even if a default limit exists for this type).
+ /// The limit will be deleted upon account action (see deleteMarketGroupExposureLimit) or when no active markets
+ /// remain under market group.
+ /// It is possible to "invalidate" default limit for a specific group by using a "empty" limit (see type ExposureLimit).
+ /// Upon successful execution of the request, the effective limit for this group will be the one set by this request (Properties will NOT be inherited from default limit).
+ ///
+ public async Task SetExposureLimitForMarketGroup(MarketGroup marketGroup, ExposureLimit limit)
+ {
+ var request = new
+ {
+ marketGroup,
+ limit
+ };
+ var result = await ExecuteRequest(_endpoint + "setExposureLimitForMarketGroup/", request);
+ return result;
+ }
+
+ ///
+ /// Remove default exposure limit for a market group type.
+ /// This operation will NOT remove/update any market group limits.
+ ///
+ public async Task RemoveDefaultExposureLimitForMarketGroups(MarketGroupType marketGroupType)
+ {
+ var request = new
+ {
+ marketGroupType
+ };
+ var result = await ExecuteRequest(_endpoint + "removeDefaultExposureLimitForMarketGroups/", request);
+ return result;
+ }
+
+ ///
+ /// Delete exposure limit for a market group.
+ /// If a default exposure limit exist for market type, it takes effect immediately.
+ ///
+ public async Task RemoveExposureLimitForMarketGroup(MarketGroup marketGroup)
+ {
+ var request = new
+ {
+ marketGroup
+ };
+ var result = await ExecuteRequest(_endpoint + "removeExposureLimitForMarketGroup/", request);
+ return result;
+ }
+
+ ///
+ /// Response to this request returns default group limit and group limits grouped by type.
+ /// If marketGroupTypeFilter is not populated values for all types are returned.
+ /// The response will always contain the default limit. It is possible to control which groups to return using marketGroupsFilter parameter.
+ /// If marketGroupsFilter is not set all group limits are returned. If an emtpy list is passed only default limit(s) is returned.
+ /// When marketGroupTypeFilter and marketGroupsFilter used together, all groups in marketGroupsFilter are required to be of same type (type used in marketGroupTypeFilter).
+ ///
+ public async Task ListExposureLimitsForMarketGroups(MarketGroupType? marketGroupTypeFilter = null, MarketGroup[] marketGroupFilter = null)
+ {
+ var request = new
+ {
+ marketGroupTypeFilter,
+ marketGroupFilter
+ };
+ var result = await ExecuteRequest(_endpoint + "listExposureLimitsForMarketGroups/", request);
+ return result;
+ }
+
+ ///
+ /// Unblock a market group after it has been blocked due to the breach of a previously set exposure limit.
+ ///
+ public async Task UnblockMarketGroup(MarketGroup marketGroup)
+ {
+ var request = new
+ {
+ marketGroup
+ };
+ var result = await ExecuteRequest(_endpoint + "unblockMarketGroup/", request);
+ return result;
+ }
+
+ ///
+ /// Retrieves events from exposure reuse enabled events list. To edit this list use
+ /// addExposureReuseEnabledEvents and removeExposureReuseEnabledEvents operations.
+ ///
+ public async Task GetExposureReuseEnabledEvents()
+ {
+ var result = await ExecuteRequest(_endpoint + "getExposureReuseEnabledEvents/");
+ return result;
+ }
+
+ ///
+ /// Enables events for exposure reuse by appending them to the current list of events already enabled.
+ ///
+ public async Task AddExposureReuseEnabledEvents(long[] eventIds)
+ {
+ var request = new
+ {
+ eventIds
+ };
+ var result = await ExecuteRequest(_endpoint + "addExposureReuseEnabledEvents/", request);
+ return result;
+ }
+
+ ///
+ /// Removes events from exposure reuse enabled events list.
+ ///
+ public async Task RemoveExposureReuseEnabledEvents(long[] eventIds)
+ {
+ var request = new
+ {
+ eventIds
+ };
+ var result = await ExecuteRequest(_endpoint + "removeExposureReuseEnabledEvents/", request);
+ return result;
+ }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/CancelExecutionReport.cs b/BetfairApi/BettingModels/CancelExecutionReport.cs
new file mode 100644
index 0000000..12eb1d4
--- /dev/null
+++ b/BetfairApi/BettingModels/CancelExecutionReport.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ public class CancelExecutionReport
+ {
+ public string CustomerRef { get; set; }
+ public string Status { get; set; }
+ public string ErrorCode { get; set; }
+ public string MarketId { get; set; }
+ public CancelInstructionReport[] InstructionReports { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/CancelInstruction.cs b/BetfairApi/BettingModels/CancelInstruction.cs
new file mode 100644
index 0000000..ba1df9d
--- /dev/null
+++ b/BetfairApi/BettingModels/CancelInstruction.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Instruction to fully or partially cancel an order (only applies to LIMIT orders)
+ ///
+ public class CancelInstruction
+ {
+ public string BetId { get; set; }
+ public double SizeReduction { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/CancelInstructionReport.cs b/BetfairApi/BettingModels/CancelInstructionReport.cs
new file mode 100644
index 0000000..5ea19c0
--- /dev/null
+++ b/BetfairApi/BettingModels/CancelInstructionReport.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ public class CancelInstructionReport
+ {
+ public string Status { get; set; }
+ public string ErrorCode { get; set; }
+ public CancelInstruction Instruction { get; set; }
+ public double SizeCancelled { get; set; }
+ public DateTime CancelledDate { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/ClearedOrderSummary.cs b/BetfairApi/BettingModels/ClearedOrderSummary.cs
new file mode 100644
index 0000000..ccc03a3
--- /dev/null
+++ b/BetfairApi/BettingModels/ClearedOrderSummary.cs
@@ -0,0 +1,36 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Summary of a cleared order.
+ ///
+ public class ClearedOrderSummary
+ {
+ public string EventTypeId { get; set; }
+ public string EventId { get; set; }
+ public string MarketId { get; set; }
+ public long SelectionId { get; set; }
+ public decimal Handicap { get; set; }
+ public string BetId { get; set; }
+ public DateTime PlacedDate { get; set; }
+ public string PersistenceType { get; set; }
+ public string OrderType { get; set; }
+ public string Side { get; set; }
+ public ItemDescription ItemDescription { get; set; }
+ public string BetOutcome { get; set; }
+ public decimal PriceRequested { get; set; }
+ public DateTime SettledDate { get; set; }
+ public DateTime LastMatchedDate { get; set; }
+ public int BetCount { get; set; }
+ public decimal Commission { get; set; }
+ public decimal PriceMatched { get; set; }
+ public bool PriceReduced { get; set; }
+ public decimal SizeSettled { get; set; }
+ public decimal Profit { get; set; }
+ public decimal SizeCancelled { get; set; }
+ public string CustomerOrderRef { get; set; }
+ public string CustomerStrategyRef { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/ClearedOrderSummaryReport.cs b/BetfairApi/BettingModels/ClearedOrderSummaryReport.cs
new file mode 100644
index 0000000..df6b414
--- /dev/null
+++ b/BetfairApi/BettingModels/ClearedOrderSummaryReport.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// A container representing search results.
+ ///
+ public class ClearedOrderSummaryReport
+ {
+ public ClearedOrderSummary[] ClearedOrders { get; set; }
+ public bool MoreAvailable { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Competition.cs b/BetfairApi/BettingModels/Competition.cs
new file mode 100644
index 0000000..f9d2d3c
--- /dev/null
+++ b/BetfairApi/BettingModels/Competition.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Competition
+ ///
+ public class Competition
+ {
+ public string Id { get; set; }
+ public string Name { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/CompetitionResult.cs b/BetfairApi/BettingModels/CompetitionResult.cs
new file mode 100644
index 0000000..e71c758
--- /dev/null
+++ b/BetfairApi/BettingModels/CompetitionResult.cs
@@ -0,0 +1,15 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Competition Result
+ ///
+ public class CompetitionResult
+ {
+ public Competition Competition { get; set; }
+ public int MarketCount { get; set; }
+ public string CompetitionRegion { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/CountryCodeResult.cs b/BetfairApi/BettingModels/CountryCodeResult.cs
new file mode 100644
index 0000000..6d1c01e
--- /dev/null
+++ b/BetfairApi/BettingModels/CountryCodeResult.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// CountryCode Result
+ ///
+ public class CountryCodeResult
+ {
+ public string CountryCode { get; set; }
+ public int MarketCount { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/CurrentOrderSummary.cs b/BetfairApi/BettingModels/CurrentOrderSummary.cs
new file mode 100644
index 0000000..8f7c276
--- /dev/null
+++ b/BetfairApi/BettingModels/CurrentOrderSummary.cs
@@ -0,0 +1,34 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Summary of a current order.
+ ///
+ public class CurrentOrderSummary
+ {
+ public string BetId { get; set; }
+ public string MarketId { get; set; }
+ public long SelectionId { get; set; }
+ public double Handicap { get; set; }
+ public PriceSize PriceSize { get; set; }
+ public double BspLiability { get; set; }
+ public string Side { get; set; }
+ public string Status { get; set; }
+ public string PersistenceType { get; set; }
+ public string OrderType { get; set; }
+ public DateTime PlacedDate { get; set; }
+ public DateTime MatchedDate { get; set; }
+ public decimal AveragePriceMatched { get; set; }
+ public double SizeMatched { get; set; }
+ public double SizeRemaining { get; set; }
+ public double SizeLapsed { get; set; }
+ public double SizeCancelled { get; set; }
+ public double SizeVoided { get; set; }
+ public string RegulatorAuthCode { get; set; }
+ public string RegulatorCode { get; set; }
+ public string CustomerOrderRef { get; set; }
+ public string CustomerStrategyRef { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/CurrentOrderSummaryReport.cs b/BetfairApi/BettingModels/CurrentOrderSummaryReport.cs
new file mode 100644
index 0000000..42ef43f
--- /dev/null
+++ b/BetfairApi/BettingModels/CurrentOrderSummaryReport.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// A container representing search results.
+ ///
+ public class CurrentOrderSummaryReport
+ {
+ public CurrentOrderSummary[] CurrentOrders { get; set; }
+ public bool MoreAvailable { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/BetStatus.cs b/BetfairApi/BettingModels/Enums/BetStatus.cs
new file mode 100644
index 0000000..784f761
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/BetStatus.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum BetStatus
+ {
+ [EnumMember(Value = "SETTLED")]
+ Settled,
+ [EnumMember(Value = "VOIDED")]
+ Voided,
+ [EnumMember(Value = "LAPSED")]
+ Lapsed,
+ [EnumMember(Value = "CANCELLED")]
+ Cancelled
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/BetTargetType.cs b/BetfairApi/BettingModels/Enums/BetTargetType.cs
new file mode 100644
index 0000000..1c4f09b
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/BetTargetType.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum BetTargetType
+ {
+ [EnumMember(Value = "PAYOUT")]
+ Payout,
+ [EnumMember(Value = "BACKERS_PROFIT")]
+ BackersProfit
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/ExecutionReportErrorCode.cs b/BetfairApi/BettingModels/Enums/ExecutionReportErrorCode.cs
new file mode 100644
index 0000000..6f6beb6
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/ExecutionReportErrorCode.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum ExecutionReportErrorCode
+ {
+ [EnumMember(Value = "ERROR_IN_MATCHER")]
+ ErrorInMatcher,
+ [EnumMember(Value = "PROCESSED_WITH_ERRORS")]
+ ProcessedWithErrors,
+ [EnumMember(Value = "BET_ACTION_ERROR")]
+ BetActionError,
+ [EnumMember(Value = "INVALID_ACCOUNT_STATE")]
+ InvalidAccountState,
+ [EnumMember(Value = "INVALID_WALLET_STATUS")]
+ InvalidWalletStatus,
+ [EnumMember(Value = "INSUFFICIENT_FUNDS")]
+ InsufficientFunds,
+ [EnumMember(Value = "LOSS_LIMIT_EXCEEDED")]
+ LossLimitExceeded,
+ [EnumMember(Value = "MARKET_SUSPENDED")]
+ MarketSuspended,
+ [EnumMember(Value = "MARKET_NOT_OPEN_FOR_BETTING")]
+ MarketNotOpenForBetting,
+ [EnumMember(Value = "DUPLICATE_TRANSACTION")]
+ DuplicateTransaction,
+ [EnumMember(Value = "INVALID_ORDER")]
+ InvalidOrder,
+ [EnumMember(Value = "INVALID_MARKET_ID")]
+ InvalidMarketId,
+ [EnumMember(Value = "PERMISSION_DENIED")]
+ PermissionDenied,
+ [EnumMember(Value = "DUPLICATE_BETIDS")]
+ DuplicateBetids,
+ [EnumMember(Value = "NO_ACTION_REQUIRED")]
+ NoActionRequired,
+ [EnumMember(Value = "SERVICE_UNAVAILABLE")]
+ ServiceUnavailable,
+ [EnumMember(Value = "REJECTED_BY_REGULATOR")]
+ RejectedByRegulator,
+ [EnumMember(Value = "NO_CHASING")]
+ NoChasing,
+ [EnumMember(Value = "REGULATOR_IS_NOT_AVAILABLE")]
+ RegulatorIsNotAvailable,
+ [EnumMember(Value = "TOO_MANY_INSTRUCTIONS")]
+ TooManyInstructions,
+ [EnumMember(Value = "INVALID_MARKET_VERSION")]
+ InvalidMarketVersion,
+ [EnumMember(Value = "EVENT_EXPOSURE_LIMIT_EXCEEDED")]
+ EventExposureLimitExceeded,
+ [EnumMember(Value = "EVENT_MATCHED_EXPOSURE_LIMIT_EXCEEDED")]
+ EventMatchedExposureLimitExceeded,
+ [EnumMember(Value = "EVENT_BLOCKED")]
+ EventBlocked
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/ExecutionReportStatus.cs b/BetfairApi/BettingModels/Enums/ExecutionReportStatus.cs
new file mode 100644
index 0000000..9644d42
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/ExecutionReportStatus.cs
@@ -0,0 +1,16 @@
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum ExecutionReportStatus
+ {
+ [EnumMember(Value = "SUCCESS")]
+ Success,
+ [EnumMember(Value = "FAILURE")]
+ Failure,
+ [EnumMember(Value = "PROCESSED_WITH_ERRORS")]
+ ProcessedWithErrors,
+ [EnumMember(Value = "TIMEOUT")]
+ Timeout
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/GroupBy.cs b/BetfairApi/BettingModels/Enums/GroupBy.cs
new file mode 100644
index 0000000..723cb68
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/GroupBy.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum GroupBy
+ {
+ [EnumMember(Value = "EVENT_TYPE")]
+ EventType,
+ [EnumMember(Value = "EVENT")]
+ Event,
+ [EnumMember(Value = "MARKET")]
+ Market,
+ [EnumMember(Value = "RUNNER")]
+ Runner,
+ [EnumMember(Value = "SIDE")]
+ Side,
+ [EnumMember(Value = "BET")]
+ Bet,
+ [EnumMember(Value = "STRATEGY")]
+ Strategy
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/InstructionReportErrorCode.cs b/BetfairApi/BettingModels/Enums/InstructionReportErrorCode.cs
new file mode 100644
index 0000000..f825e51
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/InstructionReportErrorCode.cs
@@ -0,0 +1,65 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum InstructionReportErrorCode
+ {
+ [EnumMember(Value = "INVALID_BET_SIZE")]
+ InvalidBetSize,
+ [EnumMember(Value = "INVALID_RUNNER")]
+ InvalidRunner,
+ [EnumMember(Value = "BET_TAKEN_OR_LAPSED")]
+ BetTakenOrLapsed,
+ [EnumMember(Value = "BET_IN_PROGRESS")]
+ BetInProgress,
+ [EnumMember(Value = "RUNNER_REMOVED")]
+ RunnerRemoved,
+ [EnumMember(Value = "MARKET_NOT_OPEN_FOR_BETTING")]
+ MarketNotOpenForBetting,
+ [EnumMember(Value = "LOSS_LIMIT_EXCEEDED")]
+ LossLimitExceeded,
+ [EnumMember(Value = "MARKET_NOT_OPEN_FOR_BSP_BETTING")]
+ MarketNotOpenForBspBetting,
+ [EnumMember(Value = "INVALID_PRICE_EDIT")]
+ InvalidPriceEdit,
+ [EnumMember(Value = "INVALID_ODDS")]
+ InvalidOdds,
+ [EnumMember(Value = "INSUFFICIENT_FUNDS")]
+ InsufficientFunds,
+ [EnumMember(Value = "INVALID_PERSISTENCE_TYPE")]
+ InvalidPersistenceType,
+ [EnumMember(Value = "ERROR_IN_MATCHER")]
+ ErrorInMatcher,
+ [EnumMember(Value = "INVALID_BACK_LAY_COMBINATION")]
+ InvalidBackLayCombination,
+ [EnumMember(Value = "ERROR_IN_ORDER")]
+ ErrorInOrder,
+ [EnumMember(Value = "INVALID_BID_TYPE")]
+ InvalidBidType,
+ [EnumMember(Value = "INVALID_BET_ID")]
+ InvalidBetId,
+ [EnumMember(Value = "CANCELLED_NOT_PLACED")]
+ CancelledNotPlaced,
+ [EnumMember(Value = "RELATED_ACTION_FAILED")]
+ RelatedActionFailed,
+ [EnumMember(Value = "NO_ACTION_REQUIRED")]
+ NoActionRequired,
+ [EnumMember(Value = "INVALID_MIN_FILL_SIZE")]
+ InvalidMinFillSize,
+ [EnumMember(Value = "INVALID_CUSTOMER_ORDER_REF")]
+ InvalidCustomerOrderRef,
+ [EnumMember(Value = "TIME_IN_FORCE_CONFLICT")]
+ TimeInForceConflict,
+ [EnumMember(Value = "UNEXPECTED_PERSISTENCE_TYPE")]
+ UnexpectedPersistenceType,
+ [EnumMember(Value = "INVALID_ORDER_TYPE")]
+ InvalidOrderType,
+ [EnumMember(Value = "UNEXPECTED_MIN_FILL_SIZE")]
+ UnexpectedMinFillSize,
+ [EnumMember(Value = "INVALID_CUSTOMER_STRATEGY_REF")]
+ InvalidCustomerStrategyRef,
+ [EnumMember(Value = "BET_LAPSED_PRICE_IMPROVEMENT_TOO_LARGE")]
+ BetLapsedPriceImprovementTooLarge
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/InstructionReportStatus.cs b/BetfairApi/BettingModels/Enums/InstructionReportStatus.cs
new file mode 100644
index 0000000..c3a4528
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/InstructionReportStatus.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum InstructionReportStatus
+ {
+ [EnumMember(Value = "SUCCESS")]
+ Success,
+ [EnumMember(Value = "FAILURE")]
+ Failure,
+ [EnumMember(Value = "TIMEOUT")]
+ Timeout
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/LimitBreachActionType.cs b/BetfairApi/BettingModels/Enums/LimitBreachActionType.cs
new file mode 100644
index 0000000..5d1171c
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/LimitBreachActionType.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum LimitBreachActionType
+ {
+ [EnumMember(Value = "REJECT_BETS")]
+ RejectBets,
+ [EnumMember(Value = "STOP_BETTING")]
+ StopBetting,
+ [EnumMember(Value = "TEAR_DOWN_MARKET_GROUP")]
+ TearDownMarketGroup
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/MarketBettingType.cs b/BetfairApi/BettingModels/Enums/MarketBettingType.cs
new file mode 100644
index 0000000..2cb0fce
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/MarketBettingType.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum MarketBettingType
+ {
+ [EnumMember(Value = "ODDS")]
+ Odds,
+ [EnumMember(Value = "LINE")]
+ Line,
+ [EnumMember(Value = "RANGE")]
+ Range,
+ [EnumMember(Value = "ASIAN_HANDICAP_DOUBLE_LINE")]
+ AsianHandicapDoubleLine,
+ [EnumMember(Value = "ASIAN_HANDICAP_SINGLE_LINE")]
+ AsianHandicapSingleLine,
+ [EnumMember(Value = "FIXED_ODDS")]
+ FixedOdds
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/MarketGroupType.cs b/BetfairApi/BettingModels/Enums/MarketGroupType.cs
new file mode 100644
index 0000000..78def9b
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/MarketGroupType.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum MarketGroupType
+ {
+ [EnumMember(Value = "EVENT")]
+ Event
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/MarketProjection.cs b/BetfairApi/BettingModels/Enums/MarketProjection.cs
new file mode 100644
index 0000000..7e57a89
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/MarketProjection.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum MarketProjection
+ {
+ [EnumMember(Value = "COMPETITION")]
+ Competition,
+ [EnumMember(Value = "EVENT")]
+ Event,
+ [EnumMember(Value = "EVENT_TYPE")]
+ EventType,
+ [EnumMember(Value = "MARKET_START_TIME")]
+ MarketStartTime,
+ [EnumMember(Value = "MARKET_DESCRIPTION")]
+ MarketDescription,
+ [EnumMember(Value = "RUNNER_DESCRIPTION")]
+ RunnerDescription,
+ [EnumMember(Value = "RUNNER_METADATA")]
+ RunnerMetadata
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/MarketSort.cs b/BetfairApi/BettingModels/Enums/MarketSort.cs
new file mode 100644
index 0000000..8ceb14f
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/MarketSort.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum MarketSort
+ {
+ [EnumMember(Value = "MINIMUM_TRADED")]
+ MinimumTraded,
+ [EnumMember(Value = "MAXIMUM_TRADED")]
+ MaximumTraded,
+ [EnumMember(Value = "MINIMUM_AVAILABLE")]
+ MinimumAvailable,
+ [EnumMember(Value = "MAXIMUM_AVAILABLE")]
+ MaximumAvailable,
+ [EnumMember(Value = "FIRST_TO_START")]
+ FirstToStart,
+ [EnumMember(Value = "LAST_TO_START")]
+ LastToStart
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/MarketStatus.cs b/BetfairApi/BettingModels/Enums/MarketStatus.cs
new file mode 100644
index 0000000..5be863e
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/MarketStatus.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum MarketStatus
+ {
+ [EnumMember(Value = "INACTIVE")]
+ Inactive,
+ [EnumMember(Value = "OPEN")]
+ Open,
+ [EnumMember(Value = "SUSPENDED")]
+ Suspended,
+ [EnumMember(Value = "CLOSED")]
+ Closed
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/MatchProjection.cs b/BetfairApi/BettingModels/Enums/MatchProjection.cs
new file mode 100644
index 0000000..cc1583a
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/MatchProjection.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum MatchProjection
+ {
+ [EnumMember(Value = "NO_ROLLUP")]
+ NoRollup,
+ [EnumMember(Value = "ROLLED_UP_BY_PRICE")]
+ RolledUpByPrice,
+ [EnumMember(Value = "ROLLED_UP_BY_AVG_PRICE")]
+ RolledUpByAvgPrice
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/OrderBy.cs b/BetfairApi/BettingModels/Enums/OrderBy.cs
new file mode 100644
index 0000000..bea7e04
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/OrderBy.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum OrderBy
+ {
+ [EnumMember(Value = "BY_BET")]
+ ByBet,
+ [EnumMember(Value = "BY_MARKET")]
+ ByMarket,
+ [EnumMember(Value = "BY_PLACE_TIME")]
+ ByPlaceTime,
+ [EnumMember(Value = "BY_MATCH_TIME")]
+ ByMatchTime,
+ [EnumMember(Value = "BY_VOID_TIME")]
+ ByVoidTime,
+ [EnumMember(Value = "BY_SETTLED_TIME")]
+ BySettledTime
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/OrderProjection.cs b/BetfairApi/BettingModels/Enums/OrderProjection.cs
new file mode 100644
index 0000000..2af5acc
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/OrderProjection.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum OrderProjection
+ {
+ [EnumMember(Value = "ALL")]
+ All,
+ [EnumMember(Value = "EXECUTABLE")]
+ Executable,
+ [EnumMember(Value = "EXECUTION_COMPLETE")]
+ ExecutionComplete
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/OrderStatus.cs b/BetfairApi/BettingModels/Enums/OrderStatus.cs
new file mode 100644
index 0000000..3d5bf25
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/OrderStatus.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum OrderStatus
+ {
+ [EnumMember(Value = "PENDING")]
+ Pending,
+ [EnumMember(Value = "EXECUTION_COMPLETE")]
+ ExecutionComplete,
+ [EnumMember(Value = "EXECUTABLE")]
+ Executable,
+ [EnumMember(Value = "EXPIRED")]
+ Expired
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/OrderType.cs b/BetfairApi/BettingModels/Enums/OrderType.cs
new file mode 100644
index 0000000..2daaeb6
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/OrderType.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum OrderType
+ {
+ [EnumMember(Value = "LIMIT")]
+ Limit,
+ [EnumMember(Value = "LIMIT_ON_CLOSE")]
+ LimitOnClose,
+ [EnumMember(Value = "MARKET_ON_CLOSE")]
+ MarketOnClose
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/PersistenceType.cs b/BetfairApi/BettingModels/Enums/PersistenceType.cs
new file mode 100644
index 0000000..c1fce61
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/PersistenceType.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum PersistenceType
+ {
+ [EnumMember(Value = "LAPSE")]
+ Lapse,
+ [EnumMember(Value = "PERSIST")]
+ Persist,
+ [EnumMember(Value = "MARKET_ON_CLOSE")]
+ MarketOnClose
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/PriceData.cs b/BetfairApi/BettingModels/Enums/PriceData.cs
new file mode 100644
index 0000000..26ae250
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/PriceData.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum PriceData
+ {
+ [EnumMember(Value = "SP_AVAILABLE")]
+ SpAvailable,
+ [EnumMember(Value = "SP_TRADED")]
+ SpTraded,
+ [EnumMember(Value = "EX_BEST_OFFERS")]
+ ExBestOffers,
+ [EnumMember(Value = "EX_ALL_OFFERS")]
+ ExAllOffers,
+ [EnumMember(Value = "EX_TRADED")]
+ ExTraded
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/PriceLadderType.cs b/BetfairApi/BettingModels/Enums/PriceLadderType.cs
new file mode 100644
index 0000000..2b2d637
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/PriceLadderType.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum PriceLadderType
+ {
+ [EnumMember(Value = "CLASSIC")]
+ Classic,
+ [EnumMember(Value = "FINEST")]
+ Finest,
+ [EnumMember(Value = "LINE_RANGE")]
+ LineRange
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/RollupModel.cs b/BetfairApi/BettingModels/Enums/RollupModel.cs
new file mode 100644
index 0000000..35654b7
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/RollupModel.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum RollupModel
+ {
+ [EnumMember(Value = "STAKE")]
+ Stake,
+ [EnumMember(Value = "PAYOUT")]
+ Payout,
+ [EnumMember(Value = "MANAGED_LIABILITY")]
+ ManagedLiability,
+ [EnumMember(Value = "NONE")]
+ None
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/RunnerStatus.cs b/BetfairApi/BettingModels/Enums/RunnerStatus.cs
new file mode 100644
index 0000000..575780e
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/RunnerStatus.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum RunnerStatus
+ {
+ [EnumMember(Value = "ACTIVE")]
+ Active,
+ [EnumMember(Value = "WINNER")]
+ Winner,
+ [EnumMember(Value = "LOSER")]
+ Loser,
+ [EnumMember(Value = "REMOVED_VACANT")]
+ RemovedVacant,
+ [EnumMember(Value = "REMOVED")]
+ Removed,
+ [EnumMember(Value = "PLACED")]
+ Placed
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/Side.cs b/BetfairApi/BettingModels/Enums/Side.cs
new file mode 100644
index 0000000..e9a2a23
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/Side.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum Side
+ {
+ [EnumMember(Value = "BACK")]
+ Back,
+ [EnumMember(Value = "LAY")]
+ Lay
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/SortDir.cs b/BetfairApi/BettingModels/Enums/SortDir.cs
new file mode 100644
index 0000000..0ddeb54
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/SortDir.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum SortDir
+ {
+ [EnumMember(Value = "EARLIEST_TO_LATEST")]
+ EarliestToLatest,
+ [EnumMember(Value = "LATEST_TO_EARLIEST")]
+ LatestToEarliest
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/TimeGranularity.cs b/BetfairApi/BettingModels/Enums/TimeGranularity.cs
new file mode 100644
index 0000000..d2dc023
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/TimeGranularity.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum TimeGranularity
+ {
+ [EnumMember(Value = "DAYS")]
+ Days,
+ [EnumMember(Value = "HOURS")]
+ Hours,
+ [EnumMember(Value = "MINUTES")]
+ Minutes
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Enums/TimeInForce.cs b/BetfairApi/BettingModels/Enums/TimeInForce.cs
new file mode 100644
index 0000000..631f7ee
--- /dev/null
+++ b/BetfairApi/BettingModels/Enums/TimeInForce.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Runtime.Serialization;
+
+namespace BetfairApi.BettingModels.Enums
+{
+ public enum TimeInForce
+ {
+ [EnumMember(Value = "FILL_OR_KILL")]
+ FillOrKill
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Event.cs b/BetfairApi/BettingModels/Event.cs
new file mode 100644
index 0000000..40d2276
--- /dev/null
+++ b/BetfairApi/BettingModels/Event.cs
@@ -0,0 +1,18 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Event
+ ///
+ public class Event
+ {
+ public string Id { get; set; }
+ public string Name { get; set; }
+ public string CountryCode { get; set; }
+ public string Timezone { get; set; }
+ public string Venue { get; set; }
+ public DateTime OpenDate { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/EventResult.cs b/BetfairApi/BettingModels/EventResult.cs
new file mode 100644
index 0000000..68b08b6
--- /dev/null
+++ b/BetfairApi/BettingModels/EventResult.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Event Result
+ ///
+ public class EventResult
+ {
+ public Event Event { get; set; }
+ public int MarketCount { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/EventType.cs b/BetfairApi/BettingModels/EventType.cs
new file mode 100644
index 0000000..09f1636
--- /dev/null
+++ b/BetfairApi/BettingModels/EventType.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// EventType
+ ///
+ public class EventType
+ {
+ public string Id { get; set; }
+ public string Name { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/EventTypeResult.cs b/BetfairApi/BettingModels/EventTypeResult.cs
new file mode 100644
index 0000000..3d12e28
--- /dev/null
+++ b/BetfairApi/BettingModels/EventTypeResult.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// EventType Result
+ ///
+ public class EventTypeResult
+ {
+ public EventType EventType { get; set; }
+ public int MarketCount { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/ExBestOffersOverrides.cs b/BetfairApi/BettingModels/ExBestOffersOverrides.cs
new file mode 100644
index 0000000..3247537
--- /dev/null
+++ b/BetfairApi/BettingModels/ExBestOffersOverrides.cs
@@ -0,0 +1,17 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Options to alter the default representation of best offer prices
+ ///
+ public class ExBestOffersOverrides
+ {
+ public int BestPricesDepth { get; set; }
+ public RollupModel RollupModel { get; set; }
+ public int RollupLimit { get; set; }
+ public double RollupLiabilityThreshold { get; set; }
+ public int RollupLiabilityFactor { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/ExchangePrices.cs b/BetfairApi/BettingModels/ExchangePrices.cs
new file mode 100644
index 0000000..9f4767d
--- /dev/null
+++ b/BetfairApi/BettingModels/ExchangePrices.cs
@@ -0,0 +1,12 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ public class ExchangePrices
+ {
+ public PriceSize[] AvailableToBack { get; set; }
+ public PriceSize[] AvailableToLay { get; set; }
+ public PriceSize[] TradedVolume { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/ExposureLimit.cs b/BetfairApi/BettingModels/ExposureLimit.cs
new file mode 100644
index 0000000..7daacf2
--- /dev/null
+++ b/BetfairApi/BettingModels/ExposureLimit.cs
@@ -0,0 +1,19 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Exposure limit and limit breach action.
+ /// Not populating one of total or matched parameters indicates that no limit should be set for that exposure value.
+ ///
+ /// A special use of this type is when none of its parameters are populated, this can be used to override
+ /// default limit to "no limit" for a specific instance of market group (see setExposureLimitForMarketGroup operation)
+ ///
+ public class ExposureLimit
+ {
+ public double Matched { get; set; }
+ public double Total { get; set; }
+ public LimitBreachAction LimitBreachAction { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/ExposureLimitsForMarketGroups.cs b/BetfairApi/BettingModels/ExposureLimitsForMarketGroups.cs
new file mode 100644
index 0000000..b2c86e0
--- /dev/null
+++ b/BetfairApi/BettingModels/ExposureLimitsForMarketGroups.cs
@@ -0,0 +1,18 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Wrapper type that contains accounts exposure limits for a market group type.
+ /// If default limit exists for group type, defaultLimit value will be populated.
+ /// Group limits to return can be controller by marketGroupFilter parameter (see listExposureLimitsForMarketGroups operation).
+ ///
+ public class ExposureLimitsForMarketGroups
+ {
+ public MarketGroupType MarketGroupType { get; set; }
+ public ExposureLimit DefaultLimit { get; set; }
+ public MarketGroupExposureLimit[] GroupLimits { get; set; }
+ public MarketGroupId[] BlockedMarketGroups { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/ItemDescription.cs b/BetfairApi/BettingModels/ItemDescription.cs
new file mode 100644
index 0000000..9b8cbe6
--- /dev/null
+++ b/BetfairApi/BettingModels/ItemDescription.cs
@@ -0,0 +1,21 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// This object contains some text which may be useful to render a betting history view. It offers no
+ /// long-term warranty as to the correctness of the text.
+ ///
+ public class ItemDescription
+ {
+ public string EventTypeDesc { get; set; }
+ public string EventDesc { get; set; }
+ public string MarketDesc { get; set; }
+ public string MarketType { get; set; }
+ public DateTime MarketStartTime { get; set; }
+ public string RunnerDesc { get; set; }
+ public int NumberOfWinners { get; set; }
+ public double EachWayDivisor { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/KeyLineDescription.cs b/BetfairApi/BettingModels/KeyLineDescription.cs
new file mode 100644
index 0000000..e89a6ed
--- /dev/null
+++ b/BetfairApi/BettingModels/KeyLineDescription.cs
@@ -0,0 +1,13 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// A list of KeyLineSelection objects describing the key line for the market
+ ///
+ public class KeyLineDescription
+ {
+ public KeyLineSelection[] KeyLine { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/KeyLineSelection.cs b/BetfairApi/BettingModels/KeyLineSelection.cs
new file mode 100644
index 0000000..637bc27
--- /dev/null
+++ b/BetfairApi/BettingModels/KeyLineSelection.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Description of a markets key line selection, comprising the selectionId and handicap of the team it is applied to.
+ ///
+ public class KeyLineSelection
+ {
+ public long SelectionId { get; set; }
+ public double Handicap { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/LimitBreachAction.cs b/BetfairApi/BettingModels/LimitBreachAction.cs
new file mode 100644
index 0000000..5056a10
--- /dev/null
+++ b/BetfairApi/BettingModels/LimitBreachAction.cs
@@ -0,0 +1,13 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Action that should be execute when limit is breached
+ ///
+ public class LimitBreachAction
+ {
+ public LimitBreachActionType ActionType { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/LimitOnCloseOrder.cs b/BetfairApi/BettingModels/LimitOnCloseOrder.cs
new file mode 100644
index 0000000..6294577
--- /dev/null
+++ b/BetfairApi/BettingModels/LimitOnCloseOrder.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Place a new LIMIT_ON_CLOSE bet
+ ///
+ public class LimitOnCloseOrder
+ {
+ public double Liability { get; set; }
+ public decimal Price { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/LimitOrder.cs b/BetfairApi/BettingModels/LimitOrder.cs
new file mode 100644
index 0000000..cae0bba
--- /dev/null
+++ b/BetfairApi/BettingModels/LimitOrder.cs
@@ -0,0 +1,19 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Place a new LIMIT order (simple exchange bet for immediate execution)
+ ///
+ public class LimitOrder
+ {
+ public decimal Size { get; set; }
+ public decimal Price { get; set; }
+ public PersistenceType? PersistenceType { get; set; }
+ public TimeInForce? TimeInForce { get; set; }
+ public double? MinFillSize { get; set; }
+ public BetTargetType? BetTargetType { get; set; }
+ public double? BetTargetSize { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/MarketBook.cs b/BetfairApi/BettingModels/MarketBook.cs
new file mode 100644
index 0000000..1e724c7
--- /dev/null
+++ b/BetfairApi/BettingModels/MarketBook.cs
@@ -0,0 +1,30 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// The dynamic data in a market
+ ///
+ public class MarketBook
+ {
+ public string MarketId { get; set; }
+ public bool IsMarketDataDelayed { get; set; }
+ public string Status { get; set; }
+ public int BetDelay { get; set; }
+ public bool BspReconciled { get; set; }
+ public bool Complete { get; set; }
+ public bool Inplay { get; set; }
+ public int NumberOfWinners { get; set; }
+ public int NumberOfRunners { get; set; }
+ public int NumberOfActiveRunners { get; set; }
+ public DateTime LastMatchTime { get; set; }
+ public double TotalMatched { get; set; }
+ public double TotalAvailable { get; set; }
+ public bool CrossMatching { get; set; }
+ public bool RunnersVoidable { get; set; }
+ public long Version { get; set; }
+ public Runner[] Runners { get; set; }
+ public KeyLineDescription KeyLineDescription { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/MarketCatalogue.cs b/BetfairApi/BettingModels/MarketCatalogue.cs
new file mode 100644
index 0000000..2ac20f5
--- /dev/null
+++ b/BetfairApi/BettingModels/MarketCatalogue.cs
@@ -0,0 +1,21 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Information about a market
+ ///
+ public class MarketCatalogue
+ {
+ public string MarketId { get; set; }
+ public string MarketName { get; set; }
+ public DateTime MarketStartTime { get; set; }
+ public MarketDescription Description { get; set; }
+ public double TotalMatched { get; set; }
+ public RunnerCatalog[] Runners { get; set; }
+ public EventType EventType { get; set; }
+ public Competition Competition { get; set; }
+ public Event Event { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/MarketDescription.cs b/BetfairApi/BettingModels/MarketDescription.cs
new file mode 100644
index 0000000..30a2f07
--- /dev/null
+++ b/BetfairApi/BettingModels/MarketDescription.cs
@@ -0,0 +1,31 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Market definition
+ ///
+ public class MarketDescription
+ {
+ public bool PersistenceEnabled { get; set; }
+ public bool BspMarket { get; set; }
+ public DateTime MarketTime { get; set; }
+ public DateTime SuspendTime { get; set; }
+ public DateTime SettleTime { get; set; }
+ public string BettingType { get; set; }
+ public bool TurnInPlayEnabled { get; set; }
+ public string MarketType { get; set; }
+ public string Regulator { get; set; }
+ public double MarketBaseRate { get; set; }
+ public bool DiscountAllowed { get; set; }
+ public string Wallet { get; set; }
+ public string Rules { get; set; }
+ public bool RulesHasDate { get; set; }
+ public string Clarifications { get; set; }
+ public double EachWayDivisor { get; set; }
+ public MarketLineRangeInfo LineRangeInfo { get; set; }
+ public string RaceType { get; set; }
+ public PriceLadderDescription PriceLadderDescription { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/MarketFilter.cs b/BetfairApi/BettingModels/MarketFilter.cs
new file mode 100644
index 0000000..0c6bbff
--- /dev/null
+++ b/BetfairApi/BettingModels/MarketFilter.cs
@@ -0,0 +1,25 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ public class MarketFilter
+ {
+ public string TextQuery { get; set; }
+ public string[] ExchangeIds { get; set; }
+ public string[] EventTypeIds { get; set; }
+ public string[] EventIds { get; set; }
+ public string[] CompetitionIds { get; set; }
+ public string[] MarketIds { get; set; }
+ public string[] Venues { get; set; }
+ public bool? BspOnly { get; set; }
+ public bool? TurnInPlayEnabled { get; set; }
+ public bool? InPlayOnly { get; set; }
+ public MarketBettingType[] MarketBettingTypes { get; set; }
+ public string[] MarketCountries { get; set; }
+ public string[] MarketTypeCodes { get; set; }
+ public TimeRange MarketStartTime { get; set; }
+ public OrderStatus[] WithOrders { get; set; }
+ public string[] RaceTypes { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/MarketGroup.cs b/BetfairApi/BettingModels/MarketGroup.cs
new file mode 100644
index 0000000..8875729
--- /dev/null
+++ b/BetfairApi/BettingModels/MarketGroup.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Represents a market group
+ ///
+ public class MarketGroup
+ {
+ public MarketGroupType Type { get; set; }
+ public MarketGroupId Id { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/MarketGroupExposureLimit.cs b/BetfairApi/BettingModels/MarketGroupExposureLimit.cs
new file mode 100644
index 0000000..21c97cf
--- /dev/null
+++ b/BetfairApi/BettingModels/MarketGroupExposureLimit.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Container type for a group exposure limit
+ ///
+ public class MarketGroupExposureLimit
+ {
+ public MarketGroupId GroupId { get; set; }
+ public ExposureLimit Limit { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/MarketGroupId.cs b/BetfairApi/BettingModels/MarketGroupId.cs
new file mode 100644
index 0000000..3f8ccf3
--- /dev/null
+++ b/BetfairApi/BettingModels/MarketGroupId.cs
@@ -0,0 +1,13 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Container type for market group ID
+ ///
+ public class MarketGroupId
+ {
+ public long EventId { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/MarketLicence.cs b/BetfairApi/BettingModels/MarketLicence.cs
new file mode 100644
index 0000000..672f993
--- /dev/null
+++ b/BetfairApi/BettingModels/MarketLicence.cs
@@ -0,0 +1,16 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Market Licence
+ ///
+ public class MarketLicence
+ {
+ public string Wallet { get; set; }
+ public string Rules { get; set; }
+ public bool RulesHasDate { get; set; }
+ public string Clarifications { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/MarketLineRangeInfo.cs b/BetfairApi/BettingModels/MarketLineRangeInfo.cs
new file mode 100644
index 0000000..1445ef7
--- /dev/null
+++ b/BetfairApi/BettingModels/MarketLineRangeInfo.cs
@@ -0,0 +1,16 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Market Line and Range Info
+ ///
+ public class MarketLineRangeInfo
+ {
+ public double MaxUnitValue { get; set; }
+ public double MinUnitValue { get; set; }
+ public double Interval { get; set; }
+ public string MarketUnit { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/MarketOnCloseOrder.cs b/BetfairApi/BettingModels/MarketOnCloseOrder.cs
new file mode 100644
index 0000000..749eb45
--- /dev/null
+++ b/BetfairApi/BettingModels/MarketOnCloseOrder.cs
@@ -0,0 +1,13 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Place a new MARKET_ON_CLOSE bet
+ ///
+ public class MarketOnCloseOrder
+ {
+ public double Liability { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/MarketProfitAndLoss.cs b/BetfairApi/BettingModels/MarketProfitAndLoss.cs
new file mode 100644
index 0000000..2277746
--- /dev/null
+++ b/BetfairApi/BettingModels/MarketProfitAndLoss.cs
@@ -0,0 +1,15 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Profit and loss in a market
+ ///
+ public class MarketProfitAndLoss
+ {
+ public string MarketId { get; set; }
+ public double CommissionApplied { get; set; }
+ public RunnerProfitAndLoss[] ProfitAndLosses { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/MarketRates.cs b/BetfairApi/BettingModels/MarketRates.cs
new file mode 100644
index 0000000..78f4106
--- /dev/null
+++ b/BetfairApi/BettingModels/MarketRates.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Market Rates
+ ///
+ public class MarketRates
+ {
+ public double MarketBaseRate { get; set; }
+ public bool DiscountAllowed { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/MarketState.cs b/BetfairApi/BettingModels/MarketState.cs
new file mode 100644
index 0000000..e15171d
--- /dev/null
+++ b/BetfairApi/BettingModels/MarketState.cs
@@ -0,0 +1,22 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Market definition
+ ///
+ public class MarketState
+ {
+ public string Status { get; set; }
+ public int BetDelay { get; set; }
+ public bool BspReconciled { get; set; }
+ public bool Complete { get; set; }
+ public bool Inplay { get; set; }
+ public int NumberOfActiveRunners { get; set; }
+ public DateTime LastMatchTime { get; set; }
+ public double TotalMatched { get; set; }
+ public double TotalAvailable { get; set; }
+ public KeyLineDescription KeyLineDescription { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/MarketTypeResult.cs b/BetfairApi/BettingModels/MarketTypeResult.cs
new file mode 100644
index 0000000..4d7c8f0
--- /dev/null
+++ b/BetfairApi/BettingModels/MarketTypeResult.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// MarketType Result
+ ///
+ public class MarketTypeResult
+ {
+ public string MarketType { get; set; }
+ public int MarketCount { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/MarketVersion.cs b/BetfairApi/BettingModels/MarketVersion.cs
new file mode 100644
index 0000000..5bc3de2
--- /dev/null
+++ b/BetfairApi/BettingModels/MarketVersion.cs
@@ -0,0 +1,13 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Market version
+ ///
+ public class MarketVersion
+ {
+ public long Version { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Match.cs b/BetfairApi/BettingModels/Match.cs
new file mode 100644
index 0000000..86083d7
--- /dev/null
+++ b/BetfairApi/BettingModels/Match.cs
@@ -0,0 +1,19 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// An individual bet Match, or rollup by price or avg price. Rollup
+ /// depends on the requested MatchProjection
+ ///
+ public class Match
+ {
+ public string BetId { get; set; }
+ public string MatchId { get; set; }
+ public string Side { get; set; }
+ public decimal Price { get; set; }
+ public double Size { get; set; }
+ public DateTime MatchDate { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Matches.cs b/BetfairApi/BettingModels/Matches.cs
new file mode 100644
index 0000000..790ea4b
--- /dev/null
+++ b/BetfairApi/BettingModels/Matches.cs
@@ -0,0 +1,13 @@
+using Newtonsoft.Json;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Match list.
+ ///
+ public class Matches
+ {
+ [JsonProperty("matches")]
+ public Match[] Items { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Order.cs b/BetfairApi/BettingModels/Order.cs
new file mode 100644
index 0000000..4301f43
--- /dev/null
+++ b/BetfairApi/BettingModels/Order.cs
@@ -0,0 +1,26 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ public class Order
+ {
+ public string BetId { get; set; }
+ public string OrderType { get; set; }
+ public string Status { get; set; }
+ public string PersistenceType { get; set; }
+ public string Side { get; set; }
+ public decimal Price { get; set; }
+ public double Size { get; set; }
+ public double BspLiability { get; set; }
+ public DateTime PlacedDate { get; set; }
+ public decimal AvgPriceMatched { get; set; }
+ public double SizeMatched { get; set; }
+ public double SizeRemaining { get; set; }
+ public double SizeLapsed { get; set; }
+ public double SizeCancelled { get; set; }
+ public double SizeVoided { get; set; }
+ public string CustomerOrderRef { get; set; }
+ public string CustomerStrategyRef { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/PlaceExecutionReport.cs b/BetfairApi/BettingModels/PlaceExecutionReport.cs
new file mode 100644
index 0000000..b3bb107
--- /dev/null
+++ b/BetfairApi/BettingModels/PlaceExecutionReport.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ public class PlaceExecutionReport
+ {
+ public string CustomerRef { get; set; }
+ public string Status { get; set; }
+ public string ErrorCode { get; set; }
+ public string MarketId { get; set; }
+ public PlaceInstructionReport[] InstructionReports { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/PlaceInstruction.cs b/BetfairApi/BettingModels/PlaceInstruction.cs
new file mode 100644
index 0000000..71b0398
--- /dev/null
+++ b/BetfairApi/BettingModels/PlaceInstruction.cs
@@ -0,0 +1,20 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Instruction to place a new order
+ ///
+ public class PlaceInstruction
+ {
+ public OrderType OrderType { get; set; }
+ public long SelectionId { get; set; }
+ public double? Handicap { get; set; }
+ public Side Side { get; set; }
+ public LimitOrder LimitOrder { get; set; }
+ public LimitOnCloseOrder LimitOnCloseOrder { get; set; }
+ public MarketOnCloseOrder MarketOnCloseOrder { get; set; }
+ public string CustomerOrderRef { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/PlaceInstructionReport.cs b/BetfairApi/BettingModels/PlaceInstructionReport.cs
new file mode 100644
index 0000000..8f511d1
--- /dev/null
+++ b/BetfairApi/BettingModels/PlaceInstructionReport.cs
@@ -0,0 +1,20 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Response to a PlaceInstruction
+ ///
+ public class PlaceInstructionReport
+ {
+ public string Status { get; set; }
+ public string ErrorCode { get; set; }
+ public OrderStatus OrderStatus { get; set; }
+ public PlaceInstruction Instruction { get; set; }
+ public string BetId { get; set; }
+ public DateTime PlacedDate { get; set; }
+ public decimal AveragePriceMatched { get; set; }
+ public double SizeMatched { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/PriceLadderDescription.cs b/BetfairApi/BettingModels/PriceLadderDescription.cs
new file mode 100644
index 0000000..0103e8a
--- /dev/null
+++ b/BetfairApi/BettingModels/PriceLadderDescription.cs
@@ -0,0 +1,13 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Description of the price ladder type and any related data.
+ ///
+ public class PriceLadderDescription
+ {
+ public PriceLadderType Type { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/PriceProjection.cs b/BetfairApi/BettingModels/PriceProjection.cs
new file mode 100644
index 0000000..b086608
--- /dev/null
+++ b/BetfairApi/BettingModels/PriceProjection.cs
@@ -0,0 +1,16 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Selection criteria of the returning price data
+ ///
+ public class PriceProjection
+ {
+ public PriceData[] PriceData { get; set; }
+ public ExBestOffersOverrides ExBestOffersOverrides { get; set; }
+ public bool Virtualise { get; set; }
+ public bool RolloverStakes { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/PriceSize.cs b/BetfairApi/BettingModels/PriceSize.cs
new file mode 100644
index 0000000..fac42d8
--- /dev/null
+++ b/BetfairApi/BettingModels/PriceSize.cs
@@ -0,0 +1,11 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ public class PriceSize
+ {
+ public decimal Price { get; set; }
+ public double Size { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/ReplaceExecutionReport.cs b/BetfairApi/BettingModels/ReplaceExecutionReport.cs
new file mode 100644
index 0000000..c605cf0
--- /dev/null
+++ b/BetfairApi/BettingModels/ReplaceExecutionReport.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ public class ReplaceExecutionReport
+ {
+ public string CustomerRef { get; set; }
+ public string Status { get; set; }
+ public string ErrorCode { get; set; }
+ public string MarketId { get; set; }
+ public ReplaceInstructionReport[] InstructionReports { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/ReplaceInstruction.cs b/BetfairApi/BettingModels/ReplaceInstruction.cs
new file mode 100644
index 0000000..06e4b40
--- /dev/null
+++ b/BetfairApi/BettingModels/ReplaceInstruction.cs
@@ -0,0 +1,16 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Instruction to replace a LIMIT or LIMIT_ON_CLOSE order at a new price. Original order will be
+ /// cancelled
+ /// and a new order placed at the new price for the remaining stake.
+ ///
+ public class ReplaceInstruction
+ {
+ public string BetId { get; set; }
+ public decimal NewPrice { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/ReplaceInstructionReport.cs b/BetfairApi/BettingModels/ReplaceInstructionReport.cs
new file mode 100644
index 0000000..4834159
--- /dev/null
+++ b/BetfairApi/BettingModels/ReplaceInstructionReport.cs
@@ -0,0 +1,13 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ public class ReplaceInstructionReport
+ {
+ public string Status { get; set; }
+ public string ErrorCode { get; set; }
+ public CancelInstructionReport CancelInstructionReport { get; set; }
+ public PlaceInstructionReport PlaceInstructionReport { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/Runner.cs b/BetfairApi/BettingModels/Runner.cs
new file mode 100644
index 0000000..25e6752
--- /dev/null
+++ b/BetfairApi/BettingModels/Runner.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using BetfairApi.BettingModels.Enums;
+using Newtonsoft.Json;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// The dynamic data about runners in a market
+ ///
+ public class Runner
+ {
+ public long SelectionId { get; set; }
+ public double Handicap { get; set; }
+ public string Status { get; set; }
+ public double AdjustmentFactor { get; set; }
+ public double LastPriceTraded { get; set; }
+ public double TotalMatched { get; set; }
+ public DateTime? RemovalDate { get; set; }
+ public StartingPrices Sp { get; set; }
+ [JsonProperty("Ex")]
+ public ExchangePrices ExchangePrices { get; set; }
+ public Order[] Orders { get; set; }
+ public Match[] Matches { get; set; }
+ public Dictionary MatchesByStrategy { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/RunnerCatalog.cs b/BetfairApi/BettingModels/RunnerCatalog.cs
new file mode 100644
index 0000000..985a803
--- /dev/null
+++ b/BetfairApi/BettingModels/RunnerCatalog.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Information about the Runners (selections) in a market
+ ///
+ public class RunnerCatalog
+ {
+ public long SelectionId { get; set; }
+ public string RunnerName { get; set; }
+ public double Handicap { get; set; }
+ public int SortPriority { get; set; }
+ public RunnerMetaData Metadata { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/RunnerId.cs b/BetfairApi/BettingModels/RunnerId.cs
new file mode 100644
index 0000000..dac3df4
--- /dev/null
+++ b/BetfairApi/BettingModels/RunnerId.cs
@@ -0,0 +1,15 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// This object contains the unique identifier for a runner
+ ///
+ public class RunnerId
+ {
+ public string MarketId { get; set; }
+ public long SelectionId { get; set; }
+ public double Handicap { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/RunnerMetaData.cs b/BetfairApi/BettingModels/RunnerMetaData.cs
new file mode 100644
index 0000000..6fee491
--- /dev/null
+++ b/BetfairApi/BettingModels/RunnerMetaData.cs
@@ -0,0 +1,41 @@
+using SuccessfulCodeTools.Extensions;
+using System.Collections.Generic;
+
+namespace BetfairApi.BettingModels
+{
+ public class RunnerMetaData : Dictionary
+ {
+ public string SireName => this.GetValueOrDefault("SIRE_NAME");
+ public string ClothNumberAlpha => this.GetValueOrDefault("CLOTH_NUMBER_ALPHA");
+ public string OfficialRating => this.GetValueOrDefault("OFFICIAL_RATING");
+ public string ColoursDescription => this.GetValueOrDefault("COLOURS_DESCRIPTION");
+ public string ColoursFilename => this.GetValueOrDefault("COLOURS_FILENAME");
+ public string ForecastpriceDenominator => this.GetValueOrDefault("FORECASTPRICE_DENOMINATOR");
+ public string DamsireName => this.GetValueOrDefault("DAMSIRE_NAME");
+ public string WeightValue => this.GetValueOrDefault("WEIGHT_VALUE");
+ public string SexType => this.GetValueOrDefault("SEX_TYPE");
+ public string DaysSinceLastRun => this.GetValueOrDefault("DAYS_SINCE_LAST_RUN");
+ public string Wearing => this.GetValueOrDefault("WEARING");
+ public string OwnerName => this.GetValueOrDefault("OWNER_NAME");
+ public string DamYearBorn => this.GetValueOrDefault("DAM_YEAR_BORN");
+ public string SireBred => this.GetValueOrDefault("SIRE_BRED");
+ public string JockeyName => this.GetValueOrDefault("JOCKEY_NAME");
+ public string DamBred => this.GetValueOrDefault("DAM_BRED");
+ public string AdjustedRating => this.GetValueOrDefault("ADJUSTED_RATING");
+ public string RunnerId => this.GetValueOrDefault("runnerId");
+ public string ClothNumber => this.GetValueOrDefault("CLOTH_NUMBER");
+ public string SireYearBorn => this.GetValueOrDefault("SIRE_YEAR_BORN");
+ public string TrainerName => this.GetValueOrDefault("TRAINER_NAME");
+ public string ColourType => this.GetValueOrDefault("COLOUR_TYPE");
+ public string Age => this.GetValueOrDefault("AGE");
+ public string DamsireBred => this.GetValueOrDefault("DAMSIRE_BRED");
+ public string JockeyClaim => this.GetValueOrDefault("JOCKEY_CLAIM");
+ public string Form => this.GetValueOrDefault("FORM");
+ public string ForecastpriceNumerator => this.GetValueOrDefault("FORECASTPRICE_NUMERATOR");
+ public string Bred => this.GetValueOrDefault("BRED");
+ public string DamName => this.GetValueOrDefault("DAM_NAME");
+ public string DamsireYearBorn => this.GetValueOrDefault("DAMSIRE_YEAR_BORN");
+ public string StallDraw => this.GetValueOrDefault("STALL_DRAW");
+ public string WeightUnits => this.GetValueOrDefault("WEIGHT_UNITS");
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/RunnerProfitAndLoss.cs b/BetfairApi/BettingModels/RunnerProfitAndLoss.cs
new file mode 100644
index 0000000..f643696
--- /dev/null
+++ b/BetfairApi/BettingModels/RunnerProfitAndLoss.cs
@@ -0,0 +1,16 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Profit and loss if selection is wins or loses
+ ///
+ public class RunnerProfitAndLoss
+ {
+ public long SelectionId { get; set; }
+ public double IfWin { get; set; }
+ public double IfLose { get; set; }
+ public double IfPlace { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/StartingPrices.cs b/BetfairApi/BettingModels/StartingPrices.cs
new file mode 100644
index 0000000..0eccc92
--- /dev/null
+++ b/BetfairApi/BettingModels/StartingPrices.cs
@@ -0,0 +1,17 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Information about the Betfair Starting Price. Only available in BSP markets
+ ///
+ public class StartingPrices
+ {
+ public double NearPrice { get; set; }
+ public double FarPrice { get; set; }
+ public PriceSize[] BackStakeTaken { get; set; }
+ public PriceSize[] LayLiabilityTaken { get; set; }
+ public double ActualSP { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/TimeRange.cs b/BetfairApi/BettingModels/TimeRange.cs
new file mode 100644
index 0000000..18d2bcb
--- /dev/null
+++ b/BetfairApi/BettingModels/TimeRange.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// TimeRange
+ ///
+ public class TimeRange
+ {
+ public DateTime From { get; set; }
+ public DateTime To { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/TimeRangeResult.cs b/BetfairApi/BettingModels/TimeRangeResult.cs
new file mode 100644
index 0000000..41424b3
--- /dev/null
+++ b/BetfairApi/BettingModels/TimeRangeResult.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// TimeRange Result
+ ///
+ public class TimeRangeResult
+ {
+ public TimeRange TimeRange { get; set; }
+ public int MarketCount { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/UpdateExecutionReport.cs b/BetfairApi/BettingModels/UpdateExecutionReport.cs
new file mode 100644
index 0000000..78d52f7
--- /dev/null
+++ b/BetfairApi/BettingModels/UpdateExecutionReport.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ public class UpdateExecutionReport
+ {
+ public string CustomerRef { get; set; }
+ public string Status { get; set; }
+ public string ErrorCode { get; set; }
+ public string MarketId { get; set; }
+ public UpdateInstructionReport[] InstructionReports { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/UpdateInstruction.cs b/BetfairApi/BettingModels/UpdateInstruction.cs
new file mode 100644
index 0000000..4d35f34
--- /dev/null
+++ b/BetfairApi/BettingModels/UpdateInstruction.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Instruction to update LIMIT bet's persistence of an order that do not affect exposure
+ ///
+ public class UpdateInstruction
+ {
+ public string BetId { get; set; }
+ public PersistenceType NewPersistenceType { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/UpdateInstructionReport.cs b/BetfairApi/BettingModels/UpdateInstructionReport.cs
new file mode 100644
index 0000000..b1398be
--- /dev/null
+++ b/BetfairApi/BettingModels/UpdateInstructionReport.cs
@@ -0,0 +1,12 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ public class UpdateInstructionReport
+ {
+ public string Status { get; set; }
+ public string ErrorCode { get; set; }
+ public UpdateInstruction Instruction { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/BetfairApi/BettingModels/VenueResult.cs b/BetfairApi/BettingModels/VenueResult.cs
new file mode 100644
index 0000000..66aa68b
--- /dev/null
+++ b/BetfairApi/BettingModels/VenueResult.cs
@@ -0,0 +1,14 @@
+using System;
+using BetfairApi.BettingModels.Enums;
+
+namespace BetfairApi.BettingModels
+{
+ ///
+ /// Venue Result
+ ///
+ public class VenueResult
+ {
+ public string Venue { get; set; }
+ public int MarketCount { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..2198b31
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,3 @@
+FROM mcr.microsoft.com/dotnet/core/sdk:3.0 AS builder
+
+COPY . .
\ No newline at end of file
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 0000000..80a2f21
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1,37 @@
+pipeline
+{
+ agent { dockerfile true }
+ stages
+ {
+ stage('Build')
+ {
+ steps
+ {
+ sh 'dotnet restore -s http://artifacts.successfulcode.com/repository/nuget-group/'
+ sh 'dotnet build -c Release --no-restore'
+ sh "dotnet pack -c Release --no-restore --no-build -p:PackageVersion=1.0.${env.BUILD_NUMBER}"
+ }
+ }
+
+ stage('Archive artifacts')
+ {
+ steps
+ {
+ archiveArtifacts artifacts:'*/bin/Release/**/*.nupkg'
+ }
+ }
+
+ stage('Publish nuget artifacts')
+ {
+ steps
+ {
+ sh "./JenkinsfileScripts/PublishNugetArtifacts.sh ${env.BUILD_NUMBER}"
+ }
+ }
+ }
+ post {
+ always {
+ deleteDir() /* clean up our workspace */
+ }
+ }
+}
\ No newline at end of file
diff --git a/JenkinsfileScripts/PublishNugetArtifacts.sh b/JenkinsfileScripts/PublishNugetArtifacts.sh
new file mode 100644
index 0000000..aa88e20
--- /dev/null
+++ b/JenkinsfileScripts/PublishNugetArtifacts.sh
@@ -0,0 +1,5 @@
+echo "Publish version $1 artifacts"
+BUILD_NUMBER = $1
+for f in BetfairApi/bin/Release/**/*.nupkg; do
+ dotnet nuget push "$f" -k "8bb434b9-48cb-345d-a089-5216967caac1" -s "http://artifacts.successfulcode.com/repository/nuget-hosted/"
+done
\ No newline at end of file