-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e174a15
commit 8c80dd9
Showing
10 changed files
with
135 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using System.Threading.Tasks; | ||
|
||
namespace Xtb.XApi.Examples; | ||
|
||
public class E1 : ExampleBase | ||
{ | ||
public override async Task Run() | ||
{ | ||
var client = XApiClient.Create("81.2.190.163", 5124, 5125); | ||
await client.ConnectAsync(); | ||
var loginResponse = await client.LoginAsync("16697884", "xoh11724"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Hosting; | ||
using System.Threading.Tasks; | ||
using Xtb.XApi.Extensions.DependencyInjection; | ||
|
||
namespace Xtb.XApi.Examples; | ||
|
||
public class E2 : ExampleBase | ||
{ | ||
public override async Task Run() | ||
{ | ||
var hostBuilder = Host.CreateDefaultBuilder() | ||
.ConfigureServices((context, services) => | ||
{ | ||
services.AddXApiClient(options => | ||
{ | ||
options.Address = "81.2.190.163"; | ||
options.MainPort = 5124; | ||
options.StreamingPort = 5125; | ||
}); | ||
}); | ||
|
||
var host = hostBuilder.Build(); | ||
|
||
var client = host.Services.GetRequiredService<XApiClient>(); | ||
|
||
await client.ConnectAsync(); | ||
var loginResponse = await client.LoginAsync("16697884", "xoh11724"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using System.Threading.Tasks; | ||
|
||
namespace Xtb.XApi.Examples; | ||
|
||
public abstract class ExampleBase | ||
{ | ||
public abstract Task Run(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using Xtb.XApi.Examples; | ||
|
||
namespace Xtb.XApi.SystemTests; | ||
|
||
internal static class Program | ||
{ | ||
private static async Task Main(string[] args) | ||
{ | ||
//await new E1().Run(); | ||
await new E2().Run(); | ||
|
||
Console.WriteLine("Done."); | ||
Console.Read(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8</TargetFramework> | ||
<LangVersion>latest</LangVersion> | ||
<Nullable>enable</Nullable> | ||
<AnalysisLevel>latest-recommended</AnalysisLevel> | ||
<OutputType>Exe</OutputType> | ||
<IsPackable>false</IsPackable> | ||
<Version>2.5.19</Version> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Extensions.DependencyInjection\Xtb.XApi.Extensions.DependencyInjection.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file was deleted.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
src/Extensions.DependencyInjection/XApiClientServiceOptions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
namespace Xtb.XApi.Extensions.DependencyInjection; | ||
|
||
/// <summary> | ||
/// Options for configuring the <see cref="XApiClient" />. | ||
/// </summary> | ||
public record XApiClientServiceOptions | ||
{ | ||
/// <summary> | ||
/// The address of the X API service. | ||
/// </summary> | ||
public string Address { get; set; } | ||
Check warning on line 11 in src/Extensions.DependencyInjection/XApiClientServiceOptions.cs GitHub Actions / build
|
||
|
||
/// <summary> | ||
/// The port number for requests. | ||
/// </summary> | ||
public int MainPort { get; set; } | ||
|
||
/// <summary> | ||
/// The port number used for streaming connections. | ||
/// </summary> | ||
public int StreamingPort { get; set; } | ||
|
||
/// <summary> | ||
/// The streaming listener instance that will handle streaming data. | ||
/// </summary> | ||
public IStreamingListener? StreamingListener { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters