Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update with upstream #1

Merged
merged 3 commits into from
Apr 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -382,3 +382,6 @@ MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/

# Jetbrains IDE Files
.idea/
7 changes: 5 additions & 2 deletions IEXSharp/Helper/ExecutorREST.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,11 @@ public async Task<IEXResponse<ReturnType>> ExecuteAsync<ReturnType>(
{ // "Forbidden" or "Not found"
return new IEXResponse<ReturnType>() { ErrorMessage = content };
}
else return new IEXResponse<ReturnType>() { Data =
JsonConvert.DeserializeObject<ReturnType>(content, jsonSerializerSettings) };
else {
return new IEXResponse<ReturnType>() {
Data = JsonConvert.DeserializeObject<ReturnType>(content, jsonSerializerSettings)
};
}
}
catch (JsonException ex)
{
Expand Down
7 changes: 7 additions & 0 deletions IEXSharp/Model/ReferenceData/Response/SectorResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace VSLee.IEXSharp.Model.ReferenceData.Response
{
public class SectorResponse
{
public string name { get; set; }
}
}
17 changes: 17 additions & 0 deletions IEXSharp/Model/ReferenceData/Response/SymbolCryptoResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;

namespace VSLee.IEXSharp.Model.ReferenceData.Response
{
public class SymbolCryptoResponse
{
public string symbol { get; set; }
public string name { get; set; }
public string exchange { get; set; }
public DateTime date { get; set; }
public string type { get; set; }
public string iexId { get; set; }
public string region { get; set; }
public string currency { get; set; }
public bool isEnabled { get; set; }
}
}
7 changes: 7 additions & 0 deletions IEXSharp/Model/ReferenceData/Response/TagResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace VSLee.IEXSharp.Model.ReferenceData.Response
{
public class TagResponse
{
public string name { get; set; }
}
}
18 changes: 18 additions & 0 deletions IEXSharp/Service/V2/ReferenceData/IReferenceDataService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ public interface IReferenceDataService
/// <returns></returns>
Task<IEXResponse<SymbolFXResponse>> SymbolFXAsync();

/// <summary>
/// <see cref="https://iexcloud.io/docs/api/#cryptocurrency-symbols"/>
/// </summary>
/// <returns></returns>
Task<IEXResponse<IEnumerable<SymbolCryptoResponse>>> SymbolCryptoAsync();

/// <summary>
/// <see cref="https://iexcloud.io/docs/api/#iex-symbols"/>
/// </summary>
Expand Down Expand Up @@ -60,12 +66,24 @@ public interface IReferenceDataService
/// <returns></returns>
Task<IEXResponse<IEnumerable<SymbolOTCResponse>>> SymbolsOTCAsync();

/// <summary>
/// <see cref="https://iexcloud.io/docs/api/#sectors"/>
/// </summary>
/// <returns></returns>
Task<IEXResponse<IEnumerable<SectorResponse>>> SectorsAsync();

/// <summary>
/// <see cref="https://iexcloud.io/docs/api/#symbols"/>
/// </summary>
/// <returns></returns>
Task<IEXResponse<IEnumerable<SymbolResponse>>> SymbolsAsync();

/// <summary>
/// <see cref="https://iexcloud.io/docs/api/#tags"/>
/// </summary>
/// <returns></returns>
Task<IEXResponse<IEnumerable<TagResponse>>> TagsAsync();

/// <summary>
/// <see cref="https://iexcloud.io/docs/api/#u-s-exchanges"/>
/// </summary>
Expand Down
11 changes: 10 additions & 1 deletion IEXSharp/Service/V2/ReferenceData/ReferenceDataService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public async Task<IEXResponse<IEnumerable<SearchResponse>>> SearchAsync(string f
public async Task<IEXResponse<SymbolFXResponse>> SymbolFXAsync() =>
await _executor.NoParamExecute<SymbolFXResponse>("ref-data/fx/symbols");

public async Task<IEXResponse<IEnumerable<SymbolCryptoResponse>>> SymbolCryptoAsync() =>
await _executor.NoParamExecute<IEnumerable<SymbolCryptoResponse>>("ref-data/crypto/symbols");

public async Task<IEXResponse<IEnumerable<SymbolIEXResponse>>> SymbolsIEXAsync() =>
await _executor.NoParamExecute<IEnumerable<SymbolIEXResponse>>("ref-data/iex/symbols");

Expand Down Expand Up @@ -72,11 +75,17 @@ public async Task<IEXResponse<IEnumerable<SymbolMutualFundResponse>>> SymbolsMut
await _executor.NoParamExecute<IEnumerable<SymbolMutualFundResponse>>("ref-data/mutual-funds/symbols");

public async Task<IEXResponse<IEnumerable<SymbolOTCResponse>>> SymbolsOTCAsync() =>
await _executor.NoParamExecute < IEnumerable<SymbolOTCResponse>>("ref-data/otc/symbols");
await _executor.NoParamExecute<IEnumerable<SymbolOTCResponse>>("ref-data/otc/symbols");

public async Task<IEXResponse<IEnumerable<SectorResponse>>> SectorsAsync() =>
await _executor.NoParamExecute<IEnumerable<SectorResponse>>("ref-data/sectors");

public async Task<IEXResponse<IEnumerable<SymbolResponse>>> SymbolsAsync() =>
await _executor.NoParamExecute<IEnumerable<SymbolResponse>>("ref-data/symbols");

public async Task<IEXResponse<IEnumerable<TagResponse>>> TagsAsync() =>
await _executor.NoParamExecute<IEnumerable<TagResponse>>("ref-data/tags");

public async Task<IEXResponse<IEnumerable<ExchangeUSResponse>>> ExchangeUSAsync() =>
await _executor.NoParamExecute<IEnumerable<ExchangeUSResponse>>("ref-data/market/us/exchanges");

Expand Down
2 changes: 1 addition & 1 deletion IEXSharp/Service/V2/Stock/IStockService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,6 @@ public interface IStockService
/// </summary>
/// <param name="symbol"></param>
/// <returns></returns>
Task<IEXResponse<VolumeByVenueResponse>> VolumeByVenueAsync(string symbol);
Task<IEXResponse<IEnumerable<VolumeByVenueResponse>>> VolumeByVenueAsync(string symbol);
}
}
4 changes: 2 additions & 2 deletions IEXSharp/Service/V2/Stock/StockService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ public async Task<IEXResponse<UpcomingEventMarketResponse>> UpcomingEventMarketA
return await executor.ExecuteAsync<UpcomingEventMarketResponse>(urlPattern, pathNvc, qsb);
}

