Skip to content

Commit

Permalink
Gateways
Browse files Browse the repository at this point in the history
  • Loading branch information
artemiusgreat committed Dec 5, 2024
1 parent b0fb9aa commit c0bed0f
Show file tree
Hide file tree
Showing 9 changed files with 263 additions and 324 deletions.
9 changes: 7 additions & 2 deletions Core/Models/Points/PointScreenerModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ namespace Terminal.Core.Models
public class PointScreenerModel
{
/// <summary>
/// Asset
/// Count
/// </summary>
public virtual InstrumentModel Instrument { get; set; }
public virtual int? Count { get; set; }

/// <summary>
/// Start date
Expand All @@ -19,5 +19,10 @@ public class PointScreenerModel
/// End date
/// </summary>
public virtual DateTime? MaxDate { get; set; }

/// <summary>
/// Asset
/// </summary>
public virtual InstrumentModel Instrument { get; set; }
}
}
24 changes: 8 additions & 16 deletions Gateway/Alpaca/Libs/Adapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -553,22 +553,14 @@ protected virtual void OnTrade(ITrade streamOrder)
protected virtual async Task<ResponseModel<IList<InstrumentModel>>> GetPageOptions(OptionChainRequest screener)
{
var response = new ResponseModel<IList<InstrumentModel>>();

try
{
var client = _dataClients[InstrumentEnum.Options] as IAlpacaOptionsDataClient;
var optionResponse = await client.GetOptionChainAsync(screener);

response.Cursor = optionResponse.NextPageToken;
response.Data = optionResponse
.Items
.Select(option => InternalMap.GetOption(screener, option.Value, option.Key))
.ToList();
}
catch (Exception e)
{
response.Errors = [new ErrorModel { ErrorMessage = $"{e}" }];
}
var client = _dataClients[InstrumentEnum.Options] as IAlpacaOptionsDataClient;
var optionResponse = await client.GetOptionChainAsync(screener);

response.Cursor = optionResponse.NextPageToken;
response.Data = optionResponse
.Items
.Select(option => InternalMap.GetOption(screener, option.Value, option.Key))
.ToList();

return response;
}
Expand Down
Loading

0 comments on commit c0bed0f

Please sign in to comment.