@@ -0,0 +1,20 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
|
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
|
||||||
|
<PackageReference Include="xunit" Version="2.4.0" />
|
||||||
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
|
||||||
|
<PackageReference Include="coverlet.collector" Version="1.0.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\BetfairApi\BetfairApi.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create 2 application keys for given user; one active and the other delayed
|
||||||
|
/// </summary>
|
||||||
|
public async Task<DeveloperApp> CreateDeveloperAppKeys(string appName)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
appName
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<DeveloperApp>(_endpoint + "createDeveloperAppKeys/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get all application keys owned by the given developer/vendor
|
||||||
|
/// </summary>
|
||||||
|
public async Task<DeveloperApp[]> GetDeveloperAppKeys()
|
||||||
|
{
|
||||||
|
var result = await ExecuteRequest<DeveloperApp[]>(_endpoint + "getDeveloperAppKeys/");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get available to bet amount.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<AccountFundsResponse> GetAccountFunds(Wallet? wallet = null)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
wallet
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<AccountFundsResponse>(_endpoint + "getAccountFunds/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Transfer funds between wallets
|
||||||
|
/// </summary>
|
||||||
|
public async Task<TransferResponse> TransferFunds(Wallet from, Wallet to, double amount)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
from,
|
||||||
|
to,
|
||||||
|
amount
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<TransferResponse>(_endpoint + "transferFunds/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get Account details.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<AccountDetailsResponse> GetAccountDetails()
|
||||||
|
{
|
||||||
|
var result = await ExecuteRequest<AccountDetailsResponse>(_endpoint + "getAccountDetails/");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get vendor client id for customer account.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<string> GetVendorClientId()
|
||||||
|
{
|
||||||
|
var result = await ExecuteRequest<string>(_endpoint + "getVendorClientId/");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the newly generate subscription token
|
||||||
|
/// </summary>
|
||||||
|
public async Task<string> GetApplicationSubscriptionToken(int? subscriptionLength = null, string clientReference = null)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
subscriptionLength,
|
||||||
|
clientReference
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<string>(_endpoint + "getApplicationSubscriptionToken/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Activate the subscription token for the customer
|
||||||
|
/// </summary>
|
||||||
|
public async Task<Status> ActivateApplicationSubscription(string subscriptionToken)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
subscriptionToken
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<Status>(_endpoint + "activateApplicationSubscription/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cancel application subscription
|
||||||
|
/// </summary>
|
||||||
|
public async Task<Status> CancelApplicationSubscription(string subscriptionToken)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
subscriptionToken
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<Status>(_endpoint + "cancelApplicationSubscription/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update an application subscription with a new expiry date
|
||||||
|
/// </summary>
|
||||||
|
public async Task<string> UpdateApplicationSubscription(string vendorClientId, int subscriptionLength)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
vendorClientId,
|
||||||
|
subscriptionLength
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<string>(_endpoint + "updateApplicationSubscription/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// List of subscription tokens for an application
|
||||||
|
/// </summary>
|
||||||
|
public async Task<ApplicationSubscription[]> ListApplicationSubscriptionTokens(SubscriptionStatus? subscriptionStatus = null)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
subscriptionStatus
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<ApplicationSubscription[]>(_endpoint + "listApplicationSubscriptionTokens/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// List of subscription tokens associated with the account
|
||||||
|
/// </summary>
|
||||||
|
public async Task<AccountSubscription[]> ListAccountSubscriptionTokens()
|
||||||
|
{
|
||||||
|
var result = await ExecuteRequest<AccountSubscription[]>(_endpoint + "listAccountSubscriptionTokens/");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<SubscriptionHistory[]> GetApplicationSubscriptionHistory(string vendorClientId = null, string applicationKey = null)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
vendorClientId,
|
||||||
|
applicationKey
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<SubscriptionHistory[]>(_endpoint + "getApplicationSubscriptionHistory/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get account statement
|
||||||
|
/// </summary>
|
||||||
|
public async Task<AccountStatementReport> 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<AccountStatementReport>(_endpoint + "getAccountStatement/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a list of currency rates based on given currency
|
||||||
|
/// </summary>
|
||||||
|
public async Task<CurrencyRate[]> ListCurrencyRates(string fromCurrency = null)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
fromCurrency
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<CurrencyRate[]>(_endpoint + "listCurrencyRates/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generate auth code for web vendor, used to get vendor session
|
||||||
|
/// </summary>
|
||||||
|
public async Task<AuthorisationResponse> GetAuthorisationCode(string vendorId)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
vendorId
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<AuthorisationResponse>(_endpoint + "getAuthorisationCode/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generate web vendor session based on a standard session identifiable by auth code, vendor secret and app key
|
||||||
|
/// </summary>
|
||||||
|
public async Task<VendorAccessTokenInfo> 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<VendorAccessTokenInfo>(_endpoint + "token/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return details about a vendor from its identifier. Response includes Vendor Name and URL.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<VendorDetails> GetVendorDetails(string vendorId)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
vendorId
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<VendorDetails>(_endpoint + "getVendorDetails/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove the link between an account and a vendor web app. This will remove the refreshToken for this user-vendor pair subscription.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<Status> RevokeAccessToWebApp(long vendorId)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
vendorId
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<Status>(_endpoint + "revokeAccessToWebApp/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve all vendors applications currently subscribed to by the user making the request
|
||||||
|
/// </summary>
|
||||||
|
public async Task<VendorDetails[]> ListAuthorizedWebApps()
|
||||||
|
{
|
||||||
|
var result = await ExecuteRequest<VendorDetails[]>(_endpoint + "listAuthorizedWebApps/");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return whether an account has authorised a web app.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<bool> IsAccountSubscribedToWebApp(string vendorId)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
vendorId
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<bool>(_endpoint + "isAccountSubscribedToWebApp/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return relation between a list of users and an affiliate
|
||||||
|
/// </summary>
|
||||||
|
public async Task<AffiliateRelation[]> GetAffiliateRelation(string[] vendorClientIds)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
vendorClientIds
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<AffiliateRelation[]>(_endpoint + "getAffiliateRelation/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Task<T> ExecuteRequest<T>(string endpoint, object request = null)
|
||||||
|
{
|
||||||
|
return _authentication.ExecuteRequest<T>(endpoint, request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.AccountModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.AccountModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Response for Account details.
|
||||||
|
/// </summary>
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.AccountModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.AccountModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Response for retrieving available to bet.
|
||||||
|
/// </summary>
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.AccountModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.AccountModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A container representing search results.
|
||||||
|
/// </summary>
|
||||||
|
public class AccountStatementReport
|
||||||
|
{
|
||||||
|
public StatementItem[] AccountStatement { get; set; }
|
||||||
|
public bool MoreAvailable { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.AccountModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.AccountModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Application subscription details
|
||||||
|
/// </summary>
|
||||||
|
public class AccountSubscription
|
||||||
|
{
|
||||||
|
public SubscriptionTokenInfo[] SubscriptionTokens { get; set; }
|
||||||
|
public string ApplicationName { get; set; }
|
||||||
|
public string ApplicationVersionId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.AccountModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.AccountModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Wrapper object containing affiliate relation details
|
||||||
|
/// </summary>
|
||||||
|
public class AffiliateRelation
|
||||||
|
{
|
||||||
|
public string VendorClientId { get; set; }
|
||||||
|
public AffiliateRelationStatus Status { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.AccountModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.AccountModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Application subscription details
|
||||||
|
/// </summary>
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.AccountModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.AccountModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Wrapper object containing authorisation code and redirect URL for web vendors
|
||||||
|
/// </summary>
|
||||||
|
public class AuthorisationResponse
|
||||||
|
{
|
||||||
|
public string AuthorisationCode { get; set; }
|
||||||
|
public string RedirectUrl { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.AccountModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.AccountModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Currency rate
|
||||||
|
/// </summary>
|
||||||
|
public class CurrencyRate
|
||||||
|
{
|
||||||
|
public string CurrencyCode { get; set; }
|
||||||
|
public double Rate { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.AccountModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.AccountModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Describes developer/vendor specific application
|
||||||
|
/// </summary>
|
||||||
|
public class DeveloperApp
|
||||||
|
{
|
||||||
|
public string AppName { get; set; }
|
||||||
|
public long AppId { get; set; }
|
||||||
|
public DeveloperAppVersion[] AppVersions { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.AccountModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.AccountModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Describes a version of an external application
|
||||||
|
/// </summary>
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
|
||||||
|
namespace BetfairApi.AccountModels.Enums
|
||||||
|
{
|
||||||
|
public enum ItemClass
|
||||||
|
{
|
||||||
|
[EnumMember(Value = "UNKNOWN")]
|
||||||
|
Unknown
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
|
||||||
|
namespace BetfairApi.AccountModels.Enums
|
||||||
|
{
|
||||||
|
public enum Status
|
||||||
|
{
|
||||||
|
[EnumMember(Value = "SUCCESS")]
|
||||||
|
Success
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
|
||||||
|
namespace BetfairApi.AccountModels.Enums
|
||||||
|
{
|
||||||
|
public enum TokenType
|
||||||
|
{
|
||||||
|
[EnumMember(Value = "BEARER")]
|
||||||
|
Bearer
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using BetfairApi.AccountModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.AccountModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Summary of a cleared order.
|
||||||
|
/// </summary>
|
||||||
|
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<string,string> ItemClassData { get; set; }
|
||||||
|
public StatementLegacyData LegacyData { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.AccountModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.AccountModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Summary of a cleared order.
|
||||||
|
/// </summary>
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.AccountModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.AccountModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Application subscription history details
|
||||||
|
/// </summary>
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.AccountModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.AccountModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Wrapper object containing details of how a subscription should be created
|
||||||
|
/// </summary>
|
||||||
|
public class SubscriptionOptions
|
||||||
|
{
|
||||||
|
public int Subscription_length { get; set; }
|
||||||
|
public string Subscription_token { get; set; }
|
||||||
|
public string Client_reference { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.AccountModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.AccountModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Subscription token information
|
||||||
|
/// </summary>
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.AccountModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.AccountModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// TimeRange
|
||||||
|
/// </summary>
|
||||||
|
public class TimeRange
|
||||||
|
{
|
||||||
|
public DateTime From { get; set; }
|
||||||
|
public DateTime To { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.AccountModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.AccountModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Transfer operation response
|
||||||
|
/// </summary>
|
||||||
|
public class TransferResponse
|
||||||
|
{
|
||||||
|
public string TransactionId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.AccountModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.AccountModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Wrapper object containing UserVendorSessionToken, RefreshToken and optionally a Subscription Token if one was created
|
||||||
|
/// </summary>
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.AccountModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.AccountModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Wrapper object containing vendor name and redirect url
|
||||||
|
/// </summary>
|
||||||
|
public class VendorDetails
|
||||||
|
{
|
||||||
|
public long AppVersionId { get; set; }
|
||||||
|
public string VendorName { get; set; }
|
||||||
|
public string RedirectUrl { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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<Login> Authenticate()
|
||||||
|
{
|
||||||
|
var message = new HttpRequestMessage(HttpMethod.Post, "https://identitysso.betfair.com/api/login")
|
||||||
|
{
|
||||||
|
Content = new FormUrlEncodedContent(new Dictionary<string, string>()
|
||||||
|
{
|
||||||
|
{ "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<Login>();
|
||||||
|
return _loginResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<T> ExecuteRequest<T>(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<T>();
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
|
<PackageReference Include="SuccessfulCodeTools" Version="1.0.2" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@@ -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<MarketCatalogue[]> 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<EventTypeResult[]> GetHorseRacingMarketTypes()
|
||||||
|
{
|
||||||
|
var horseRacingMarket = new MarketFilter()
|
||||||
|
{
|
||||||
|
EventTypeIds = new[] { _horseRacingId }
|
||||||
|
};
|
||||||
|
var eventTypes = await _client.ListEventTypes(horseRacingMarket);
|
||||||
|
return eventTypes;
|
||||||
|
}
|
||||||
|
public async Task<MarketBook[]> 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<MarketBook[]> 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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<T> ExecuteRequest<T>(string endpoint, object request = null)
|
||||||
|
{
|
||||||
|
return _authentication.ExecuteRequest<T>(endpoint, request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a list of Event Types (i.e. Sports) associated with the markets selected by the
|
||||||
|
/// MarketFilter.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<EventTypeResult[]> ListEventTypes(MarketFilter filter, string locale = null)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
filter,
|
||||||
|
locale
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<EventTypeResult[]>(_endpoint + "listEventTypes/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<CompetitionResult[]> ListCompetitions(MarketFilter filter, string locale = null)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
filter,
|
||||||
|
locale
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<CompetitionResult[]>(_endpoint + "listCompetitions/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<TimeRangeResult[]> ListTimeRanges(MarketFilter filter, TimeGranularity granularity)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
filter,
|
||||||
|
granularity
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<TimeRangeResult[]>(_endpoint + "listTimeRanges/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a list of Events (i.e, Reading vs. Man United) associated with the markets selected by the
|
||||||
|
/// MarketFilter.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<EventResult[]> ListEvents(MarketFilter filter, string locale = null)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
filter,
|
||||||
|
locale
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<EventResult[]>(_endpoint + "listEvents/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<MarketTypeResult[]> ListMarketTypes(MarketFilter filter, string locale = null)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
filter,
|
||||||
|
locale
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<MarketTypeResult[]>(_endpoint + "listMarketTypes/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a list of Countries associated with the markets selected by the MarketFilter.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<CountryCodeResult[]> ListCountries(MarketFilter filter, string locale = null)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
filter,
|
||||||
|
locale
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<CountryCodeResult[]>(_endpoint + "listCountries/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<VenueResult[]> ListVenues(MarketFilter filter, string locale = null)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
filter,
|
||||||
|
locale
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<VenueResult[]>(_endpoint + "listVenues/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<MarketCatalogue[]> 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<MarketCatalogue[]>(_endpoint + "listMarketCatalogue/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<MarketBook[]> 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<MarketBook[]>(_endpoint + "listMarketBook/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<MarketBook[]> 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<MarketBook[]>(_endpoint + "listRunnerBook/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<CurrentOrderSummaryReport> 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<CurrentOrderSummaryReport>(_endpoint + "listCurrentOrders/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a List of bets based on the bet status, ordered by settled date
|
||||||
|
/// </summary>
|
||||||
|
public async Task<ClearedOrderSummaryReport> 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<ClearedOrderSummaryReport>(_endpoint + "listClearedOrders/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<PlaceExecutionReport> 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<PlaceExecutionReport>(_endpoint + "placeOrders/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<CancelExecutionReport> CancelOrders(string marketId = null, CancelInstruction[] instructions = null, string customerRef = null)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
marketId,
|
||||||
|
instructions,
|
||||||
|
customerRef
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<CancelExecutionReport>(_endpoint + "cancelOrders/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<ReplaceExecutionReport> 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<ReplaceExecutionReport>(_endpoint + "replaceOrders/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update non-exposure changing fields
|
||||||
|
/// </summary>
|
||||||
|
public async Task<UpdateExecutionReport> UpdateOrders(string marketId, UpdateInstruction[] instructions, string customerRef = null)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
marketId,
|
||||||
|
instructions,
|
||||||
|
customerRef
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<UpdateExecutionReport>(_endpoint + "updateOrders/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<MarketProfitAndLoss[]> ListMarketProfitAndLoss(string[] marketIds, bool? includeSettledBets = null, bool? includeBspBets = null, bool? netOfCommission = null)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
marketIds,
|
||||||
|
includeSettledBets,
|
||||||
|
includeBspBets,
|
||||||
|
netOfCommission
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<MarketProfitAndLoss[]>(_endpoint + "listMarketProfitAndLoss/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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).
|
||||||
|
/// </summary>
|
||||||
|
public async Task<string> SetDefaultExposureLimitForMarketGroups(MarketGroupType marketGroupType, ExposureLimit limit)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
marketGroupType,
|
||||||
|
limit
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<string>(_endpoint + "setDefaultExposureLimitForMarketGroups/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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).
|
||||||
|
/// </summary>
|
||||||
|
public async Task<string> SetExposureLimitForMarketGroup(MarketGroup marketGroup, ExposureLimit limit)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
marketGroup,
|
||||||
|
limit
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<string>(_endpoint + "setExposureLimitForMarketGroup/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove default exposure limit for a market group type.
|
||||||
|
/// This operation will NOT remove/update any market group limits.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<string> RemoveDefaultExposureLimitForMarketGroups(MarketGroupType marketGroupType)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
marketGroupType
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<string>(_endpoint + "removeDefaultExposureLimitForMarketGroups/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Delete exposure limit for a market group.
|
||||||
|
/// If a default exposure limit exist for market type, it takes effect immediately.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<string> RemoveExposureLimitForMarketGroup(MarketGroup marketGroup)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
marketGroup
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<string>(_endpoint + "removeExposureLimitForMarketGroup/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 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).
|
||||||
|
/// </summary>
|
||||||
|
public async Task<ExposureLimitsForMarketGroups[]> ListExposureLimitsForMarketGroups(MarketGroupType? marketGroupTypeFilter = null, MarketGroup[] marketGroupFilter = null)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
marketGroupTypeFilter,
|
||||||
|
marketGroupFilter
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<ExposureLimitsForMarketGroups[]>(_endpoint + "listExposureLimitsForMarketGroups/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Unblock a market group after it has been blocked due to the breach of a previously set exposure limit.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<string> UnblockMarketGroup(MarketGroup marketGroup)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
marketGroup
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<string>(_endpoint + "unblockMarketGroup/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves events from exposure reuse enabled events list. To edit this list use
|
||||||
|
/// addExposureReuseEnabledEvents and removeExposureReuseEnabledEvents operations.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<long[]> GetExposureReuseEnabledEvents()
|
||||||
|
{
|
||||||
|
var result = await ExecuteRequest<long[]>(_endpoint + "getExposureReuseEnabledEvents/");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enables events for exposure reuse by appending them to the current list of events already enabled.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<string> AddExposureReuseEnabledEvents(long[] eventIds)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
eventIds
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<string>(_endpoint + "addExposureReuseEnabledEvents/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes events from exposure reuse enabled events list.
|
||||||
|
/// </summary>
|
||||||
|
public async Task<string> RemoveExposureReuseEnabledEvents(long[] eventIds)
|
||||||
|
{
|
||||||
|
var request = new
|
||||||
|
{
|
||||||
|
eventIds
|
||||||
|
};
|
||||||
|
var result = await ExecuteRequest<string>(_endpoint + "removeExposureReuseEnabledEvents/", request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Instruction to fully or partially cancel an order (only applies to LIMIT orders)
|
||||||
|
/// </summary>
|
||||||
|
public class CancelInstruction
|
||||||
|
{
|
||||||
|
public string BetId { get; set; }
|
||||||
|
public double SizeReduction { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Summary of a cleared order.
|
||||||
|
/// </summary>
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A container representing search results.
|
||||||
|
/// </summary>
|
||||||
|
public class ClearedOrderSummaryReport
|
||||||
|
{
|
||||||
|
public ClearedOrderSummary[] ClearedOrders { get; set; }
|
||||||
|
public bool MoreAvailable { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Competition
|
||||||
|
/// </summary>
|
||||||
|
public class Competition
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Competition Result
|
||||||
|
/// </summary>
|
||||||
|
public class CompetitionResult
|
||||||
|
{
|
||||||
|
public Competition Competition { get; set; }
|
||||||
|
public int MarketCount { get; set; }
|
||||||
|
public string CompetitionRegion { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// CountryCode Result
|
||||||
|
/// </summary>
|
||||||
|
public class CountryCodeResult
|
||||||
|
{
|
||||||
|
public string CountryCode { get; set; }
|
||||||
|
public int MarketCount { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Summary of a current order.
|
||||||
|
/// </summary>
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A container representing search results.
|
||||||
|
/// </summary>
|
||||||
|
public class CurrentOrderSummaryReport
|
||||||
|
{
|
||||||
|
public CurrentOrderSummary[] CurrentOrders { get; set; }
|
||||||
|
public bool MoreAvailable { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels.Enums
|
||||||
|
{
|
||||||
|
public enum MarketGroupType
|
||||||
|
{
|
||||||
|
[EnumMember(Value = "EVENT")]
|
||||||
|
Event
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels.Enums
|
||||||
|
{
|
||||||
|
public enum TimeInForce
|
||||||
|
{
|
||||||
|
[EnumMember(Value = "FILL_OR_KILL")]
|
||||||
|
FillOrKill
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Event
|
||||||
|
/// </summary>
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Event Result
|
||||||
|
/// </summary>
|
||||||
|
public class EventResult
|
||||||
|
{
|
||||||
|
public Event Event { get; set; }
|
||||||
|
public int MarketCount { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// EventType
|
||||||
|
/// </summary>
|
||||||
|
public class EventType
|
||||||
|
{
|
||||||
|
public string Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// EventType Result
|
||||||
|
/// </summary>
|
||||||
|
public class EventTypeResult
|
||||||
|
{
|
||||||
|
public EventType EventType { get; set; }
|
||||||
|
public int MarketCount { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Options to alter the default representation of best offer prices
|
||||||
|
/// </summary>
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 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)
|
||||||
|
/// </summary>
|
||||||
|
public class ExposureLimit
|
||||||
|
{
|
||||||
|
public double Matched { get; set; }
|
||||||
|
public double Total { get; set; }
|
||||||
|
public LimitBreachAction LimitBreachAction { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 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).
|
||||||
|
/// </summary>
|
||||||
|
public class ExposureLimitsForMarketGroups
|
||||||
|
{
|
||||||
|
public MarketGroupType MarketGroupType { get; set; }
|
||||||
|
public ExposureLimit DefaultLimit { get; set; }
|
||||||
|
public MarketGroupExposureLimit[] GroupLimits { get; set; }
|
||||||
|
public MarketGroupId[] BlockedMarketGroups { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 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.
|
||||||
|
/// </summary>
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A list of KeyLineSelection objects describing the key line for the market
|
||||||
|
/// </summary>
|
||||||
|
public class KeyLineDescription
|
||||||
|
{
|
||||||
|
public KeyLineSelection[] KeyLine { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Description of a markets key line selection, comprising the selectionId and handicap of the team it is applied to.
|
||||||
|
/// </summary>
|
||||||
|
public class KeyLineSelection
|
||||||
|
{
|
||||||
|
public long SelectionId { get; set; }
|
||||||
|
public double Handicap { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Action that should be execute when limit is breached
|
||||||
|
/// </summary>
|
||||||
|
public class LimitBreachAction
|
||||||
|
{
|
||||||
|
public LimitBreachActionType ActionType { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Place a new LIMIT_ON_CLOSE bet
|
||||||
|
/// </summary>
|
||||||
|
public class LimitOnCloseOrder
|
||||||
|
{
|
||||||
|
public double Liability { get; set; }
|
||||||
|
public decimal Price { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Place a new LIMIT order (simple exchange bet for immediate execution)
|
||||||
|
/// </summary>
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The dynamic data in a market
|
||||||
|
/// </summary>
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Information about a market
|
||||||
|
/// </summary>
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Market definition
|
||||||
|
/// </summary>
|
||||||
|
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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a market group
|
||||||
|
/// </summary>
|
||||||
|
public class MarketGroup
|
||||||
|
{
|
||||||
|
public MarketGroupType Type { get; set; }
|
||||||
|
public MarketGroupId Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Container type for a group exposure limit
|
||||||
|
/// </summary>
|
||||||
|
public class MarketGroupExposureLimit
|
||||||
|
{
|
||||||
|
public MarketGroupId GroupId { get; set; }
|
||||||
|
public ExposureLimit Limit { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Container type for market group ID
|
||||||
|
/// </summary>
|
||||||
|
public class MarketGroupId
|
||||||
|
{
|
||||||
|
public long EventId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Market Licence
|
||||||
|
/// </summary>
|
||||||
|
public class MarketLicence
|
||||||
|
{
|
||||||
|
public string Wallet { get; set; }
|
||||||
|
public string Rules { get; set; }
|
||||||
|
public bool RulesHasDate { get; set; }
|
||||||
|
public string Clarifications { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Market Line and Range Info
|
||||||
|
/// </summary>
|
||||||
|
public class MarketLineRangeInfo
|
||||||
|
{
|
||||||
|
public double MaxUnitValue { get; set; }
|
||||||
|
public double MinUnitValue { get; set; }
|
||||||
|
public double Interval { get; set; }
|
||||||
|
public string MarketUnit { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Place a new MARKET_ON_CLOSE bet
|
||||||
|
/// </summary>
|
||||||
|
public class MarketOnCloseOrder
|
||||||
|
{
|
||||||
|
public double Liability { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using BetfairApi.BettingModels.Enums;
|
||||||
|
|
||||||
|
namespace BetfairApi.BettingModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Profit and loss in a market
|
||||||
|
/// </summary>
|
||||||
|
public class MarketProfitAndLoss
|
||||||
|
{
|
||||||
|
public string MarketId { get; set; }
|
||||||
|
public double CommissionApplied { get; set; }
|
||||||
|
public RunnerProfitAndLoss[] ProfitAndLosses { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user