public async Task<IEXResponse<VolumeByVenueResponse>> VolumeByVenueAsync(string symbol) =>
await executor.SymbolExecuteAsync<VolumeByVenueResponse>("stock/[symbol]/delayed-quote", symbol);
public async Task<IEXResponse<IEnumerable<VolumeByVenueResponse>>> VolumeByVenueAsync(string symbol) =>
await executor.SymbolExecuteAsync<IEnumerable<VolumeByVenueResponse>>("stock/[symbol]/volume-by-venue", symbol);
}
}
36 changes: 35 additions & 1 deletion IEXSharpTest/Cloud(V2)/ReferenceDataTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@ public async Task SymbolsFXAsyncTest()
Assert.IsNotNull(response.Data);
}

[Test]
public async Task SymbolCryptoAsyncTest()
{
var response = await sandBoxClient.ReferenceData.SymbolCryptoAsync();

Assert.IsNull(response.ErrorMessage);
Assert.IsNotNull(response.Data);
Assert.GreaterOrEqual(response.Data.Count(), 1);

Assert.IsNotNull(response.Data.First().symbol);
Assert.IsNotNull(response.Data.First().name);
Assert.IsNotNull(response.Data.First().isEnabled);
}

[Test]
public async Task SymbolsIEXAsyncTest()
{
Expand Down Expand Up @@ -103,7 +117,7 @@ public async Task SymbolsMutualFundAsyncTest()
}

[Test]
public async Task SymbolsOTCAsync()
public async Task SymbolsOTCAsyncTest()
{
var response = await sandBoxClient.ReferenceData.SymbolsOTCAsync();

Expand All @@ -112,6 +126,16 @@ public async Task SymbolsOTCAsync()
Assert.GreaterOrEqual(response.Data.Count(), 1);
}

[Test]
public async Task SectorsAsyncTest()
{
var response = await sandBoxClient.ReferenceData.SectorsAsync();

Assert.IsNull(response.ErrorMessage);
Assert.IsNotNull(response.Data);
Assert.GreaterOrEqual(response.Data.Count(), 1);
}

[Test]
public async Task SymbolsAsyncTest()
{
Expand All @@ -122,6 +146,16 @@ public async Task SymbolsAsyncTest()
Assert.GreaterOrEqual(response.Data.Count(), 1);
}

[Test]
public async Task TagsAsyncTest()
{
var response = await sandBoxClient.ReferenceData.TagsAsync();

Assert.IsNull(response.ErrorMessage);
Assert.IsNotNull(response.Data);
Assert.GreaterOrEqual(response.Data.Count(), 1);
}

[Test]
public async Task ExchangeUSAsyncTest()
{
Expand Down
5 changes: 5 additions & 0 deletions IEXSharpTest/Cloud(V2)/StockTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,11 @@ public async Task VolumeByVenueAsyncTest(string symbol)

Assert.IsNull(response.ErrorMessage);
Assert.IsNotNull(response.Data);

Assert.GreaterOrEqual(response.Data.Count(), 1);

Assert.IsNotNull(response.Data.First().venue);
Assert.IsNotNull(response.Data.First().volume);
}
}
}